diff --git a/client/consensus/nimbus-consensus/src/import_queue.rs b/client/consensus/nimbus-consensus/src/import_queue.rs index 174384b5..a3ab8daf 100644 --- a/client/consensus/nimbus-consensus/src/import_queue.rs +++ b/client/consensus/nimbus-consensus/src/import_queue.rs @@ -200,7 +200,10 @@ pub fn import_queue( create_inherent_data_providers: CIDP, spawner: &impl sp_core::traits::SpawnEssentialNamed, registry: Option<&substrate_prometheus_endpoint::Registry>, - parachain: bool, + // Deprecated: Using a custom fork strategy for parachain at block + // import is no longer necessary. + // Context: https://github.com/paritytech/polkadot-sdk/issues/4333 + use_custom_fork_strategy: Option, ) -> ClientResult> where I: BlockImport + Send + Sync + 'static, @@ -214,9 +217,19 @@ where _marker: PhantomData, }; + let block_import_for_queue: sc_consensus::BoxBlockImport = match use_custom_fork_strategy + { + Some(parachain_context) => + { + #[allow(deprecated)] + Box::new(NimbusBlockImport::new(block_import, parachain_context)) + } + None => Box::new(block_import), + }; + Ok(BasicQueue::new( verifier, - Box::new(NimbusBlockImport::new(block_import, parachain)), + block_import_for_queue, None, spawner, registry, @@ -232,11 +245,15 @@ where /// /// There may be additional nimbus-specific logic here in the future, but for now it is /// only the conditional parachain logic +#[deprecated( + note = "Aura was using a custom fork strategy for parachain at block import, this is no longer necessary." +)] pub struct NimbusBlockImport { inner: I, parachain_context: bool, } +#[allow(deprecated)] impl NimbusBlockImport { /// Create a new instance. pub fn new(inner: I, parachain_context: bool) -> Self { @@ -247,6 +264,7 @@ impl NimbusBlockImport { } } +#[allow(deprecated)] #[async_trait::async_trait] impl BlockImport for NimbusBlockImport where diff --git a/template/node/src/command.rs b/template/node/src/command.rs index c17bad7d..03d0a39b 100644 --- a/template/node/src/command.rs +++ b/template/node/src/command.rs @@ -106,7 +106,7 @@ macro_rules! construct_async_run { runner.async_run(|$config| { let $components = new_partial( // We default to the non-parachain import queue and select chain. - &$config, false, + &$config, )?; let task_manager = $components.task_manager; { $( $code )* }.map(|v| (v, task_manager)) @@ -172,7 +172,7 @@ pub fn run() -> Result<()> { Some(Subcommand::ExportGenesisState(cmd)) => { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { - let partials = new_partial(&config, false)?; + let partials = new_partial(&config)?; cmd.run(partials.client) }) @@ -202,7 +202,7 @@ pub fn run() -> Result<()> { } } BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { - let partials = new_partial(&config, false)?; + let partials = new_partial(&config)?; cmd.run(partials.client) }), #[cfg(not(feature = "runtime-benchmarks"))] @@ -216,7 +216,7 @@ pub fn run() -> Result<()> { } #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { - let partials = new_partial(&config, false)?; + let partials = new_partial(&config)?; let db = partials.backend.expose_db(); let storage = partials.backend.expose_storage(); diff --git a/template/node/src/service.rs b/template/node/src/service.rs index 3f15945d..2b0cd5bd 100644 --- a/template/node/src/service.rs +++ b/template/node/src/service.rs @@ -73,7 +73,6 @@ type ParachainBlockImport = TParachainBlockImport, P /// be able to perform chain operations. pub fn new_partial( config: &Configuration, - parachain: bool, ) -> Result< PartialComponents< ParachainClient, @@ -145,9 +144,7 @@ pub fn new_partial( client.clone(), ); - // `new_with_delayed_best_block` is now necessary: https://github.com/paritytech/polkadot-sdk/pull/2001 - let block_import = - ParachainBlockImport::new_with_delayed_best_block(client.clone(), backend.clone()); + let block_import = ParachainBlockImport::new(client.clone(), backend.clone()); let import_queue = nimbus_consensus::import_queue( client.clone(), @@ -159,7 +156,7 @@ pub fn new_partial( }, &task_manager.spawn_essential_handle(), config.prometheus_registry().clone(), - parachain, + None, )?; Ok(PartialComponents { @@ -215,7 +212,7 @@ where { let parachain_config = prepare_node_config(parachain_config); - let params = new_partial(¶chain_config, true)?; + let params = new_partial(¶chain_config)?; let (block_import, mut telemetry, telemetry_worker_handle) = params.other; let client = params.client.clone(); @@ -441,7 +438,7 @@ where select_chain, transaction_pool, other: (_, mut telemetry, _), - } = new_partial(&config, false)?; + } = new_partial(&config)?; let net_config = FullNetworkConfiguration::<_, _, N>::new(&config.network);