55 releases (36 major breaking)

38.0.0 Sep 25, 2024
37.0.0 Jul 18, 2024
36.0.0 Jul 12, 2024
35.0.0 Jun 21, 2024
2.0.0-alpha.5 Mar 24, 2020

#33 in #substrate

Download history 2435/week @ 2024-08-26 2163/week @ 2024-09-02 2709/week @ 2024-09-09 2709/week @ 2024-09-16 3614/week @ 2024-09-23 3407/week @ 2024-09-30 2229/week @ 2024-10-07 3248/week @ 2024-10-14 4253/week @ 2024-10-21 3879/week @ 2024-10-28 3297/week @ 2024-11-04 22226/week @ 2024-11-11 27363/week @ 2024-11-18 30628/week @ 2024-11-25 25660/week @ 2024-12-02 31641/week @ 2024-12-09

116,785 downloads per month
Used in 54 crates (33 directly)

Apache-2.0

2.5MB
45K 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,
    AllPalletsWithSystem,
>;

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,
    AllPalletsWithSystem,
    CustomOnRuntimeUpgrade,
>;

License: Apache-2.0

Release

Polkadot SDK stable2409

Dependencies

~17–31MB
~511K SLoC