difftreelog
feat try-runtime subcommand
in: master
7 files changed
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -22,6 +22,10 @@
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.20"
+[dependencies.try-runtime-cli]
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
[dependencies.pallet-transaction-payment-rpc]
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.20"
@@ -318,3 +322,4 @@
'unique-runtime/runtime-benchmarks',
'polkadot-service/runtime-benchmarks',
]
+try-runtime = []
node/cli/src/cli.rsdiffbeforeafterboth--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -55,6 +55,9 @@
/// The custom benchmark subcommmand benchmarking runtime pallets.
#[clap(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
+
+ /// Try runtime
+ TryRuntime(try_runtime_cli::TryRuntimeCmd),
}
/// Command for exporting the genesis state of the parachain
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -49,6 +49,7 @@
use codec::Encode;
use cumulus_primitives_core::ParaId;
use cumulus_client_service::genesis::generate_genesis_block;
+use std::{future::Future, pin::Pin};
use log::info;
use polkadot_parachain::primitives::AccountIdConversion;
use sc_cli::{
@@ -413,6 +414,41 @@
Some(Subcommand::Benchmark(..)) => {
Err("benchmarking is only available with unique runtime enabled".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 =
+ sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
+ .map_err(|e| format!("Error: {:?}", e))?;
+
+ runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {
+ Ok((
+ match config.chain_spec.runtime_id() {
+ #[cfg(feature = "unique-runtime")]
+ RuntimeId::Unique => Box::pin(cmd.run::<Block, UniqueRuntimeExecutor>(config)),
+
+ #[cfg(feature = "quartz-runtime")]
+ RuntimeId::Quartz => Box::pin(cmd.run::<Block, QuartzRuntimeExecutor>(config)),
+
+ RuntimeId::Opal => {
+ Box::pin(cmd.run::<Block, OpalRuntimeExecutor>(config))
+ }
+ RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain).into()),
+ },
+ task_manager,
+ ))
+ })
+ } else {
+ Err("Try-runtime must be enabled by `--features try-runtime`.".into())
+ }
+ }
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let collator_options = cli.run.collator_options();
runtime/common/src/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -425,6 +425,19 @@
Ok(batches)
}
}
+
+ #[cfg(feature = "try-runtime")]
+ impl frame_try_runtime::TryRuntime<Block> for Runtime {
+ fn on_runtime_upgrade() -> (Weight, Weight) {
+ log::info!("try-runtime::on_runtime_upgrade unique-chain.");
+ let weight = Executive::try_runtime_upgrade().unwrap();
+ (weight, RuntimeBlockWeights::get().max_block)
+ }
+
+ fn execute_block_no_check(block: Block) -> Weight {
+ Executive::execute_block_no_check(block)
+ }
+ }
}
}
}
runtime/opal/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Opal Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'opal-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version = '0.9.20'1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['std']20runtime-benchmarks = [21 'hex-literal',22 'frame-benchmarking',23 'frame-support/runtime-benchmarks',24 'frame-system-benchmarking',25 'frame-system/runtime-benchmarks',26 'pallet-ethereum/runtime-benchmarks',27 'pallet-evm-migration/runtime-benchmarks',28 'pallet-evm-coder-substrate/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',30 'pallet-timestamp/runtime-benchmarks',31 'pallet-common/runtime-benchmarks',32 'pallet-fungible/runtime-benchmarks',33 'pallet-refungible/runtime-benchmarks',34 'pallet-nonfungible/runtime-benchmarks',35 'pallet-unique/runtime-benchmarks',36 'pallet-inflation/runtime-benchmarks',37 'pallet-xcm/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]41std = [42 'codec/std',43 'cumulus-pallet-aura-ext/std',44 'cumulus-pallet-parachain-system/std',45 'cumulus-pallet-xcm/std',46 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',49 'frame-executive/std',50 'frame-support/std',51 'frame-system/std',52 'frame-system-rpc-runtime-api/std',53 'pallet-aura/std',54 'pallet-balances/std',55 # 'pallet-contracts/std',56 # 'pallet-contracts-primitives/std',57 # 'pallet-contracts-rpc-runtime-api/std',58 # 'pallet-contract-helpers/std',59 'pallet-randomness-collective-flip/std',60 'pallet-sudo/std',61 'pallet-timestamp/std',62 'pallet-transaction-payment/std',63 'pallet-transaction-payment-rpc-runtime-api/std',64 'pallet-treasury/std',65 # 'pallet-vesting/std',66 'pallet-evm/std',67 'pallet-evm-migration/std',68 'pallet-evm-contract-helpers/std',69 'pallet-evm-transaction-payment/std',70 'pallet-evm-coder-substrate/std',71 'pallet-ethereum/std',72 'pallet-base-fee/std',73 'fp-rpc/std',74 'up-rpc/std',75 'fp-evm-mapping/std',76 'fp-self-contained/std',77 'parachain-info/std',78 'serde',79 'pallet-inflation/std',80 'pallet-common/std',81 'pallet-fungible/std',82 'pallet-refungible/std',83 'pallet-nonfungible/std',84 'pallet-unique/std',85 'pallet-unq-scheduler/std',86 'pallet-charge-transaction/std',87 'up-data-structs/std',88 'sp-api/std',89 'sp-block-builder/std',90 "sp-consensus-aura/std",91 'sp-core/std',92 'sp-inherents/std',93 'sp-io/std',94 'sp-offchain/std',95 'sp-runtime/std',96 'sp-session/std',97 'sp-std/std',98 'sp-transaction-pool/std',99 'sp-version/std',100 'xcm/std',101 'xcm-builder/std',102 'xcm-executor/std',103 'unique-runtime-common/std',104105 "orml-vesting/std",106]107limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']108109################################################################################110# Substrate Dependencies111112[dependencies.codec]113default-features = false114features = ['derive']115package = 'parity-scale-codec'116version = '3.1.2'117118[dependencies.frame-benchmarking]119default-features = false120git = "https://github.com/paritytech/substrate"121optional = true122branch = "polkadot-v0.9.20"123124[dependencies.frame-executive]125default-features = false126git = "https://github.com/paritytech/substrate"127branch = "polkadot-v0.9.20"128129[dependencies.frame-support]130default-features = false131git = "https://github.com/paritytech/substrate"132branch = "polkadot-v0.9.20"133134[dependencies.frame-system]135default-features = false136git = "https://github.com/paritytech/substrate"137branch = "polkadot-v0.9.20"138139[dependencies.frame-system-benchmarking]140default-features = false141git = "https://github.com/paritytech/substrate"142optional = true143branch = "polkadot-v0.9.20"144145[dependencies.frame-system-rpc-runtime-api]146default-features = false147git = "https://github.com/paritytech/substrate"148branch = "polkadot-v0.9.20"149150[dependencies.hex-literal]151optional = true152version = '0.3.3'153154[dependencies.serde]155default-features = false156features = ['derive']157optional = true158version = '1.0.130'159160[dependencies.pallet-aura]161default-features = false162git = "https://github.com/paritytech/substrate"163branch = "polkadot-v0.9.20"164165[dependencies.pallet-balances]166default-features = false167git = "https://github.com/paritytech/substrate"168branch = "polkadot-v0.9.20"169170# Contracts specific packages171# [dependencies.pallet-contracts]172# git = 'https://github.com/paritytech/substrate'173# default-features = false174# branch = 'master'175# version = '4.0.0-dev'176177# [dependencies.pallet-contracts-primitives]178# git = 'https://github.com/paritytech/substrate'179# default-features = false180# branch = 'master'181# version = '4.0.0-dev'182183# [dependencies.pallet-contracts-rpc-runtime-api]184# git = 'https://github.com/paritytech/substrate'185# default-features = false186# branch = 'master'187# version = '4.0.0-dev'188189[dependencies.pallet-randomness-collective-flip]190default-features = false191git = "https://github.com/paritytech/substrate"192branch = "polkadot-v0.9.20"193194[dependencies.pallet-sudo]195default-features = false196git = "https://github.com/paritytech/substrate"197branch = "polkadot-v0.9.20"198199[dependencies.pallet-timestamp]200default-features = false201git = "https://github.com/paritytech/substrate"202branch = "polkadot-v0.9.20"203204[dependencies.pallet-transaction-payment]205default-features = false206git = "https://github.com/paritytech/substrate"207branch = "polkadot-v0.9.20"208209[dependencies.pallet-transaction-payment-rpc-runtime-api]210default-features = false211git = "https://github.com/paritytech/substrate"212branch = "polkadot-v0.9.20"213214[dependencies.pallet-treasury]215default-features = false216git = "https://github.com/paritytech/substrate"217branch = "polkadot-v0.9.20"218219# [dependencies.pallet-vesting]220# default-features = false221# git = 'https://github.com/paritytech/substrate'222# branch = 'master'223224[dependencies.sp-arithmetic]225default-features = false226git = "https://github.com/paritytech/substrate"227branch = "polkadot-v0.9.20"228229[dependencies.sp-api]230default-features = false231git = "https://github.com/paritytech/substrate"232branch = "polkadot-v0.9.20"233234[dependencies.sp-block-builder]235default-features = false236git = "https://github.com/paritytech/substrate"237branch = "polkadot-v0.9.20"238239[dependencies.sp-core]240default-features = false241git = "https://github.com/paritytech/substrate"242branch = "polkadot-v0.9.20"243244[dependencies.sp-consensus-aura]245default-features = false246git = "https://github.com/paritytech/substrate"247branch = "polkadot-v0.9.20"248249[dependencies.sp-inherents]250default-features = false251git = "https://github.com/paritytech/substrate"252branch = "polkadot-v0.9.20"253254[dependencies.sp-io]255default-features = false256git = "https://github.com/paritytech/substrate"257branch = "polkadot-v0.9.20"258259[dependencies.sp-offchain]260default-features = false261git = "https://github.com/paritytech/substrate"262branch = "polkadot-v0.9.20"263264[dependencies.sp-runtime]265default-features = false266git = "https://github.com/paritytech/substrate"267branch = "polkadot-v0.9.20"268269[dependencies.sp-session]270default-features = false271git = "https://github.com/paritytech/substrate"272branch = "polkadot-v0.9.20"273274[dependencies.sp-std]275default-features = false276git = "https://github.com/paritytech/substrate"277branch = "polkadot-v0.9.20"278279[dependencies.sp-transaction-pool]280default-features = false281git = "https://github.com/paritytech/substrate"282branch = "polkadot-v0.9.20"283284[dependencies.sp-version]285default-features = false286git = "https://github.com/paritytech/substrate"287branch = "polkadot-v0.9.20"288289[dependencies.smallvec]290version = '1.6.1'291292################################################################################293# Cumulus dependencies294295[dependencies.parachain-info]296default-features = false297git = "https://github.com/paritytech/cumulus"298branch = "polkadot-v0.9.20"299300[dependencies.cumulus-pallet-aura-ext]301git = "https://github.com/paritytech/cumulus"302branch = "polkadot-v0.9.20"303default-features = false304305[dependencies.cumulus-pallet-parachain-system]306git = "https://github.com/paritytech/cumulus"307branch = "polkadot-v0.9.20"308default-features = false309310[dependencies.cumulus-primitives-core]311git = "https://github.com/paritytech/cumulus"312branch = "polkadot-v0.9.20"313default-features = false314315[dependencies.cumulus-pallet-xcm]316git = "https://github.com/paritytech/cumulus"317branch = "polkadot-v0.9.20"318default-features = false319320[dependencies.cumulus-pallet-dmp-queue]321git = "https://github.com/paritytech/cumulus"322branch = "polkadot-v0.9.20"323default-features = false324325[dependencies.cumulus-pallet-xcmp-queue]326git = "https://github.com/paritytech/cumulus"327branch = "polkadot-v0.9.20"328default-features = false329330[dependencies.cumulus-primitives-utility]331git = "https://github.com/paritytech/cumulus"332branch = "polkadot-v0.9.20"333default-features = false334335[dependencies.cumulus-primitives-timestamp]336git = "https://github.com/paritytech/cumulus"337branch = "polkadot-v0.9.20"338default-features = false339340################################################################################341# Polkadot dependencies342343[dependencies.polkadot-parachain]344git = "https://github.com/paritytech/polkadot"345branch = "release-v0.9.20"346default-features = false347348[dependencies.xcm]349git = "https://github.com/paritytech/polkadot"350branch = "release-v0.9.20"351default-features = false352353[dependencies.xcm-builder]354git = "https://github.com/paritytech/polkadot"355branch = "release-v0.9.20"356default-features = false357358[dependencies.xcm-executor]359git = "https://github.com/paritytech/polkadot"360branch = "release-v0.9.20"361default-features = false362363[dependencies.pallet-xcm]364git = "https://github.com/paritytech/polkadot"365branch = "release-v0.9.20"366default-features = false367368[dependencies.orml-vesting]369git = "https://github.com/uniquenetwork/open-runtime-module-library"370branch = "unique-polkadot-v0.9.20"371version = "0.4.1-dev"372default-features = false373374################################################################################375# local dependencies376377[dependencies]378unique-runtime-common = { path = "../common", default-features = false }379scale-info = { version = "2.0.1", default-features = false, features = [380 "derive",381] }382derivative = "2.2.0"383pallet-unique = { path = '../../pallets/unique', default-features = false }384up-rpc = { path = "../../primitives/rpc", default-features = false }385fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }386pallet-inflation = { path = '../../pallets/inflation', default-features = false }387up-data-structs = { path = '../../primitives/data-structs', default-features = false }388pallet-common = { default-features = false, path = "../../pallets/common" }389pallet-fungible = { default-features = false, path = "../../pallets/fungible" }390pallet-refungible = { default-features = false, path = "../../pallets/refungible" }391pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }392pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }393# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }394pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.20", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }395pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }396pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }397pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }398pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }399pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }400pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }401pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }402fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }403fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }404405################################################################################406# Build Dependencies407408[build-dependencies.substrate-wasm-builder]409git = "https://github.com/paritytech/substrate"410branch = "polkadot-v0.9.20"runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -38,6 +38,11 @@
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
]
+try-runtime = [
+ 'frame-try-runtime',
+ 'frame-executive/try-runtime',
+ 'frame-system/try-runtime',
+]
std = [
'codec/std',
'cumulus-pallet-aura-ext/std',
@@ -46,6 +51,7 @@
'cumulus-pallet-xcmp-queue/std',
'cumulus-primitives-core/std',
'cumulus-primitives-utility/std',
+ 'frame-try-runtime/std',
'frame-executive/std',
'frame-support/std',
'frame-system/std',
@@ -121,6 +127,12 @@
optional = true
branch = "polkadot-v0.9.20"
+[dependencies.frame-try-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.17'
+
[dependencies.frame-executive]
default-features = false
git = "https://github.com/paritytech/substrate"
@@ -375,6 +387,7 @@
# local dependencies
[dependencies]
+log = { version = "0.4.16", default-features = false }
unique-runtime-common = { path = "../common", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -38,6 +38,11 @@
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
]
+try-runtime = [
+ 'frame-try-runtime',
+ 'frame-executive/try-runtime',
+ 'frame-system/try-runtime',
+]
std = [
'codec/std',
'cumulus-pallet-aura-ext/std',
@@ -46,6 +51,7 @@
'cumulus-pallet-xcmp-queue/std',
'cumulus-primitives-core/std',
'cumulus-primitives-utility/std',
+ 'frame-try-runtime/std',
'frame-executive/std',
'frame-support/std',
'frame-system/std',
@@ -121,6 +127,12 @@
optional = true
branch = "polkadot-v0.9.20"
+[dependencies.frame-try-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.17'
+
[dependencies.frame-executive]
default-features = false
git = "https://github.com/paritytech/substrate"
@@ -375,6 +387,7 @@
# local dependencies
[dependencies]
+log = { version = "0.4.16", default-features = false }
unique-runtime-common = { path = "../common", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",