difftreelog
feat try-runtime subcommand
in: master
7 files changed
node/cli/Cargo.tomldiffbeforeafterboth22git = "https://github.com/paritytech/substrate"22git = "https://github.com/paritytech/substrate"23branch = "polkadot-v0.9.20"23branch = "polkadot-v0.9.20"2425[dependencies.try-runtime-cli]26git = 'https://github.com/paritytech/substrate.git'27branch = 'polkadot-v0.9.17'242825[dependencies.pallet-transaction-payment-rpc]29[dependencies.pallet-transaction-payment-rpc]26git = "https://github.com/paritytech/substrate"30git = "https://github.com/paritytech/substrate"318 'unique-runtime/runtime-benchmarks',322 'unique-runtime/runtime-benchmarks',319 'polkadot-service/runtime-benchmarks',323 'polkadot-service/runtime-benchmarks',320]324]325try-runtime = []321326node/cli/src/cli.rsdiffbeforeafterboth56 #[clap(subcommand)]56 #[clap(subcommand)]57 Benchmark(frame_benchmarking_cli::BenchmarkCmd),57 Benchmark(frame_benchmarking_cli::BenchmarkCmd),5859 /// Try runtime60 TryRuntime(try_runtime_cli::TryRuntimeCmd),58}61}596260/// Command for exporting the genesis state of the parachain63/// Command for exporting the genesis state of the parachainnode/cli/src/command.rsdiffbeforeafterboth49use codec::Encode;49use codec::Encode;50use cumulus_primitives_core::ParaId;50use cumulus_primitives_core::ParaId;51use cumulus_client_service::genesis::generate_genesis_block;51use cumulus_client_service::genesis::generate_genesis_block;52use std::{future::Future, pin::Pin};52use log::info;53use log::info;53use polkadot_parachain::primitives::AccountIdConversion;54use polkadot_parachain::primitives::AccountIdConversion;54use sc_cli::{55use sc_cli::{413 Some(Subcommand::Benchmark(..)) => {414 Some(Subcommand::Benchmark(..)) => {414 Err("benchmarking is only available with unique runtime enabled".into())415 Err("benchmarking is only available with unique runtime enabled".into())415 }416 }417 Some(Subcommand::TryRuntime(cmd)) => {418 if cfg!(feature = "try-runtime") {419 let runner = cli.create_runner(cmd)?;420421 // grab the task manager.422 let registry = &runner423 .config()424 .prometheus_config425 .as_ref()426 .map(|cfg| &cfg.registry);427 let task_manager =428 sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)429 .map_err(|e| format!("Error: {:?}", e))?;430431 runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {432 Ok((433 match config.chain_spec.runtime_id() {434 #[cfg(feature = "unique-runtime")]435 RuntimeId::Unique => Box::pin(cmd.run::<Block, UniqueRuntimeExecutor>(config)),436437 #[cfg(feature = "quartz-runtime")]438 RuntimeId::Quartz => Box::pin(cmd.run::<Block, QuartzRuntimeExecutor>(config)),439440 RuntimeId::Opal => {441 Box::pin(cmd.run::<Block, OpalRuntimeExecutor>(config))442 }443 RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain).into()),444 },445 task_manager,446 ))447 })448 } else {449 Err("Try-runtime must be enabled by `--features try-runtime`.".into())450 }451 }416 None => {452 None => {417 let runner = cli.create_runner(&cli.run.normalize())?;453 let runner = cli.create_runner(&cli.run.normalize())?;418 let collator_options = cli.run.collator_options();454 let collator_options = cli.run.collator_options();runtime/common/src/runtime_apis.rsdiffbeforeafterboth426 }426 }427 }427 }428429 #[cfg(feature = "try-runtime")]430 impl frame_try_runtime::TryRuntime<Block> for Runtime {431 fn on_runtime_upgrade() -> (Weight, Weight) {432 log::info!("try-runtime::on_runtime_upgrade unique-chain.");433 let weight = Executive::try_runtime_upgrade().unwrap();434 (weight, RuntimeBlockWeights::get().max_block)435 }436437 fn execute_block_no_check(block: Block) -> Weight {438 Executive::execute_block_no_check(block)439 }440 }428 }441 }429 }442 }430}443}runtime/opal/Cargo.tomldiffbeforeafterboth38 'sp-runtime/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]40]41try-runtime = [42 'frame-try-runtime',43 'frame-executive/try-runtime',44 'frame-system/try-runtime',45]41std = [46std = [42 'codec/std',47 'codec/std',43 'cumulus-pallet-aura-ext/std',48 'cumulus-pallet-aura-ext/std',46 'cumulus-pallet-xcmp-queue/std',51 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',52 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',53 'cumulus-primitives-utility/std',54 'frame-try-runtime/std',49 'frame-executive/std',55 'frame-executive/std',50 'frame-support/std',56 'frame-support/std',51 'frame-system/std',57 'frame-system/std',121optional = true127optional = true122branch = "polkadot-v0.9.20"128branch = "polkadot-v0.9.20"129130[dependencies.frame-try-runtime]131default-features = false132git = 'https://github.com/paritytech/substrate.git'133optional = true134branch = 'polkadot-v0.9.17'123135124[dependencies.frame-executive]136[dependencies.frame-executive]125default-features = false137default-features = false375# local dependencies387# local dependencies376388377[dependencies]389[dependencies]390log = { version = "0.4.16", default-features = false }378unique-runtime-common = { path = "../common", default-features = false }391unique-runtime-common = { path = "../common", default-features = false }379scale-info = { version = "2.0.1", default-features = false, features = [392scale-info = { version = "2.0.1", default-features = false, features = [380 "derive",393 "derive",runtime/quartz/Cargo.tomldiffbeforeafterboth38 'sp-runtime/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]40]41try-runtime = [42 'frame-try-runtime',43 'frame-executive/try-runtime',44 'frame-system/try-runtime',45]41std = [46std = [42 'codec/std',47 'codec/std',43 'cumulus-pallet-aura-ext/std',48 'cumulus-pallet-aura-ext/std',46 'cumulus-pallet-xcmp-queue/std',51 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',52 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',53 'cumulus-primitives-utility/std',54 'frame-try-runtime/std',49 'frame-executive/std',55 'frame-executive/std',50 'frame-support/std',56 'frame-support/std',51 'frame-system/std',57 'frame-system/std',121optional = true127optional = true122branch = "polkadot-v0.9.20"128branch = "polkadot-v0.9.20"129130[dependencies.frame-try-runtime]131default-features = false132git = 'https://github.com/paritytech/substrate.git'133optional = true134branch = 'polkadot-v0.9.17'123135124[dependencies.frame-executive]136[dependencies.frame-executive]125default-features = false137default-features = false375# local dependencies387# local dependencies376388377[dependencies]389[dependencies]390log = { version = "0.4.16", default-features = false }378unique-runtime-common = { path = "../common", default-features = false }391unique-runtime-common = { path = "../common", default-features = false }379scale-info = { version = "2.0.1", default-features = false, features = [392scale-info = { version = "2.0.1", default-features = false, features = [380 "derive",393 "derive",runtime/unique/Cargo.tomldiffbeforeafterboth38 'sp-runtime/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]40]41try-runtime = [42 'frame-try-runtime',43 'frame-executive/try-runtime',44 'frame-system/try-runtime',45]41std = [46std = [42 'codec/std',47 'codec/std',43 'cumulus-pallet-aura-ext/std',48 'cumulus-pallet-aura-ext/std',46 'cumulus-pallet-xcmp-queue/std',51 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',52 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',53 'cumulus-primitives-utility/std',54 'frame-try-runtime/std',49 'frame-executive/std',55 'frame-executive/std',50 'frame-support/std',56 'frame-support/std',51 'frame-system/std',57 'frame-system/std',121optional = true127optional = true122branch = "polkadot-v0.9.20"128branch = "polkadot-v0.9.20"129130[dependencies.frame-try-runtime]131default-features = false132git = 'https://github.com/paritytech/substrate.git'133optional = true134branch = 'polkadot-v0.9.17'123135124[dependencies.frame-executive]136[dependencies.frame-executive]125default-features = false137default-features = false375# local dependencies387# local dependencies376388377[dependencies]389[dependencies]390log = { version = "0.4.16", default-features = false }378unique-runtime-common = { path = "../common", default-features = false }391unique-runtime-common = { path = "../common", default-features = false }379scale-info = { version = "2.0.1", default-features = false, features = [392scale-info = { version = "2.0.1", default-features = false, features = [380 "derive",393 "derive",