follow-chain testing mode for try-runtime (and revamp CLI configs). (#9788)

* deadlock, need to ask someone to help now

* Finally it seems to be working.. at least for a few blocks

* self-review

* major mega revamp

* some small fixes

* another mega refactor

* add license

* Apply suggestions from code review

* hack around signature verification

* Some fixes

* Update utils/frame/try-runtime/cli/src/lib.rs

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* Update utils/frame/try-runtime/cli/src/lib.rs

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* Update utils/frame/try-runtime/cli/src/lib.rs

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* final tweaks, hopefully.

* a little self-review

* Add the ext root check

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
This commit is contained in:
Kian Paimani
2021-09-21 16:04:28 +01:00
committed by GitHub
parent 94635218af
commit 8f5f89324d
14 changed files with 1237 additions and 379 deletions
+31
View File
@@ -220,6 +220,37 @@ where
weight
}
/// Execute given block, but don't do any of the [`final_checks`].
///
/// Should only be used for testing.
#[cfg(feature = "try-runtime")]
pub fn execute_block_no_check(block: Block) -> frame_support::weights::Weight {
Self::initialize_block(block.header());
Self::initial_checks(&block);
let (header, extrinsics) = block.deconstruct();
Self::execute_extrinsics_with_book_keeping(extrinsics, *header.number());
// do some of the checks that would normally happen in `final_checks`, but definitely skip
// the state root check.
{
let new_header = <frame_system::Pallet<System>>::finalize();
let items_zip = header.digest().logs().iter().zip(new_header.digest().logs().iter());
for (header_item, computed_item) in items_zip {
header_item.check_equal(&computed_item);
assert!(header_item == computed_item, "Digest item must match that calculated.");
}
assert!(
header.extrinsics_root() == new_header.extrinsics_root(),
"Transaction trie root must be valid.",
);
}
frame_system::Pallet::<System>::block_weight().total()
}
/// Execute all `OnRuntimeUpgrade` of this runtime, including the pre and post migration checks.
///
/// This should only be used for testing.