diff --git a/Cargo.lock b/Cargo.lock index 5657a4dd18..60137afbee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -486,7 +486,7 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-backing-primitives" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "sp-api", "sp-consensus-slots", @@ -7571,7 +7571,7 @@ dependencies = [ [[package]] name = "nimbus-consensus" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "async-backing-primitives", "async-trait", @@ -7611,7 +7611,7 @@ dependencies = [ [[package]] name = "nimbus-primitives" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "async-trait", "frame-benchmarking", @@ -8126,7 +8126,7 @@ dependencies = [ [[package]] name = "pallet-async-backing" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -8146,7 +8146,7 @@ dependencies = [ [[package]] name = "pallet-author-inherent" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "frame-benchmarking", "frame-support", @@ -8165,7 +8165,7 @@ dependencies = [ [[package]] name = "pallet-author-mapping" version = "2.0.5" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "frame-benchmarking", "frame-support", @@ -8184,7 +8184,7 @@ dependencies = [ [[package]] name = "pallet-author-slot-filter" version = "0.9.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "frame-benchmarking", "frame-support", @@ -8541,7 +8541,7 @@ dependencies = [ [[package]] name = "pallet-emergency-para-xcm" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -9253,7 +9253,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-xcm" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "cumulus-primitives-core", "evm", @@ -9501,7 +9501,7 @@ dependencies = [ [[package]] name = "pallet-maintenance-mode" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -9552,7 +9552,7 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "frame-benchmarking", "frame-support", @@ -9880,7 +9880,7 @@ dependencies = [ [[package]] name = "pallet-randomness" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "environmental", "frame-benchmarking", @@ -9955,7 +9955,7 @@ dependencies = [ [[package]] name = "pallet-relay-storage-roots" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -14815,7 +14815,7 @@ dependencies = [ [[package]] name = "session-keys-primitives" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "async-trait", "frame-support", @@ -18468,7 +18468,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#f32e4035c5b00083accd53f0f6b829feb9b88b1e" +source = "git+https://github.com/Moonsong-Labs/moonkit?branch=moonbeam-polkadot-stable2407#54564227255cc8e6cd6a01fb8540459337fb43ff" dependencies = [ "frame-support", "impl-trait-for-tuples", diff --git a/Cargo.toml b/Cargo.toml index 9ff6678e5b..5ea739b8f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -377,8 +377,7 @@ slices = "0.2.0" strum = { version = "0.26.3", default-features = false, features = ["derive"] } strum_macros = "0.24" smallvec = "1.11.0" -p256 = { version = "0.13.2", default-features = false, features = [ - "ecdsa"] } +p256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] } ansi_term = "0.12.1" # Other (client) diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 1e48e3f570..1d91e83f1c 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -142,6 +142,11 @@ pub struct RunCmd { #[clap(long)] pub dev_service: bool, + /// Enable the new block import strategy + /// Deprecated in: https://github.com/Moonsong-Labs/moonkit/pull/43 + #[clap(long)] + pub experimental_block_import_strategy: bool, + #[cfg(feature = "lazy-loading")] #[clap(long)] pub fork_chain_from_rpc: Option, diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index f319f39178..93f6df82d0 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -268,8 +268,11 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; let rpc_config = cli.run.new_rpc_config(); runner.async_run(|mut config| { - let (client, _, import_queue, task_manager) = - moonbeam_service::new_chain_ops(&mut config, &rpc_config)?; + let (client, _, import_queue, task_manager) = moonbeam_service::new_chain_ops( + &mut config, + &rpc_config, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(client, import_queue), task_manager)) }) } @@ -277,8 +280,11 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; let rpc_config = cli.run.new_rpc_config(); runner.async_run(|mut config| { - let (client, _, _, task_manager) = - moonbeam_service::new_chain_ops(&mut config, &rpc_config)?; + let (client, _, _, task_manager) = moonbeam_service::new_chain_ops( + &mut config, + &rpc_config, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(client, config.database), task_manager)) }) } @@ -286,8 +292,11 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; let rpc_config = cli.run.new_rpc_config(); runner.async_run(|mut config| { - let (client, _, _, task_manager) = - moonbeam_service::new_chain_ops(&mut config, &rpc_config)?; + let (client, _, _, task_manager) = moonbeam_service::new_chain_ops( + &mut config, + &rpc_config, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(client, config.chain_spec), task_manager)) }) } @@ -295,8 +304,11 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; let rpc_config = cli.run.new_rpc_config(); runner.async_run(|mut config| { - let (client, _, import_queue, task_manager) = - moonbeam_service::new_chain_ops(&mut config, &rpc_config)?; + let (client, _, import_queue, task_manager) = moonbeam_service::new_chain_ops( + &mut config, + &rpc_config, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(client, import_queue), task_manager)) }) } @@ -356,7 +368,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonriver_runtime::RuntimeApi, moonbeam_service::MoonriverCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok(( cmd.run(params.client, params.backend, None), @@ -368,7 +385,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbeam_runtime::RuntimeApi, moonbeam_service::MoonbeamCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok(( cmd.run(params.client, params.backend, None), @@ -380,7 +402,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbase_runtime::RuntimeApi, moonbeam_service::MoonbaseCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok(( cmd.run(params.client, params.backend, None), @@ -536,7 +563,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonriver_runtime::RuntimeApi, moonbeam_service::MoonriverCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; cmd.run(params.client) }) @@ -547,7 +579,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbeam_runtime::RuntimeApi, moonbeam_service::MoonbeamCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; cmd.run(params.client) }) @@ -558,7 +595,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbase_runtime::RuntimeApi, moonbeam_service::MoonbaseCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; cmd.run(params.client) }) @@ -583,7 +625,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonriver_runtime::RuntimeApi, moonbeam_service::MoonriverCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; let db = params.backend.expose_db(); let storage = params.backend.expose_storage(); @@ -597,7 +644,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbeam_runtime::RuntimeApi, moonbeam_service::MoonbeamCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; let db = params.backend.expose_db(); let storage = params.backend.expose_storage(); @@ -611,7 +663,12 @@ pub fn run() -> Result<()> { let params = moonbeam_service::new_partial::< moonbeam_service::moonbase_runtime::RuntimeApi, moonbeam_service::MoonbaseCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; let db = params.backend.expose_db(); let storage = params.backend.expose_storage(); @@ -654,7 +711,12 @@ pub fn run() -> Result<()> { } = moonbeam_service::new_partial::< moonbeam_service::moonriver_runtime::RuntimeApi, moonbeam_service::MoonriverCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(backend, config.chain_spec), task_manager)) } @@ -667,7 +729,12 @@ pub fn run() -> Result<()> { } = moonbeam_service::new_partial::< moonbeam_service::moonbeam_runtime::RuntimeApi, moonbeam_service::MoonbeamCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(backend, config.chain_spec), task_manager)) } @@ -680,7 +747,12 @@ pub fn run() -> Result<()> { } = moonbeam_service::new_partial::< moonbeam_service::moonbase_runtime::RuntimeApi, moonbeam_service::MoonbaseCustomizations, - >(&mut config, &rpc_config, false)?; + >( + &mut config, + &rpc_config, + false, + cli.run.experimental_block_import_strategy, + )?; Ok((cmd.run(backend, config.chain_spec), task_manager)) } @@ -863,6 +935,7 @@ pub fn run() -> Result<()> { true, cli.run.block_authoring_duration, hwbench, + cli.run.experimental_block_import_strategy, ) .await .map(|r| r.0) @@ -880,6 +953,7 @@ pub fn run() -> Result<()> { true, cli.run.block_authoring_duration, hwbench, + cli.run.experimental_block_import_strategy, ) .await .map(|r| r.0) @@ -897,6 +971,7 @@ pub fn run() -> Result<()> { true, cli.run.block_authoring_duration, hwbench, + cli.run.experimental_block_import_strategy, ) .await .map(|r| r.0) diff --git a/node/service/src/lazy_loading/mod.rs b/node/service/src/lazy_loading/mod.rs index 6ec62c9448..1cec53fc69 100644 --- a/node/service/src/lazy_loading/mod.rs +++ b/node/service/src/lazy_loading/mod.rs @@ -340,7 +340,7 @@ where create_inherent_data_providers, &task_manager.spawn_essential_handle(), config.prometheus_registry(), - false, + None, )?; let block_import = BlockImportPipeline::Dev(frontier_block_import); diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 1040fb1c6c..03fd121921 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -361,6 +361,7 @@ pub const SOFT_DEADLINE_PERCENT: Percent = Percent::from_percent(100); pub fn new_chain_ops( config: &mut Configuration, rpc_config: &RpcConfig, + experimental_block_import_strategy: bool, ) -> Result< ( Arc, @@ -375,15 +376,17 @@ pub fn new_chain_ops( spec if spec.is_moonriver() => new_chain_ops_inner::< moonriver_runtime::RuntimeApi, MoonriverCustomizations, - >(config, rpc_config), + >(config, rpc_config, experimental_block_import_strategy), #[cfg(feature = "moonbeam-native")] spec if spec.is_moonbeam() => new_chain_ops_inner::< moonbeam_runtime::RuntimeApi, MoonbeamCustomizations, - >(config, rpc_config), + >(config, rpc_config, experimental_block_import_strategy), #[cfg(feature = "moonbase-native")] _ => new_chain_ops_inner::( - config, rpc_config, + config, + rpc_config, + experimental_block_import_strategy, ), #[cfg(not(feature = "moonbase-native"))] _ => panic!("invalid chain spec"), @@ -394,6 +397,7 @@ pub fn new_chain_ops( fn new_chain_ops_inner( config: &mut Configuration, rpc_config: &RpcConfig, + experimental_block_import_strategy: bool, ) -> Result< ( Arc, @@ -416,7 +420,12 @@ where import_queue, task_manager, .. - } = new_partial::(config, rpc_config, config.chain_spec.is_dev())?; + } = new_partial::( + config, + rpc_config, + config.chain_spec.is_dev(), + experimental_block_import_strategy, + )?; Ok(( Arc::new(Client::from(client)), backend, @@ -455,6 +464,7 @@ pub fn new_partial( config: &mut Configuration, rpc_config: &RpcConfig, dev_service: bool, + experimental_block_import_strategy: bool, ) -> PartialComponentsResult, FullBackend> where RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, @@ -557,15 +567,17 @@ where create_inherent_data_providers, &task_manager.spawn_essential_handle(), config.prometheus_registry(), - !dev_service, + if experimental_block_import_strategy { + None + } else { + Some(!dev_service) + }, )?, BlockImportPipeline::Dev(frontier_block_import), ) } else { - let parachain_block_import = ParachainBlockImport::new_with_delayed_best_block( - frontier_block_import, - backend.clone(), - ); + let parachain_block_import = + ParachainBlockImport::new(frontier_block_import, backend.clone()); ( nimbus_consensus::import_queue( client.clone(), @@ -573,7 +585,11 @@ where create_inherent_data_providers, &task_manager.spawn_essential_handle(), config.prometheus_registry(), - !dev_service, + if experimental_block_import_strategy { + None + } else { + Some(!dev_service) + }, )?, BlockImportPipeline::Parachain(parachain_block_import), ) @@ -638,6 +654,7 @@ async fn start_node_impl( async_backing: bool, block_authoring_duration: Duration, hwbench: Option, + experimental_block_import_strategy: bool, ) -> sc_service::error::Result<(TaskManager, Arc>)> where RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, @@ -647,8 +664,12 @@ where { let mut parachain_config = prepare_node_config(parachain_config); - let params = - new_partial::(&mut parachain_config, &rpc_config, false)?; + let params = new_partial::( + &mut parachain_config, + &rpc_config, + false, + experimental_block_import_strategy, + )?; let ( block_import, filter_pool, @@ -1128,6 +1149,7 @@ pub async fn start_node( async_backing: bool, block_authoring_duration: Duration, hwbench: Option, + experimental_block_import_strategy: bool ) -> sc_service::error::Result<(TaskManager, Arc>)> where RuntimeApi: @@ -1145,6 +1167,7 @@ where async_backing, block_authoring_duration, hwbench, + experimental_block_import_strategy ) .await } @@ -1186,7 +1209,7 @@ where frontier_backend, fee_history_cache, ), - } = new_partial::(&mut config, &rpc_config, true)?; + } = new_partial::(&mut config, &rpc_config, true, true)?; let block_import = if let BlockImportPipeline::Dev(block_import) = block_import_pipeline { block_import