Crate moonbeam_runtime
source ·Expand description
The Moonbeam Runtime.
Primary features of this runtime include:
- Ethereum compatibility
- Moonbeam tokenomics
Modules§
- Asset configuration for Moonbase.
- GLMR, the native token, uses 18 decimals of precision.
- Governance configurations
- Opaque types. These are used by the CLI to instantiate machinery that don’t need to know the specifics of the runtime. They can then be made to be agnostic over specific formats of data like extrinsics, allowing for them to continue syncing the network through upgrades to even the core datastructures.
- Dynamic runtime parameters for moonbeam.
- XCM configuration for Moonbase.
Macros§
Structs§
- The adjustment variable of the runtime. Higher values will cause
TargetBlockFullness
to change the fees more rapidly. This low value causes changes to occur slowly over time. - We allow for 5 MB blocks.
- The author inherent provides a AccountId20, but pallet evm needs an H160. This simple adapter makes the conversion.
- The amount of gas per pov. A ratio of 4 if we convert ref_time to gas and we compare it with the pov_size for a block. E.g. ceil( (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS ) We should re-check
xcm_config::Erc20XcmBridgeTransferGasLimit
when changing this value - The amount of gas per storage (in bytes): BLOCK_GAS_LIMIT / BLOCK_STORAGE_LIMIT The current definition of BLOCK_STORAGE_LIMIT is 160 KB, resulting in a value of 366.
- Account definition used for genesis block construction.
- Maintenance mode Call filter
- Maximum multiplier. We pick a value that is expensive but not impossibly so; it should act as a safety net.
- Minimum amount of the multiplier. This value cannot be too low. A test case should ensure that combined with
AdjustmentVariable
, we can recover from the minimum. Seemultiplier_can_grow_from_zero
in integration_tests.rs. This value is currently only used by pallet-transaction-payment as an assertion that the next multiplier is always > min value. - Normal Call Filter We dont allow to create nor mint assets, this for now is disabled We only allow transfers. For now creation of assets will go through asset-manager, while minting/burning only happens through xcm messages This can change in the future
- Provides an implementation of
PalletInfo
to provide information about the pallet setup in the runtime. - Implements all runtime apis for the client side.
- The runtime origin type representing the origin of a call.
- The portion of the
NORMAL_DISPATCH_RATIO
that we adjust the fees with. Blocks filled less than this will decrease the weight and more will increase.
Enums§
- The type used to represent the kinds of proxying allowed.
- The aggregated runtime call type.
- A reason for placing a freeze on funds.
- A reason for placing a hold on funds.
- An identifier for each lock placed on funds.
- A reason for slashing funds.
- An aggregation of all
Task
enums across all pallets included in the current runtime.
Constants§
- The asset precompile address prefix. Addresses that match against this prefix will be routed to Erc20AssetsPrecompileSet being marked as foreign
- Current approximation of the gas/s consumption considering EVM execution over compiled WASM (on 4.4Ghz CPU). Given the 2000ms Weight, from which 75% only are used for transactions, the total EVM execution gas limit is: GAS_PER_SECOND * 2 * 0.75 ~= 60_000_000.
- Maximum weight per block
- We need to duplicate this because the
runtime_version
macro is conflicting with the conditional compilation at the state_version field. - Approximate ratio of the amount of Weight per Gas. u64 works for approximations because Weight is a very small unit compared to gas.
Traits§
- Complex storage builder stuff.
- A trait for querying a single value from a type.
- Weight functions needed for pallet_parachain_staking.
Functions§
- The version information used to identify this runtime when compiled natively.
Type Aliases§
- Some way of identifying an account on the chain. We intentionally make it equivalent to the public key of our transaction signing scheme.
- The type for looking up accounts. We don’t expect more than 4 billion of them, but you never know…
- The address format for describing accounts.
- All pallets included in the runtime as a nested tuple of types.
- All pallets included in the runtime as a nested tuple of types. Excludes the System pallet.
- AssetId type
- Balance of an account.
- Block type as expected by this runtime.
- BlockId type as expected by this runtime.
- An index to a block.
- Extrinsic type that has already been checked.
- Digest item type.
- The type of eligibility to use
- Executive: handles dispatch to the various pallets.
- A hash of some data used by the chain.
- Block header type as expected by this runtime.
- Index of a transaction in the chain.
- The PrecompileSet installed in the Moonbeam runtime. We include the nine Istanbul precompiles (https://github.com/ethereum/go-ethereum/blob/3c46f557/core/vm/contracts.go#L69) as well as a special precompile for dispatching Substrate extrinsics The following distribution has been decided for the precompiles 0-1023: Ethereum Mainnet Precompiles 1024-2047 Precompiles that are not in Ethereum Mainnet but are neither Moonbeam specific 2048-4095 Moonbeam specific precompiles
- Alias to 512-bit hash when used in the context of a transaction signature on the chain.
- A Block signed with a Justification
- The SignedExtension to the basic transaction logic.
- Parameterized slow adjusting fee updated based on https://w3f-research.readthedocs.io/en/latest/polkadot/overview/2-token-economics.html#-2.-slow-adjusting-mechanism // editorconfig-checker-disable-line
- Unchecked extrinsic type as expected by this runtime.