pub struct BlockOverrides {
pub number: Option<U256>,
pub difficulty: Option<U256>,
pub time: Option<u64>,
pub gas_limit: Option<u64>,
pub coinbase: Option<Address>,
pub random: Option<B256>,
pub base_fee: Option<U256>,
pub block_hash: Option<BTreeMap<u64, B256>>,
}
Expand description
BlockOverrides is a set of header fields to override.
Fields§
§number: Option<U256>
Overrides the block number.
For eth_callMany
this will be the block number of the first simulated block. Each
following block increments its block number by 1
difficulty: Option<U256>
Overrides the difficulty of the block.
time: Option<u64>
Overrides the timestamp of the block.
gas_limit: Option<u64>
Overrides the gas limit of the block.
coinbase: Option<Address>
Overrides the coinbase address of the block.
random: Option<B256>
Overrides the prevrandao of the block.
base_fee: Option<U256>
Overrides the basefee of the block.
block_hash: Option<BTreeMap<u64, B256>>
A dictionary that maps blockNumber to a user-defined hash. It can be queried from the EVM opcode BLOCKHASH.
Implementations§
Source§impl BlockOverrides
impl BlockOverrides
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Returns true if all fields are None, false if any field is not None
Sourcepub const fn with_number(self, number: U256) -> Self
pub const fn with_number(self, number: U256) -> Self
Sets the block number override
Sourcepub const fn with_difficulty(self, difficulty: U256) -> Self
pub const fn with_difficulty(self, difficulty: U256) -> Self
Sets the difficulty override
Sourcepub const fn with_gas_limit(self, gas_limit: u64) -> Self
pub const fn with_gas_limit(self, gas_limit: u64) -> Self
Sets the gas limit override
Sourcepub const fn with_coinbase(self, coinbase: Address) -> Self
pub const fn with_coinbase(self, coinbase: Address) -> Self
Sets the coinbase (fee recipient) override
Sourcepub const fn with_random(self, random: B256) -> Self
pub const fn with_random(self, random: B256) -> Self
Sets the randomness (prevRandao) override
Sourcepub const fn with_base_fee(self, base_fee: U256) -> Self
pub const fn with_base_fee(self, base_fee: U256) -> Self
Sets the base fee override
Sourcepub fn append_block_hash(self, block_number: u64, hash: B256) -> Self
pub fn append_block_hash(self, block_number: u64, hash: B256) -> Self
Adds a block hash override for a specific block number
Sourcepub fn with_block_hash_overrides<I>(self, hashes: I) -> Self
pub fn with_block_hash_overrides<I>(self, hashes: I) -> Self
Adds multiple block hash overrides from an iterator
Trait Implementations§
Source§impl Clone for BlockOverrides
impl Clone for BlockOverrides
Source§fn clone(&self) -> BlockOverrides
fn clone(&self) -> BlockOverrides
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BlockOverrides
impl Debug for BlockOverrides
Source§impl Default for BlockOverrides
impl Default for BlockOverrides
Source§fn default() -> BlockOverrides
fn default() -> BlockOverrides
Source§impl<'de> Deserialize<'de> for BlockOverrideswhere
BlockOverrides: Default,
impl<'de> Deserialize<'de> for BlockOverrideswhere
BlockOverrides: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for BlockOverrides
impl PartialEq for BlockOverrides
Source§impl Serialize for BlockOverrides
impl Serialize for BlockOverrides
impl Eq for BlockOverrides
impl StructuralPartialEq for BlockOverrides
Auto Trait Implementations§
impl Freeze for BlockOverrides
impl RefUnwindSafe for BlockOverrides
impl Send for BlockOverrides
impl Sync for BlockOverrides
impl Unpin for BlockOverrides
impl UnwindSafe for BlockOverrides
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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 more