Trait AlloyBlockHeader
pub trait AlloyBlockHeader {
Show 32 methods
// Required methods
fn parent_hash(&self) -> FixedBytes<32>;
fn ommers_hash(&self) -> FixedBytes<32>;
fn beneficiary(&self) -> Address;
fn state_root(&self) -> FixedBytes<32>;
fn transactions_root(&self) -> FixedBytes<32>;
fn receipts_root(&self) -> FixedBytes<32>;
fn withdrawals_root(&self) -> Option<FixedBytes<32>>;
fn logs_bloom(&self) -> Bloom;
fn difficulty(&self) -> Uint<256, 4>;
fn number(&self) -> u64;
fn gas_limit(&self) -> u64;
fn gas_used(&self) -> u64;
fn timestamp(&self) -> u64;
fn mix_hash(&self) -> Option<FixedBytes<32>>;
fn nonce(&self) -> Option<FixedBytes<8>>;
fn base_fee_per_gas(&self) -> Option<u64>;
fn blob_gas_used(&self) -> Option<u64>;
fn excess_blob_gas(&self) -> Option<u64>;
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>;
fn requests_hash(&self) -> Option<FixedBytes<32>>;
fn extra_data(&self) -> &Bytes;
// Provided methods
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128> { ... }
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64> { ... }
fn maybe_next_block_excess_blob_gas(
&self,
blob_params: Option<BlobParams>,
) -> Option<u64> { ... }
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128> { ... }
fn maybe_next_block_blob_fee(
&self,
blob_params: Option<BlobParams>,
) -> Option<u128> { ... }
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64> { ... }
fn parent_num_hash(&self) -> NumHash { ... }
fn is_empty(&self) -> bool { ... }
fn is_zero_difficulty(&self) -> bool { ... }
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool { ... }
fn is_nonce_zero(&self) -> bool { ... }
}
Expand description
Trait for extracting specific Ethereum block data from a header
Required Methods§
fn parent_hash(&self) -> FixedBytes<32>
fn parent_hash(&self) -> FixedBytes<32>
Retrieves the parent hash of the block
fn ommers_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
Retrieves the ommers hash of the block
fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
Retrieves the beneficiary (miner) of the block
fn state_root(&self) -> FixedBytes<32>
fn state_root(&self) -> FixedBytes<32>
Retrieves the state root hash of the block
fn transactions_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
Retrieves the transactions root hash of the block
fn receipts_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
Retrieves the receipts root hash of the block
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
Retrieves the withdrawals root hash of the block, if available
fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
Retrieves the logs bloom filter of the block
fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
Retrieves the difficulty of the block
fn mix_hash(&self) -> Option<FixedBytes<32>>
fn mix_hash(&self) -> Option<FixedBytes<32>>
Retrieves the mix hash of the block, if available
fn nonce(&self) -> Option<FixedBytes<8>>
fn nonce(&self) -> Option<FixedBytes<8>>
Retrieves the nonce of the block, if avaialble
fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
Retrieves the base fee per gas of the block, if available
fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
Retrieves the blob gas used by the block, if available
fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
Retrieves the excess blob gas of the block, if available
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
Retrieves the parent beacon block root of the block, if available
fn requests_hash(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
Retrieves the requests hash of the block, if available
fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
Retrieves the block’s extra data field
Provided Methods§
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Returns the blob fee for this block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
Calculate excess blob gas for the next block according to the EIP-4844 spec.
Returns a None
if no excess blob gas is set, no EIP-4844 support
fn maybe_next_block_excess_blob_gas(
&self,
blob_params: Option<BlobParams>,
) -> Option<u64>
fn maybe_next_block_excess_blob_gas( &self, blob_params: Option<BlobParams>, ) -> Option<u64>
Convenience function for Self::next_block_excess_blob_gas
with an optional
[BlobParams
] argument.
Returns None
if the blob_params
are None
.
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Returns the blob fee for the next block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None.
fn maybe_next_block_blob_fee(
&self,
blob_params: Option<BlobParams>,
) -> Option<u128>
fn maybe_next_block_blob_fee( &self, blob_params: Option<BlobParams>, ) -> Option<u128>
Convenience function for Self::next_block_blob_fee
with an optional [BlobParams
]
argument.
Returns None
if the blob_params
are None
.
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
Calculate base fee for next block according to the EIP-1559 spec.
Returns a None
if no base fee is set, no EIP-1559 support
fn parent_num_hash(&self) -> NumHash
fn parent_num_hash(&self) -> NumHash
Returns the parent block’s number and hash
Note: for the genesis block the parent number is 0 and the parent hash is the zero hash.
fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Checks if the header is considered empty - has no transactions, no ommers or withdrawals
fn is_zero_difficulty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
Checks if the block’s difficulty is set to zero, indicating a Proof-of-Stake header.
This function is linked to EIP-3675, proposing the consensus upgrade to Proof-of-Stake: EIP-3675
Verifies whether, as per the EIP, the block’s difficulty is updated to zero, signifying the transition to a Proof-of-Stake mechanism.
Returns true
if the block’s difficulty matches the constant zero set by the EIP.
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
Checks if the block’s timestamp is in the future based on the present timestamp.
Clock can drift but this can be consensus issue.
Note: This check is relevant only pre-merge.
fn is_nonce_zero(&self) -> bool
fn is_nonce_zero(&self) -> bool
Checks if the nonce exists, and if it exists, if it’s zero.
If the nonce is None
, then this returns false
.
Implementations on Foreign Types§
§impl BlockHeader for AnyHeader
impl BlockHeader for AnyHeader
fn parent_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
fn beneficiary(&self) -> Address
fn state_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn logs_bloom(&self) -> Bloom
fn difficulty(&self) -> Uint<256, 4>
fn number(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_used(&self) -> u64
fn timestamp(&self) -> u64
fn mix_hash(&self) -> Option<FixedBytes<32>>
fn nonce(&self) -> Option<FixedBytes<8>>
fn base_fee_per_gas(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
fn extra_data(&self) -> &Bytes
§impl<'a, T> BlockHeader for &'a Twhere
T: 'a + BlockHeader + ?Sized,
impl<'a, T> BlockHeader for &'a Twhere
T: 'a + BlockHeader + ?Sized,
fn parent_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
fn beneficiary(&self) -> Address
fn state_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn logs_bloom(&self) -> Bloom
fn difficulty(&self) -> Uint<256, 4>
fn number(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_used(&self) -> u64
fn timestamp(&self) -> u64
fn mix_hash(&self) -> Option<FixedBytes<32>>
fn nonce(&self) -> Option<FixedBytes<8>>
fn base_fee_per_gas(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
fn extra_data(&self) -> &Bytes
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn maybe_next_block_excess_blob_gas( &self, blob_params: Option<BlobParams>, ) -> Option<u64>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn maybe_next_block_blob_fee( &self, blob_params: Option<BlobParams>, ) -> Option<u128>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn parent_num_hash(&self) -> NumHash
fn is_empty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn is_nonce_zero(&self) -> bool
§impl<T> BlockHeader for Arc<T>where
T: BlockHeader + ?Sized,
impl<T> BlockHeader for Arc<T>where
T: BlockHeader + ?Sized,
fn parent_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
fn beneficiary(&self) -> Address
fn state_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn logs_bloom(&self) -> Bloom
fn difficulty(&self) -> Uint<256, 4>
fn number(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_used(&self) -> u64
fn timestamp(&self) -> u64
fn mix_hash(&self) -> Option<FixedBytes<32>>
fn nonce(&self) -> Option<FixedBytes<8>>
fn base_fee_per_gas(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
fn extra_data(&self) -> &Bytes
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn maybe_next_block_excess_blob_gas( &self, blob_params: Option<BlobParams>, ) -> Option<u64>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn maybe_next_block_blob_fee( &self, blob_params: Option<BlobParams>, ) -> Option<u128>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn parent_num_hash(&self) -> NumHash
fn is_empty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn is_nonce_zero(&self) -> bool
Implementors§
impl BlockHeader for reth::primitives::Header
impl<B> BlockHeader for RecoveredBlock<B>where
B: Block,
impl<H> BlockHeader for reth::rpc::types::Header<H>where
H: BlockHeader,
impl<T> BlockHeader for WithOtherFields<T>where
T: BlockHeader,
serde
only.