Integrate try-runtime into cumulus (#793)

* almost integrate

* revert branch changes

* remove extra deps

* some review comments'

* Fix a bunch of stuff

* Update parachain-template/node/Cargo.toml

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Fix

* Fix

* fix benchmark

* fmt

* Remove wrong bench test

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
Kian Paimani
2021-12-02 14:00:54 +01:00
committed by GitHub
parent ca81203b83
commit e70f7fd016
23 changed files with 189 additions and 10 deletions
+20 -1
View File
@@ -13,7 +13,10 @@ use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sc_service::{
config::{BasePath, PrometheusConfig},
TaskManager,
};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::Block as BlockT;
use std::{io::Write, net::SocketAddr};
@@ -237,6 +240,22 @@ pub fn run() -> Result<()> {
You can enable it with `--features runtime-benchmarks`."
.into())
},
Some(Subcommand::TryRuntime(cmd)) =>
if cfg!(feature = "try-runtime") {
let runner = cli.create_runner(cmd)?;
// grab the task manager.
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;
runner.async_run(|config| {
Ok((cmd.run::<Block, TemplateRuntimeExecutor>(config), task_manager))
})
} else {
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
},
None => {
let runner = cli.create_runner(&cli.run.normalize())?;