Type Alias BlockBody

pub type BlockBody<T = TransactionSigned, H = Header> = BlockBody<T, H>;
Expand description

A response to GetBlockBodies, containing bodies if any bodies were found.

Withdrawals can be optionally included at the end of the RLP encoded message.

Aliased Type§

struct BlockBody<T = TransactionSigned, H = Header> {
    pub transactions: Vec<T>,
    pub ommers: Vec<H>,
    pub withdrawals: Option<Withdrawals>,
}

Fields§

§transactions: Vec<T>

Transactions in this block.

§ommers: Vec<H>

Ommers/uncles header.

§withdrawals: Option<Withdrawals>

Block withdrawals.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 72 bytes

Implementations

§

impl<T, H> BlockBody<T, H>

pub fn transactions(&self) -> impl Iterator<Item = &T>

Returns an iterator over all transactions.

pub const fn into_block(self, header: H) -> Block<T, H>

Create a [Block] from the body and its header.

pub fn calculate_ommers_root(&self) -> FixedBytes<32>
where H: Encodable,

Calculate the ommers root for the block body.

pub fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>

Calculate the withdrawals root for the block body, if withdrawals exist. If there are no withdrawals, this will return None.

pub fn map_ommers<U>(self, f: impl FnMut(H) -> U) -> BlockBody<T, U>

Converts the body’s ommers type by applying a function to it.

pub fn try_map_ommers<U, E>( self, f: impl FnMut(H) -> Result<U, E>, ) -> Result<BlockBody<T, U>, E>

Converts the body’s ommers type by applying a fallible function to it.

§

impl<T, H> BlockBody<T, H>
where T: Transaction,

pub fn blob_versioned_hashes_iter( &self, ) -> impl Iterator<Item = &FixedBytes<32>>

Returns an iterator over all blob versioned hashes from the block body.

§

impl<T, H> BlockBody<T, H>
where T: Typed2718,

pub fn has_eip4844_transactions(&self) -> bool

Returns whether or not the block body contains any blob transactions.

pub fn has_eip7702_transactions(&self) -> bool

Returns whether or not the block body contains any EIP-7702 transactions.

pub fn eip4844_transactions_iter(&self) -> impl Iterator<Item = &T>

Returns an iterator over all blob transactions of the block.

Trait Implementations

§

impl<'a, T, H> Arbitrary<'a> for BlockBody<T, H>
where T: Arbitrary<'a>, H: Arbitrary<'a>,

Available on crate feature arbitrary only.
§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<BlockBody<T, H>, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

impl<T, H> BlockBody for BlockBody<T, H>

§

type Transaction = T

Ordered list of signed transactions as committed in the block.
§

type OmmerHeader = H

Ommer header type.
§

fn transactions(&self) -> &[<BlockBody<T, H> as BlockBody>::Transaction]

Returns reference to transactions in the block.
§

fn into_ethereum_body(self) -> BlockBody<T, H>

A Convenience function to convert this type into the regular ethereum block body that consists of: Read more
§

fn into_transactions(self) -> Vec<<BlockBody<T, H> as BlockBody>::Transaction>

Consume the block body and return a Vec of transactions.
§

fn withdrawals(&self) -> Option<&Withdrawals>

Returns block withdrawals if any.
§

fn ommers(&self) -> Option<&[<BlockBody<T, H> as BlockBody>::OmmerHeader]>

Returns block ommers if any.
§

fn transactions_iter(&self) -> impl Iterator<Item = &Self::Transaction>

Returns an iterator over the transactions in the block.
§

fn transaction_by_hash( &self, hash: &FixedBytes<32>, ) -> Option<&Self::Transaction>

Returns the transaction with the matching hash. Read more
§

fn clone_transactions(&self) -> Vec<Self::Transaction>

Clones the transactions in the block. Read more
§

fn transaction_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>

Returns an iterator over all transaction hashes in the block body.
§

fn transaction_count(&self) -> usize

Returns the number of the transactions in the block.
§

fn contains_transaction_type(&self, tx_type: u8) -> bool

Returns true if the block body contains a transaction of the given type.
§

fn calculate_tx_root(&self) -> FixedBytes<32>

Calculate the transaction root for the block body.
§

fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>

Calculate the withdrawals root for the block body. Read more
§

fn calculate_ommers_root(&self) -> Option<FixedBytes<32>>

Calculate the ommers root for the block body. Read more
§

fn blob_gas_used(&self) -> u64

Calculates the total blob gas used by all EIP-4844 transactions in the block.
§

fn blob_versioned_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>

Returns an iterator over all blob versioned hashes in the block body.
§

fn encoded_2718_transactions_iter(&self) -> impl Iterator<Item = Vec<u8>>

Returns an iterator over the encoded 2718 transactions. Read more
§

fn encoded_2718_transactions(&self) -> Vec<Bytes>

Returns a vector of encoded 2718 transactions. Read more
§

fn recover_signers(&self) -> Result<Vec<Address>, RecoveryError>

Recover signer addresses for all transactions in the block body.
§

fn try_recover_signers(&self) -> Result<Vec<Address>, RecoveryError>

Recover signer addresses for all transactions in the block body. Read more
§

fn recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>

Recover signer addresses for all transactions in the block body without ensuring that the signature has a low s value. Read more
§

fn try_recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>

Recover signer addresses for all transactions in the block body without ensuring that the signature has a low s value. Read more
§

impl<T, H> Clone for BlockBody<T, H>
where T: Clone, H: Clone,

§

fn clone(&self) -> BlockBody<T, H>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl<T, H> Debug for BlockBody<T, H>
where T: Debug, H: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<T, H> Decodable for BlockBody<T, H>
where T: Decodable, H: Decodable,

§

fn decode(b: &mut &[u8]) -> Result<BlockBody<T, H>, Error>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
§

impl<T, H> Default for BlockBody<T, H>

§

fn default() -> BlockBody<T, H>

Returns the “default value” for a type. Read more
§

impl<'de, T, H> Deserialize<'de> for BlockBody<T, H>
where T: Deserialize<'de>, H: Deserialize<'de>,

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<BlockBody<T, H>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<T, H> Encodable for BlockBody<T, H>
where T: Encodable, H: Encodable,

§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
§

impl<T, H> From<Block<T, H>> for BlockBody<T, H>

§

fn from(block: Block<T, H>) -> BlockBody<T, H>

Converts to this type from the input type.
§

impl<'a, T, H> From<BlockBody<'a, T, H>> for BlockBody<T, H>

§

fn from(value: BlockBody<'a, T, H>) -> BlockBody<T, H>

Converts to this type from the input type.
§

impl<T, H> InMemorySize for BlockBody<T, H>

§

fn size(&self) -> usize

Calculates a heuristic for the in-memory size of the block body

§

impl<T, H> PartialEq for BlockBody<T, H>
where T: PartialEq, H: PartialEq,

§

fn eq(&self, other: &BlockBody<T, H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
§

impl<T, H> SerdeBincodeCompat for BlockBody<T, H>

§

type BincodeRepr<'a> = BlockBody<'a, T, H>

Serde representation of the type for bincode serialization. Read more
§

fn as_repr(&self) -> <BlockBody<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>

Convert this type into its bincode representation
§

fn from_repr( repr: <BlockBody<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>, ) -> BlockBody<T, H>

Convert from the bincode representation
§

impl<T, H> Serialize for BlockBody<T, H>
where T: Serialize, H: Serialize,

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<T, H> Eq for BlockBody<T, H>
where T: Eq, H: Eq,

§

impl<T, H> StructuralPartialEq for BlockBody<T, H>