Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to new block import strategy #3204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ 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
/// Enable the legacy block import strategy
#[clap(long)]
pub experimental_block_import_strategy: bool,
pub legacy_block_import_strategy: bool,

/// Specifies the URL used to fetch chain data via RPC.
///
Expand Down
38 changes: 19 additions & 19 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn run() -> Result<()> {
let (client, _, import_queue, task_manager) = moonbeam_service::new_chain_ops(
&mut config,
&rpc_config,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;
Ok((cmd.run(client, import_queue), task_manager))
})
Expand All @@ -283,7 +283,7 @@ pub fn run() -> Result<()> {
let (client, _, _, task_manager) = moonbeam_service::new_chain_ops(
&mut config,
&rpc_config,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;
Ok((cmd.run(client, config.database), task_manager))
})
Expand All @@ -295,7 +295,7 @@ pub fn run() -> Result<()> {
let (client, _, _, task_manager) = moonbeam_service::new_chain_ops(
&mut config,
&rpc_config,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;
Ok((cmd.run(client, config.chain_spec), task_manager))
})
Expand All @@ -307,7 +307,7 @@ pub fn run() -> Result<()> {
let (client, _, import_queue, task_manager) = moonbeam_service::new_chain_ops(
&mut config,
&rpc_config,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;
Ok((cmd.run(client, import_queue), task_manager))
})
Expand Down Expand Up @@ -372,7 +372,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((
Expand All @@ -389,7 +389,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((
Expand All @@ -406,7 +406,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((
Expand Down Expand Up @@ -558,7 +558,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

cmd.run(params.client)
Expand All @@ -574,7 +574,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

cmd.run(params.client)
Expand All @@ -590,7 +590,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

cmd.run(params.client)
Expand Down Expand Up @@ -620,7 +620,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

let db = params.backend.expose_db();
Expand All @@ -639,7 +639,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

let db = params.backend.expose_db();
Expand All @@ -658,7 +658,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

let db = params.backend.expose_db();
Expand Down Expand Up @@ -706,7 +706,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((cmd.run(backend, config.chain_spec), task_manager))
Expand All @@ -724,7 +724,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((cmd.run(backend, config.chain_spec), task_manager))
Expand All @@ -742,7 +742,7 @@ pub fn run() -> Result<()> {
&mut config,
&rpc_config,
false,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)?;

Ok((cmd.run(backend, config.chain_spec), task_manager))
Expand Down Expand Up @@ -930,7 +930,7 @@ pub fn run() -> Result<()> {
true,
cli.run.block_authoring_duration,
hwbench,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)
.await
.map(|r| r.0)
Expand All @@ -948,7 +948,7 @@ pub fn run() -> Result<()> {
true,
cli.run.block_authoring_duration,
hwbench,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)
.await
.map(|r| r.0)
Expand All @@ -966,7 +966,7 @@ pub fn run() -> Result<()> {
true,
cli.run.block_authoring_duration,
hwbench,
cli.run.experimental_block_import_strategy,
cli.run.legacy_block_import_strategy,
)
.await
.map(|r| r.0)
Expand Down
32 changes: 16 additions & 16 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,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,
legacy_block_import_strategy: bool,
) -> Result<
(
Arc<Client>,
Expand All @@ -377,17 +377,17 @@ pub fn new_chain_ops(
spec if spec.is_moonriver() => new_chain_ops_inner::<
moonriver_runtime::RuntimeApi,
MoonriverCustomizations,
>(config, rpc_config, experimental_block_import_strategy),
>(config, rpc_config, legacy_block_import_strategy),
#[cfg(feature = "moonbeam-native")]
spec if spec.is_moonbeam() => new_chain_ops_inner::<
moonbeam_runtime::RuntimeApi,
MoonbeamCustomizations,
>(config, rpc_config, experimental_block_import_strategy),
>(config, rpc_config, legacy_block_import_strategy),
#[cfg(feature = "moonbase-native")]
_ => new_chain_ops_inner::<moonbase_runtime::RuntimeApi, MoonbaseCustomizations>(
config,
rpc_config,
experimental_block_import_strategy,
legacy_block_import_strategy,
),
#[cfg(not(feature = "moonbase-native"))]
_ => panic!("invalid chain spec"),
Expand All @@ -398,7 +398,7 @@ pub fn new_chain_ops(
fn new_chain_ops_inner<RuntimeApi, Customizations>(
config: &mut Configuration,
rpc_config: &RpcConfig,
experimental_block_import_strategy: bool,
legacy_block_import_strategy: bool,
) -> Result<
(
Arc<Client>,
Expand All @@ -425,7 +425,7 @@ where
config,
rpc_config,
config.chain_spec.is_dev(),
experimental_block_import_strategy,
legacy_block_import_strategy,
)?;
Ok((
Arc::new(Client::from(client)),
Expand Down Expand Up @@ -465,7 +465,7 @@ pub fn new_partial<RuntimeApi, Customizations>(
config: &mut Configuration,
rpc_config: &RpcConfig,
dev_service: bool,
experimental_block_import_strategy: bool,
legacy_block_import_strategy: bool,
) -> PartialComponentsResult<FullClient<RuntimeApi>, FullBackend>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi>> + Send + Sync + 'static,
Expand Down Expand Up @@ -569,18 +569,18 @@ where
create_inherent_data_providers,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
!experimental_block_import_strategy,
legacy_block_import_strategy,
)?,
BlockImportPipeline::Dev(frontier_block_import),
)
} else {
let parachain_block_import = if experimental_block_import_strategy {
ParachainBlockImport::new(frontier_block_import, backend.clone())
} else {
let parachain_block_import = if legacy_block_import_strategy {
ParachainBlockImport::new_with_delayed_best_block(
frontier_block_import,
backend.clone(),
)
} else {
ParachainBlockImport::new(frontier_block_import, backend.clone())
};
(
nimbus_consensus::import_queue(
Expand All @@ -589,7 +589,7 @@ where
create_inherent_data_providers,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
!experimental_block_import_strategy,
legacy_block_import_strategy,
)?,
BlockImportPipeline::Parachain(parachain_block_import),
)
Expand Down Expand Up @@ -654,7 +654,7 @@ async fn start_node_impl<RuntimeApi, Customizations, Net>(
async_backing: bool,
block_authoring_duration: Duration,
hwbench: Option<sc_sysinfo::HwBench>,
experimental_block_import_strategy: bool,
legacy_block_import_strategy: bool,
) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi>>)>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi>> + Send + Sync + 'static,
Expand All @@ -668,7 +668,7 @@ where
&mut parachain_config,
&rpc_config,
false,
experimental_block_import_strategy,
legacy_block_import_strategy,
)?;
let (
block_import,
Expand Down Expand Up @@ -1151,7 +1151,7 @@ pub async fn start_node<RuntimeApi, Customizations>(
async_backing: bool,
block_authoring_duration: Duration,
hwbench: Option<sc_sysinfo::HwBench>,
experimental_block_import_strategy: bool
legacy_block_import_strategy: bool
) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi>>)>
where
RuntimeApi:
Expand All @@ -1169,7 +1169,7 @@ where
async_backing,
block_authoring_duration,
hwbench,
experimental_block_import_strategy
legacy_block_import_strategy
)
.await
}
Expand Down
Loading