The Substrate Runtime Module Library (SRML) is a collection of 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:
executive
dispatches incoming extrinsic calls to the respective modules in the runtime.
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
.
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
.