Skip to main content

UnvalidatedBlockHeader

Struct UnvalidatedBlockHeader 

Source
pub struct UnvalidatedBlockHeader<'a> {
Show 22 fields pub field_set: HeaderFieldSet, pub parent_hash: B256, pub ommers_hash: B256, pub beneficiary: Address, pub state_root: B256, pub transactions_root: B256, pub receipts_root: B256, pub logs_bloom: LogsBloom, pub difficulty: [u8; 32], pub number: BlockNumber, pub gas_limit: Gas, pub gas_used: Gas, pub timestamp: UnixTimestamp, pub extra_data: &'a [u8], pub mix_hash: B256, pub nonce: [u8; 8], pub base_fee_per_gas: Option<Wei>, pub withdrawals_root: Option<B256>, pub blob_gas_used: Option<Gas>, pub excess_blob_gas: Option<Gas>, pub parent_beacon_block_root: Option<B256>, pub requests_hash: Option<B256>, /* private fields */
}
Expand description

Borrowed execution-layer header decoded only into field domains.

This type is intentionally unvalidated. It does not prove ancestry, ommers hash, state root, transaction root, receipt root, bloom correctness, gas accounting, base-fee calculation, withdrawals root, blob-gas accounting, parent beacon root, requests hash, proof roots, or fork activation. The extra_data field is also not checked against any network’s consensus-specific byte limit.

Fields§

§field_set: HeaderFieldSet

Field layout used to decode the header.

§parent_hash: B256

Parent block hash.

§ommers_hash: B256

Ommers/uncles hash.

§beneficiary: Address

Block beneficiary/coinbase.

§state_root: B256

Post-state root.

§transactions_root: B256

Transactions trie root.

§receipts_root: B256

Receipts trie root.

§logs_bloom: LogsBloom

Logs bloom filter.

§difficulty: [u8; 32]

Raw canonical U256 difficulty field.

§number: BlockNumber

Block number.

§gas_limit: Gas

Gas limit.

§gas_used: Gas

Gas used.

§timestamp: UnixTimestamp

Header timestamp.

§extra_data: &'a [u8]

Borrowed extra data.

This is not checked against the network’s consensus limit, such as the 32-byte mainnet cap. Callers must validate that limit for their chain.

§mix_hash: B256

Mix hash or post-merge prev_randao.

§nonce: [u8; 8]

Header nonce bytes.

§base_fee_per_gas: Option<Wei>

London base fee per gas.

§withdrawals_root: Option<B256>

Shanghai withdrawals root.

§blob_gas_used: Option<Gas>

Cancun blob gas used.

§excess_blob_gas: Option<Gas>

Cancun excess blob gas.

§parent_beacon_block_root: Option<B256>

Cancun parent beacon block root.

§requests_hash: Option<B256>

Prague requests hash.

Implementations§

Source§

impl UnvalidatedBlockHeader<'_>

Source

pub const fn encoded_rlp(&self) -> &[u8]

Returns the exact canonical RLP bytes that were decoded.

Source

pub fn hash_with<H>(&self, hasher: H) -> BlockHash
where H: Keccak256,

Hashes the exact canonical header RLP with the caller-provided Keccak implementation and returns a block-hash domain value.

Trait Implementations§

Source§

impl<'a> Clone for UnvalidatedBlockHeader<'a>

Source§

fn clone(&self) -> UnvalidatedBlockHeader<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for UnvalidatedBlockHeader<'a>

Source§

impl<'a> Debug for UnvalidatedBlockHeader<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for UnvalidatedBlockHeader<'a>

Source§

impl<'a> PartialEq for UnvalidatedBlockHeader<'a>

Source§

fn eq(&self, other: &UnvalidatedBlockHeader<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for UnvalidatedBlockHeader<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.