Expand description
Substrate runtime version
Each runtime that should be executed by a Substrate based node needs to have a runtime version.
The runtime version is defined by RuntimeVersion
. The runtime version is used to
distinguish different runtimes. The most important field is the
spec_version
. The spec_version
should be increased in a
runtime when a new runtime build includes breaking changes that would make other runtimes unable
to import blocks built by this runtime or vice-versa, where the new runtime could not import
blocks built by the old runtime. The runtime version also carries other version information
about the runtime, see RuntimeVersion
for more information on this.
Substrate will fetch the runtime version from a wasm
blob by first checking the
runtime_version
link section or calling the Core::version
runtime api. The link section can
be generated in the runtime using the runtime_version
attribute. The Core
runtime api also
needs to be implemented for the runtime using impl_runtime_apis!
.
Modules§
- embed
- Provides functionality to embed a
RuntimeVersion
as custom section into a WASM file.
Macros§
- create_
apis_ vec - Create a vector of Api declarations.
- create_
runtime_ str Deprecated - Deprecated
Cow::Borrowed()
wrapper.
Structs§
- Native
Version - The version of the native runtime.
- Runtime
Version - 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_version
and possiblyauthoring_version
, absolutely notimpl_version
since they change the semantics of the runtime.
Enums§
- State
Version - Different possible state version.
Traits§
- GetNative
Version - Returns the version of the native runtime.
- GetRuntime
Version At - Something that can provide the runtime version at a given block.
Functions§
- core_
version_ from_ apis - Returns the version of the
Core
runtime api.
Type Aliases§
- ApiId
- The identity of a particular API interface that the runtime might provide.
- ApisVec
- A vector of pairs of
ApiId
and au32
for version.
Attribute Macros§
- runtime_
version - An attribute that accepts a version declaration of a runtime and generates a custom wasm section with the equivalent contents.