31 releases (17 major breaking)

new 20.0.0 Mar 26, 2023
19.0.0 Mar 5, 2023
18.0.0 Feb 26, 2023
17.0.0 Feb 19, 2023
2.0.0-alpha.5 Mar 24, 2020

#1145 in Magic Beans

Download history 2276/week @ 2022-12-09 2099/week @ 2022-12-16 1453/week @ 2022-12-23 554/week @ 2022-12-30 1324/week @ 2023-01-06 1080/week @ 2023-01-13 2347/week @ 2023-01-20 1692/week @ 2023-01-27 2065/week @ 2023-02-03 1034/week @ 2023-02-10 2472/week @ 2023-02-17 4412/week @ 2023-02-24 2184/week @ 2023-03-03 1137/week @ 2023-03-10 1287/week @ 2023-03-17 1254/week @ 2023-03-24

5,977 downloads per month
Used in 295 crates (15 directly)

Apache-2.0

280KB
5.5K SLoC

Version module for the Substrate runtime; Provides a function that returns the runtime version.

License: Apache-2.0


lib.rs:

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!.

Dependencies

~6–41MB
~702K SLoC