Type Alias moonbeam_runtime::DigestItem
source · pub type DigestItem = DigestItem;
Expand description
Digest item type.
Aliased Type§
enum DigestItem {
PreRuntime([u8; 4], Vec<u8>),
Consensus([u8; 4], Vec<u8>),
Seal([u8; 4], Vec<u8>),
Other(Vec<u8>),
RuntimeEnvironmentUpdated,
}
Variants§
PreRuntime([u8; 4], 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([u8; 4], 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([u8; 4], 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
§impl DigestItem
impl DigestItem
pub fn dref(&self) -> DigestItemRef<'_>
pub fn dref(&self) -> DigestItemRef<'_>
Returns a ‘referencing view’ for this digest item.
pub fn as_pre_runtime(&self) -> Option<([u8; 4], &[u8])>
pub fn as_pre_runtime(&self) -> Option<([u8; 4], &[u8])>
Returns Some
if this entry is the PreRuntime
entry.
pub fn as_consensus(&self) -> Option<([u8; 4], &[u8])>
pub fn as_consensus(&self) -> Option<([u8; 4], &[u8])>
Returns Some
if this entry is the Consensus
entry.
pub 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.
pub fn try_to<T>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>where
T: Decode,
pub fn try_to<T>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>where
T: Decode,
Returns the data contained in the item if Some
if this entry has the id given, decoded
to the type provided T
.
pub fn seal_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
pub fn seal_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
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.
pub fn consensus_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
pub fn consensus_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
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.
pub fn pre_runtime_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
pub fn pre_runtime_try_to<T>(&self, id: &[u8; 4]) -> Option<T>where
T: Decode,
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
§impl CheckEqual for DigestItem
impl CheckEqual for DigestItem
§fn check_equal(&self, other: &DigestItem)
fn check_equal(&self, other: &DigestItem)
§impl<Signature> CompatibleDigestItem<Signature> for DigestItemwhere
Signature: Codec,
impl<Signature> CompatibleDigestItem<Signature> for DigestItemwhere
Signature: Codec,
§fn aura_seal(signature: Signature) -> DigestItem
fn aura_seal(signature: Signature) -> DigestItem
§fn as_aura_seal(&self) -> Option<Signature>
fn as_aura_seal(&self) -> Option<Signature>
§fn aura_pre_digest(slot: Slot) -> DigestItem
fn aura_pre_digest(slot: Slot) -> DigestItem
§fn as_aura_pre_digest(&self) -> Option<Slot>
fn as_aura_pre_digest(&self) -> Option<Slot>
§impl CompatibleDigestItem for DigestItem
impl CompatibleDigestItem for DigestItem
§fn babe_pre_digest(digest: PreDigest) -> DigestItem
fn babe_pre_digest(digest: PreDigest) -> DigestItem
§fn as_babe_pre_digest(&self) -> Option<PreDigest>
fn as_babe_pre_digest(&self) -> Option<PreDigest>
§fn babe_seal(signature: Signature) -> DigestItem
fn babe_seal(signature: Signature) -> DigestItem
§fn as_babe_seal(&self) -> Option<Signature>
fn as_babe_seal(&self) -> Option<Signature>
§fn as_next_epoch_descriptor(&self) -> Option<NextEpochDescriptor>
fn as_next_epoch_descriptor(&self) -> Option<NextEpochDescriptor>
§fn as_next_config_descriptor(&self) -> Option<NextConfigDescriptor>
fn as_next_config_descriptor(&self) -> Option<NextConfigDescriptor>
§impl CompatibleDigestItem for DigestItem
impl CompatibleDigestItem for DigestItem
§fn nimbus_pre_digest(author: Public) -> DigestItem
fn nimbus_pre_digest(author: Public) -> DigestItem
§fn as_nimbus_pre_digest(&self) -> Option<Public>
fn as_nimbus_pre_digest(&self) -> Option<Public>
§fn nimbus_seal(signature: Signature) -> DigestItem
fn nimbus_seal(signature: Signature) -> DigestItem
§fn as_nimbus_seal(&self) -> Option<Signature>
fn as_nimbus_seal(&self) -> Option<Signature>
§fn nimbus_consensus_digest(author: Public) -> DigestItem
fn nimbus_consensus_digest(author: Public) -> DigestItem
§fn as_nimbus_consensus_digest(&self) -> Option<Public>
fn as_nimbus_consensus_digest(&self) -> Option<Public>
§impl CompatibleDigestItem for DigestItem
impl CompatibleDigestItem for DigestItem
§fn vrf_pre_digest(digest: PreDigest) -> DigestItem
fn vrf_pre_digest(digest: PreDigest) -> DigestItem
§fn as_vrf_pre_digest(&self) -> Option<PreDigest>
fn as_vrf_pre_digest(&self) -> Option<PreDigest>
§fn as_vrf_seal(&self) -> Option<Signature>
fn as_vrf_seal(&self) -> Option<Signature>
§impl Decode for DigestItem
impl Decode for DigestItem
§fn decode<I>(input: &mut I) -> Result<DigestItem, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<DigestItem, Error>where
I: Input,
§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>
§impl<'a> Deserialize<'a> for DigestItem
impl<'a> Deserialize<'a> for DigestItem
§fn deserialize<D>(de: D) -> Result<DigestItem, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(de: D) -> Result<DigestItem, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
§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) -> R
fn using_encoded<R, F>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
§impl From<CustomDigestItem> for DigestItem
impl From<CustomDigestItem> for DigestItem
Convert custom application digest item into a concrete digest item