reth::core::primitives::block::body

Trait BlockBody

pub trait BlockBody:
    Send
    + Sync
    + Unpin
    + Clone
    + Default
    + Debug
    + PartialEq
    + Eq
    + Encodable
    + Decodable
    + InMemorySize
    + MaybeSerde
    + 'static {
    type Transaction: SignedTransaction;
    type OmmerHeader: BlockHeader;

Show 15 methods // Required methods fn transactions(&self) -> &[Self::Transaction]; fn into_transactions(self) -> Vec<Self::Transaction>; fn withdrawals(&self) -> Option<&Withdrawals>; fn ommers(&self) -> Option<&[Self::OmmerHeader]>; // Provided methods fn transaction_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>> { ... } fn transaction_count(&self) -> usize { ... } fn calculate_tx_root(&self) -> FixedBytes<32> { ... } fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>> { ... } fn calculate_ommers_root(&self) -> Option<FixedBytes<32>> { ... } fn blob_gas_used(&self) -> u64 { ... } fn blob_versioned_hashes_iter( &self, ) -> impl Iterator<Item = &FixedBytes<32>> { ... } fn encoded_2718_transactions_iter(&self) -> impl Iterator<Item = Vec<u8>> { ... } fn encoded_2718_transactions(&self) -> Vec<Bytes> { ... } fn recover_signers(&self) -> Option<Vec<Address>> where Self::Transaction: SignedTransaction { ... } fn recover_signers_unchecked(&self) -> Option<Vec<Address>> where Self::Transaction: SignedTransaction { ... }
}
Expand description

Abstraction for block’s body.

Required Associated Types§

type Transaction: SignedTransaction

Ordered list of signed transactions as committed in block.

type OmmerHeader: BlockHeader

Ommer header type.

Required Methods§

fn transactions(&self) -> &[Self::Transaction]

Returns reference to transactions in block.

fn into_transactions(self) -> Vec<Self::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<&[Self::OmmerHeader]>

Returns block ommers if any.

Provided Methods§

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 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.

Returns None if there are no withdrawals in the block.

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

Calculate the ommers root for the block body.

Returns None if there are no ommers in the block.

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.

This is also known as raw transactions.

See also [Encodable2718].

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

Returns a vector of encoded 2718 transactions.

This is also known as raw transactions.

See also [Encodable2718].

fn recover_signers(&self) -> Option<Vec<Address>>

Recover signer addresses for all transactions in the block body.

fn recover_signers_unchecked(&self) -> Option<Vec<Address>>

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

Returns None, if some transaction’s signature is invalid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<T> BlockBody for BlockBody<T>

§

type Transaction = T

§

type OmmerHeader = Header

§

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

§

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

§

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

§

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

Implementors§