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:
Kian Paimani
2021-12-02 14:00:54 +01:00
committed by GitHub
parent ad8fa5fc07
commit 70ea98995a
23 changed files with 189 additions and 10 deletions
@@ -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" }
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]
hex-literal = "0.3.1"
@@ -100,6 +103,10 @@ runtime-benchmarks = [
"pallet-xcm/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
]
try-runtime = [
"frame-try-runtime",
"frame-executive/try-runtime",
]
std = [
"codec/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")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (