mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +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:
@@ -107,6 +107,22 @@ test-linux-stable:
|
|||||||
fi
|
fi
|
||||||
- sccache -s
|
- sccache -s
|
||||||
|
|
||||||
|
check-runtime-benchmarks:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-env
|
||||||
|
script:
|
||||||
|
# Check that the node will compile with `runtime-benchmarks` feature flag.
|
||||||
|
- time cargo check --features runtime-benchmarks
|
||||||
|
- sccache -s
|
||||||
|
|
||||||
|
cargo-check-try-runtime:
|
||||||
|
stage: test
|
||||||
|
<<: *docker-env
|
||||||
|
script:
|
||||||
|
# Check that the node will compile with `try-runtime` feature flag.
|
||||||
|
- time cargo check --features try-runtime
|
||||||
|
- sccache -s
|
||||||
|
|
||||||
#### stage: publish
|
#### stage: publish
|
||||||
|
|
||||||
publish-s3:
|
publish-s3:
|
||||||
|
|||||||
Generated
+7
@@ -6055,6 +6055,7 @@ dependencies = [
|
|||||||
"substrate-build-script-utils",
|
"substrate-build-script-utils",
|
||||||
"substrate-frame-rpc-system",
|
"substrate-frame-rpc-system",
|
||||||
"substrate-prometheus-endpoint",
|
"substrate-prometheus-endpoint",
|
||||||
|
"try-runtime-cli",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6076,6 +6077,7 @@ dependencies = [
|
|||||||
"frame-system",
|
"frame-system",
|
||||||
"frame-system-benchmarking",
|
"frame-system-benchmarking",
|
||||||
"frame-system-rpc-runtime-api",
|
"frame-system-rpc-runtime-api",
|
||||||
|
"frame-try-runtime",
|
||||||
"hex-literal 0.3.4",
|
"hex-literal 0.3.4",
|
||||||
"log",
|
"log",
|
||||||
"pallet-aura",
|
"pallet-aura",
|
||||||
@@ -6699,6 +6701,7 @@ dependencies = [
|
|||||||
"substrate-frame-rpc-system",
|
"substrate-frame-rpc-system",
|
||||||
"substrate-prometheus-endpoint",
|
"substrate-prometheus-endpoint",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"try-runtime-cli",
|
||||||
"westmint-runtime",
|
"westmint-runtime",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -9816,6 +9819,7 @@ dependencies = [
|
|||||||
"frame-executive",
|
"frame-executive",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
"frame-system",
|
"frame-system",
|
||||||
|
"frame-try-runtime",
|
||||||
"log",
|
"log",
|
||||||
"parachain-info",
|
"parachain-info",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
@@ -10712,6 +10716,7 @@ dependencies = [
|
|||||||
"frame-system",
|
"frame-system",
|
||||||
"frame-system-benchmarking",
|
"frame-system-benchmarking",
|
||||||
"frame-system-rpc-runtime-api",
|
"frame-system-rpc-runtime-api",
|
||||||
|
"frame-try-runtime",
|
||||||
"hex-literal 0.3.4",
|
"hex-literal 0.3.4",
|
||||||
"log",
|
"log",
|
||||||
"node-primitives",
|
"node-primitives",
|
||||||
@@ -10777,6 +10782,7 @@ dependencies = [
|
|||||||
"frame-system",
|
"frame-system",
|
||||||
"frame-system-benchmarking",
|
"frame-system-benchmarking",
|
||||||
"frame-system-rpc-runtime-api",
|
"frame-system-rpc-runtime-api",
|
||||||
|
"frame-try-runtime",
|
||||||
"hex-literal 0.3.4",
|
"hex-literal 0.3.4",
|
||||||
"log",
|
"log",
|
||||||
"node-primitives",
|
"node-primitives",
|
||||||
@@ -12170,6 +12176,7 @@ dependencies = [
|
|||||||
"frame-system",
|
"frame-system",
|
||||||
"frame-system-benchmarking",
|
"frame-system-benchmarking",
|
||||||
"frame-system-rpc-runtime-api",
|
"frame-system-rpc-runtime-api",
|
||||||
|
"frame-try-runtime",
|
||||||
"hex-literal 0.3.4",
|
"hex-literal 0.3.4",
|
||||||
"log",
|
"log",
|
||||||
"node-primitives",
|
"node-primitives",
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ pub struct RunCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A non-redundant version of the `RunCmd` that sets the `validator` field when the
|
/// A non-redundant version of the `RunCmd` that sets the `validator` field when the
|
||||||
/// original `RunCmd` had the `colaltor` field.
|
/// original `RunCmd` had the `collator` field.
|
||||||
/// This is how we make `--collator` imply `--validator`.
|
/// This is how we make `--collator` imply `--validator`.
|
||||||
pub struct NormalizedRunCmd {
|
pub struct NormalizedRunCmd {
|
||||||
/// The cumulus RunCmd inherents from sc_cli's
|
/// The cumulus RunCmd inherents from sc_cli's
|
||||||
|
|||||||
@@ -60,3 +60,5 @@ std = [
|
|||||||
"pallet-authorship/std",
|
"pallet-authorship/std",
|
||||||
"pallet-session/std",
|
"pallet-session/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
try-runtime = [ "frame-support/try-runtime" ]
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ fn register_validators<T: Config + session::Config>(count: u32) {
|
|||||||
let validators = (0..count).map(|c| validator::<T>(c)).collect::<Vec<_>>();
|
let validators = (0..count).map(|c| validator::<T>(c)).collect::<Vec<_>>();
|
||||||
|
|
||||||
for (who, keys) in validators {
|
for (who, keys) in validators {
|
||||||
<session::Module<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
|
<session::Pallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#![cfg(feature = "runtime-benchmarks")]
|
#![cfg(feature = "runtime-benchmarks")]
|
||||||
use sp_std::{prelude::*, vec};
|
use sp_std::{prelude::*, vec};
|
||||||
|
|
||||||
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
|
use frame_benchmarking::{benchmarks, whitelisted_caller};
|
||||||
use frame_system::RawOrigin;
|
use frame_system::RawOrigin;
|
||||||
use pallet_session::*;
|
use pallet_session::*;
|
||||||
pub struct Pallet<T: Config>(pallet_session::Pallet<T>);
|
pub struct Pallet<T: Config>(pallet_session::Pallet<T>);
|
||||||
@@ -39,6 +39,4 @@ benchmarks! {
|
|||||||
let proof: Vec<u8> = vec![0,1,2,3];
|
let proof: Vec<u8> = vec![0,1,2,3];
|
||||||
let _t = pallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(caller.clone()).into(), keys, proof);
|
let _t = pallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(caller.clone()).into(), keys, proof);
|
||||||
}: _(RawOrigin::Signed(caller))
|
}: _(RawOrigin::Signed(caller))
|
||||||
|
|
||||||
}
|
}
|
||||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false,);
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
runtime-benchmarks = ["parachain-template-runtime/runtime-benchmarks"]
|
runtime-benchmarks = ["parachain-template-runtime/runtime-benchmarks"]
|
||||||
|
try-runtime = [ "parachain-template-runtime/try-runtime" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
derive_more = "0.99.2"
|
derive_more = "0.99.2"
|
||||||
@@ -39,6 +40,7 @@ parachain-template-runtime = { path = "../runtime" }
|
|||||||
# Substrate Dependencies
|
# Substrate Dependencies
|
||||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
@@ -92,3 +94,4 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "maste
|
|||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ pub enum Subcommand {
|
|||||||
/// The custom benchmark subcommmand benchmarking runtime pallets.
|
/// The custom benchmark subcommmand benchmarking runtime pallets.
|
||||||
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
||||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||||
|
|
||||||
|
/// Try some testing command against a specified runtime state.
|
||||||
|
TryRuntime(try_runtime_cli::TryRuntimeCmd),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Command for exporting the genesis state of the parachain
|
/// Command for exporting the genesis state of the parachain
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ use sc_cli::{
|
|||||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||||
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
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_core::hexdisplay::HexDisplay;
|
||||||
use sp_runtime::traits::Block as BlockT;
|
use sp_runtime::traits::Block as BlockT;
|
||||||
use std::{io::Write, net::SocketAddr};
|
use std::{io::Write, net::SocketAddr};
|
||||||
@@ -237,6 +240,22 @@ pub fn run() -> Result<()> {
|
|||||||
You can enable it with `--features runtime-benchmarks`."
|
You can enable it with `--features runtime-benchmarks`."
|
||||||
.into())
|
.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 => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||||
|
|
||||||
|
|||||||
@@ -35,3 +35,4 @@ std = [
|
|||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
"frame-benchmarking/std",
|
"frame-benchmarking/std",
|
||||||
]
|
]
|
||||||
|
try-runtime = [ "frame-support/try-runtime" ]
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features
|
|||||||
|
|
||||||
## Substrate FRAME Dependencies
|
## Substrate FRAME Dependencies
|
||||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
||||||
|
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
|
||||||
@@ -144,3 +145,8 @@ runtime-benchmarks = [
|
|||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
try-runtime = [
|
||||||
|
"frame-try-runtime",
|
||||||
|
"frame-executive/try-runtime",
|
||||||
|
]
|
||||||
|
|||||||
@@ -732,6 +732,18 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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 parachain-template.");
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
@@ -788,7 +800,6 @@ impl_runtime_apis! {
|
|||||||
add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
|
add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
|
||||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
||||||
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
|
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
|
||||||
add_benchmark!(params, batches, pallet_session, Session);
|
|
||||||
|
|
||||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|||||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
|
# try-runtime stuff.
|
||||||
|
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
# RPC related dependencies
|
# RPC related dependencies
|
||||||
jsonrpc-core = "18.0.0"
|
jsonrpc-core = "18.0.0"
|
||||||
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
@@ -95,3 +98,9 @@ runtime-benchmarks = [
|
|||||||
"statemine-runtime/runtime-benchmarks",
|
"statemine-runtime/runtime-benchmarks",
|
||||||
"westmint-runtime/runtime-benchmarks",
|
"westmint-runtime/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
try-runtime = [
|
||||||
|
'statemint-runtime/try-runtime',
|
||||||
|
'statemine-runtime/try-runtime',
|
||||||
|
'westmint-runtime/try-runtime',
|
||||||
|
'shell-runtime/try-runtime',
|
||||||
|
]
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ frame-support = { git = "https://github.com/paritytech/substrate", default-featu
|
|||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
|
|
||||||
|
# try-runtime stuff.
|
||||||
|
frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
|
|
||||||
# Cumulus dependencies
|
# Cumulus dependencies
|
||||||
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
|
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
|
||||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||||
@@ -72,3 +75,7 @@ std = [
|
|||||||
"xcm-builder/std",
|
"xcm-builder/std",
|
||||||
"xcm-executor/std",
|
"xcm-executor/std",
|
||||||
]
|
]
|
||||||
|
try-runtime = [
|
||||||
|
"frame-try-runtime",
|
||||||
|
"frame-executive/try-runtime",
|
||||||
|
]
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ pub enum Subcommand {
|
|||||||
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
||||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||||
|
|
||||||
|
/// Try some testing command against a specified runtime state.
|
||||||
|
TryRuntime(try_runtime_cli::TryRuntimeCmd),
|
||||||
|
|
||||||
/// Key management CLI utilities
|
/// Key management CLI utilities
|
||||||
Key(sc_cli::KeySubcommand),
|
Key(sc_cli::KeySubcommand),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ use sc_cli::{
|
|||||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||||
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
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_core::hexdisplay::HexDisplay;
|
||||||
use sp_runtime::traits::Block as BlockT;
|
use sp_runtime::traits::Block as BlockT;
|
||||||
use std::{io::Write, net::SocketAddr};
|
use std::{io::Write, net::SocketAddr};
|
||||||
@@ -391,6 +394,37 @@ pub fn run() -> Result<()> {
|
|||||||
You can enable it with `--features runtime-benchmarks`."
|
You can enable it with `--features runtime-benchmarks`."
|
||||||
.into())
|
.into())
|
||||||
},
|
},
|
||||||
|
Some(Subcommand::TryRuntime(cmd)) =>
|
||||||
|
if cfg!(feature = "try-runtime") {
|
||||||
|
// grab the task manager.
|
||||||
|
let runner = cli.create_runner(cmd)?;
|
||||||
|
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))?;
|
||||||
|
|
||||||
|
if runner.config().chain_spec.is_statemine() {
|
||||||
|
runner.async_run(|config| {
|
||||||
|
Ok((cmd.run::<Block, StatemineRuntimeExecutor>(config), task_manager))
|
||||||
|
})
|
||||||
|
} else if runner.config().chain_spec.is_westmint() {
|
||||||
|
runner.async_run(|config| {
|
||||||
|
Ok((cmd.run::<Block, WestmintRuntimeExecutor>(config), task_manager))
|
||||||
|
})
|
||||||
|
} else if runner.config().chain_spec.is_statemint() {
|
||||||
|
runner.async_run(|config| {
|
||||||
|
Ok((cmd.run::<Block, StatemintRuntimeExecutor>(config), task_manager))
|
||||||
|
})
|
||||||
|
} else if runner.config().chain_spec.is_shell() {
|
||||||
|
runner.async_run(|config| {
|
||||||
|
Ok((cmd.run::<Block, ShellRuntimeExecutor>(config), task_manager))
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Err("Chain doesn't support try-runtime".into())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
||||||
|
},
|
||||||
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
|
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features
|
|||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|
||||||
|
# Try-runtime stuff
|
||||||
|
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex-literal = "0.3.1"
|
hex-literal = "0.3.1"
|
||||||
|
|
||||||
@@ -100,6 +103,10 @@ runtime-benchmarks = [
|
|||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"pallet-collator-selection/runtime-benchmarks",
|
"pallet-collator-selection/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
try-runtime = [
|
||||||
|
"frame-try-runtime",
|
||||||
|
"frame-executive/try-runtime",
|
||||||
|
]
|
||||||
std = [
|
std = [
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
|
|||||||
@@ -889,6 +889,19 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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 statemine.");
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
fn benchmark_metadata(extra: bool) -> (
|
fn benchmark_metadata(extra: bool) -> (
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features
|
|||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|
||||||
|
# Try-runtime stuff
|
||||||
|
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex-literal = "0.3.1"
|
hex-literal = "0.3.1"
|
||||||
|
|
||||||
@@ -100,6 +103,10 @@ runtime-benchmarks = [
|
|||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"pallet-collator-selection/runtime-benchmarks",
|
"pallet-collator-selection/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
try-runtime = [
|
||||||
|
"frame-try-runtime",
|
||||||
|
"frame-executive/try-runtime",
|
||||||
|
]
|
||||||
std = [
|
std = [
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
|
|||||||
@@ -890,6 +890,19 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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 statemint.");
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
fn benchmark_metadata(extra: bool) -> (
|
fn benchmark_metadata(extra: bool) -> (
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", default-featu
|
|||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-asset-tx-payment = { git = 'https://github.com/paritytech/substrate', default-features = false, branch = "master" }
|
||||||
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
@@ -73,6 +73,9 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features
|
|||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|
||||||
|
# Try-runtime stuff
|
||||||
|
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex-literal = "0.3.1"
|
hex-literal = "0.3.1"
|
||||||
|
|
||||||
@@ -100,6 +103,10 @@ runtime-benchmarks = [
|
|||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"pallet-collator-selection/runtime-benchmarks",
|
"pallet-collator-selection/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
try-runtime = [
|
||||||
|
"frame-try-runtime",
|
||||||
|
"frame-executive/try-runtime",
|
||||||
|
]
|
||||||
std = [
|
std = [
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
|
|||||||
@@ -887,6 +887,19 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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 westmint.");
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
fn benchmark_metadata(extra: bool) -> (
|
fn benchmark_metadata(extra: bool) -> (
|
||||||
|
|||||||
Reference in New Issue
Block a user