Migration testing CLI (#2447)

* Template

* Midway..

* Make all 3 runtimes work

* Update node/service/Cargo.toml

* undo brach updates

* fix with latest version

* Update runtime/kusama/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update runtime/rococo/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Final nits

* Update runtime/kusama/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Kian Paimani
2021-02-24 14:38:05 +00:00
committed by GitHub
parent 6d46fc1d85
commit 2398bbfaef
12 changed files with 140 additions and 8 deletions
+26 -1
View File
@@ -245,7 +245,7 @@ pub fn run() -> Result<()> {
Ok(runner.async_run(|mut config| {
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config, None)?;
Ok((cmd.run(client, backend).map_err(Error::SubstrateCli),task_manager))
Ok((cmd.run(client, backend).map_err(Error::SubstrateCli), task_manager))
})?)
},
Some(Subcommand::ValidationWorker(cmd)) => {
@@ -276,6 +276,31 @@ pub fn run() -> Result<()> {
})?)
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;
set_default_ss58_version(chain_spec);
runner.async_run(|config| {
use sc_service::TaskManager;
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager = TaskManager::new(
config.task_executor.clone(),
registry,
).map_err(|e| Error::SubstrateService(sc_service::Error::Prometheus(e)))?;
Ok((
cmd.run::<
service::kusama_runtime::Block,
service::KusamaExecutor,
>(config).map_err(Error::SubstrateCli),
task_manager
))
// NOTE: we fetch only the block number from the block type, the chance of disparity
// between kusama's and polkadot's block number is small enough to overlook this.
})
}
}?;
Ok(())
}