companion for try-runtime revamp (#1997)

* companion for try-rutnime revamp

* Fixes

Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Kian Paimani
2022-12-15 10:50:52 +00:00
committed by GitHub
parent babf73bbc6
commit 391a5d8988
13 changed files with 408 additions and 391 deletions
+11 -12
View File
@@ -696,21 +696,20 @@ 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 penpal.");
let weight = Executive::try_runtime_upgrade().unwrap();
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
log::info!(
target: "runtime::penpal", "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")
fn execute_block(
block: Block,
state_root_check: bool,
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
}
}