pub struct RuntimeVersion {
    pub spec_name: Cow<'static, str>,
    pub impl_name: Cow<'static, str>,
    pub authoring_version: u32,
    pub spec_version: u32,
    pub impl_version: u32,
    pub apis: Cow<'static, [([u8; 8], u32)]>,
    pub transaction_version: u32,
    pub system_version: u8,
}Expand description
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 possibly
authoring_version, absolutely not impl_version since they change the semantics of the
runtime.
Fields§
§spec_name: Cow<'static, str>Identifies the different Substrate runtimes. There’ll be at least polkadot and node. A different on-chain spec_name to that of the native runtime would normally result in node not attempting to sync or author blocks.
impl_name: Cow<'static, str>Name of the implementation of the spec. This is of little consequence for the node
and serves only to differentiate code of different implementation teams. For this
codebase, it will be parity-polkadot. If there were a non-Rust implementation of the
Polkadot runtime (e.g. C++), then it would identify itself with an accordingly different
impl_name.
authoring_version is the version of the authorship interface. An authoring node
will not attempt to author blocks unless this is equal to its native runtime.
spec_version: u32Version of the runtime specification.
A full-node will not attempt to use its native runtime in substitute for the on-chain
Wasm runtime unless all of spec_name, spec_version and authoring_version are the same
between Wasm and native.
This number should never decrease.
impl_version: u32Version of the implementation of the specification.
Nodes are free to ignore this; it serves only as an indication that the code is different;
as long as the other two versions are the same then while the actual code may be different,
it is nonetheless required to do the same thing. Non-consensus-breaking optimizations are
about the only changes that could be made which would result in only the impl_version
changing.
This number can be reverted to 0 after a spec_version bump.
apis: Cow<'static, [([u8; 8], u32)]>List of supported API “features” along with their versions.
transaction_version: u32All existing calls (dispatchables) are fully compatible when this number doesn’t change. If
this number changes, then spec_version must change, also.
This number must change when an existing call (pallet index, call index) is changed,
either through an alteration in its user-level semantics, a parameter
added/removed, a parameter type changed, or a call/pallet changing its index. An alteration
of the user level semantics is for example when the call was before transfer and now is
transfer_all, the semantics of the call changed completely.
Removing a pallet or a call doesn’t require a bump as long as no pallet or call is put at the same index. Removing doesn’t require a bump as the chain will reject a transaction referencing this removed call/pallet while decoding and thus, the user isn’t at risk to execute any unknown call. FRAME runtime devs have control over the index of a call/pallet to prevent that an index gets reused.
Adding a new pallet or call also doesn’t require a bump as long as they also don’t reuse any previously used index.
This number should never decrease.
system_version: u8Version of the system implementation used by this runtime. Use of an incorrect version is consensus breaking.
Implementations§
Source§impl RuntimeVersion
 
impl RuntimeVersion
Sourcepub fn decode_with_version_hint<I>(
    input: &mut I,
    core_version: Option<u32>,
) -> Result<RuntimeVersion, Error>where
    I: Input,
 
pub fn decode_with_version_hint<I>(
    input: &mut I,
    core_version: Option<u32>,
) -> Result<RuntimeVersion, Error>where
    I: Input,
Decode while giving a “version hint”
There exists multiple versions of RuntimeVersion and they are versioned using the Core
runtime api:
Coreversion < 3 is a runtime version without a transaction version and state version.Coreversion 3 is a runtime version without a state version.Coreversion 4 is the latest runtime version.
Source§impl RuntimeVersion
 
impl RuntimeVersion
Sourcepub fn can_call_with(&self, other: &RuntimeVersion) -> bool
 
pub fn can_call_with(&self, other: &RuntimeVersion) -> bool
Check if this version matches other version for calling into runtime.
Sourcepub fn has_api_with<P>(&self, id: &[u8; 8], predicate: P) -> bool
 
pub fn has_api_with<P>(&self, id: &[u8; 8], predicate: P) -> bool
Check if the given api with api_id is implemented and the version passes the given
predicate.
Source§impl RuntimeVersion
 
impl RuntimeVersion
Sourcepub fn state_version(&self) -> StateVersion
 
pub fn state_version(&self) -> StateVersion
Returns state version to use for update.
For runtime with core api version less than 4, V0 trie version will be applied to state. Otherwise, V1 trie version will be use.
Sourcepub fn extrinsics_root_state_version(&self) -> StateVersion
 
pub fn extrinsics_root_state_version(&self) -> StateVersion
Returns the state version to use for Extrinsics root.
Trait Implementations§
Source§impl Clone for RuntimeVersion
 
impl Clone for RuntimeVersion
Source§fn clone(&self) -> RuntimeVersion
 
fn clone(&self) -> RuntimeVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeVersion
 
impl Debug for RuntimeVersion
Source§impl Decode for RuntimeVersion
 
impl Decode for RuntimeVersion
Source§fn decode<I>(input: &mut I) -> Result<RuntimeVersion, Error>where
    I: Input,
 
fn decode<I>(input: &mut I) -> Result<RuntimeVersion, Error>where
    I: Input,
Source§fn decode_into<I>(
    input: &mut I,
    dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
    I: Input,
 
fn decode_into<I>(
    input: &mut I,
    dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
    I: Input,
Source§impl Default for RuntimeVersion
 
impl Default for RuntimeVersion
Source§fn default() -> RuntimeVersion
 
fn default() -> RuntimeVersion
Source§impl<'de> Deserialize<'de> for RuntimeVersion
 
impl<'de> Deserialize<'de> for RuntimeVersion
Source§fn deserialize<D>(
    deserializer: D,
) -> Result<RuntimeVersion, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<RuntimeVersion, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Source§impl Display for RuntimeVersion
 
impl Display for RuntimeVersion
Source§impl Encode for RuntimeVersion
 
impl Encode for RuntimeVersion
Source§fn size_hint(&self) -> usize
 
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy>(
    &self,
    __codec_dest_edqy: &mut __CodecOutputEdqy,
)
 
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
 
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
 
fn encoded_size(&self) -> usize
Source§impl PartialEq for RuntimeVersion
 
impl PartialEq for RuntimeVersion
Source§impl Serialize for RuntimeVersion
 
impl Serialize for RuntimeVersion
Source§fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
 
fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
Source§impl TypeInfo for RuntimeVersion
 
impl TypeInfo for RuntimeVersion
impl EncodeLike for RuntimeVersion
impl Eq for RuntimeVersion
impl StructuralPartialEq for RuntimeVersion
Auto Trait Implementations§
impl Freeze for RuntimeVersion
impl RefUnwindSafe for RuntimeVersion
impl Send for RuntimeVersion
impl Sync for RuntimeVersion
impl Unpin for RuntimeVersion
impl UnwindSafe for RuntimeVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
 
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> DecodeLimit for Twhere
    T: Decode,
 
impl<T> DecodeLimit for Twhere
    T: Decode,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
    Dest: FromTuple<Src>,
 
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
    Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
 
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pointable for T
 
impl<T> Pointable for T
Source§impl<T> SaturatedConversion for T
 
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
    Self: UniqueSaturatedFrom<T>,
 
fn saturated_from<T>(t: T) -> Selfwhere
    Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
    Self: UniqueSaturatedInto<T>,
 
fn saturated_into<T>(self) -> Twhere
    Self: UniqueSaturatedInto<T>,
T. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
    T: UncheckedFrom<S>,
 
impl<S, T> UncheckedInto<T> for Swhere
    T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
 
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
 
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
 
fn unique_saturated_into(self) -> T
T.