Skip to content

Latest commit

 

History

History

srml

SRML

The Substrate Runtime Module Library (SRML) is a collection of runtime modules.

What are runtime modules?

A Substrate runtime can be composed of several smaller components for separation of concerns. These components are called runtime modules. Each runtime module packages together a set of functions (dispatchable extrinsic calls, public or private, mutable or immutable), storage items, and events.

There are four primary components that support runtime modules:

system module

system provides low-level APIs and utilities for other modules. system also defines all core types and extrinsic events for the Substrate runtime. All modules depend on the system module.

executive module

executive dispatches incoming extrinsic calls to the respective modules in the runtime.

support macros

support macros are a collection of Rust macros to facilitate the implementation of common module components. support macros expand at runtime to generate types (e.g. Module, Call, Store, Event) which are thereafter used by the runtime to communicate with the modules. Common support macros include decl_module, decl_storage, decl_event, and ensure.

runtime

The runtime expands the support macros to get type and trait implementations for each module before calling executive to dispatch calls to the individual modules. To see an example of how this might look, see ../node/runtime.