diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index 402d2621793..36e5ab635ac 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -229,9 +229,12 @@ pub fn run() -> Result<()> { }, #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { + use parachain_template_runtime::MILLISECS_PER_BLOCK; + use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; + use try_runtime_cli::block_building_info::timestamp_with_aura_info; + let runner = cli.create_runner(cmd)?; - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; type HostFunctionsOf = ExtendedHostFunctions< sp_io::SubstrateHostFunctions, ::ExtendHostFunctions, @@ -243,8 +246,15 @@ pub fn run() -> Result<()> { sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; + let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK); + runner.async_run(|_| { - Ok((cmd.run::>(), task_manager)) + Ok(( + cmd.run::, _>(Some( + info_provider, + )), + task_manager, + )) }) }, #[cfg(not(feature = "try-runtime"))] diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index cbfe3b64af2..04e2c17e797 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -704,73 +704,88 @@ pub fn run() -> Result<()> { }, #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { + use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; + use try_runtime_cli::block_building_info::timestamp_with_aura_info; + // grab the task manager. let runner = cli.create_runner(cmd)?; let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); let task_manager = sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; type HostFunctionsOf = ExtendedHostFunctions< sp_io::SubstrateHostFunctions, ::ExtendHostFunctions, >; + let info_provider = timestamp_with_aura_info(6000); + match runner.config().chain_spec.runtime() { Runtime::Statemine => runner.async_run(|_| { Ok(( - cmd.run::>(), + cmd.run::, _>(Some( + info_provider, + )), task_manager, )) }), Runtime::Westmint => runner.async_run(|_| { - Ok((cmd.run::>(), task_manager)) + Ok(( + cmd.run::, _>(Some( + info_provider, + )), + task_manager, + )) }), Runtime::Statemint => runner.async_run(|_| { Ok(( - cmd.run::>(), + cmd.run::, _>(Some( + info_provider, + )), task_manager, )) }), Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => runner.async_run(|_| { Ok(( - cmd.run::>(), + cmd.run::, _>(Some(info_provider)), task_manager, )) }), - Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type { - chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment => runner.async_run(|_| { - Ok(( - cmd.run::>(), + Runtime::BridgeHub(bridge_hub_runtime_type) => + match bridge_hub_runtime_type { + chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot | + chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal | + chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment => + runner.async_run(|_| { + Ok(( + cmd.run::, _>(Some(info_provider)), task_manager, )) - }), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| { - Ok(( - cmd.run::>(), + }), + chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama | + chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal | + chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| { + Ok(( + cmd.run::, _>(Some(info_provider)), task_manager, )) - }), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| { - Ok(( - cmd.run::>(), + }), + chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo | + chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal | + chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| { + Ok(( + cmd.run::, _>(Some(info_provider)), task_manager, )) - }), - _ => Err(format!( + }), + _ => Err(format!( "Chain '{:?}' doesn't support try-runtime for bridge_hub_runtime_type: {:?}", runner.config().chain_spec.runtime(), bridge_hub_runtime_type ) - .into()), - }, + .into()), + }, Runtime::Shell => runner.async_run(|_| { Ok(( cmd.run::>(),