diff --git a/cumulus/polkadot-parachains/src/command.rs b/cumulus/polkadot-parachains/src/command.rs index 69d48520c3cbb14b7d3d57c4d47e998f85772470..67ec05935b60b29c7a99e37f72c46a8c6324afdd 100644 --- a/cumulus/polkadot-parachains/src/command.rs +++ b/cumulus/polkadot-parachains/src/command.rs @@ -49,9 +49,17 @@ fn load_spec( )?)), "shell" => Ok(Box::new(chain_spec::get_shell_chain_spec(para_id))), "" => Ok(Box::new(chain_spec::get_chain_spec(para_id))), - path => Ok(Box::new(chain_spec::ChainSpec::from_json_file( + path => Ok({ + let chain_spec = chain_spec::ChainSpec::from_json_file( path.into(), - )?)), + )?; + + if use_shell_runtime(&chain_spec) { + Box::new(chain_spec::ShellChainSpec::from_json_file(path.into())?) + } else { + Box::new(chain_spec) + } + }), } } @@ -91,7 +99,7 @@ impl SubstrateCli for Cli { } fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion { - if use_shell_runtime(chain_spec) { + if use_shell_runtime(&**chain_spec) { &shell_runtime::VERSION } else { &rococo_parachain_runtime::VERSION @@ -149,8 +157,8 @@ fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<V .ok_or_else(|| "Could not find wasm file in genesis state!".into()) } -fn use_shell_runtime(chain_spec: &Box<dyn ChainSpec>) -> bool { - chain_spec.id().starts_with("track") || chain_spec.id().starts_with("shell") +fn use_shell_runtime(chain_spec: &dyn ChainSpec) -> bool { + chain_spec.id().starts_with("shell") } use crate::service::{new_partial, RococoParachainRuntimeExecutor, ShellRuntimeExecutor}; @@ -158,7 +166,7 @@ use crate::service::{new_partial, RococoParachainRuntimeExecutor, ShellRuntimeEx macro_rules! construct_async_run { (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ let runner = $cli.create_runner($cmd)?; - if use_shell_runtime(&runner.config().chain_spec) { + if use_shell_runtime(&*runner.config().chain_spec) { runner.async_run(|$config| { let $components = new_partial::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _>( &$config, @@ -284,7 +292,7 @@ pub fn run() -> Result<()> { } None => { let runner = cli.create_runner(&cli.run.normalize())?; - let use_shell = use_shell_runtime(&runner.config().chain_spec); + let use_shell = use_shell_runtime(&*runner.config().chain_spec); runner.run_node_until_exit(|config| async move { // TODO