Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Co #12341: Use try-runtime feature #1759

Merged
merged 11 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add try-runtime feature
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Oct 13, 2022
commit fc2a53cdf72d905bb86bcff2f5c8c367dc5b7d5d
8 changes: 6 additions & 2 deletions parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "mast
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
Expand All @@ -78,7 +78,11 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate"
[features]
default = []
runtime-benchmarks = [
"try-runtime-cli/try-runtime",
"parachain-template-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
]
try-runtime = ["parachain-template-runtime/try-runtime"]
try-runtime = [
"try-runtime-cli/try-runtime",
"parachain-template-runtime/try-runtime"
]
1 change: 1 addition & 0 deletions parachain-template/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum Subcommand {
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some testing command against a specified runtime state.
#[cfg(feature = "try-runtime" )]
TryRuntime(try_runtime_cli::TryRuntimeCmd),
}

Expand Down
27 changes: 12 additions & 15 deletions parachain-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,19 @@ pub fn run() -> Result<()> {
_ => Err("Benchmarking sub-command unsupported".into()),
}
},
#[cfg(feature = "try-runtime")]
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())
}
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))
})
},
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
Expand Down
2 changes: 1 addition & 1 deletion parachain-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/assets/statemine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/assets/statemint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/assets/westmint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-alliance/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/contracts/contracts-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/starters/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ std = [
]
try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
]
2 changes: 1 addition & 1 deletion parachains/runtimes/testing/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ try-runtime = [
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
Expand Down