Expand description
§Substrate Runtime Primitives.
This crate, among other things, contains a large library of types and utilities that are used in
the Substrate runtime, but are not particularly FRAME
-oriented.
§Block, Header and Extrinsics
Most notable, this crate contains some of the types and trait that enable important communication between the client and the runtime. This includes:
- A set of traits to declare what any block/header/extrinsic type should provide.
- A set of types that implement these traits, whilst still providing a high degree of configurability via generics.
§Runtime API Types
This crate also contains some types that are often used in conjuncture with Runtime APIs. Most notable:
ApplyExtrinsicResult
, andDispatchOutcome
, which dictate how the client and runtime communicate about the success or failure of an extrinsic.transaction_validity
, which dictates how the client and runtime communicate about the validity of an extrinsic while still in the transaction-queue.
Re-exports§
pub use generic::Digest;
pub use generic::DigestItem;
Modules§
- biguint
- Re-export big_uint stuff. Infinite precision unsigned integer for substrate runtime.
- bounded_
btree_ map - Re-export bounded_vec and bounded_btree_map macros only when std is enabled. Traits, types and structs to support a bounded BTreeMap.
- bounded_
vec - Re-export bounded_vec and bounded_btree_map macros only when std is enabled. Traits, types and structs to support putting a bounded vector into storage, as a raw value, map or a double map.
- curve
- Provides some utilities to define a piecewise linear function.
- generic
- Generic implementations of
crate::traits::Header
,crate::traits::Block
andcrate::traits::ExtrinsicLike
. - helpers_
128bit - Re-export 128 bit helpers. Some helper functions to work with 128bit numbers. Note that the functionality provided here is only sensible to use with 128bit numbers because for smaller sizes, you can always rely on assumptions of a bigger type (u128) being available, or simply create a per-thing and use the multiplication implementation provided there.
- key_
types - Re-export this since it’s part of the API of this crate. Known key types; this also functions as a global registry of key types for projects wishing to avoid collisions with each other.
- legacy
- Runtime types that existed in old API versions.
- offchain
- A collection of higher lever helpers for offchain calls.
- proving_
trie - Types for merkle tries compatible with the runtime.
- runtime_
logger - A logger that can be used to log from the runtime.
- testing
- Testing utilities.
- traits
- Primitives for the runtime modules.
- transaction_
validity - Transaction validity interface.
- type_
with_ default - Provides a type that wraps another type and provides a default value.
Macros§
- assert_
eq_ error_ rate - Checks that
$x
is equal to$y
with an error rate of$error
. - assert_
eq_ error_ rate_ float - Same as
assert_eq_error_rate
, but intended to be used with floating point number, or generally those who do not have over/underflow potentials. - bounded_
btree_ map - Re-export bounded_vec and bounded_btree_map macros only when std is enabled. Build a bounded btree-map from the given literals.
- bounded_
vec - Re-export bounded_vec and bounded_btree_map macros only when std is enabled. Build a bounded vec from the given literals.
- count
- Calls a given macro a number of times with a set of fixed params and an incrementing numeral. e.g.
- create_
runtime_ str Deprecated - Deprecated
Cow::Borrowed()
wrapper. - impl_
opaque_ keys - Implement
OpaqueKeys
for a described struct. - impl_
tx_ ext_ default - Helper macro to be used in a
impl TransactionExtension
block to add default implementations ofweight
,validate
,prepare
or any combinations of the them. - morph_
types - Create a
Morph
and/orTryMorph
impls with a simple closure-like expression.
Structs§
- Account
Id32 - Re-export this since it’s part of the API of this crate. An opaque 32-byte cryptographic identifier.
- AnySignature
- Signature verify that can work with any known signature types..
- BoundedB
Tree Map - Re-export this since it’s part of the API of this crate. A bounded map based on a B-Tree.
- BoundedB
Tree Set - Re-export this since it’s part of the API of this crate. A bounded set based on a B-Tree.
- Bounded
Slice - Re-export this since it’s part of the API of this crate. A bounded slice.
- Bounded
Vec - Re-export this since it’s part of the API of this crate. A bounded vector.
- Crypto
Type Id - Re-export this since it’s part of the API of this crate. An identifier for a specific cryptographic algorithm used by a key pair
- Dispatch
Error With Post Info - Result of a
Dispatchable
which contains theDispatchResult
and additional information about theDispatchable
that is only known post dispatch. - Fixed
I64 - Re-export top-level arithmetic stuff. A fixed point number representation in the range. Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]
- Fixed
I128 - Re-export top-level arithmetic stuff. A fixed point number representation in the range. Fixed Point 128 bits signed, range = [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]
- Fixed
U64 - Re-export top-level arithmetic stuff. A fixed point number representation in the range. Fixed Point 64 bits unsigned, range = [0.000000000, 18446744073.709551615]
- Fixed
U128 - Re-export top-level arithmetic stuff. A fixed point number representation in the range. Fixed Point 128 bits unsigned, range = [0.000000000000000000, 340282366920938463463.374607431768211455]
- Justifications
- Collection of justifications for a given block, multiple justifications may be provided by different consensus engines for the same block.
- KeyType
Id - Re-export this since it’s part of the API of this crate. An identifier for a type of cryptographic key.
- Module
Error - Reason why a pallet call failed.
- Opaque
Extrinsic - Simple blob to hold an extrinsic without committing to its format and ensure it is serialized correctly.
- Opaque
Value - Simple blob that hold a value in an encoded form without committing to its type.
- PerU16
- Re-export top-level arithmetic stuff. A fixed point representation of a number in the range [0, 1].
- Perbill
- Re-export top-level arithmetic stuff. A fixed point representation of a number in the range [0, 1].
- Percent
- Re-export top-level arithmetic stuff. A fixed point representation of a number in the range [0, 1].
- Permill
- Re-export top-level arithmetic stuff. A fixed point representation of a number in the range [0, 1].
- Perquintill
- Re-export top-level arithmetic stuff. A fixed point representation of a number in the range [0, 1].
- Rational128
- Re-export top-level arithmetic stuff. A wrapper for any rational number with a 128 bit numerator and denominator.
- Storage
- Struct containing data needed for a storage.
- Storage
Child - Child trie storage data.
- Weak
Bounded Vec - Re-export this since it’s part of the API of this crate. A weakly bounded vector.
- Weight
- Re-export this since it’s part of the API of this crate.
Enums§
- Arithmetic
Error - Re-export top-level arithmetic stuff. Arithmetic errors.
- Dispatch
Error - Reason why a dispatch call failed.
- Either
- The enum
Either
with variantsLeft
andRight
is a general purpose sum type with two cases. - Extrinsic
Inclusion Mode - Confines the kind of extrinsics that can be included in a block.
- Multi
Address - A multi-format address wrapper for on-chain accounts.
- Multi
Signature - Signature verify that can work with any known signature types.
- Multi
Signer - Public key for any known crypto algorithm.
- Rounding
- Re-export top-level arithmetic stuff. The rounding method to use for unsigned quantities.
- State
Version - Different possible state version.
- Token
Error - Description of what went wrong when trying to complete an operation on a token.
- Transaction
Outcome - Describes on what should happen with a storage transaction.
- Transactional
Error - Errors related to transactional storage layers.
Constants§
- MAX_
MODULE_ ERROR_ ENCODED_ SIZE - The number of bytes of the module-specific
error
field defined inModuleError
. In FRAME, this is the maximum encoded size of a pallet error type.
Traits§
- Bound
ToRuntime AppPublic - Something that is bound to a fixed
RuntimeAppPublic
. - Build
Module Genesis Storage Deprecated - Something that can build the genesis storage of a module.
- Build
Storage - Complex storage builder stuff.
- Crypto
Type - Re-export this since it’s part of the API of this crate. Type which has a particular kind of crypto associated with it.
- Deserialize
- A data structure that can be deserialized from any data format supported by Serde.
- Deserialize
Owned - A data structure that can be deserialized without borrowing any data from the deserializer.
- Fixed
Point Number - Re-export top-level arithmetic stuff. Something that implements a decimal fixed point number.
- Fixed
Point Operand - Re-export top-level arithmetic stuff.
Integer types that can be used to interact with
FixedPointNumber
implementations. - PerThing
- Re-export top-level arithmetic stuff.
Something that implements a fixed point ration with an arbitrary granularity
X
, as parts perX
. - Runtime
AppPublic - Runtime interface for an application’s public key.
- Saturated
Conversion - Re-export top-level arithmetic stuff.
Convenience type to work around the highly unergonomic syntax needed
to invoke the functions of overloaded generic traits, in this case
SaturatedFrom
andSaturatedInto
. - Serialize
- A data structure that can be serialized into any data format supported by Serde.
- TypeId
- Re-export this since it’s part of the API of this crate. Provide a simple 4 byte identifier for a type.
Functions§
- Print something that implements
Printable
from the runtime. - str_
array - Utility function to declare string literals backed by an array of length N.
- verify_
encoded_ lazy - Verify a signature on an encoded value in a lazy manner. This can be an optimization if the signature scheme has an “unsigned” escape hash.
Type Aliases§
- Apply
Extrinsic Result - The result of applying of an extrinsic.
- Apply
Extrinsic Result With Info - Same as
ApplyExtrinsicResult
but augmented withPostDispatchInfo
on success. - Consensus
Engine Id - Consensus engine unique ID.
- Dispatch
Outcome - This type specifies the outcome of dispatching a call to a module.
- Dispatch
Result - This is the legacy return type of
Dispatchable
. It is still exposed for compatibility reasons. The new return type isDispatchResultWithInfo
. FRAME runtimes should useframe_support::dispatch::DispatchResult
. - Dispatch
Result With Info - Return type of a
Dispatchable
which contains theDispatchResult
and additional information about theDispatchable
that is only known post dispatch. - Encoded
Justification - The encoded justification specific to a consensus engine.
- InnerOf
- Re-export top-level arithmetic stuff.
Get the inner type of a
PerThing
. - Justification
- An abstraction over justification for a block’s validity under a consensus algorithm.
- Runtime
String Deprecated - Deprecated alias to improve upgrade experience
- TryRuntime
Error - The error type used as return type in try runtime hooks.
- UpperOf
- Re-export top-level arithmetic stuff.
Get the upper type of a
PerThing
.
Derive Macros§
- Deserialize
- Runtime
Debug - Re-export
RuntimeDebug
, to avoid dependency clutter. - Serialize