mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
try-runtime::fast-forward (#12896)
* try-runtime::fast-forward * Revert un`pub`ing command's fields * Handle storage change failure * Adjust Substrate node * Feature-gated imports * doc link * Feature-gated imports in node-template * Move trait, blanket implementation and auxiliary functions to a new module * Distinguish between plain babe+timestamp and substrate enhanced info * Remove uncles inherents * Missing argument * Add doc comment about `blocktime_millis` * Add licenses
This commit is contained in:
committed by
GitHub
parent
64bff4529d
commit
3595d87182
@@ -358,6 +358,7 @@
|
||||
|
||||
#![cfg(feature = "try-runtime")]
|
||||
|
||||
use crate::block_building_info::BlockBuildingInfoProvider;
|
||||
use parity_scale_codec::Decode;
|
||||
use remote_externalities::{
|
||||
Builder, Mode, OfflineConfig, OnlineConfig, RemoteExternalities, SnapshotConfig,
|
||||
@@ -381,15 +382,17 @@ use sp_core::{
|
||||
twox_128, H256,
|
||||
};
|
||||
use sp_externalities::Extensions;
|
||||
use sp_inherents::InherentData;
|
||||
use sp_keystore::{testing::KeyStore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, Block as BlockT, NumberFor},
|
||||
DeserializeOwned,
|
||||
DeserializeOwned, Digest,
|
||||
};
|
||||
use sp_state_machine::{CompactProof, OverlayedChanges, StateMachine, TrieBackendBuilder};
|
||||
use sp_version::StateVersion;
|
||||
use std::{fmt::Debug, path::PathBuf, str::FromStr};
|
||||
|
||||
pub mod block_building_info;
|
||||
pub mod commands;
|
||||
pub(crate) mod parse;
|
||||
pub(crate) const LOG_TARGET: &str = "try-runtime::cli";
|
||||
@@ -445,6 +448,15 @@ pub enum Command {
|
||||
/// tested has remained the same, otherwise block decoding might fail.
|
||||
FollowChain(commands::follow_chain::FollowChainCmd),
|
||||
|
||||
/// Produce a series of empty, consecutive blocks and execute them one-by-one.
|
||||
///
|
||||
/// To compare it with [`Command::FollowChain`]:
|
||||
/// - we don't have the delay of the original blocktime (for Polkadot 6s), but instead, we
|
||||
/// execute every block immediately
|
||||
/// - the only data that will be put into blocks are pre-runtime digest items and inherent
|
||||
/// extrinsics; both things should be defined in your node CLI handling level
|
||||
FastForward(commands::fast_forward::FastForwardCmd),
|
||||
|
||||
/// Create a new snapshot file.
|
||||
CreateSnapshot(commands::create_snapshot::CreateSnapshotCmd),
|
||||
}
|
||||
@@ -719,7 +731,10 @@ impl State {
|
||||
}
|
||||
|
||||
impl TryRuntimeCmd {
|
||||
pub async fn run<Block, HostFns>(&self) -> sc_cli::Result<()>
|
||||
pub async fn run<Block, HostFns, BBIP>(
|
||||
&self,
|
||||
block_building_info_provider: Option<BBIP>,
|
||||
) -> sc_cli::Result<()>
|
||||
where
|
||||
Block: BlockT<Hash = H256> + DeserializeOwned,
|
||||
Block::Header: DeserializeOwned,
|
||||
@@ -729,6 +744,7 @@ impl TryRuntimeCmd {
|
||||
<NumberFor<Block> as TryInto<u64>>::Error: Debug,
|
||||
NumberFor<Block>: FromStr,
|
||||
HostFns: HostFunctions,
|
||||
BBIP: BlockBuildingInfoProvider<Block, Option<(InherentData, Digest)>>,
|
||||
{
|
||||
match &self.command {
|
||||
Command::OnRuntimeUpgrade(ref cmd) =>
|
||||
@@ -755,6 +771,13 @@ impl TryRuntimeCmd {
|
||||
cmd.clone(),
|
||||
)
|
||||
.await,
|
||||
Command::FastForward(cmd) =>
|
||||
commands::fast_forward::fast_forward::<Block, HostFns, BBIP>(
|
||||
self.shared.clone(),
|
||||
cmd.clone(),
|
||||
block_building_info_provider,
|
||||
)
|
||||
.await,
|
||||
Command::CreateSnapshot(cmd) =>
|
||||
commands::create_snapshot::create_snapshot::<Block, HostFns>(
|
||||
self.shared.clone(),
|
||||
|
||||
Reference in New Issue
Block a user