From 8b28f540406ac10b3a13158872b3d7ccfb75ef0d Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 27 May 2024 20:42:43 +0800 Subject: [PATCH 1/4] Enable exponential backoff for AuRa --- Cargo.lock | 1 + Cargo.toml | 1 + node/Cargo.toml | 1 + node/src/service.rs | 4 +++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 992c85032..ecd283132 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4645,6 +4645,7 @@ dependencies = [ "sc-consensus-aura", "sc-consensus-grandpa", "sc-consensus-grandpa-rpc", + "sc-consensus-slots", "sc-executor", "sc-keystore", "sc-network", diff --git a/Cargo.toml b/Cargo.toml index dfa709f62..7c2f0d312 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,6 +65,7 @@ sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = " sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sc-consensus-grandpa-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } +sc-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sc-executor = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sc-network = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } diff --git a/node/Cargo.toml b/node/Cargo.toml index 41a0df11f..6d05a99cf 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -45,6 +45,7 @@ sc-consensus = { workspace = true } sc-consensus-grandpa = { workspace = true } sc-consensus-grandpa-rpc = { workspace = true } sp-consensus-grandpa = { workspace = true } +sc-consensus-slots = { workspace = true } sc-client-api = { workspace = true } sp-runtime = { workspace = true } sp-io = { workspace = true } diff --git a/node/src/service.rs b/node/src/service.rs index 5c35ee317..c992095ca 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -5,6 +5,7 @@ use node_subtensor_runtime::{opaque::Block, RuntimeApi}; use sc_client_api::{Backend, BlockBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_grandpa::SharedVoterState; +use sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging; use sc_executor::sp_wasm_interface::{Function, HostFunctionRegistry, HostFunctions}; pub use sc_executor::NativeElseWasmExecutor; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; @@ -240,7 +241,8 @@ pub fn new_full(config: Configuration) -> Result { let role = config.role.clone(); let force_authoring = config.force_authoring; - let backoff_authoring_blocks: Option<()> = None; + let backoff_authoring_blocks = + Some(BackoffAuthoringOnFinalizedHeadLagging::default()); let name = config.network.node_name.clone(); let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); From da7b41c661682e725dec7eba9cd12d4ed26e2423 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 27 May 2024 20:50:00 +0800 Subject: [PATCH 2/4] cargo fmt --- node/src/service.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/src/service.rs b/node/src/service.rs index c992095ca..eec390dba 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -241,8 +241,7 @@ pub fn new_full(config: Configuration) -> Result { let role = config.role.clone(); let force_authoring = config.force_authoring; - let backoff_authoring_blocks = - Some(BackoffAuthoringOnFinalizedHeadLagging::default()); + let backoff_authoring_blocks = Some(BackoffAuthoringOnFinalizedHeadLagging::default()); let name = config.network.node_name.clone(); let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); From 906864b01154492a837a112a794b7946efa4b8d1 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 27 May 2024 22:18:36 +0800 Subject: [PATCH 3/4] Use 15 blocks as the unfinalized slack --- node/src/service.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node/src/service.rs b/node/src/service.rs index eec390dba..934443f6a 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -241,7 +241,10 @@ pub fn new_full(config: Configuration) -> Result { let role = config.role.clone(); let force_authoring = config.force_authoring; - let backoff_authoring_blocks = Some(BackoffAuthoringOnFinalizedHeadLagging::default()); + let backoff_authoring_blocks = Some(BackoffAuthoringOnFinalizedHeadLagging { + unfinalized_slack: 15, + ..Default::default() + }); let name = config.network.node_name.clone(); let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); From 25abdf3e7909412a4c482b51dcafbb0911250ef0 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 27 May 2024 22:34:13 +0800 Subject: [PATCH 4/4] Use 6 blocks as the unfinalized slack --- node/src/service.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/service.rs b/node/src/service.rs index 934443f6a..284edb52a 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -242,7 +242,7 @@ pub fn new_full(config: Configuration) -> Result { let role = config.role.clone(); let force_authoring = config.force_authoring; let backoff_authoring_blocks = Some(BackoffAuthoringOnFinalizedHeadLagging { - unfinalized_slack: 15, + unfinalized_slack: 6, ..Default::default() }); let name = config.network.node_name.clone();