#tetcoin #framework #blockchain #crypto

no-std fabric-executive

FABRIC executives engine

Show the crate…

1 stable release

2.0.0 Apr 4, 2021
0.0.0 Mar 8, 2021

#32 in #tetcoin

Download history 27/week @ 2024-03-14 33/week @ 2024-03-21 64/week @ 2024-03-28 45/week @ 2024-04-04 26/week @ 2024-04-11 40/week @ 2024-04-18 33/week @ 2024-04-25 29/week @ 2024-05-02 35/week @ 2024-05-09 26/week @ 2024-05-16 20/week @ 2024-05-23 25/week @ 2024-05-30 24/week @ 2024-06-06 19/week @ 2024-06-13 29/week @ 2024-06-20 17/week @ 2024-06-27

94 downloads per month
Used in 13 crates (3 directly)

Apache-2.0

1.5MB
25K 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 noble providing functionality around a specific feature. It is a cross-cutting framework component for the FABRIC. It works in conjunction with the FABRIC 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:

  • ExecuteBlock: Trait that can be used to execute a block.
  • Executive: Type that can be used to make the FABRIC available from the runtime.

Usage

The default Tetcore 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 fabric_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
    fn on_runtime_upgrade() -> fabric_support::weights::Weight {
        // Do whatever you want.
        0
    }
}

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

License: Apache-2.0

Dependencies

~3–12MB
~135K SLoC