pub struct Header<H = Header> {
pub hash: FixedBytes<32>,
pub inner: H,
pub total_difficulty: Option<Uint<256, 4>>,
pub size: Option<Uint<256, 4>>,
}eth only.Expand description
RPC representation of block header, wrapping a consensus header.
This wraps the consensus header and adds additional fields for RPC.
Fields§
§hash: FixedBytes<32>Hash of the block
inner: HInner consensus header.
total_difficulty: Option<Uint<256, 4>>Total difficulty
Note: This field is now effectively deprecated: https://github.com/ethereum/execution-apis/pull/570
size: Option<Uint<256, 4>>Integer the size of this block in bytes.
Implementations§
Source§impl<H> Header<H>
impl<H> Header<H>
Sourcepub fn new(inner: H) -> Header<H>where
H: Sealable,
pub fn new(inner: H) -> Header<H>where
H: Sealable,
Create a new Header from a consensus header.
Note: This will compute the hash of the header.
Sourcepub fn from_sealed(header: Sealed<H>) -> Header<H>
pub fn from_sealed(header: Sealed<H>) -> Header<H>
Create a new Header from a sealed consensus header.
Note: This does not set the total difficulty or size of the block.
Sourcepub fn into_sealed(self) -> Sealed<H>
pub fn into_sealed(self) -> Sealed<H>
Consumes the type and returns the Sealed header.
Sourcepub fn into_consensus(self) -> H
pub fn into_consensus(self) -> H
Consumes the type and returns the wrapped consensus header.
Sourcepub fn from_consensus(
header: Sealed<H>,
total_difficulty: Option<Uint<256, 4>>,
size: Option<Uint<256, 4>>,
) -> Header<H>
pub fn from_consensus( header: Sealed<H>, total_difficulty: Option<Uint<256, 4>>, size: Option<Uint<256, 4>>, ) -> Header<H>
Create a new Header from a sealed consensus header and additional fields.
Sourcepub const fn with_total_difficulty(
self,
total_difficulty: Option<Uint<256, 4>>,
) -> Header<H>
pub const fn with_total_difficulty( self, total_difficulty: Option<Uint<256, 4>>, ) -> Header<H>
Set the total difficulty of the block.
Sourcepub const fn with_size(self, size: Option<Uint<256, 4>>) -> Header<H>
pub const fn with_size(self, size: Option<Uint<256, 4>>) -> Header<H>
Set the size of the block.
Source§impl<H> Header<H>where
H: BlockHeader,
impl<H> Header<H>where
H: BlockHeader,
Sourcepub fn blob_fee(&self) -> Option<u128>
pub fn blob_fee(&self) -> Option<u128>
Returns the blob fee for this block according to the EIP-4844 spec.
Returns None if excess_blob_gas is None
Sourcepub fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
pub 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.
See also Self::next_block_excess_blob_gas
Sourcepub fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
pub 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
Trait Implementations§
Source§impl<'arbitrary, H> Arbitrary<'arbitrary> for Header<H>where
H: Arbitrary<'arbitrary>,
impl<'arbitrary, H> Arbitrary<'arbitrary> for Header<H>where
H: Arbitrary<'arbitrary>,
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Header<H>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Header<H>, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Header<H>, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Header<H>, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<H> BlockHeader for Header<H>where
H: BlockHeader,
impl<H> BlockHeader for Header<H>where
H: BlockHeader,
Source§fn parent_hash(&self) -> FixedBytes<32>
fn parent_hash(&self) -> FixedBytes<32>
Source§fn ommers_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
Source§fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
Source§fn state_root(&self) -> FixedBytes<32>
fn state_root(&self) -> FixedBytes<32>
Source§fn transactions_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
Source§fn receipts_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
Source§fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
Source§fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
Source§fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
Source§fn mix_hash(&self) -> Option<FixedBytes<32>>
fn mix_hash(&self) -> Option<FixedBytes<32>>
Source§fn nonce(&self) -> Option<FixedBytes<8>>
fn nonce(&self) -> Option<FixedBytes<8>>
Source§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
Source§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
Source§fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
Source§fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
Source§fn requests_hash(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
Source§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
Source§fn header_info(&self) -> HeaderInfo
fn header_info(&self) -> HeaderInfo
Source§fn header_roots(&self) -> HeaderRoots
fn header_roots(&self) -> HeaderRoots
Source§fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Source§fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
Source§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>
Self::next_block_excess_blob_gas with an optional
BlobParams argument. Read moreSource§fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
Source§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>
Source§fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
Source§fn parent_num_hash(&self) -> NumHash
fn parent_num_hash(&self) -> NumHash
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Source§fn is_zero_difficulty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
Source§fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
Source§fn is_nonce_zero(&self) -> bool
fn is_nonce_zero(&self) -> bool
Source§impl<'de, H> Deserialize<'de> for Header<H>where
H: Deserialize<'de>,
impl<'de, H> Deserialize<'de> for Header<H>where
H: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Header<H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Header<H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<H> HeaderResponse for Header<H>where
H: BlockHeader,
impl<H> HeaderResponse for Header<H>where
H: BlockHeader,
Source§fn hash(&self) -> FixedBytes<32>
fn hash(&self) -> FixedBytes<32>
Source§impl<H> Serialize for Header<H>where
H: Serialize,
impl<H> Serialize for Header<H>where
H: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<H> Eq for Header<H>where
H: Eq,
impl<H> StructuralPartialEq for Header<H>
Auto Trait Implementations§
impl<H> Freeze for Header<H>where
H: Freeze,
impl<H> RefUnwindSafe for Header<H>where
H: RefUnwindSafe,
impl<H> Send for Header<H>where
H: Send,
impl<H> Sync for Header<H>where
H: Sync,
impl<H> Unpin for Header<H>where
H: Unpin,
impl<H> UnwindSafe for Header<H>where
H: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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 moreSource§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
random to avoid conflict with the new gen keyword in Rust 2024.Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
random_rangeRng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
std only.RngCore to a RngReadAdapter.Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> CryptoRng for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> Formattable for T
impl<T> Parsable for T
impl<R> TryCryptoRng for R
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.