mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 18:47:56 +00:00
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:
@@ -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())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user