Crate frame::prelude::frame_system
Expand description
frame_system’s parent crate, which is mandatory in all pallets build with this crate.
Conveniently, the keyword frame_system is in scope as one uses use frame::prelude::*
System Pallet
The System pallet provides low-level access to core types and cross-cutting utilities. It acts as the base layer for other pallets to interact with the Substrate framework components.
Overview
The System pallet defines the core data types used in a Substrate runtime.
It also provides several utility functions (see Pallet) for other FRAME pallets.
In addition, it manages the storage items for extrinsics data, indexes, event records, and digest items, among other things that support the execution of the current block.
It also handles low-level tasks like depositing logs, basic set up and take down of temporary storage entries, and access to previous block hashes.
Interface
Dispatchable Functions
The System pallet does not implement any dispatchable functions.
Public Functions
See the Pallet struct for details of publicly available functions.
Signed Extensions
The System pallet defines the following extensions:
CheckWeight: Checks the weight and length of the block and ensure that it does not exceed the limits.CheckNonce: Checks the nonce of the transaction. Contains a single payload of typeT::Nonce.CheckEra: Checks the era of the transaction. Contains a single payload of typeEra.CheckGenesis: Checks the provided genesis hash of the transaction. Must be a part of the signed payload of the transaction.CheckSpecVersion: Checks that the runtime version is the same as the one used to sign the transaction.CheckTxVersion: Checks that the transaction version is the same as the one used to sign the transaction.
Lookup the runtime aggregator file (e.g. node/runtime) to see the full list of signed
extensions included in a chain.
Modules
- Block resource limits configuration structures.
- Migrate the reference counting state.
- Provide types to help defining a mock environment when testing pallets.
- Module helpers for off-chain calls.
- The
palletmodule in each FRAME pallet hosts the most important items needed to construct this pallet. - Prelude to be used alongside pallet macro, for ease of use.
- Autogenerated weights for frame_system
Structs
- Information of an account.
- Check for transaction mortality.
- Genesis hash check to provide replay protection between different networks.
- Check for transaction mortality.
- Check to ensure that the sender is not the zero address.
- Nonce check and increment to give replay protection for transactions.
- Ensure the runtime version registered in the transaction is the same as at present.
- Ensure the transaction version registered in the transaction is the same as at present.
- Block resource (weight) limit check.
- Event handler which registers a consumer when created.
- Always fail.
- Ensure the origin is
None. i.e. unsigned transaction. - Ensure the origin is Root.
- Ensure the origin is Root and return the provided
Successvalue. - Ensure the origin is any
Signedorigin. - Ensure the origin is
Signedorigin from the givenAccountId. - Ensure the origin is provided
Ensureorigin and return the providedSuccessvalue. - Record of an event happening.
- Can be used to configure the genesis state of this pallet.
- Stores the
spec_versionandspec_nameof when the last runtime upgrade happened. - The
Palletstruct, the main type that implements traits and standalone functions within the pallet. - Event handler which registers a provider when created.
- Event handler which registers a self-sufficient when created.
Enums
- Contains a variant per dispatchable extrinsic that this pallet has.
- Some resultant status relevant to decrementing a provider/self-sufficient reference.
- Error for the System pallet
- Event for the System pallet.
- Some resultant status relevant to incrementing a provider/self-sufficient reference.
- A phase of a block’s execution.
- Origin for the System pallet.
- Reference status; can be either referenced or unreferenced.
Traits
- Configuration trait of this pallet.
- Numeric limits over the ability to add a consumer ref using
inc_consumers. - Based on
Config. Auto-generated by#[pallet::config(with_default)]. Can be used in tandem with#[register_default_config]and#[derive_impl]to derive test config traits based on existing pallet config traits in a safe and developer-friendly way. - Do something when we should be setting the code.
- Weight functions needed for frame_system.
Functions
- Ensure that the origin
orepresents an unsigned extrinsic. ReturnsOkor anErrotherwise. - Ensure that the origin
orepresents the root. ReturnsOkor anErrotherwise. - Ensure that the origin
orepresents a signed extrinsic (i.e. transaction). ReturnsOkwith the account that signed the extrinsic or anErrotherwise. - Ensure that the origin
orepresents either a signed extrinsic (i.e. transaction) or the root. ReturnsOkwith the account that signed the extrinsic,Noneif it was root, or anErrotherwise. - Compute the trie root of a list of extrinsics.
- Compute the trie root of a list of extrinsics.
- Split an
optioninto two constituent options, as defined by asplitterfunction. - Returns a 32 byte datum which is guaranteed to be universally unique.
entropyis provided as a facility to reduce the potential for precalculating results.
Type Definitions
- The full account information for a particular account ID.
- Map of block numbers to block hashes.
- An object to track the currently used extrinsic weight in a block.
- Stores the
spec_versionandspec_nameof when the last runtime upgrade happened. - ModuleDeprecatedType alias to
Pallet, to be used byconstruct_runtime. - Exposed trait-generic origin type.
- Type used to encode the number of references an account has.