32 releases (18 major breaking)

new 20.0.0 Mar 26, 2023
19.0.0 Mar 5, 2023
18.0.0 Feb 26, 2023
17.0.0 Feb 19, 2023
2.0.0-alpha.5 Mar 24, 2020

#1338 in Magic Beans

Download history 1511/week @ 2022-12-09 584/week @ 2022-12-16 790/week @ 2022-12-23 278/week @ 2022-12-30 526/week @ 2023-01-06 471/week @ 2023-01-13 1161/week @ 2023-01-20 738/week @ 2023-01-27 1104/week @ 2023-02-03 400/week @ 2023-02-10 1311/week @ 2023-02-17 219/week @ 2023-02-24 916/week @ 2023-03-03 733/week @ 2023-03-10 755/week @ 2023-03-17 355/week @ 2023-03-24

2,804 downloads per month
Used in 2 crates (via suntime)

Apache-2.0

2MB
37K SLoC

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,
    AllPallets,
>;

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.
        frame_support::weights::Weight::zero()
    }
}

pub type Executive = executive::Executive<
    Runtime,
    Block,
    Context,
    Runtime,
    AllPallets,
    CustomOnRuntimeUpgrade,
>;

License: Apache-2.0

Dependencies

~8–44MB
~745K SLoC