#run-time #version #substrate #polkadot #module #api #runtime-version

no-std sp-version

Version module for the Substrate runtime; Provides a function that returns the runtime version. (polkadot v1.9.0)

50 releases (30 major breaking)

32.0.0 Mar 18, 2024
31.0.0 Feb 26, 2024
30.0.0 Feb 13, 2024
29.0.0 Jan 23, 2024
2.0.0-alpha.5 Mar 24, 2020

#1037 in Magic Beans

Download history 3584/week @ 2023-12-07 3066/week @ 2023-12-14 2010/week @ 2023-12-21 1839/week @ 2023-12-28 3964/week @ 2024-01-04 4418/week @ 2024-01-11 4138/week @ 2024-01-18 2732/week @ 2024-01-25 2353/week @ 2024-02-01 4582/week @ 2024-02-08 4387/week @ 2024-02-15 5430/week @ 2024-02-22 4078/week @ 2024-02-29 4284/week @ 2024-03-07 4690/week @ 2024-03-14 4848/week @ 2024-03-21

18,715 downloads per month
Used in 576 crates (50 directly)

Apache-2.0

305KB
6K 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

~16–34MB
~561K SLoC