Expand description
Types and traits for runtimes that implement runtime APIs.
A testing runtime should not need this.
A non-testing runtime should have this enabled, as such:
use frame::runtime::{prelude::*, apis::{*,}};Re-exports
pub use sp_api;
Modules
- Aura (Authority-Round) digests
Macros
- Enable/disable the given code depending on
not(feature = "std")being enabled for the crate or not. - Enable/disable the given code depending on
feature = "std"being enabled for the crate or not. - Create a vector of Api declarations.
- Enable/disable the given code depending on
not(feature = "std")being enabled for the crate or not. - Enable/disable the given code depending on
feature = "std"being enabled for the crate or not. - Creates a
Veccontaining the arguments.
Structs
- Auxiliary wrapper that holds an api instance and binds it to the given lifetime.
- Parameters for
CallApiAt::call_api_at. - The result of checking inherents.
- Proof of voter misbehavior on a given set id. Misbehavior/equivocation in GRANDPA happens when a voter votes on the same round (either at prevote or precommit stage) for different blocks. Proving is achieved by collecting the signed messages of conflicting votes.
- Stores extensions that should be made available through the externalities.
- A GRANDPA justification for block finality, it includes a commit message and an ancestry proof including all headers routing all precommit target blocks to the commit target block. Due to the current voting strategy the precommit targets should be the same as the commit target, since honest voters don’t vote past authority set change blocks.
- Inherent data to include in a block.
- An identifier for a type of cryptographic key.
- An opaque type used to represent the key ownership proof at the runtime API boundary. The inner value is an encoded representation of the actual key ownership proof which will be parameterized when defining the runtime. At the runtime API boundary this type is unknown and as such we keep this opaque representation, implementors of the runtime API will have to make sure that all usages of
OpaqueKeyOwnershipProofrefer to the same type. - Stores the encoded
RuntimeMetadatafor the native side as opaque type. - The set of changes that are overlaid onto the backend.
- Runtime version. This should not be thought of as classic Semver (major/minor/tiny). This triplet have different semantics and mis-interpretation could cause problems. In particular: bug fixes should result in an increment of
spec_versionand possiblyauthoring_version, absolutely notimpl_versionsince they change the semantics of the runtime. - A scheduled change of authority set.
- Unit type wrapper that represents a slot.
- A slot duration defined in milliseconds.
- A proof that some set of key-value pairs are included in the storage trie. The proof contains the storage values so that the partial storage backend can be reconstructed by a verifier that does not already have access to the key-value pairs.
- Patricia trie-based backend. Transaction type is an overlay of changes to commit.
- Builder for creating a
TrieBackend. - An AuthorityList that is encoded with a version specifier. The encoding version is updated any time the AuthorityList type changes. This ensures that encodings of different versions of an AuthorityList are differentiable. Attempting to decode an authority list with an unknown version will fail.
Enums
- An error describing which API call failed.
- Something to identify a block.
- The context in which a call is done.
- Wrapper object for GRANDPA equivocation proofs, useful for unifying prevote and precommit equivocations under a common type.
- A string that wraps a
&'static strin the runtime andString/Vec<u8>on decode. - Different possible state version.
- Describes on what should happen with a storage transaction.
Constants
- The
ConsensusEngineIdof AuRa. - WASM function call to get current GRANDPA authorities.
- The log target to be used by client code.
- The storage key for the current set of weighted Grandpa authorities. The value stored is an encoded VersionedAuthorityList.
- The
ConsensusEngineIdof GRANDPA. - Key type for GRANDPA module.
- Maximum nesting level for extrinsics.
- WASM function call to check for pending changes.
- The number of bytes required to encode a
RuntimeApiInfo. - The log target to be used by runtime code.
- Persistent storage prefix used by the Offchain Worker API when creating a DB key.
Traits
- The API to query account nonce.
- Extends the runtime api implementation with some common functionality.
- Something that can be converted into a
TrieBackend. - API necessary for block authorship with aura.
- The
BlockBuilderapi trait that provides the required functionality for building a block. - Something which fulfills the abstract idea of a Substrate block. It has types for
Extrinsicpieces of information as well as aHeader. - Something that can call into the an api at a given block.
- Something that can be constructed to a runtime api.
- The
Coreruntime api that every Substrate runtime needs to implement. - Trait that allows zero-copy read of value-references from slices in LE format.
- Extension trait to
Decodefor decoding with a maximum recursion depth. - Trait that allows zero-copy write of value-references to slices in LE format.
- Marker trait for types that should be registered as
Externalitiesextension. - APIs for integrating the GRANDPA finality gadget into runtimes. This should be implemented on the runtime side.
- Abstraction around hashing
- Trait describing an object that can hash a slice of bytes. Used to abstract other types over the hashing algorithm. Defines a single
hashmethod and anOutassociated type with the necessary bounds. - Something which fulfills the abstract idea of a Substrate header. It has types for a
Number, aHashand aHashing. It provides access to anextrinsics_root,state_rootandparent_hash, as well as adigestand a blocknumber. - The
Metadataapi trait that returns metadata for the runtime. - The offchain worker api.
- Something that provides a runtime api.
- Something that provides information about a runtime api.
- Session keys runtime api.
- A state backend is used to read state data and can have changes committed to it.
- The
TaggedTransactionQueueapi trait for interfering with the transaction queue.
Functions
- Verifies the equivocation proof by making sure that both votes target different blocks and that its signatures are valid.
- Check a message signature by encoding the message as a localized payload and verifying the provided signature using the expected authority id.
- Check a message signature by encoding the message as a localized payload and verifying the provided signature using the expected authority id. The encoding necessary to verify the signature will be done using the given buffer, the original content of the buffer will be cleared.
- Deserialize the runtime API info serialized by
serialize_runtime_api_info. - Init the
RuntimeLogger. - Encode round message localized to a given round and set id.
- Encode round message localized to a given round and set id using the given buffer. The given buffer will be cleared and the resulting encoded payload will always be written to the start of the buffer.
- Crude and simple way to serialize the
RuntimeApiInfointo a bunch of bytes. - Localizes the message to the given set and round and signs the payload.
Type Definitions
- The identity of a particular API interface that the runtime might provide.
- A vector of pairs of
ApiIdand au32for version. - The result of applying of an extrinsic.
- Identity of a Grandpa authority.
- A list of Grandpa authorities with associated weights.
- The grandpa crypto scheme defined via the keypair type.
- Signature for a Grandpa authority.
- The weight of an authority.
- A catch up message for this chain’s block type.
- A commit message for this chain’s block type.
- A compact commit message for this chain’s block type.
- Extract the hashing type for a block.
- Trie backend with in-memory storage.
- A GRANDPA message for a substrate chain.
- Extract the number type for a block.
- A precommit message for this chain’s block type.
- A prevote message for this chain’s block type.
- A primary propose message for this chain’s block type.
- A type that records all accessed trie nodes and generates a proof out of it.
- The round indicator.
- The monotonic identifier of a GRANDPA set of authorities.
- A signed message.
- Information on a transaction’s validity and, if valid, on how it relates to other transactions.
Derive Macros
- Derive
parity_scale_codec::Decodeand for struct and enum. - Derive
parity_scale_codec::Encodeandparity_scale_codec::EncodeLikefor struct and enum.