Crate moonbase_runtime
source ·Expand description
The Moonbase Runtime.
Primary features of this runtime include:
- Ethereum compatibility
- Moonbase tokenomics
Modules§
- Asset configuration for Moonbase.
- UNIT, 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 data structures.
- Dynamic runtime parameters for moonbase.
- XCM configuration for Moonbase.
Macros§
Structs§
- The adjustment variable of the runtime. Higher values will cause
TargetBlockFullness
to change the fees more rapidly. This fast multiplier responds by doubling/halving in approximately one hour at extreme block congestion levels. - We allow for 5 MB blocks.
- TODO: this is left here so that
impl_runtime_apis_plus_common
will find the same type forBlockWeights
in all runtimes. It can probably be removed once the customRuntimeBlockWeights
has been pushed to each runtime. - The author inherent provides an AccountId, but pallet evm needs an H160. This simple adapter makes the conversion for any types T, U such that T: Into
- The amount of gas per pov. A ratio of 16 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 (60_000_000 / 160 kb)
- 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. - 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 highest amount of new storage that can be created in a block (160KB).
- 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 2 sec 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
- This runtime version. The spec_version is composed of 2x2 digits. The first 2 digits represent major changes that can’t be skipped, such as data migration upgrades. The last 2 digits represent minor changes which can be skipped.
- 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 “Fast” TargetedFeeAdjustment. Parameters chosen based on model described here: https://research.web3.foundation/en/latest/polkadot/overview/2-token-economics.html#-1.-fast-adjusting-mechanism // editorconfig-checker-disable-line
- 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 Moonbase runtime. We include the nine Istanbul precompiles (https://github.com/ethereum/go-ethereum/blob/3c46f557/core/vm/contracts.go#L69) 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.
- Unchecked extrinsic type as expected by this runtime.