companion try-state (#5907)

* bunch of changes for now

* companion for sanity-checks

* Fix

* remove bridges

* better logging

* revert spec change

* fmt

* fix

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Kian Paimani
2022-09-01 15:24:03 +01:00
committed by GitHub
parent 254582df7f
commit f2020208c0
9 changed files with 219 additions and 185 deletions
+175 -170
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -243,8 +243,8 @@ try-runtime = [
"frame-system/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bags-list/try-runtime",
"pallet-balances/try-runtime",
"pallet-bounties/try-runtime",
"pallet-child-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
@@ -252,6 +252,7 @@ try-runtime = [
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-democracy/try-runtime",
"pallet-gilt/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-identity/try-runtime",
"pallet-im-online/try-runtime",
@@ -273,6 +274,7 @@ try-runtime = [
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
"pallet-babe/try-runtime",
"pallet-xcm/try-runtime",
"runtime-common/try-runtime",
]
# When enabled, the runtime API will not be build.
+10 -2
View File
@@ -1882,8 +1882,16 @@ sp_api::impl_runtime_apis! {
let weight = Executive::try_runtime_upgrade().unwrap();
(weight, BlockWeights::get().max_block)
}
fn execute_block_no_check(block: Block) -> Weight {
Executive::execute_block_no_check(block)
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
log::info!(
target: "runtime::kusama", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
block.header.number,
block.header.hash(),
state_root_check,
select,
);
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
}
}
+3 -1
View File
@@ -226,6 +226,7 @@ try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime",
"frame-system/try-runtime",
"runtime-common/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
@@ -243,6 +244,7 @@ try-runtime = [
"pallet-indices/try-runtime",
"pallet-membership/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nomination-pools/try-runtime",
"pallet-offences/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
@@ -255,7 +257,7 @@ try-runtime = [
"pallet-babe/try-runtime",
"pallet-vesting/try-runtime",
"pallet-utility/try-runtime",
"runtime-common/try-runtime",
"pallet-xcm/try-runtime",
]
# When enabled, the runtime API will not be build.
#
+9 -2
View File
@@ -2002,8 +2002,15 @@ sp_api::impl_runtime_apis! {
(weight, BlockWeights::get().max_block)
}
fn execute_block_no_check(block: Block) -> Weight {
Executive::execute_block_no_check(block)
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
log::info!(
target: "runtime::polkadot", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
block.header.number,
block.header.hash(),
state_root_check,
select,
);
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
}
}
+4 -3
View File
@@ -227,10 +227,10 @@ try-runtime = [
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"pallet-authorship/try-runtime",
"runtime-common/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bags-list/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
"pallet-elections-phragmen/try-runtime",
@@ -256,8 +256,9 @@ try-runtime = [
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
"pallet-xcm/try-runtime",
"pallet-babe/try-runtime",
"runtime-common/try-runtime",
"pallet-bags-list/try-runtime",
]
# When enabled, the runtime API will not be build.
#
+11 -3
View File
@@ -1587,13 +1587,21 @@ sp_api::impl_runtime_apis! {
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> (frame_support::weights::Weight, frame_support::weights::Weight) {
fn on_runtime_upgrade() -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade westend.");
let weight = Executive::try_runtime_upgrade().unwrap();
(weight, BlockWeights::get().max_block)
}
fn execute_block_no_check(block: Block) -> frame_support::weights::Weight {
Executive::execute_block_no_check(block)
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
log::info!(
target: "runtime::westend", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
block.header.number,
block.header.hash(),
state_root_check,
select,
);
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
}
}
@@ -86,7 +86,7 @@ async fn main() {
(Runtime::Kusama, Command::SanityCheck) => {
use kusama_runtime::{Block, Runtime};
use kusama_runtime_constants::currency::UNITS;
sanity_check::execute::<Runtime, Block>(UNITS as u64, "KSM", options.uri.clone()).await;
try_state::execute::<Runtime, Block>(UNITS as u64, "KSM", options.uri.clone()).await;
},
(Runtime::Kusama, Command::Snapshot) => {
use kusama_runtime::{Block, Runtime};
@@ -107,7 +107,7 @@ async fn main() {
(Runtime::Westend, Command::SanityCheck) => {
use westend_runtime::{Block, Runtime};
use westend_runtime_constants::currency::UNITS;
sanity_check::execute::<Runtime, Block>(UNITS as u64, "WND", options.uri.clone()).await;
try_state::execute::<Runtime, Block>(UNITS as u64, "WND", options.uri.clone()).await;
},
(Runtime::Westend, Command::Snapshot) => {
use westend_runtime::{Block, Runtime};
@@ -128,7 +128,7 @@ async fn main() {
(Runtime::Polkadot, Command::SanityCheck) => {
use polkadot_runtime::{Block, Runtime};
use polkadot_runtime_constants::currency::UNITS;
sanity_check::execute::<Runtime, Block>(UNITS as u64, "DOT", options.uri.clone()).await;
try_state::execute::<Runtime, Block>(UNITS as u64, "DOT", options.uri.clone()).await;
},
(Runtime::Polkadot, Command::Snapshot) => {
use polkadot_runtime::{Block, Runtime};
+1
View File
@@ -43,3 +43,4 @@ std = [
runtime-benchmarks = [
"frame-system/runtime-benchmarks"
]
try-runtime = ["frame-support/try-runtime"]