Type Alias BlockWithSenders
pub type BlockWithSenders<B = Block<TransactionSigned>> = RecoveredBlock<B>;
RecoveredBlock
insteadExpand description
Ethereum recovered block
Aliased Type§
struct BlockWithSenders<B = Block<TransactionSigned>> { /* private fields */ }
Layout§
Note: Encountered an error during type layout; the type failed to be normalized.
Implementations
§impl<B> RecoveredBlock<B>where
B: Block,
impl<B> RecoveredBlock<B>where
B: Block,
pub fn new(
block: B,
senders: Vec<Address>,
hash: FixedBytes<32>,
) -> RecoveredBlock<B>
pub fn new( block: B, senders: Vec<Address>, hash: FixedBytes<32>, ) -> RecoveredBlock<B>
Creates a new recovered block instance with the given senders as provided and the block hash.
Note: This expects that the given senders match the transactions in the block.
pub fn new_unhashed(block: B, senders: Vec<Address>) -> RecoveredBlock<B>
pub fn new_unhashed(block: B, senders: Vec<Address>) -> RecoveredBlock<B>
Creates a new recovered block instance with the given senders as provided.
Note: This expects that the given senders match the transactions in the block.
pub fn senders_iter(&self) -> impl Iterator<Item = &Address>
pub fn senders_iter(&self) -> impl Iterator<Item = &Address>
Returns an iterator over the recovered senders.
pub fn into_block(self) -> B
pub fn into_block(self) -> B
Consumes the type and returns the inner block.
pub const fn sealed_block(&self) -> &SealedBlock<B>
pub const fn sealed_block(&self) -> &SealedBlock<B>
Returns a reference to the sealed block.
pub const fn new_sealed(
block: SealedBlock<B>,
senders: Vec<Address>,
) -> RecoveredBlock<B>
pub const fn new_sealed( block: SealedBlock<B>, senders: Vec<Address>, ) -> RecoveredBlock<B>
Creates a new recovered block instance with the given SealedBlock
and senders as
provided
pub fn try_new(
block: B,
senders: Vec<Address>,
hash: FixedBytes<32>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_new( block: B, senders: Vec<Address>, hash: FixedBytes<32>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
A safer variant of Self::new_unhashed
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer
to recover the senders.
pub fn try_new_unchecked(
block: B,
senders: Vec<Address>,
hash: FixedBytes<32>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_new_unchecked( block: B, senders: Vec<Address>, hash: FixedBytes<32>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
A safer variant of Self::new
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer_unchecked
to recover the senders.
pub fn try_new_unhashed(
block: B,
senders: Vec<Address>,
) -> Result<RecoveredBlock<B>, RecoveryError>
pub fn try_new_unhashed( block: B, senders: Vec<Address>, ) -> Result<RecoveredBlock<B>, RecoveryError>
A safer variant of Self::new_unhashed
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer
to recover the senders.
pub fn try_new_unhashed_unchecked(
block: B,
senders: Vec<Address>,
) -> Result<RecoveredBlock<B>, RecoveryError>
pub fn try_new_unhashed_unchecked( block: B, senders: Vec<Address>, ) -> Result<RecoveredBlock<B>, RecoveryError>
A safer variant of Self::new_unhashed
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer_unchecked
to recover the senders.
pub fn try_recover(block: B) -> Result<RecoveredBlock<B>, RecoveryError>
pub fn try_recover(block: B) -> Result<RecoveredBlock<B>, RecoveryError>
Recovers the senders from the transactions in the block using
SignedTransaction::recover_signer
.
Returns an error if any of the transactions fail to recover the sender.
pub fn try_recover_unchecked(
block: B,
) -> Result<RecoveredBlock<B>, RecoveryError>
pub fn try_recover_unchecked( block: B, ) -> Result<RecoveredBlock<B>, RecoveryError>
Recovers the senders from the transactions in the block using
SignedTransaction::recover_signer_unchecked
.
Returns an error if any of the transactions fail to recover the sender.
pub fn try_recover_sealed(
block: SealedBlock<B>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_recover_sealed( block: SealedBlock<B>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
Recovers the senders from the transactions in the block using
SignedTransaction::recover_signer
.
Returns an error if any of the transactions fail to recover the sender.
pub fn try_recover_sealed_unchecked(
block: SealedBlock<B>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_recover_sealed_unchecked( block: SealedBlock<B>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
Recovers the senders from the transactions in the sealed block using
SignedTransaction::recover_signer_unchecked
.
Returns an error if any of the transactions fail to recover the sender.
pub fn try_recover_sealed_with_senders(
block: SealedBlock<B>,
senders: Vec<Address>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_recover_sealed_with_senders( block: SealedBlock<B>, senders: Vec<Address>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
A safer variant of Self::new_unhashed
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer_unchecked
to recover the senders.
Returns an error if any of the transactions fail to recover the sender.
pub fn try_recover_sealed_with_senders_unchecked(
block: SealedBlock<B>,
senders: Vec<Address>,
) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
pub fn try_recover_sealed_with_senders_unchecked( block: SealedBlock<B>, senders: Vec<Address>, ) -> Result<RecoveredBlock<B>, BlockRecoveryError<SealedBlock<B>>>
A safer variant of Self::new
that checks if the number of senders is equal to
the number of transactions in the block and recovers the senders from the transactions, if
not using SignedTransaction::recover_signer_unchecked
to recover the senders.
pub fn hash_ref(&self) -> &FixedBytes<32>
pub fn hash_ref(&self) -> &FixedBytes<32>
Returns the block hash.
pub fn hash(&self) -> FixedBytes<32>
pub fn hash(&self) -> FixedBytes<32>
Returns a copy of the block hash.
pub fn num_hash(&self) -> NumHash
pub fn num_hash(&self) -> NumHash
Return the number hash tuple.
pub fn block_with_parent(&self) -> BlockWithParent
pub fn block_with_parent(&self) -> BlockWithParent
Return a [BlockWithParent
] for this header.
pub fn clone_header(&self) -> <B as Block>::Header
pub fn clone_header(&self) -> <B as Block>::Header
Clone the header.
pub fn clone_sealed_header(&self) -> SealedHeader<<B as Block>::Header>
pub fn clone_sealed_header(&self) -> SealedHeader<<B as Block>::Header>
Clones the internal header and returns a SealedHeader
sealed with the hash.
pub fn clone_sealed_block(&self) -> SealedBlock<B>
pub fn clone_sealed_block(&self) -> SealedBlock<B>
Clones the wrapped block and returns the SealedBlock
sealed with the hash.
pub fn into_header(self) -> <B as Block>::Header
pub fn into_header(self) -> <B as Block>::Header
Consumes the block and returns the block’s header.
pub fn into_sealed_block(self) -> SealedBlock<B>
pub fn into_sealed_block(self) -> SealedBlock<B>
Consumes the block and returns the SealedBlock
and drops the recovered senders.
pub fn split_sealed(self) -> (SealedBlock<B>, Vec<Address>)
pub fn split_sealed(self) -> (SealedBlock<B>, Vec<Address>)
Consumes the type and returns its components.
pub fn transactions_with_sender(
&self,
) -> impl Iterator<Item = (&Address, &<<B as Block>::Body as BlockBody>::Transaction)>
pub fn transactions_with_sender( &self, ) -> impl Iterator<Item = (&Address, &<<B as Block>::Body as BlockBody>::Transaction)>
Returns an iterator over all transactions and their sender.
pub fn clone_transactions_recovered(
&self,
) -> impl Iterator<Item = Recovered<<<B as Block>::Body as BlockBody>::Transaction>>
pub fn clone_transactions_recovered( &self, ) -> impl Iterator<Item = Recovered<<<B as Block>::Body as BlockBody>::Transaction>>
Returns an iterator over cloned Recovered<Transaction>
pub fn transactions_recovered(
&self,
) -> impl Iterator<Item = Recovered<&<<B as Block>::Body as BlockBody>::Transaction>>
pub fn transactions_recovered( &self, ) -> impl Iterator<Item = Recovered<&<<B as Block>::Body as BlockBody>::Transaction>>
Returns an iterator over Recovered<&Transaction>
pub fn into_transactions_recovered(
self,
) -> impl Iterator<Item = Recovered<<<B as Block>::Body as BlockBody>::Transaction>>
pub fn into_transactions_recovered( self, ) -> impl Iterator<Item = Recovered<<<B as Block>::Body as BlockBody>::Transaction>>
Consumes the type and returns an iterator over all Recovered
transactions in the block.
pub fn into_transactions(
self,
) -> Vec<<<B as Block>::Body as BlockBody>::Transaction>
pub fn into_transactions( self, ) -> Vec<<<B as Block>::Body as BlockBody>::Transaction>
Consumes the block and returns the transactions of the block.
§impl<B> RecoveredBlock<B>where
B: Block,
impl<B> RecoveredBlock<B>where
B: Block,
pub fn senders_mut(&mut self) -> &mut Vec<Address>
Available on crate feature test-utils
only.
pub fn senders_mut(&mut self) -> &mut Vec<Address>
test-utils
only.Returns a mutable reference to the recovered senders.
pub fn push_sender(&mut self, sender: Address)
Available on crate feature test-utils
only.
pub fn push_sender(&mut self, sender: Address)
test-utils
only.Appends the sender to the list of senders.
§impl<B> RecoveredBlock<B>where
B: TestBlock,
impl<B> RecoveredBlock<B>where
B: TestBlock,
pub fn set_header(&mut self, header: <B as Block>::Header)
Available on crate feature test-utils
only.
pub fn set_header(&mut self, header: <B as Block>::Header)
test-utils
only.Updates the block header.
pub fn set_hash(&mut self, hash: FixedBytes<32>)
Available on crate feature test-utils
only.
pub fn set_hash(&mut self, hash: FixedBytes<32>)
test-utils
only.Updates the block hash.
pub fn header_mut(&mut self) -> &mut <B as Block>::Header
Available on crate feature test-utils
only.
pub fn header_mut(&mut self) -> &mut <B as Block>::Header
test-utils
only.Returns a mutable reference to the header.
pub fn block_mut(&mut self) -> &mut <B as Block>::Body
Available on crate feature test-utils
only.
pub fn block_mut(&mut self) -> &mut <B as Block>::Body
test-utils
only.Returns a mutable reference to the header.
pub fn set_parent_hash(&mut self, hash: FixedBytes<32>)
Available on crate feature test-utils
only.
pub fn set_parent_hash(&mut self, hash: FixedBytes<32>)
test-utils
only.Updates the parent block hash.
pub fn set_block_number(&mut self, number: u64)
Available on crate feature test-utils
only.
pub fn set_block_number(&mut self, number: u64)
test-utils
only.Updates the block number.
pub fn set_state_root(&mut self, state_root: FixedBytes<32>)
Available on crate feature test-utils
only.
pub fn set_state_root(&mut self, state_root: FixedBytes<32>)
test-utils
only.Updates the block state root.
pub fn set_difficulty(&mut self, difficulty: Uint<256, 4>)
Available on crate feature test-utils
only.
pub fn set_difficulty(&mut self, difficulty: Uint<256, 4>)
test-utils
only.Updates the block difficulty.
Trait Implementations
§impl<'a, B> Arbitrary<'a> for RecoveredBlock<B>
Available on crate feature arbitrary
only.
impl<'a, B> Arbitrary<'a> for RecoveredBlock<B>
arbitrary
only.§fn arbitrary(u: &mut Unstructured<'a>) -> Result<RecoveredBlock<B>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<RecoveredBlock<B>, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read more§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read more§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 more§impl<B> BlockHeader for RecoveredBlock<B>where
B: Block,
impl<B> BlockHeader for RecoveredBlock<B>where
B: Block,
§fn parent_hash(&self) -> FixedBytes<32>
fn parent_hash(&self) -> FixedBytes<32>
§fn ommers_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
§fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
§fn state_root(&self) -> FixedBytes<32>
fn state_root(&self) -> FixedBytes<32>
§fn transactions_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
§fn receipts_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
§fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
§fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
§fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
§fn mix_hash(&self) -> Option<FixedBytes<32>>
fn mix_hash(&self) -> Option<FixedBytes<32>>
§fn nonce(&self) -> Option<FixedBytes<8>>
fn nonce(&self) -> Option<FixedBytes<8>>
§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
§fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
§fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
§fn requests_hash(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
§fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
§fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
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 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 more§fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
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 maybe_next_block_blob_fee( &self, blob_params: Option<BlobParams>, ) -> Option<u128>
Self::next_block_blob_fee
with an optional [BlobParams
]
argument. Read more§fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
§fn parent_num_hash(&self) -> NumHash
fn parent_num_hash(&self) -> NumHash
§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
§fn is_zero_difficulty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
§fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
§fn is_nonce_zero(&self) -> bool
fn is_nonce_zero(&self) -> bool
§impl<B> Clone for RecoveredBlock<B>
impl<B> Clone for RecoveredBlock<B>
§fn clone(&self) -> RecoveredBlock<B>
fn clone(&self) -> RecoveredBlock<B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<B> Debug for RecoveredBlock<B>
impl<B> Debug for RecoveredBlock<B>
§impl<B> Default for RecoveredBlock<B>
impl<B> Default for RecoveredBlock<B>
§fn default() -> RecoveredBlock<B>
fn default() -> RecoveredBlock<B>
§impl<B> Deref for RecoveredBlock<B>where
B: Block,
impl<B> Deref for RecoveredBlock<B>where
B: Block,
§type Target = SealedBlock<B>
type Target = SealedBlock<B>
§fn deref(&self) -> &<RecoveredBlock<B> as Deref>::Target
fn deref(&self) -> &<RecoveredBlock<B> as Deref>::Target
§impl<B> DerefMut for RecoveredBlock<B>where
B: Block,
Available on crate feature test-utils
only.
impl<B> DerefMut for RecoveredBlock<B>where
B: Block,
test-utils
only.