Enum sp_runtime::generic::DigestItem
source · pub enum DigestItem {
PreRuntime(ConsensusEngineId, Vec<u8>),
Consensus(ConsensusEngineId, Vec<u8>),
Seal(ConsensusEngineId, Vec<u8>),
Other(Vec<u8>),
RuntimeEnvironmentUpdated,
}
Expand description
Digest item that is able to encode/decode ‘system’ digest items and provide opaque access to other items.
Variants§
PreRuntime(ConsensusEngineId, Vec<u8>)
A pre-runtime digest.
These are messages from the consensus engine to the runtime, although the consensus engine can (and should) read them itself to avoid code and state duplication. It is erroneous for a runtime to produce these, but this is not (yet) checked.
NOTE: the runtime is not allowed to panic or fail in an on_initialize
call if an expected PreRuntime
digest is not present. It is the
responsibility of a external block verifier to check this. Runtime API calls
will initialize the block without pre-runtime digests, so initialization
cannot fail when they are missing.
Consensus(ConsensusEngineId, Vec<u8>)
A message from the runtime to the consensus engine. This should never be generated by the native code of any consensus engine, but this is not checked (yet).
Seal(ConsensusEngineId, Vec<u8>)
Put a Seal on it. This is only used by native code, and is never seen by runtimes.
Other(Vec<u8>)
Some other thing. Unsupported and experimental.
RuntimeEnvironmentUpdated
An indication for the light clients that the runtime execution environment is updated.
Currently this is triggered when:
- Runtime code blob is changed or
heap_pages
value is changed.
Implementations§
source§impl DigestItem
impl DigestItem
sourcepub fn dref(&self) -> DigestItemRef<'_>
pub fn dref(&self) -> DigestItemRef<'_>
Returns a ‘referencing view’ for this digest item.
sourcepub fn as_pre_runtime(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_pre_runtime(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the PreRuntime
entry.
sourcepub fn as_consensus(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_consensus(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the Consensus
entry.
sourcepub fn as_seal(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_seal(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the Seal
entry.
sourcepub fn try_as_raw(&self, id: OpaqueDigestItemId<'_>) -> Option<&[u8]>
pub fn try_as_raw(&self, id: OpaqueDigestItemId<'_>) -> Option<&[u8]>
Returns the opaque data contained in the item if Some
if this entry has the id given.
sourcepub fn try_to<T: Decode>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>
pub fn try_to<T: Decode>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>
Returns the data contained in the item if Some
if this entry has the id given, decoded
to the type provided T
.
sourcepub fn seal_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
pub fn seal_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
Try to match this to a Self::Seal
, check id
matches and decode it.
Returns None
if this isn’t a seal item, the id
doesn’t match or when the decoding fails.
sourcepub fn consensus_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
pub fn consensus_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
Try to match this to a Self::Consensus
, check id
matches and decode it.
Returns None
if this isn’t a consensus item, the id
doesn’t match or
when the decoding fails.
sourcepub fn pre_runtime_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
pub fn pre_runtime_try_to<T: Decode>(&self, id: &ConsensusEngineId) -> Option<T>
Try to match this to a Self::PreRuntime
, check id
matches and decode it.
Returns None
if this isn’t a pre-runtime item, the id
doesn’t match or
when the decoding fails.
Trait Implementations§
source§impl CheckEqual for DigestItem
impl CheckEqual for DigestItem
source§fn check_equal(&self, other: &Self)
fn check_equal(&self, other: &Self)
source§impl Clone for DigestItem
impl Clone for DigestItem
source§fn clone(&self) -> DigestItem
fn clone(&self) -> DigestItem
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DigestItem
impl Debug for DigestItem
source§impl Decode for DigestItem
impl Decode for DigestItem
source§fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
§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,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
source§impl<'a> Deserialize<'a> for DigestItem
impl<'a> Deserialize<'a> for DigestItem
source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where D: Deserializer<'a>,
source§impl Encode for DigestItem
impl Encode for DigestItem
§fn encode_to<T>(&self, dest: &mut T)where
T: Output + ?Sized,
fn encode_to<T>(&self, dest: &mut T)where T: Output + ?Sized,
§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl PartialEq<DigestItem> for DigestItem
impl PartialEq<DigestItem> for DigestItem
source§fn eq(&self, other: &DigestItem) -> bool
fn eq(&self, other: &DigestItem) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DigestItem
impl Serialize for DigestItem
source§impl TypeInfo for DigestItem
impl TypeInfo for DigestItem
impl EncodeLike<DigestItem> for DigestItem
impl Eq for DigestItem
impl StructuralEq for DigestItem
impl StructuralPartialEq for DigestItem
Auto Trait Implementations§
impl RefUnwindSafe for DigestItem
impl Send for DigestItem
impl Sync for DigestItem
impl Unpin for DigestItem
impl UnwindSafe for DigestItem
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere T: Decode,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§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 Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere T: Codec,
§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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.