polkadot: disable block authoring backoff on production networks (#2510)

Currently the polkadot node will backoff from block authoring if
finality starts lagging. This PR disables this mechanism on production
networks (polkadot and kusama) and adds a flags to optionally force
enabling it.
This commit is contained in:
André Silva
2023-11-28 09:18:26 +00:00
committed by GitHub
parent 0f7ffc66a5
commit 58a1f9c53d
7 changed files with 23 additions and 4 deletions
+14 -4
View File
@@ -625,6 +625,9 @@ pub struct NewFullParams<OverseerGenerator: OverseerGen> {
pub is_parachain_node: IsParachainNode,
pub grandpa_pause: Option<(u32, u32)>,
pub enable_beefy: bool,
/// Whether to enable the block authoring backoff on production networks
/// where it isn't enabled by default.
pub force_authoring_backoff: bool,
pub jaeger_agent: Option<std::net::SocketAddr>,
pub telemetry_worker_handle: Option<TelemetryWorkerHandle>,
/// The version of the node. TESTING ONLY: `None` can be passed to skip the node/worker version
@@ -716,6 +719,7 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
is_parachain_node,
grandpa_pause,
enable_beefy,
force_authoring_backoff,
jaeger_agent,
telemetry_worker_handle,
node_version,
@@ -733,15 +737,21 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
let is_offchain_indexing_enabled = config.offchain_worker.indexing_enabled;
let role = config.role.clone();
let force_authoring = config.force_authoring;
let backoff_authoring_blocks = {
let backoff_authoring_blocks = if !force_authoring_backoff &&
(config.chain_spec.is_polkadot() || config.chain_spec.is_kusama())
{
// the block authoring backoff is disabled by default on production networks
None
} else {
let mut backoff = sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default();
if config.chain_spec.is_rococo() ||
config.chain_spec.is_wococo() ||
config.chain_spec.is_versi()
config.chain_spec.is_versi() ||
config.chain_spec.is_dev()
{
// it's a testnet that's in flux, finality has stalled sometimes due
// to operational issues and it's annoying to slow down block
// on testnets that are in flux (like rococo or versi), finality has stalled
// sometimes due to operational issues and it's annoying to slow down block
// production to 1 block per hour.
backoff.max_interval = 10;
}