Struct sc_executor::RuntimeVersion
source · pub struct RuntimeVersion {
pub spec_name: RuntimeString,
pub impl_name: RuntimeString,
pub authoring_version: u32,
pub spec_version: u32,
pub impl_version: u32,
pub apis: Cow<'static, [([u8; 8], u32)]>,
pub transaction_version: u32,
pub state_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: RuntimeString
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: RuntimeString
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: u32
Version 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.
impl_version: u32
Version 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.
apis: Cow<'static, [([u8; 8], u32)]>
List of supported API “features” along with their versions.
transaction_version: u32
All existing dispatches 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 dispatchable (module ID, dispatch ID) is changed, either through an alteration in its user-level semantics, a parameter added/removed/changed, a dispatchable being removed, a module being removed, or a dispatchable/module changing its index.
It need not change when a new module is added or when a dispatchable is added.
state_version: u8
Version of the state 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:
Core
version < 3 is a runtime version without a transaction version and state version.Core
version 3 is a runtime version without a state version.Core
version 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. Otherwhise, V1 trie version will be use.
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§fn eq(&self, other: &RuntimeVersion) -> bool
fn eq(&self, other: &RuntimeVersion) -> bool
self
and other
values to be equal, and is used
by ==
.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 StructuralEq for RuntimeVersion
impl StructuralPartialEq for RuntimeVersion
Auto Trait Implementations§
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
§impl<T> Clear for T
impl<T> Clear for T
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.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§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
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.