* add in idle hook * remaining weight passed through to on_idle * added weight return * remove TODO * weight adjustment fix * added adjusted weight into tuple * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * compile errors for on_idle in dispatch * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/dispatch.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * on idle tuple clean up * register reduced weight * collect and add reduced wait from on idle call * better demo example * Update frame/support/procedural/src/pallet/expand/hooks.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * added tests to dispatch.rs * idle test on executive * skip on idle if remaining weight is 0 * Update frame/executive/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update frame/support/src/dispatch.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * abstract common logic out to functions * docs * remove demo example * remove debug * spacing * docs * revert template pallet to master * change reduced weight to used weight * remove empty line * lint * spacing * Update frame/support/src/traits.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * documentation * Update frame/support/procedural/src/pallet/expand/hooks.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * docs * Update frame/support/src/traits.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * docs * Update frame/support/src/traits.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update frame/support/src/traits.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update frame/support/src/traits.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Executive Module
The Executive module acts as the orchestration layer for the runtime. It dispatches incoming extrinsic calls to the respective modules in the runtime.
Overview
The executive module is not a typical pallet providing functionality around a specific feature. It is a cross-cutting framework component for the FRAME. It works in conjunction with the FRAME System module to perform these cross-cutting functions.
The Executive module provides functions to:
- Check transaction validity.
- Initialize a block.
- Apply extrinsics.
- Execute a block.
- Finalize a block.
- Start an off-chain worker.
Implementations
The Executive module provides the following implementations:
Executive: Type that can be used to make the FRAME available from the runtime.
Usage
The default Substrate node template declares the Executive type in its library.
Example
Executive type declaration from the node template.
#
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, Context, Runtime, AllModules>;
Custom OnRuntimeUpgrade logic
You can add custom logic that should be called in your runtime on a runtime upgrade. This is done by setting an optional generic parameter. The custom logic will be called before the on runtime upgrade logic of all modules is called.
#
struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
// Do whatever you want.
0
}
}
pub type Executive = executive::Executive<Runtime, Block, Context, Runtime, AllModules, CustomOnRuntimeUpgrade>;
License: Apache-2.0