Trait frame_try_runtime::TryRuntime
source · pub trait TryRuntime<Block: BlockT>: Core<Block> {
// Provided methods
fn on_runtime_upgrade(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
checks: UpgradeCheckSelect
) -> Result<(Weight, Weight), ApiError> { ... }
fn execute_block(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
block: Block,
state_root_check: bool,
signature_check: bool,
try_state: TryStateSelect
) -> Result<Weight, ApiError> { ... }
}
Expand description
Runtime api for testing the execution of a runtime upgrade.
Provided Methods§
sourcefn on_runtime_upgrade(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
checks: UpgradeCheckSelect
) -> Result<(Weight, Weight), ApiError>
fn on_runtime_upgrade( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, checks: UpgradeCheckSelect ) -> Result<(Weight, Weight), ApiError>
dry-run runtime upgrades, returning the total weight consumed.
This should do EXACTLY the same operations as the runtime would have done in the case of a runtime upgrade (e.g. pallet ordering must be the same)
Returns the consumed weight of the migration in case of a successful one, combined with the total allowed block weight of the runtime.
If checks
is true
, pre_migrate
and post_migrate
of each migration and
try_state
of all pallets will be executed. Else, no. If checks are executed, the PoV
tracking is likely inaccurate.
sourcefn execute_block(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
block: Block,
state_root_check: bool,
signature_check: bool,
try_state: TryStateSelect
) -> Result<Weight, ApiError>
fn execute_block( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, block: Block, state_root_check: bool, signature_check: bool, try_state: TryStateSelect ) -> Result<Weight, ApiError>
Execute the given block, but optionally disable state-root and signature checks.
Optionally, a number of try_state
hooks can also be executed after the block
execution.