pub struct LeafShardHeader<'a> {
pub shared: SharedBlockHeader<'a>,
pub beacon_chain_info: &'a BlockHeaderBeaconChainInfo,
pub pre_seal_bytes: &'a [u8],
}
Expand description
Block header that corresponds to a leaf shard
Fields§
Shared block header
beacon_chain_info: &'a BlockHeaderBeaconChainInfo
Beacon chain info
pre_seal_bytes: &'a [u8]
All bytes of the header except the seal
Implementations§
Source§impl<'a> LeafShardHeader<'a>
impl<'a> LeafShardHeader<'a>
Sourcepub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
Try to create a new instance from provided bytes.
bytes
should be 8-bytes aligned.
Returns an instance and remaining bytes on success, None
if too few bytes were given,
bytes are not properly aligned or input is otherwise invalid.
Sourcepub fn is_internally_consistent(&self) -> bool
pub fn is_internally_consistent(&self) -> bool
Check block header’s internal consistency
Sourcepub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
The same as Self::try_from_bytes()
, but for trusted input that skips some consistency
checks
Sourcepub fn to_owned(self) -> OwnedLeafShardHeader
pub fn to_owned(self) -> OwnedLeafShardHeader
Create an owned version of this header
Sourcepub fn pre_seal_hash(&self) -> Blake3Hash
pub fn pre_seal_hash(&self) -> Blake3Hash
Hash of the block before seal is applied to it
Sourcepub fn is_seal_valid(&self) -> bool
pub fn is_seal_valid(&self) -> bool
Verify seal against LeafShardHeader::pre_seal_hash()
Sourcepub fn root(&self) -> BlockRoot
pub fn root(&self) -> BlockRoot
Compute block root out of this header.
Block root is a Merkle Tree Root. The leaves are derived from individual fields in
SharedBlockHeader
and other fields of this enum in the declaration order.
Note that this method does a bunch of hashing and if hash is needed often, should be cached.
Trait Implementations§
Source§impl<'a> Clone for LeafShardHeader<'a>
impl<'a> Clone for LeafShardHeader<'a>
Source§fn clone(&self) -> LeafShardHeader<'a>
fn clone(&self) -> LeafShardHeader<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for LeafShardHeader<'a>
impl<'a> Debug for LeafShardHeader<'a>
Source§impl<'a> Deref for LeafShardHeader<'a>
impl<'a> Deref for LeafShardHeader<'a>
Source§impl<'a> From<LeafShardHeader<'a>> for BlockHeader<'a>
impl<'a> From<LeafShardHeader<'a>> for BlockHeader<'a>
Source§fn from(value: LeafShardHeader<'a>) -> Self
fn from(value: LeafShardHeader<'a>) -> Self
Source§impl<'a> GenericBlockHeader<'a> for LeafShardHeader<'a>
impl<'a> GenericBlockHeader<'a> for LeafShardHeader<'a>
impl<'a> Copy for LeafShardHeader<'a>
Auto Trait Implementations§
impl<'a> Freeze for LeafShardHeader<'a>
impl<'a> RefUnwindSafe for LeafShardHeader<'a>
impl<'a> Send for LeafShardHeader<'a>
impl<'a> Sync for LeafShardHeader<'a>
impl<'a> Unpin for LeafShardHeader<'a>
impl<'a> UnwindSafe for LeafShardHeader<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more