pub struct Backend<N: Network> {Show 26 fields
db: Arc<RwLock<Box<dyn Db>>>,
blockchain: Blockchain<N>,
states: Arc<RwLock<InMemoryBlockStates>>,
evm_env: Arc<RwLock<EvmEnv>>,
networks: NetworkConfigs,
hardfork: Arc<RwLock<FoundryHardfork>>,
fork: Arc<RwLock<Option<ClientFork>>>,
last_fork_cache_source: Arc<RwLock<Option<ForkCacheSource>>>,
time: TimeManager,
cheats: CheatsManager,
fees: FeeManager,
genesis: GenesisConfig,
new_block_listeners: Arc<Mutex<Vec<UnboundedSender<ChainNotification>>>>,
active_state_snapshots: Arc<Mutex<HashMap<U256, StateSnapshot>>>,
enable_steps_tracing: bool,
print_logs: bool,
print_traces: bool,
call_trace_decoder: Arc<RwLock<Arc<CallTraceDecoder>>>,
prune_state_history_config: PruneStateHistoryConfig,
transaction_block_keeper: Option<usize>,
pub(crate) node_config: Arc<RwLock<NodeConfig>>,
slots_in_an_epoch: u64,
precompile_factory: Option<Arc<dyn PrecompileFactory>>,
mining: Arc<Mutex<()>>,
disable_pool_balance_checks: bool,
startup_fork_cache_user: StagedForkDbUser<Box<dyn Db>>,
}Expand description
Gives access to the [revm::Database]
Fields§
§db: Arc<RwLock<Box<dyn Db>>>Access to [revm::Database] abstraction.
This will be used in combination with [alloy_evm::Evm] and is responsible for feeding
data to the evm during its execution.
At time of writing, there are two different types of Db:
MemDb: everything is stored in memoryForkDb: forks off a remote client, missing data is retrieved via RPC-calls
In order to commit changes to the [revm::Database], the [alloy_evm::Evm] requires
mutable access, which requires a write-lock from this db. In forking mode, the time
during which the write-lock is active depends on whether the ForkDb can provide all
requested data from memory or whether it has to retrieve it via RPC calls first. This
means that it potentially blocks for some time, even taking into account the rate
limits of RPC endpoints. Therefore the Db is guarded by a tokio::sync::RwLock here
so calls that need to read from it, while it’s currently written to, don’t block. E.g.
a new block is currently mined and a new Self::set_storage_at() request is being
executed.
blockchain: Blockchain<N>stores all block related data in memory.
states: Arc<RwLock<InMemoryBlockStates>>Historic states of previous blocks.
evm_env: Arc<RwLock<EvmEnv>>EVM environment data of the chain (block env, cfg env).
networks: NetworkConfigsNetwork configuration (optimism, custom precompiles, etc.)
hardfork: Arc<RwLock<FoundryHardfork>>The active hardfork.
fork: Arc<RwLock<Option<ClientFork>>>This is set if this is currently forked off another client.
last_fork_cache_source: Arc<RwLock<Option<ForkCacheSource>>>The last source that supplied the live fork backend, retained across memory resets.
time: TimeManagerProvides time related info, like timestamp.
cheats: CheatsManagerContains state of custom overrides.
fees: FeeManagerContains fee data.
genesis: GenesisConfigInitialised genesis.
new_block_listeners: Arc<Mutex<Vec<UnboundedSender<ChainNotification>>>>Listeners for new blocks that get notified when a new block was imported or when logs were removed from the canonical chain due to a reorg.
active_state_snapshots: Arc<Mutex<HashMap<U256, StateSnapshot>>>Keeps track of active state snapshots at a specific block.
enable_steps_tracing: bool§print_logs: bool§print_traces: bool§call_trace_decoder: Arc<RwLock<Arc<CallTraceDecoder>>>Recorder used for decoding traces, used together with print_traces.
prune_state_history_config: PruneStateHistoryConfigHow to keep history state
transaction_block_keeper: Option<usize>max number of blocks with transactions in memory
node_config: Arc<RwLock<NodeConfig>>§slots_in_an_epoch: u64Slots in an epoch
precompile_factory: Option<Arc<dyn PrecompileFactory>>Precompiles to inject to the EVM.
mining: Arc<Mutex<()>>Prevent race conditions during mining
disable_pool_balance_checks: boolDisable pool balance checks
startup_fork_cache_user: StagedForkDbUser<Box<dyn Db>>Keeps startup fork-cache rollback armed until startup initialization completes.
This must remain the final field so all other backend-held database references are released before a rejected startup invalidates its cache.
Implementations§
Source§impl<N: Network> Backend<N>
impl<N: Network> Backend<N>
Sourcepub(super) async fn prepare_monad_fork_replay(
&self,
source_chain_id: u64,
execution_chain_id: u64,
timestamp: u64,
parent_hash: B256,
transactions: &[HistoricalReplayTransaction],
) -> Result<Option<ForkReplay>>
Available on crate feature monad only.
pub(super) async fn prepare_monad_fork_replay( &self, source_chain_id: u64, execution_chain_id: u64, timestamp: u64, parent_hash: B256, transactions: &[HistoricalReplayTransaction], ) -> Result<Option<ForkReplay>>
monad only.Prepares the Monad-specific inputs for replaying a historical transaction prefix.
Sourcepub(super) fn finalize_monad_fork_replay(
&self,
replay: &ForkReplay,
evm_env: &mut EvmEnv,
)
Available on crate feature monad only.
pub(super) fn finalize_monad_fork_replay( &self, replay: &ForkReplay, evm_env: &mut EvmEnv, )
monad only.Applies the Monad execution rules selected for a completed fork replay.
Sourcepub(super) const fn validate_monad_transaction_type(
&self,
tx: &FoundryTxEnvelope,
) -> Result<(), InvalidTransactionError>
Available on crate feature monad only.
pub(super) const fn validate_monad_transaction_type( &self, tx: &FoundryTxEnvelope, ) -> Result<(), InvalidTransactionError>
monad only.Validates Monad-specific transaction type restrictions.
Sourcepub(super) fn validate_monad_transaction_funds(
&self,
pending: &PendingTransaction<FoundryTxEnvelope>,
account: &AccountInfo,
evm_env: &EvmEnv,
) -> Result<bool, InvalidTransactionError>
Available on crate feature monad only.
pub(super) fn validate_monad_transaction_funds( &self, pending: &PendingTransaction<FoundryTxEnvelope>, account: &AccountInfo, evm_env: &EvmEnv, ) -> Result<bool, InvalidTransactionError>
monad only.Validates Monad’s gas-only transaction balance requirement.
Returns whether the transaction was validated as a Monad transaction.
Sourcepub(super) fn validate_monad_mining_pool_transaction_for(
&self,
pool_tx: &PoolTransaction<FoundryTxEnvelope>,
account: &AccountInfo,
evm_env: &EvmEnv,
) -> Result<bool, InvalidTransactionError>
Available on crate feature monad only.
pub(super) fn validate_monad_mining_pool_transaction_for( &self, pool_tx: &PoolTransaction<FoundryTxEnvelope>, account: &AccountInfo, evm_env: &EvmEnv, ) -> Result<bool, InvalidTransactionError>
monad only.Validates a forced Monad protocol transaction selected for mining.
Returns whether the transaction was recognized and fully validated as a protocol call.
Sourcepub(super) fn execute_with_monad_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
spec_id: SpecId,
hardfork: FoundryHardfork,
pool_transactions: &[Arc<PoolTransaction<FoundryTxEnvelope>>],
gas_config: &PoolTxGasConfig,
inspector_tx_config: &InspectorTxConfig,
validator: &dyn Fn(&PoolTransaction<FoundryTxEnvelope>, &AccountInfo) -> Result<(), InvalidTransactionError>,
) -> Result<(ExecutedPoolTransactions<FoundryTxEnvelope>, BlockExecutionResult<FoundryReceiptEnvelope>), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
Available on crate feature monad only.
pub(super) fn execute_with_monad_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
spec_id: SpecId,
hardfork: FoundryHardfork,
pool_transactions: &[Arc<PoolTransaction<FoundryTxEnvelope>>],
gas_config: &PoolTxGasConfig,
inspector_tx_config: &InspectorTxConfig,
validator: &dyn Fn(&PoolTransaction<FoundryTxEnvelope>, &AccountInfo) -> Result<(), InvalidTransactionError>,
) -> Result<(ExecutedPoolTransactions<FoundryTxEnvelope>, BlockExecutionResult<FoundryReceiptEnvelope>), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
monad only.Executes a candidate block through a concrete Monad EVM.
Sourcepub(super) fn execute_with_monad_replay_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
hardfork: FoundryHardfork,
transactions: &[HistoricalReplayTransaction],
inspector_tx_config: &InspectorTxConfig,
transaction_context: Option<MonadChainContext>,
) -> Result<ExecutedHistoricalReplay>where
DB: StateDB<Error = DatabaseError>,
Available on crate feature monad only.
pub(super) fn execute_with_monad_replay_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
hardfork: FoundryHardfork,
transactions: &[HistoricalReplayTransaction],
inspector_tx_config: &InspectorTxConfig,
transaction_context: Option<MonadChainContext>,
) -> Result<ExecutedHistoricalReplay>where
DB: StateDB<Error = DatabaseError>,
monad only.Executes a historical transaction prefix through a concrete Monad EVM.
Sourcepub(super) fn monad_pending_mined_transaction_from_storage(
storage: &BlockchainStorage<N>,
transaction: MaybeImpersonatedTransaction<FoundryTxEnvelope>,
) -> Result<PendingTransaction<FoundryTxEnvelope>, BlockchainError>
Available on crate feature monad only.
pub(super) fn monad_pending_mined_transaction_from_storage( storage: &BlockchainStorage<N>, transaction: MaybeImpersonatedTransaction<FoundryTxEnvelope>, ) -> Result<PendingTransaction<FoundryTxEnvelope>, BlockchainError>
monad only.Reconstructs a locally mined transaction using its authoritative stored sender.
Sourcefn monad_tx_envs_from_storage(
&self,
storage: &BlockchainStorage<N>,
transactions: &[MaybeImpersonatedTransaction<FoundryTxEnvelope>],
) -> Result<Vec<TxEnv>, BlockchainError>
Available on crate feature monad only.
fn monad_tx_envs_from_storage( &self, storage: &BlockchainStorage<N>, transactions: &[MaybeImpersonatedTransaction<FoundryTxEnvelope>], ) -> Result<Vec<TxEnv>, BlockchainError>
monad only.Converts retained local transactions using their authoritative mined senders.
Sourcepub(super) fn monad_historical_replay_tx_envs(
&self,
transactions: &[HistoricalReplayTransaction],
) -> Vec<TxEnv>
Available on crate feature monad only.
pub(super) fn monad_historical_replay_tx_envs( &self, transactions: &[HistoricalReplayTransaction], ) -> Vec<TxEnv>
monad only.Converts a historical replay prefix using its prepared authoritative senders.
Sourcefn monad_block_participants_from_storage(
&self,
storage: &BlockchainStorage<N>,
hash: B256,
) -> Result<(u64, B256, MonadBlockParticipants), BlockchainError>
Available on crate feature monad only.
fn monad_block_participants_from_storage( &self, storage: &BlockchainStorage<N>, hash: B256, ) -> Result<(u64, B256, MonadBlockParticipants), BlockchainError>
monad only.Returns a block’s number, parent hash, and cached participants.
fn monad_block_participants( &self, hash: B256, ) -> Result<(u64, B256, MonadBlockParticipants), BlockchainError>
monad only.Sourcepub(super) fn rebuild_monad_block_participant_cache(
&self,
storage: &mut BlockchainStorage<N>,
) -> Result<(), BlockchainError>
Available on crate feature monad only.
pub(super) fn rebuild_monad_block_participant_cache( &self, storage: &mut BlockchainStorage<N>, ) -> Result<(), BlockchainError>
monad only.Rebuilds participant metadata for locally stored blocks with transaction bodies.
Sourcepub(super) fn monad_context_for_child_of(
&self,
parent_hash: B256,
) -> Result<MonadChainContext, BlockchainError>
Available on crate feature monad only.
pub(super) fn monad_context_for_child_of( &self, parent_hash: B256, ) -> Result<MonadChainContext, BlockchainError>
monad only.Builds the initial context for a block whose parent is parent_hash.
Sourcepub(super) fn monad_context_for_child_of_in_storage(
&self,
storage: &BlockchainStorage<N>,
parent_hash: B256,
) -> Result<MonadChainContext, BlockchainError>
Available on crate feature monad only.
pub(super) fn monad_context_for_child_of_in_storage( &self, storage: &BlockchainStorage<N>, parent_hash: B256, ) -> Result<MonadChainContext, BlockchainError>
monad only.Builds the initial context from staged storage.
async fn monad_context_for_child_of_block( &self, block: AnyRpcBlock, block_hash: B256, ) -> Result<MonadChainContext, BlockchainError>
monad only.Sourcepub(super) async fn monad_context_for_child_of_block_number(
&self,
block_number: u64,
) -> Result<MonadChainContext, BlockchainError>
Available on crate feature monad only.
pub(super) async fn monad_context_for_child_of_block_number( &self, block_number: u64, ) -> Result<MonadChainContext, BlockchainError>
monad only.Fetches the full blocks required to build context on top of block_number.
Sourcepub(super) async fn monad_context_for_child_of_block_hash(
&self,
block_hash: B256,
) -> Result<MonadChainContext, BlockchainError>
Available on crate feature monad only.
pub(super) async fn monad_context_for_child_of_block_hash( &self, block_hash: B256, ) -> Result<MonadChainContext, BlockchainError>
monad only.Fetches the full blocks required to build context on top of block_hash.
fn monad_context_for_mined_transactions( &self, block: &Block, current: &[TxEnv], current_tx_index: usize, ) -> Result<MonadChainContext, BlockchainError>
monad only.fn monad_context_for_mined_block( &self, block: &Block, ) -> Result<MonadChainContext, BlockchainError>
monad only.pub(super) fn active_monad_context_for_mined_block( &self, block: &Block, ) -> Result<Option<MonadChainContext>, BlockchainError>
monad only.fn monad_context_before_mined_transaction( &self, block: &Block, current_tx_index: usize, ) -> Result<MonadChainContext, BlockchainError>
monad only.pub(super) fn active_monad_context_before_mined_transaction( &self, block: &Block, current_tx_index: usize, ) -> Result<Option<MonadChainContext>, BlockchainError>
monad only.Sourcepub(super) fn build_monad_evm_env(
evm_env: &EvmEnv,
hardfork: MonadHardfork,
) -> EvmEnvFor<MonadEvmNetwork>
Available on crate feature monad only.
pub(super) fn build_monad_evm_env( evm_env: &EvmEnv, hardfork: MonadHardfork, ) -> EvmEnvFor<MonadEvmNetwork>
monad only.Builds the Monad [EvmEnv] (spec and gas params) from a base env.
Sourcepub(super) fn transact_monad_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
execution: PreparedExecution,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<MonadContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Available on crate feature monad only.
pub(super) fn transact_monad_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
execution: PreparedExecution,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<MonadContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
monad only.Monad path of Backend::transact_call_with_inspector_ref.
Source§impl<N: Network> Backend<N>
impl<N: Network> Backend<N>
Sourcepub(super) fn transact_op_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: OpTransaction<TxEnv>,
) -> Result<ResultAndState<HaltReason>, BlockchainError>
Available on crate feature optimism only.
pub(super) fn transact_op_with_inspector_ref<'db, I, DB>( &self, db: &'db DB, evm_env: &EvmEnv, inspector: &mut I, tx_env: OpTransaction<TxEnv>, ) -> Result<ResultAndState<HaltReason>, BlockchainError>
optimism only.Optimism path of Backend::transact_call_with_inspector_ref.
Creates an OP EVM, injects precompiles, transacts, and maps the
OP-specific halt reason back to the shared [HaltReason].
Source§impl<N: Network> Backend<N>
impl<N: Network> Backend<N>
Sourcepub fn impersonate(&self, addr: Address) -> bool
pub fn impersonate(&self, addr: Address) -> bool
Sets the account to impersonate
Returns true if the account is already impersonated
Sourcepub fn stop_impersonating(&self, addr: Address)
pub fn stop_impersonating(&self, addr: Address)
Removes the account that from the impersonated set
If the impersonated addr is a contract then we also reset the code here
Sourcepub fn auto_impersonate_account(&self, enabled: bool)
pub fn auto_impersonate_account(&self, enabled: bool)
If set to true will make every account impersonated
Sourcepub fn get_fork(&self) -> Option<ClientFork>
pub fn get_fork(&self) -> Option<ClientFork>
Returns the configured fork, if any
Sourcepub(crate) fn commit_startup_fork_cache(&self)
pub(crate) fn commit_startup_fork_cache(&self)
Marks startup fork-cache writes as belonging to the validated live backend.
Sourcepub(crate) async fn lock_mining(&self) -> MutexGuard<'_, ()>
pub(crate) async fn lock_mining(&self) -> MutexGuard<'_, ()>
Locks block production while a backend-wide lifecycle transition is committed.
Sourcepub async fn get_account(&self, address: Address) -> DatabaseResult<AccountInfo>
pub async fn get_account(&self, address: Address) -> DatabaseResult<AccountInfo>
Returns the AccountInfo from the database
Sourcepub async fn set_create2_deployer(&self, address: Address) -> DatabaseResult<()>
pub async fn set_create2_deployer(&self, address: Address) -> DatabaseResult<()>
Writes the CREATE2 deployer code directly to the database at the address provided.
Sourcepub(crate) fn update_interval_mine_block_time(&self, block_time: Duration)
pub(crate) fn update_interval_mine_block_time(&self, block_time: Duration)
Updates memory limits that should be more strict when auto-mine is enabled
Sourcepub const fn time(&self) -> &TimeManager
pub const fn time(&self) -> &TimeManager
Returns the TimeManager responsible for timestamps
Sourcepub const fn cheats(&self) -> &CheatsManager
pub const fn cheats(&self) -> &CheatsManager
Returns the CheatsManager responsible for executing cheatcodes
Sourcepub fn skip_blob_validation(&self, impersonator: Option<Address>) -> bool
pub fn skip_blob_validation(&self, impersonator: Option<Address>) -> bool
Whether to skip blob validation
Sourcepub const fn fees(&self) -> &FeeManager
pub const fn fees(&self) -> &FeeManager
Returns the FeeManager that manages fee/pricings
Sourcepub const fn evm_env(&self) -> &Arc<RwLock<EvmEnv>> ⓘ
pub const fn evm_env(&self) -> &Arc<RwLock<EvmEnv>> ⓘ
The EVM environment data of the blockchain
Sourcepub fn best_number(&self) -> u64
pub fn best_number(&self) -> u64
Returns the current best number of the chain
Sourcepub fn set_block_number(&self, number: u64)
pub fn set_block_number(&self, number: u64)
Sets the block number
Sourcefn protocol_chain_id(&self) -> u64
fn protocol_chain_id(&self) -> u64
Returns the chain ID that defines protocol behavior.
pub fn set_chain_id(&self, chain_id: u64)
Sourcepub const fn genesis_time(&self) -> u64
pub const fn genesis_time(&self) -> u64
Returns the genesis data for the Beacon API.
Sourcepub const fn genesis_number(&self) -> u64
pub const fn genesis_number(&self) -> u64
Returns the configured genesis block number.
Sourcepub async fn current_balance(&self, address: Address) -> DatabaseResult<U256>
pub async fn current_balance(&self, address: Address) -> DatabaseResult<U256>
Returns balance of the given account.
Sourcepub async fn current_nonce(&self, address: Address) -> DatabaseResult<u64>
pub async fn current_nonce(&self, address: Address) -> DatabaseResult<u64>
Returns balance of the given account.
Sourcepub fn set_coinbase(&self, address: Address)
pub fn set_coinbase(&self, address: Address)
Sets the coinbase address
Sourcepub fn set_next_block_prevrandao(&self, prevrandao: B256)
pub fn set_next_block_prevrandao(&self, prevrandao: B256)
Sets the prevrandao value to use for the next mined block.
This is a one-shot override that is consumed by the next block; afterwards anvil resumes its
default per-block prevrandao derivation.
Sourcepub async fn set_nonce(
&self,
address: Address,
nonce: U256,
) -> DatabaseResult<()>
pub async fn set_nonce( &self, address: Address, nonce: U256, ) -> DatabaseResult<()>
Sets the nonce of the given address
Sourcepub async fn set_balance(
&self,
address: Address,
balance: U256,
) -> DatabaseResult<()>
pub async fn set_balance( &self, address: Address, balance: U256, ) -> DatabaseResult<()>
Sets the balance of the given address
Sourcepub async fn set_code(
&self,
address: Address,
code: Bytes,
) -> DatabaseResult<()>
pub async fn set_code( &self, address: Address, code: Bytes, ) -> DatabaseResult<()>
Sets the code of the given address
Sourcepub async fn set_storage_at(
&self,
address: Address,
slot: U256,
val: B256,
) -> DatabaseResult<()>
pub async fn set_storage_at( &self, address: Address, slot: U256, val: B256, ) -> DatabaseResult<()>
Sets the value for the given slot of the given address
Sourcepub fn is_eip1559(&self) -> bool
pub fn is_eip1559(&self) -> bool
Returns true for post London
Sourcepub fn is_eip3675(&self) -> bool
pub fn is_eip3675(&self) -> bool
Returns true for post Merge
Sourcepub fn is_eip2930(&self) -> bool
pub fn is_eip2930(&self) -> bool
Returns true for post Berlin
Sourcepub fn is_eip4844(&self) -> bool
pub fn is_eip4844(&self) -> bool
Returns true for post Cancun
Sourcepub fn is_eip7702(&self) -> bool
pub fn is_eip7702(&self) -> bool
Returns true for post Prague
Sourcepub const fn is_optimism(&self) -> bool
pub const fn is_optimism(&self) -> bool
Returns true if op-stack deposits are active.
Always false when built without the optimism feature.
Sourcepub const fn execution_profile_name(&self) -> &'static str
pub const fn execution_profile_name(&self) -> &'static str
Returns the active execution profile name.
Sourcefn pending_mined_transaction(
&self,
transaction: MaybeImpersonatedTransaction<FoundryTxEnvelope>,
) -> Result<PendingTransaction<FoundryTxEnvelope>, BlockchainError>
fn pending_mined_transaction( &self, transaction: MaybeImpersonatedTransaction<FoundryTxEnvelope>, ) -> Result<PendingTransaction<FoundryTxEnvelope>, BlockchainError>
Reconstructs a locally mined transaction using its authoritative stored sender.
Sourcepub fn hardfork(&self) -> FoundryHardfork
pub fn hardfork(&self) -> FoundryHardfork
Returns the active hardfork.
Sourcefn ethereum_block_transitions(
&self,
hardfork: FoundryHardfork,
parent_beacon_block_root: Option<B256>,
execution_kind: BlockExecutionKind,
) -> Option<EthereumBlockTransitions>
fn ethereum_block_transitions( &self, hardfork: FoundryHardfork, parent_beacon_block_root: Option<B256>, execution_kind: BlockExecutionKind, ) -> Option<EthereumBlockTransitions>
Returns canonical Ethereum transition configuration only for an Ethereum network.
Sourcefn ethereum_deposit_contract_address(&self) -> Address
fn ethereum_deposit_contract_address(&self) -> Address
Returns the configured deposit contract, then the canonical address for known chains.
Sourcepub fn tempo_hardfork(&self) -> TempoHardfork
pub fn tempo_hardfork(&self) -> TempoHardfork
Returns the active Tempo hardfork.
Sourcepub fn monad_hardfork(&self) -> MonadHardfork
Available on crate feature monad only.
pub fn monad_hardfork(&self) -> MonadHardfork
monad only.Returns the active Monad hardfork.
Sourcepub fn is_tempo_hardfork_active(&self, hardfork: TempoHardfork) -> bool
pub fn is_tempo_hardfork_active(&self, hardfork: TempoHardfork) -> bool
Returns whether a Tempo hardfork is active on this backend.
Sourcepub fn precompiles(&self) -> BTreeMap<String, Address>
pub fn precompiles(&self) -> BTreeMap<String, Address>
Returns the precompiles for the current spec.
Sourcepub fn system_contracts(&self) -> BTreeMap<SystemContract, Address>
pub fn system_contracts(&self) -> BTreeMap<SystemContract, Address>
Returns the system contracts for the current spec.
Sourcepub fn blob_params(&self) -> BlobParams
pub fn blob_params(&self) -> BlobParams
Returns the active [BlobParams].
fn simulation_blob_params_at_timestamp(&self, timestamp: u64) -> BlobParams
fn is_optimism_jovian_at_header<H: BlockHeader>( &self, header: &H, decoded: Option<bool>, ) -> bool
optimism only.Sourcepub fn ensure_eip1559_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip1559_active(&self) -> Result<(), BlockchainError>
Returns an error if EIP1559 is not active (pre Berlin)
Sourcepub fn ensure_eip2930_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip2930_active(&self) -> Result<(), BlockchainError>
Returns an error if EIP1559 is not active (pre muirGlacier)
pub fn ensure_eip4844_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip7702_active(&self) -> Result<(), BlockchainError>
Sourcepub const fn ensure_op_deposits_active(&self) -> Result<(), BlockchainError>
Available on crate feature optimism only.
pub const fn ensure_op_deposits_active(&self) -> Result<(), BlockchainError>
optimism only.Returns an error if op-stack deposits are not active
Sourcepub const fn ensure_tempo_active(&self) -> Result<(), BlockchainError>
pub const fn ensure_tempo_active(&self) -> Result<(), BlockchainError>
Returns an error if Tempo transactions are not active
Sourcefn inspector_tx_config(&self) -> InspectorTxConfig
fn inspector_tx_config(&self) -> InspectorTxConfig
Builds the InspectorTxConfig from the backend’s current settings.
Sourcefn call_trace_decoder(&self) -> Arc<CallTraceDecoder> ⓘ
fn call_trace_decoder(&self) -> Arc<CallTraceDecoder> ⓘ
Returns a trace decoder configured for the currently resolved hardfork.
Sourcefn pool_tx_gas_config(&self, evm_env: &EvmEnv) -> PoolTxGasConfig
fn pool_tx_gas_config(&self, evm_env: &EvmEnv) -> PoolTxGasConfig
Builds the PoolTxGasConfig from the given EVM environment.
fn monad_cfg_env(&self, evm_env: &EvmEnv) -> Option<MonadCfgEnv>
monad only.fn tx_gas_limit_cap(&self, evm_env: &EvmEnv) -> u64
pub(crate) fn fallback_tx_gas_limit(&self, evm_env: &EvmEnv) -> u64
fn max_initcode_size(&self, evm_env: &EvmEnv) -> usize
Sourcepub fn set_gas_limit(&self, gas_limit: u64)
pub fn set_gas_limit(&self, gas_limit: u64)
Sets the block gas limit
Sourcepub const fn is_min_priority_fee_enforced(&self) -> bool
pub const fn is_min_priority_fee_enforced(&self) -> bool
Returns whether the minimum suggested priority fee is enforced
pub fn excess_blob_gas_and_price(&self) -> Option<BlobExcessGasAndPrice>
Sourcepub fn set_base_fee(&self, basefee: u64)
pub fn set_base_fee(&self, basefee: u64)
Sets the current basefee
Sourcepub fn set_gas_price(&self, price: u128)
pub fn set_gas_price(&self, price: u128)
Sets the gas price
pub fn elasticity(&self) -> f64
Sourcepub fn total_difficulty(&self) -> U256
pub fn total_difficulty(&self) -> U256
Returns the total difficulty of the chain until this block
Note: this will always be 0 in memory mode
In forking mode this will always be the total difficulty of the forked block
Sourcepub async fn create_state_snapshot(&self) -> U256
pub async fn create_state_snapshot(&self) -> U256
Creates a new evm_snapshot at the current height.
Returns the id of the snapshot created.
pub fn list_state_snapshots(&self) -> BTreeMap<U256, (u64, B256)>
Sourcefn next_evm_env(&self) -> EvmEnv
fn next_evm_env(&self) -> EvmEnv
Returns the environment for the next block
Sourcefn tx_replay_evm_env(&self, block: &Block) -> (EvmEnv, FoundryHardfork)
fn tx_replay_evm_env(&self, block: &Block) -> (EvmEnv, FoundryHardfork)
Returns the environment for replaying transactions from a historical block.
Sourcefn prepare_block_replay<'a>(
&self,
block: &Block,
parent_state: &'a StateDb,
) -> Result<(CacheDB<&'a StateDb>, EvmEnv, FoundryHardfork), BlockchainError>
fn prepare_block_replay<'a>( &self, block: &Block, parent_state: &'a StateDb, ) -> Result<(CacheDB<&'a StateDb>, EvmEnv, FoundryHardfork), BlockchainError>
Creates the database and environment for replaying a locally mined block.
An empty block execution applies protocol-level pre-execution changes, such as the EIP-2935 parent hash system call, through the same network-specific executor used while mining.
Sourcefn prepare_block_replay_with_db<DB>(
&self,
block: &Block,
db: DB,
) -> Result<(CacheDB<DB>, EvmEnv, FoundryHardfork), BlockchainError>where
DB: DatabaseRef<Error = DatabaseError> + Debug,
fn prepare_block_replay_with_db<DB>(
&self,
block: &Block,
db: DB,
) -> Result<(CacheDB<DB>, EvmEnv, FoundryHardfork), BlockchainError>where
DB: DatabaseRef<Error = DatabaseError> + Debug,
Creates an overlay and applies block-start transitions for a locally mined block replay.
Sourcefn replay_mined_transaction_prefix<DB>(
&self,
cache_db: &mut CacheDB<DB>,
evm_env: &EvmEnv,
hardfork: FoundryHardfork,
block: &Block,
end: usize,
) -> Result<(), BlockchainError>where
DB: DatabaseRef<Error = DatabaseError> + Debug,
fn replay_mined_transaction_prefix<DB>(
&self,
cache_db: &mut CacheDB<DB>,
evm_env: &EvmEnv,
hardfork: FoundryHardfork,
block: &Block,
end: usize,
) -> Result<(), BlockchainError>where
DB: DatabaseRef<Error = DatabaseError> + Debug,
Replays the stored transaction prefix [0, end) into an existing block overlay.
Sourcefn build_inspector(&self) -> AnvilInspector
fn build_inspector(&self) -> AnvilInspector
Builds [Inspector] with the configured options.
Sourcefn build_mining_inspector(&self) -> AnvilInspector
fn build_mining_inspector(&self) -> AnvilInspector
Builds an inspector configured for block mining (tracing always enabled).
Sourcepub fn new_block_notifications(&self) -> ChainNotifications
pub fn new_block_notifications(&self) -> ChainNotifications
Returns a new block event stream that yields Notifications when a new block was added or when logs were removed from the canonical chain due to a reorg
Sourcepub fn new_block_listeners_count(&self) -> usize
pub fn new_block_listeners_count(&self) -> usize
Returns the number of new-block listeners. Closed listeners are pruned lazily on the next new block notification.
Sourcefn notify_on_new_block(&self, header: Header, hash: B256)
fn notify_on_new_block(&self, header: Header, hash: B256)
Notifies all new_block_listeners about the new block
Sourcefn notify_on_removed_logs(&self, logs: Vec<Log>)
fn notify_on_removed_logs(&self, logs: Vec<Log>)
Notifies all new_block_listeners about the logs that were removed from the canonical
chain due to a reorg.
Sourcepub fn convert_block_number(&self, block: Option<BlockNumber>) -> u64
pub fn convert_block_number(&self, block: Option<BlockNumber>) -> u64
Returns the block number for the given block id
Sourcepub(crate) fn block_hash_by_number(&self, number: u64) -> Option<B256>
pub(crate) fn block_hash_by_number(&self, number: u64) -> Option<B256>
Returns the canonical hash for the given block number.
Sourcepub(crate) fn get_block_with_hash(
&self,
id: impl Into<BlockId>,
) -> Option<(Block, B256)>
pub(crate) fn get_block_with_hash( &self, id: impl Into<BlockId>, ) -> Option<(Block, B256)>
Returns the block and its hash for the given id
pub fn get_block(&self, id: impl Into<BlockId>) -> Option<Block>
pub fn get_block_by_hash(&self, hash: B256) -> Option<Block>
Sourcepub(crate) async fn fee_history_next_fees(
&self,
highest: u64,
) -> Option<(u128, u128)>
pub(crate) async fn fee_history_next_fees( &self, highest: u64, ) -> Option<(u128, u128)>
Returns the base fees for the block after a fee history range.
Mining publishes a new canonical block before advancing the fee manager. Holding the mining lock makes choosing between an existing child and the current head’s pending fees atomic with that publication sequence.
Sourcepub(crate) fn mined_parity_trace_transaction(
&self,
hash: B256,
) -> Option<Vec<LocalizedTransactionTrace>>
pub(crate) fn mined_parity_trace_transaction( &self, hash: B256, ) -> Option<Vec<LocalizedTransactionTrace>>
Returns the traces for the given transaction
Sourcepub(crate) fn mined_parity_trace_block(
&self,
block: u64,
) -> Option<Vec<LocalizedTransactionTrace>>
pub(crate) fn mined_parity_trace_block( &self, block: u64, ) -> Option<Vec<LocalizedTransactionTrace>>
Returns the traces for the given block
Sourcepub(crate) fn mined_transaction(
&self,
hash: B256,
) -> Option<MinedTransaction<N>>
pub(crate) fn mined_transaction( &self, hash: B256, ) -> Option<MinedTransaction<N>>
Returns the mined transaction for the given hash
Sourcepub async fn impersonate_signature(
&self,
signature: Bytes,
address: Address,
) -> Result<(), BlockchainError>
pub async fn impersonate_signature( &self, signature: Bytes, address: Address, ) -> Result<(), BlockchainError>
Overrides the given signature to impersonate the specified address during ecrecover.
Sourcepub async fn debug_code_by_hash(
&self,
code_hash: B256,
block_id: Option<BlockId>,
) -> Result<Option<Bytes>, BlockchainError>
pub async fn debug_code_by_hash( &self, code_hash: B256, block_id: Option<BlockId>, ) -> Result<Option<Bytes>, BlockchainError>
Returns code by its hash
Sourcepub async fn debug_db_get(
&self,
key: String,
) -> Result<Option<Bytes>, BlockchainError>
pub async fn debug_db_get( &self, key: String, ) -> Result<Option<Bytes>, BlockchainError>
Returns the value associated with a key from the database Currently only supports bytecode lookups.
Based on Reth implementation: https://github.com/paradigmxyz/reth/blob/66cfa9ed1a8c4bc2424aacf6fb2c1e67a78ee9a2/crates/rpc/rpc/src/debug.rs#L1146-L1178
Key should be: 0x63 (1-byte prefix) + 32 bytes (code_hash) Total key length must be 33 bytes.
fn mined_block_by_hash(&self, hash: B256) -> Option<AnyRpcBlock>
pub(crate) async fn mined_transactions_by_block_number( &self, number: BlockNumber, ) -> Option<Vec<AnyRpcTransaction>>
Sourcepub(crate) fn mined_transactions_in_block(
&self,
block: &Block,
) -> Option<Vec<AnyRpcTransaction>>
pub(crate) fn mined_transactions_in_block( &self, block: &Block, ) -> Option<Vec<AnyRpcTransaction>>
Returns all transactions given a block
pub fn mined_block_by_number(&self, number: BlockNumber) -> Option<AnyRpcBlock>
pub fn get_full_block(&self, id: impl Into<BlockId>) -> Option<AnyRpcBlock>
Sourcepub fn convert_block(&self, block: Block) -> AnyRpcBlock
pub fn convert_block(&self, block: Block) -> AnyRpcBlock
Takes a block as it’s stored internally and returns the eth api conform block format.
Sourcepub fn convert_block_with_hash(
&self,
block: Block,
known_hash: Option<B256>,
) -> AnyRpcBlock
pub fn convert_block_with_hash( &self, block: Block, known_hash: Option<B256>, ) -> AnyRpcBlock
Takes a block as it’s stored internally and returns the eth api conform block format.
If known_hash is provided, it will be used instead of computing hash_slow().
pub async fn block_by_hash( &self, hash: B256, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub async fn block_by_hash_full( &self, hash: B256, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub async fn block_by_number( &self, number: BlockNumber, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub async fn block_by_number_full( &self, number: BlockNumber, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
Sourcepub async fn ensure_block_number<T: Into<BlockId>>(
&self,
block_id: Option<T>,
) -> Result<u64, BlockchainError>
pub async fn ensure_block_number<T: Into<BlockId>>( &self, block_id: Option<T>, ) -> Result<u64, BlockchainError>
Converts the BlockNumber into a numeric value
§Errors
returns an error if the requested number is larger than the current height
Sourcefn inject_precompiles(&self, precompiles: &mut PrecompilesMap, evm_env: &EvmEnv)
fn inject_precompiles(&self, precompiles: &mut PrecompilesMap, evm_env: &EvmEnv)
Injects all configured precompiles into the given precompile map.
This applies five layers:
- Network-specific precompiles (e.g. Tempo, OP)
- Chain- and timestamp-specific precompiles
- User-provided precompiles via
PrecompileFactory - Cheatcode ecrecover overrides (if active)
- Block-specific precompiles (e.g. ArbSys)
fn inject_configured_precompiles( &self, precompiles: &mut PrecompilesMap, evm_env: &EvmEnv, )
fn inject_arbitrum_precompile_at_block( &self, precompiles: &mut PrecompilesMap, block_number: u64, )
fn simulation_precompile_overrides( &self, state_overrides: Option<&StateOverride>, evm_env: &EvmEnv, ) -> Result<SimulationPrecompileOverrides, BlockchainError>
fn apply_simulation_precompile_overrides( &self, precompiles: &mut PrecompilesMap, overrides: &SimulationPrecompileOverrides, ) -> Result<AddressSet, BlockchainError>
fn inject_tempo_precompiles<DB, I>(
&self,
evm: &mut TempoEvm<DB, I>,
evm_env: &EvmEnv,
)where
DB: Database,
I: Inspector<TempoContext<DB>>,
Sourcefn transact_eth_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<EthEvmContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn transact_eth_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<EthEvmContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Executes a call with the Ethereum EVM.
Creates an Ethereum EVM, injects precompiles, and transacts with a
plain [TxEnv].
fn transact_eth_with_inspector_ref_and_precompile_overrides<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
overrides: &SimulationPrecompileOverrides,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<EthEvmContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn transact_eth_simulation_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TxEnv,
overrides: &SimulationPrecompileOverrides,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<EthEvmContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Sourcefn transact_envelope_with_inspector_ref_and_context<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
pending: &PendingTransaction<FoundryTxEnvelope>,
monad_context: Option<MonadExecutionContext<'_>>,
) -> Result<(ResultAndState<HaltReason>, TxEnv), BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn transact_envelope_with_inspector_ref_and_context<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
pending: &PendingTransaction<FoundryTxEnvelope>,
monad_context: Option<MonadExecutionContext<'_>>,
) -> Result<(ResultAndState<HaltReason>, TxEnv), BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Executes an envelope through the active network EVM with optional Monad block context.
Returns both the execution result and the base [TxEnv].
Sourcefn replay_envelope_with_inspector_ref_and_context<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
pending: &PendingTransaction<FoundryTxEnvelope>,
execution: EnvelopeExecution<'_>,
) -> Result<(ResultAndState<HaltReason>, TxEnv), BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn replay_envelope_with_inspector_ref_and_context<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
pending: &PendingTransaction<FoundryTxEnvelope>,
execution: EnvelopeExecution<'_>,
) -> Result<(ResultAndState<HaltReason>, TxEnv), BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Replays a mined envelope through the active network’s canonical replay entry point.
fn transact_envelope_with_inspector_ref_and_context_kind<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
pending: &PendingTransaction<FoundryTxEnvelope>,
execution: EnvelopeExecution<'_>,
) -> Result<(ResultAndState<HaltReason>, TxEnv), BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Sourcefn build_tempo_evm_env(&self, evm_env: &EvmEnv) -> EvmEnvFor<TempoEvmNetwork>
fn build_tempo_evm_env(&self, evm_env: &EvmEnv) -> EvmEnvFor<TempoEvmNetwork>
Builds the Tempo [EvmEnv] (spec, gas params, [TempoBlockEnv]) from a base
env.
Sourcefn transact_tempo_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TempoTxEnv,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<TempoContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn transact_tempo_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: TempoTxEnv,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: Inspector<TempoContext<WrapDatabaseRef<&'db DB>>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
Creates a Tempo EVM, injects precompiles, and transacts with a native [TempoTxEnv].
Sourcefn execute_with_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
spec_id: SpecId,
hardfork: FoundryHardfork,
parent_beacon_block_root: Option<B256>,
execution_kind: BlockExecutionKind,
pool_transactions: &[Arc<PoolTransaction<FoundryTxEnvelope>>],
gas_config: &PoolTxGasConfig,
inspector_tx_config: &InspectorTxConfig,
validator: &dyn Fn(&PoolTransaction<FoundryTxEnvelope>, &AccountInfo) -> Result<(), InvalidTransactionError>,
) -> Result<(ExecutedPoolTransactions<FoundryTxEnvelope>, BlockExecutionResult<FoundryReceiptEnvelope>), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
fn execute_with_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
spec_id: SpecId,
hardfork: FoundryHardfork,
parent_beacon_block_root: Option<B256>,
execution_kind: BlockExecutionKind,
pool_transactions: &[Arc<PoolTransaction<FoundryTxEnvelope>>],
gas_config: &PoolTxGasConfig,
inspector_tx_config: &InspectorTxConfig,
validator: &dyn Fn(&PoolTransaction<FoundryTxEnvelope>, &AccountInfo) -> Result<(), InvalidTransactionError>,
) -> Result<(ExecutedPoolTransactions<FoundryTxEnvelope>, BlockExecutionResult<FoundryReceiptEnvelope>), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
Creates a concrete EVM + AnvilBlockExecutor, runs pre-execution changes, and
executes pool transactions. Returns the execution results and drops the EVM.
Sourcefn apply_simulation_pre_execution_changes<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
transitions: EthereumBlockTransitions,
) -> Result<(), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
fn apply_simulation_pre_execution_changes<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
transitions: EthereumBlockTransitions,
) -> Result<(), BlockchainError>where
DB: StateDB<Error = DatabaseError>,
Applies Ethereum block-start transitions to a disposable simulation candidate.
Sourcefn apply_simulation_post_execution_changes<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
transitions: EthereumBlockTransitions,
receipts: &[FoundryReceiptEnvelope],
) -> Result<Requests, BlockchainError>where
DB: StateDB<Error = DatabaseError>,
fn apply_simulation_post_execution_changes<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
transitions: EthereumBlockTransitions,
receipts: &[FoundryReceiptEnvelope],
) -> Result<Requests, BlockchainError>where
DB: StateDB<Error = DatabaseError>,
Applies Ethereum post-block transitions to a disposable simulation candidate.
Sourcefn build_call_env_with_base(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
block_env: BlockEnv,
base_evm_env: Option<&EvmEnv>,
) -> (EvmEnv, TxEnv, DepositTransactionParts)
fn build_call_env_with_base( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, base_evm_env: Option<&EvmEnv>, ) -> (EvmEnv, TxEnv, DepositTransactionParts)
§EVM settings
This modifies certain EVM settings to mirror geth’s SkipAccountChecks when transacting requests, see also: https://github.com/ethereum/go-ethereum/blob/380688c636a654becc8f114438c2a5d93d2db032/core/state_transition.go#L145-L148:
disable_eip3607is set totruedisable_base_feeis set totruetx_gas_limit_capis set toSome(u64::MAX)indicating no gas limit capnoncecheck is skipped
fn prepare_call_env( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<PreparedCall, BlockchainError>
fn prepare_call_env_from_base( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, base_evm_env: Option<&EvmEnv>, ) -> Result<PreparedCall, BlockchainError>
const fn base_call_tx_env(&self, tx_env: TxEnv) -> CallTxEnv
fn prepare_base_call_env_with_base( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, base_evm_env: Option<&EvmEnv>, ) -> PreparedCall
Sourcepub(crate) fn parse_transaction_request(
&self,
request: WithOtherFields<TransactionRequest>,
) -> Result<FoundryTransactionRequest, BlockchainError>
pub(crate) fn parse_transaction_request( &self, request: WithOtherFields<TransactionRequest>, ) -> Result<FoundryTransactionRequest, BlockchainError>
Classifies an RPC request according to the active network.
fn build_tempo_request_env( &self, request: TempoTransactionRequest, base: TxEnv, ) -> Result<(TempoTxEnv, AASigned), BlockchainError>
fn prepare_typed_call_env( &self, state: &dyn DatabaseRef, request: FoundryTransactionRequest, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<PreparedCall, BlockchainError>
fn prepare_typed_call_env_with_base( &self, state: &dyn DatabaseRef, request: FoundryTransactionRequest, fee_details: FeeDetails, block_env: BlockEnv, base_evm_env: Option<&EvmEnv>, ) -> Result<PreparedCall, BlockchainError>
fn transact_call_with_inspector_ref<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: CallTxEnv,
monad_context: Option<MonadExecutionContext<'_>>,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
fn transact_call_with_inspector_ref_at_hardfork<'db, I, DB>(
&self,
db: &'db DB,
evm_env: &EvmEnv,
inspector: &mut I,
tx_env: CallTxEnv,
monad_context: Option<MonadExecutionContext<'_>>,
hardfork: FoundryHardfork,
) -> Result<ResultAndState<HaltReason>, BlockchainError>where
DB: DatabaseRef + ?Sized,
I: BackendInspector<WrapDatabaseRef<&'db DB>>,
WrapDatabaseRef<&'db DB>: Database<Error = DatabaseError>,
pub fn call_with_state( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub(crate) fn call_with_state_and_context( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, monad_context: Option<MonadChainContext>, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub(crate) fn call_with_state_typed_gas_limit( &self, state: &dyn DatabaseRef, request: FoundryTransactionRequest, fee_details: FeeDetails, block_env: BlockEnv, options: GasEstimateCallOptions, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub(crate) fn call_with_state_typed_access_list( &self, state: &dyn DatabaseRef, request: FoundryTransactionRequest, fee_details: FeeDetails, block_env: BlockEnv, access_list: AccessList, monad_context: Option<MonadChainContext>, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
fn call_with_state_typed_inner( &self, state: &dyn DatabaseRef, request: FoundryTransactionRequest, fee_details: FeeDetails, block_env: BlockEnv, overrides: TypedCallOverrides, monad_context: Option<MonadChainContext>, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub fn build_access_list_with_state( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<(InstructionResult, Option<Output>, u64, AccessList), BlockchainError>
pub(crate) fn build_access_list_with_state_and_context( &self, state: &dyn DatabaseRef, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, monad_context: Option<MonadChainContext>, ) -> Result<(InstructionResult, Option<Output>, u64, AccessList), BlockchainError>
fn arbitrum_block_number(&self, evm_env: &EvmEnv) -> Option<u64>
pub fn get_code_with_state( &self, state: &dyn DatabaseRef, address: Address, ) -> Result<Bytes, BlockchainError>
pub fn get_balance_with_state<D>(
&self,
state: D,
address: Address,
) -> Result<U256, BlockchainError>where
D: DatabaseRef,
pub async fn transaction_by_block_number_and_index( &self, number: BlockNumber, index: Index, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub async fn transaction_by_block_hash_and_index( &self, hash: B256, index: Index, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub fn mined_transaction_by_block_hash_and_index( &self, block_hash: B256, index: Index, ) -> Option<AnyRpcTransaction>
pub async fn transaction_by_hash( &self, hash: B256, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub fn mined_transaction_by_hash(&self, hash: B256) -> Option<AnyRpcTransaction>
Sourcepub async fn trace_transaction(
&self,
hash: B256,
) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
pub async fn trace_transaction( &self, hash: B256, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
Returns the traces for the given transaction
Sourcepub async fn trace_get(
&self,
hash: B256,
indices: Vec<Index>,
) -> Result<Option<LocalizedTransactionTrace>, BlockchainError>
pub async fn trace_get( &self, hash: B256, indices: Vec<Index>, ) -> Result<Option<LocalizedTransactionTrace>, BlockchainError>
Returns a transaction trace at a given index.
Sourcepub async fn trace_block(
&self,
block: BlockNumber,
) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
pub async fn trace_block( &self, block: BlockNumber, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
Returns the traces for the given block
Sourcepub async fn trace_call(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
trace_types: HashSet<TraceType>,
block_request: BlockRequest<FoundryTxEnvelope>,
block_id: BlockId,
) -> Result<TraceResults, BlockchainError>where
Self: TransactionValidator<FoundryTxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
pub async fn trace_call(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
trace_types: HashSet<TraceType>,
block_request: BlockRequest<FoundryTxEnvelope>,
block_id: BlockId,
) -> Result<TraceResults, BlockchainError>where
Self: TransactionValidator<FoundryTxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
Executes a transaction call and returns requested parity trace results.
Sourcepub async fn trace_replay_block_transactions(
&self,
block: BlockNumber,
trace_types: HashSet<TraceType>,
) -> Result<Vec<TraceResultsWithTransactionHash>, BlockchainError>
pub async fn trace_replay_block_transactions( &self, block: BlockNumber, trace_types: HashSet<TraceType>, ) -> Result<Vec<TraceResultsWithTransactionHash>, BlockchainError>
Replays all transactions in a block and returns the requested traces for each transaction
Sourcepub async fn trace_replay_transaction(
&self,
hash: B256,
trace_types: HashSet<TraceType>,
) -> Result<TraceResults, BlockchainError>
pub async fn trace_replay_transaction( &self, hash: B256, trace_types: HashSet<TraceType>, ) -> Result<TraceResults, BlockchainError>
Replays a mined transaction and returns the requested traces.
Sourcepub async fn trace_raw_transaction(
&self,
pending_transaction: PendingTransaction<FoundryTxEnvelope>,
trace_types: HashSet<TraceType>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<TraceResults, BlockchainError>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
pub async fn trace_raw_transaction(
&self,
pending_transaction: PendingTransaction<FoundryTxEnvelope>,
trace_types: HashSet<TraceType>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<TraceResults, BlockchainError>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
Traces a raw transaction without committing it to the chain state or mempool.
Sourcepub async fn trace_call_many(
&self,
calls: Vec<(WithOtherFields<TransactionRequest>, HashSet<TraceType>)>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<Vec<TraceResults>, BlockchainError>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
pub async fn trace_call_many(
&self,
calls: Vec<(WithOtherFields<TransactionRequest>, HashSet<TraceType>)>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<Vec<TraceResults>, BlockchainError>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
Traces calls sequentially against a shared in-memory state.
Sourcefn mined_parity_trace_replay_block_transactions(
&self,
block_number: u64,
trace_types: &HashSet<TraceType>,
) -> Result<Option<Vec<TraceResultsWithTransactionHash>>, BlockchainError>
fn mined_parity_trace_replay_block_transactions( &self, block_number: u64, trace_types: &HashSet<TraceType>, ) -> Result<Option<Vec<TraceResultsWithTransactionHash>>, BlockchainError>
Returns the trace results for all transactions in a mined block by replaying them
Sourcefn replay_block_transactions_with_inspector(
&self,
block: &Block,
parent_state: &StateDb,
trace_config: TracingInspectorConfig,
trace_types: &HashSet<TraceType>,
) -> Result<Vec<TraceResultsWithTransactionHash>, BlockchainError>
fn replay_block_transactions_with_inspector( &self, block: &Block, parent_state: &StateDb, trace_config: TracingInspectorConfig, trace_types: &HashSet<TraceType>, ) -> Result<Vec<TraceResultsWithTransactionHash>, BlockchainError>
Replays all transactions in a block with the tracing inspector to generate TraceResults
pub async fn trace_filter( &self, filter: TraceFilter, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
pub fn get_blobs_by_block_id( &self, id: impl Into<BlockId>, versioned_hashes: Vec<B256>, ) -> Result<Option<Vec<Blob>>>
pub fn get_blob_by_versioned_hash(&self, hash: B256) -> Result<Option<Blob>>
Sourcepub async fn with_genesis(
db: Arc<AsyncRwLock<Box<dyn Db>>>,
env: Arc<RwLock<EvmEnv>>,
networks: NetworkConfigs,
genesis: GenesisConfig,
fees: FeeManager,
fork: Arc<RwLock<Option<ClientFork>>>,
enable_steps_tracing: bool,
print_logs: bool,
print_traces: bool,
call_trace_decoder: Arc<CallTraceDecoder>,
prune_state_history_config: PruneStateHistoryConfig,
max_persisted_states: Option<usize>,
transaction_block_keeper: Option<usize>,
automine_block_time: Option<Duration>,
cache_path: Option<PathBuf>,
node_config: Arc<AsyncRwLock<NodeConfig>>,
) -> Result<Self>
pub async fn with_genesis( db: Arc<AsyncRwLock<Box<dyn Db>>>, env: Arc<RwLock<EvmEnv>>, networks: NetworkConfigs, genesis: GenesisConfig, fees: FeeManager, fork: Arc<RwLock<Option<ClientFork>>>, enable_steps_tracing: bool, print_logs: bool, print_traces: bool, call_trace_decoder: Arc<CallTraceDecoder>, prune_state_history_config: PruneStateHistoryConfig, max_persisted_states: Option<usize>, transaction_block_keeper: Option<usize>, automine_block_time: Option<Duration>, cache_path: Option<PathBuf>, node_config: Arc<AsyncRwLock<NodeConfig>>, ) -> Result<Self>
Initialises the balance of the given accounts
Sourceasync fn apply_genesis(&self) -> Result<(), DatabaseError>
async fn apply_genesis(&self) -> Result<(), DatabaseError>
Applies the configured genesis settings
This will fund, create the genesis accounts
Sourceasync fn apply_fork_genesis(
&self,
db: Arc<AsyncRwLock<Box<dyn Db>>>,
cache_lease: StagedForkCacheLease,
) -> Result<(), DatabaseError>
async fn apply_fork_genesis( &self, db: Arc<AsyncRwLock<Box<dyn Db>>>, cache_lease: StagedForkCacheLease, ) -> Result<(), DatabaseError>
Applies genesis allocations to a fork database before it becomes live.
Sourceasync fn apply_funded_accounts(
&self,
db: &Arc<AsyncRwLock<Box<dyn Db>>>,
) -> Result<(), DatabaseError>
async fn apply_funded_accounts( &self, db: &Arc<AsyncRwLock<Box<dyn Db>>>, ) -> Result<(), DatabaseError>
Applies explicit --fund balances while preserving account metadata inherited from a fork.
Sourcefn populate_memory_db(
db: &mut dyn Db,
genesis: &GenesisConfig,
funded_accounts: &HashMap<Address, U256>,
hardfork: FoundryHardfork,
chain_id: u64,
is_tempo: bool,
tempo_hardfork: Option<TempoHardfork>,
genesis_hash: B256,
install_create2_deployer: bool,
) -> Result<(), DatabaseError>
fn populate_memory_db( db: &mut dyn Db, genesis: &GenesisConfig, funded_accounts: &HashMap<Address, U256>, hardfork: FoundryHardfork, chain_id: u64, is_tempo: bool, tempo_hardfork: Option<TempoHardfork>, genesis_hash: B256, install_create2_deployer: bool, ) -> Result<(), DatabaseError>
Populates a detached in-memory database from explicit reset inputs.
Sourcepub(crate) async fn prepare_fork_reset(
&self,
forking: Forking,
serving_instance_id: B256,
) -> Result<StagedForkReset, BlockchainError>
pub(crate) async fn prepare_fork_reset( &self, forking: Forking, serving_instance_id: B256, ) -> Result<StagedForkReset, BlockchainError>
Prepares a fresh fork without mutating the live backend.
Sourceasync fn stage_fork_reset(
&self,
target_rpc_urls: &[String],
block_number: Option<u64>,
serving_instance_id: B256,
previous_source: Option<ForkCacheSource>,
flush_old_cache: bool,
rpc_url_was_provided: bool,
) -> Result<Option<StagedForkReset>, BlockchainError>
async fn stage_fork_reset( &self, target_rpc_urls: &[String], block_number: Option<u64>, serving_instance_id: B256, previous_source: Option<ForkCacheSource>, flush_old_cache: bool, rpc_url_was_provided: bool, ) -> Result<Option<StagedForkReset>, BlockchainError>
Builds and validates one complete fork replacement without mutating the live backend.
async fn rollback_staged_fork_cache( &self, cache_lease: StagedForkCacheLease, restore_live_cache: bool, ) -> Result<(), BlockchainError>
Sourcepub(crate) async fn commit_fork_reset(
&self,
staged: StagedForkReset,
) -> Result<(), BlockchainError>
pub(crate) async fn commit_fork_reset( &self, staged: StagedForkReset, ) -> Result<(), BlockchainError>
Atomically publishes a fully prepared fork replacement.
Sourcepub(crate) async fn prepare_memory_reset(
&self,
) -> Result<StagedMemoryReset<N>, BlockchainError>
pub(crate) async fn prepare_memory_reset( &self, ) -> Result<StagedMemoryReset<N>, BlockchainError>
Builds a complete in-memory replacement without mutating the live backend.
Sourcepub(crate) async fn commit_memory_reset(
&self,
staged: StagedMemoryReset<N>,
) -> Result<(), BlockchainError>
pub(crate) async fn commit_memory_reset( &self, staged: StagedMemoryReset<N>, ) -> Result<(), BlockchainError>
Atomically publishes a fully prepared in-memory replacement.
Sourcepub async fn revert_state_snapshot(
&self,
id: U256,
) -> Result<bool, BlockchainError>
pub async fn revert_state_snapshot( &self, id: U256, ) -> Result<bool, BlockchainError>
Reverts the state to the state snapshot identified by the given id.
Sourcepub async fn inspect_tx(
&self,
tx: Arc<PoolTransaction<FoundryTxEnvelope>>,
) -> Result<(InstructionResult, Option<Output>, u64, State, Vec<Log>), BlockchainError>
pub async fn inspect_tx( &self, tx: Arc<PoolTransaction<FoundryTxEnvelope>>, ) -> Result<(InstructionResult, Option<Output>, u64, State, Vec<Log>), BlockchainError>
executes the transactions without writing to the underlying database
Source§impl<N: Network> Backend<N>where
N::ReceiptEnvelope: TxReceipt<Log = Log>,
impl<N: Network> Backend<N>where
N::ReceiptEnvelope: TxReceipt<Log = Log>,
Sourcefn mined_logs_for_block(
&self,
filter: Filter,
block: Block,
block_hash: B256,
) -> Vec<Log>
fn mined_logs_for_block( &self, filter: Filter, block: Block, block_hash: B256, ) -> Vec<Log>
Returns all Logs mined by the node that were emitted in the block and match the Filter
Sourcefn removed_logs_since(&self, block_number: u64) -> Vec<Log>
fn removed_logs_since(&self, block_number: u64) -> Vec<Log>
Returns all logs of the blocks with a number greater than block_number, marked as
removed.
This is used during a reorg to capture the logs of the blocks that are about to be
unwound before their transactions and receipts are cleared from storage, so they can be
re-delivered to log subscriptions and filters with removed: true.
Sourceasync fn logs_for_block(
&self,
filter: Filter,
hash: B256,
) -> Result<Vec<Log>, BlockchainError>
async fn logs_for_block( &self, filter: Filter, hash: B256, ) -> Result<Vec<Log>, BlockchainError>
Returns the logs of the block that match the filter
Sourceasync fn logs_for_range(
&self,
filter: &Filter,
from: u64,
to: u64,
) -> Result<Vec<Log>, BlockchainError>
async fn logs_for_range( &self, filter: &Filter, from: u64, to: u64, ) -> Result<Vec<Log>, BlockchainError>
Returns the logs that match the filter in the given range of blocks
Sourcepub async fn logs(&self, filter: Filter) -> Result<Vec<Log>, BlockchainError>
pub async fn logs(&self, filter: Filter) -> Result<Vec<Log>, BlockchainError>
Returns the logs according to the filter
Sourcepub fn mined_receipts(&self, hash: B256) -> Option<Vec<N::ReceiptEnvelope>>
pub fn mined_receipts(&self, hash: B256) -> Option<Vec<N::ReceiptEnvelope>>
Returns all receipts of the block
Source§impl<N> Backend<N>where
Self: TransactionValidator<FoundryTxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
impl<N> Backend<N>where
Self: TransactionValidator<FoundryTxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
Sourcepub async fn mine_block(
&self,
pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>,
) -> Result<MinedBlockOutcome<FoundryTxEnvelope>, BlockchainError>
pub async fn mine_block( &self, pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>, ) -> Result<MinedBlockOutcome<FoundryTxEnvelope>, BlockchainError>
Mines a new block and stores it.
this will execute all transaction in the order they come in and return all the markers they provide.
Sourcepub(crate) async fn apply_fork_transaction_replay(
&self,
replay: ForkTransactionReplay,
) -> Result<()>
pub(crate) async fn apply_fork_transaction_replay( &self, replay: ForkTransactionReplay, ) -> Result<()>
Replays a transaction-hash fork prefix before the live pool and miner are created.
fn execute_with_replay_block_executor<DB>(
&self,
db: DB,
evm_env: &EvmEnv,
parent_hash: B256,
arbitrum_rpc_block_number: Option<u64>,
hardfork: FoundryHardfork,
parent_beacon_block_root: Option<B256>,
transactions: &[HistoricalReplayTransaction],
inspector_tx_config: &InspectorTxConfig,
monad_context: Option<MonadChainContext>,
) -> Result<ExecutedHistoricalReplay>where
DB: StateDB<Error = DatabaseError>,
Sourcefn build_block_info(
&self,
evm_env: &EvmEnv,
parent_hash: B256,
number: u64,
state_root: B256,
block_result: BlockExecutionResult<FoundryReceiptEnvelope>,
transactions: Vec<MaybeImpersonatedTransaction<FoundryTxEnvelope>>,
transaction_infos: Vec<TransactionInfo>,
parent_beacon_block_root: Option<B256>,
) -> BlockInfo<N>
fn build_block_info( &self, evm_env: &EvmEnv, parent_hash: B256, number: u64, state_root: B256, block_result: BlockExecutionResult<FoundryReceiptEnvelope>, transactions: Vec<MaybeImpersonatedTransaction<FoundryTxEnvelope>>, transaction_infos: Vec<TransactionInfo>, parent_beacon_block_root: Option<B256>, ) -> BlockInfo<N>
Builds a BlockInfo from the EVM environment, execution results, and transactions.
async fn do_mine_block( &self, pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>, ) -> Result<MinedBlockOutcome<FoundryTxEnvelope>, BlockchainError>
Sourcepub async fn reorg(
&self,
depth: u64,
tx_pairs: HashMap<u64, Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>>,
common_block: Block,
) -> Result<(), BlockchainError>
pub async fn reorg( &self, depth: u64, tx_pairs: HashMap<u64, Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>>, common_block: Block, ) -> Result<(), BlockchainError>
Reorg the chain to a common height and execute blocks to build new chain.
The state of the chain is rewound using rewind to the common block, including the db,
storage, and env.
Finally, do_mine_block is called to create the new chain.
Sourcepub async fn pending_block(
&self,
pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>,
) -> BlockInfo<N>
pub async fn pending_block( &self, pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>, ) -> BlockInfo<N>
Creates the pending block
This will execute all transaction in the order they come but will not mine the block
Sourcepub async fn with_pending_block<F, T>(
&self,
pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>,
f: F,
) -> T
pub async fn with_pending_block<F, T>( &self, pool_transactions: Vec<Arc<PoolTransaction<FoundryTxEnvelope>>>, f: F, ) -> T
Creates the pending block
This will execute all transaction in the order they come but will not mine the block
Sourcepub async fn get_fee_token_balance(
&self,
token: Address,
account: Address,
) -> Result<U256, BlockchainError>
pub async fn get_fee_token_balance( &self, token: Address, account: Address, ) -> Result<U256, BlockchainError>
Returns the ERC20/TIP20 token balance for an account.
Calls balanceOf(address) on the token contract. Returns U256::ZERO if
the call fails (e.g. the token contract doesn’t exist).
Sourcepub async fn tempo_fee_payer(&self) -> Option<Address>
pub async fn tempo_fee_payer(&self) -> Option<Address>
Returns the account used to sponsor Tempo fee-payer requests handled by this node.
Returns None on non-Tempo networks.
Sourcepub async fn tempo_user_fee_token(
&self,
account: Address,
) -> Result<Address, BlockchainError>
pub async fn tempo_user_fee_token( &self, account: Address, ) -> Result<Address, BlockchainError>
Returns the fee token an account pays with, as stored in the Tempo fee manager.
Falls back to PathUSD when the account has no stored preference or the lookup fails.
Sourcepub async fn call(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
overrides: EvmOverrides,
) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub async fn call( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_request: Option<BlockRequest<FoundryTxEnvelope>>, overrides: EvmOverrides, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
Executes the [TransactionRequest] without writing to the DB
§Errors
Returns an error if the block_number is greater than the current height
pub async fn call_with_tracing( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_request: Option<BlockRequest<FoundryTxEnvelope>>, opts: GethDebugTracingCallOptions, ) -> Result<GethTrace, BlockchainError>
async fn call_with_tracing_at_tx_index( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_request: Option<BlockRequest<FoundryTxEnvelope>>, tx_index: u64, tracing_options: GethDebugTracingOptions, state_overrides: Option<StateOverride>, block_overrides: Option<BlockOverrides>, ) -> Result<GethTrace, BlockchainError>
fn mined_trace_call_at_tx_index( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block: &Block, tx_index: usize, tracing_options: GethDebugTracingOptions, state_overrides: Option<StateOverride>, block_overrides: Option<BlockOverrides>, ) -> Result<GethTrace, BlockchainError>
fn trace_call_with_state( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block: BlockEnv, cache_db: CacheDB<Box<dyn MaybeFullDatabase + '_>>, tracing_options: GethDebugTracingOptions, state_overrides: Option<StateOverride>, block_overrides: Option<BlockOverrides>, monad_context: Option<MonadChainContext>, historical_execution: Option<(EvmEnv, FoundryHardfork)>, ) -> Result<GethTrace, BlockchainError>
Sourcepub async fn with_database_at<F, T>(
&self,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
f: F,
) -> Result<T, BlockchainError>
pub async fn with_database_at<F, T>( &self, block_request: Option<BlockRequest<FoundryTxEnvelope>>, f: F, ) -> Result<T, BlockchainError>
Helper function to execute a closure with the database at a specific block
Sourcepub(crate) async fn with_database_at_and_context<F, T>(
&self,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
f: F,
) -> Result<T, BlockchainError>where
F: FnOnce(Box<dyn MaybeFullDatabase + '_>, BlockEnv, Option<MonadChainContext>) -> Result<T, BlockchainError>,
pub(crate) async fn with_database_at_and_context<F, T>(
&self,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
f: F,
) -> Result<T, BlockchainError>where
F: FnOnce(Box<dyn MaybeFullDatabase + '_>, BlockEnv, Option<MonadChainContext>) -> Result<T, BlockchainError>,
Executes a closure with both state and network context at a specific block.
pub async fn storage_at( &self, address: Address, index: U256, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<B256, BlockchainError>
pub async fn tempo_nonce( &self, caller: Address, nonce_key: U256, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<u64, BlockchainError>
Sourcepub async fn storage_values(
&self,
requests: HashMap<Address, Vec<B256>>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<HashMap<Address, Vec<B256>>, BlockchainError>
pub async fn storage_values( &self, requests: HashMap<Address, Vec<B256>>, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<HashMap<Address, Vec<B256>>, BlockchainError>
Returns storage values for multiple accounts and slots in a single call.
Sourcepub async fn get_code(
&self,
address: Address,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<Bytes, BlockchainError>
pub async fn get_code( &self, address: Address, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<Bytes, BlockchainError>
Returns the code of the address
If the code is not present and fork mode is enabled then this will try to fetch it from the forked client
Sourcepub async fn get_balance(
&self,
address: Address,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<U256, BlockchainError>
pub async fn get_balance( &self, address: Address, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<U256, BlockchainError>
Returns the balance of the address
If the requested number predates the fork then this will fetch it from the endpoint
pub async fn get_account_at_block( &self, address: Address, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<TrieAccount, BlockchainError>
Sourcepub async fn get_nonce(
&self,
address: Address,
block_request: BlockRequest<FoundryTxEnvelope>,
) -> Result<u64, BlockchainError>
pub async fn get_nonce( &self, address: Address, block_request: BlockRequest<FoundryTxEnvelope>, ) -> Result<u64, BlockchainError>
Returns the nonce of the address
If the requested number predates the fork then this will fetch it from the endpoint
fn replay_tx_with_inspector<I, F, T>( &self, hash: B256, inspector: I, f: F, ) -> Result<T, BlockchainError>
Sourcepub async fn trace_tx_with_js_tracer(
&self,
hash: B256,
code: String,
opts: GethDebugTracingOptions,
) -> Result<GethTrace, BlockchainError>
Available on crate feature js-tracer only.
pub async fn trace_tx_with_js_tracer( &self, hash: B256, code: String, opts: GethDebugTracingOptions, ) -> Result<GethTrace, BlockchainError>
js-tracer only.Traces the transaction with the js tracer
Sourcepub async fn prove_account_at(
&self,
address: Address,
keys: Vec<B256>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<AccountProof, BlockchainError>
pub async fn prove_account_at( &self, address: Address, keys: Vec<B256>, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<AccountProof, BlockchainError>
Prove an account’s existence or nonexistence in the state trie.
Returns a merkle proof of the account’s trie node, account_key == keccak(address)
Source§impl<N> Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
impl<N> Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
Sourcepub async fn trace_transaction_opcode_gas(
&self,
hash: B256,
) -> Result<Option<TransactionOpcodeGas>, BlockchainError>
pub async fn trace_transaction_opcode_gas( &self, hash: B256, ) -> Result<Option<TransactionOpcodeGas>, BlockchainError>
Returns opcode gas usage for the given transaction.
Sourcepub async fn trace_block_opcode_gas(
&self,
block_id: BlockId,
) -> Result<Option<BlockOpcodeGas>, BlockchainError>
pub async fn trace_block_opcode_gas( &self, block_id: BlockId, ) -> Result<Option<BlockOpcodeGas>, BlockchainError>
Returns opcode gas usage for all transactions in the given block.
fn mined_block_opcode_gas( &self, block: &Block, block_hash: B256, ) -> Result<BlockOpcodeGas, BlockchainError>
Sourcepub async fn debug_execution_witness(
&self,
block: BlockNumber,
) -> Result<ExecutionWitness, BlockchainError>
pub async fn debug_execution_witness( &self, block: BlockNumber, ) -> Result<ExecutionWitness, BlockchainError>
Returns a best-effort execution witness for the given block, in the same format as reth’s
debug_executionWitness.
Anvil does not track which state a block’s execution actually touched, so this returns a witness for the entire parent state instead: the RLP encoding of every node of the parent state trie (including all storage tries), all contract codes, and the preimages of all account addresses and storage slots. This is a strict superset of the minimal witness, so stateless re-execution of the block against it works, but the witness size grows with the total state instead of the state accessed by the block.
Limitations:
- Not supported while forking: only remotely accessed accounts are known locally, and the locally computed state roots do not match the remote chain’s roots.
- The parent block’s state must still be available in the state history, i.e. it must not
have been discarded via
--prune-history. - The genesis block has no witness since it has no parent state.
headerscontains the ancestor headers within the 256 blockBLOCKHASHwindow that are known locally, which may be fewer than 256.
Sourcepub async fn debug_account_info_at(
&self,
block_id: BlockId,
tx_index: Index,
address: Address,
) -> Result<Option<RpcAccountInfo>, BlockchainError>
pub async fn debug_account_info_at( &self, block_id: BlockId, tx_index: Index, address: Address, ) -> Result<Option<RpcAccountInfo>, BlockchainError>
Returns account information after replaying a block through the transaction at tx_index.
fn mined_debug_account_info_at( &self, block: &Block, tx_index: Index, address: Address, ) -> Result<RpcAccountInfo, BlockchainError>
Sourcepub async fn rollback(&self, common_block: Block) -> Result<(), BlockchainError>
pub async fn rollback(&self, common_block: Block) -> Result<(), BlockchainError>
Rollback the chain to a common height.
The state of the chain is rewound using rewind to the common block, including the db,
storage, and env.
Sourcepub async fn debug_trace_transaction(
&self,
hash: B256,
opts: GethDebugTracingOptions,
) -> Result<GethTrace, BlockchainError>
pub async fn debug_trace_transaction( &self, hash: B256, opts: GethDebugTracingOptions, ) -> Result<GethTrace, BlockchainError>
Returns the traces for the given transaction
Sourcepub async fn debug_trace_block(
&self,
rlp_block: Bytes,
opts: GethDebugTracingOptions,
) -> Result<Vec<TraceResult>, BlockchainError>
pub async fn debug_trace_block( &self, rlp_block: Bytes, opts: GethDebugTracingOptions, ) -> Result<Vec<TraceResult>, BlockchainError>
Returns geth-style traces for all transactions in an RLP-encoded block.
Sourcepub async fn debug_trace_block_by_hash(
&self,
block_hash: B256,
opts: GethDebugTracingOptions,
) -> Result<Vec<TraceResult>, BlockchainError>
pub async fn debug_trace_block_by_hash( &self, block_hash: B256, opts: GethDebugTracingOptions, ) -> Result<Vec<TraceResult>, BlockchainError>
Returns geth-style traces for all transactions in a block by hash.
Sourcepub async fn debug_trace_block_by_number(
&self,
block_number: BlockNumber,
opts: GethDebugTracingOptions,
) -> Result<Vec<TraceResult>, BlockchainError>
pub async fn debug_trace_block_by_number( &self, block_number: BlockNumber, opts: GethDebugTracingOptions, ) -> Result<Vec<TraceResult>, BlockchainError>
Returns geth-style traces for all transactions in a block by number.
fn geth_trace( &self, tx: &MinedTransaction<N>, opts: GethDebugTracingOptions, ) -> Result<GethTrace, BlockchainError>
async fn mined_geth_trace_transaction( &self, hash: B256, opts: GethDebugTracingOptions, ) -> Option<Result<GethTrace, BlockchainError>>
pub async fn transaction_receipt( &self, hash: B256, ) -> Result<Option<FoundryTxReceipt>, BlockchainError>
Sourcepub fn mined_block_receipts(
&self,
id: impl Into<BlockId>,
) -> Option<Vec<FoundryTxReceipt>>
pub fn mined_block_receipts( &self, id: impl Into<BlockId>, ) -> Option<Vec<FoundryTxReceipt>>
Returns all transaction receipts of the block
Sourcepub(crate) fn mined_transaction_receipt(
&self,
hash: B256,
) -> Option<MinedTransactionReceipt<FoundryNetwork>>
pub(crate) fn mined_transaction_receipt( &self, hash: B256, ) -> Option<MinedTransactionReceipt<FoundryNetwork>>
Returns the transaction receipt for the given hash
fn build_mined_transaction_receipt( &self, info: &TransactionInfo, tx_receipt: FoundryReceiptEnvelope, block_hash: B256, block: &Block, next_log_index: usize, ) -> MinedTransactionReceipt<FoundryNetwork>
Sourcepub async fn block_receipts(
&self,
number: BlockId,
) -> Result<Option<Vec<FoundryTxReceipt>>, BlockchainError>
pub async fn block_receipts( &self, number: BlockId, ) -> Result<Option<Vec<FoundryTxReceipt>>, BlockchainError>
Returns the blocks receipts for the given number
Source§impl<N: Network<ReceiptEnvelope = FoundryReceiptEnvelope>> Backend<N>
impl<N: Network<ReceiptEnvelope = FoundryReceiptEnvelope>> Backend<N>
Sourcepub async fn serialized_state(
&self,
preserve_historical_states: bool,
) -> Result<SerializableState, BlockchainError>
pub async fn serialized_state( &self, preserve_historical_states: bool, ) -> Result<SerializableState, BlockchainError>
Get the current state.
Sourcepub async fn dump_state(
&self,
preserve_historical_states: bool,
) -> Result<Bytes, BlockchainError>
pub async fn dump_state( &self, preserve_historical_states: bool, ) -> Result<Bytes, BlockchainError>
Write all chain data to serialized bytes buffer
Sourcepub async fn load_state(
&self,
state: SerializableState,
) -> Result<bool, BlockchainError>
pub async fn load_state( &self, state: SerializableState, ) -> Result<bool, BlockchainError>
Apply SerializableState data to the backend storage.
Sourcepub async fn load_state_bytes(
&self,
buf: Bytes,
) -> Result<bool, BlockchainError>
pub async fn load_state_bytes( &self, buf: Bytes, ) -> Result<bool, BlockchainError>
Deserialize and add all chain data to the backend storage
Source§impl Backend<FoundryNetwork>
impl Backend<FoundryNetwork>
Sourcepub async fn call_bundle(
&self,
bundle: EthCallBundle,
transactions: Vec<PendingTransaction<FoundryTxEnvelope>>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
) -> Result<EthCallBundleResponse, BlockchainError>
pub async fn call_bundle( &self, bundle: EthCallBundle, transactions: Vec<PendingTransaction<FoundryTxEnvelope>>, block_request: Option<BlockRequest<FoundryTxEnvelope>>, ) -> Result<EthCallBundleResponse, BlockchainError>
Simulates a bundle of signed transactions and returns Flashbots-compatible results.
Sourcepub async fn call_many(
&self,
bundles: Vec<Bundle<WithOtherFields<TransactionRequest>>>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
state_override: Option<StateOverride>,
) -> Result<Vec<Vec<EthCallResponse>>, BlockchainError>
pub async fn call_many( &self, bundles: Vec<Bundle<WithOtherFields<TransactionRequest>>>, block_request: Option<BlockRequest<FoundryTxEnvelope>>, state_override: Option<StateOverride>, ) -> Result<Vec<Vec<EthCallResponse>>, BlockchainError>
Executes bundles of call requests and returns each call output.
Sourcepub async fn simulate(
&self,
request: SimulatePayload,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
block_interval: u64,
) -> Result<Vec<SimulatedBlock<AnyRpcBlock>>, BlockchainError>
pub async fn simulate( &self, request: SimulatePayload, block_request: Option<BlockRequest<FoundryTxEnvelope>>, block_interval: u64, ) -> Result<Vec<SimulatedBlock<AnyRpcBlock>>, BlockchainError>
Simulates the payload by executing the calls in request.
Sourcepub(crate) async fn simulate_raw(
&self,
request: SimulatePayload<WithOtherFields<TransactionRequest>>,
block_request: Option<BlockRequest<FoundryTxEnvelope>>,
block_interval: u64,
) -> Result<Vec<SimulatedBlock<AnyRpcBlock>>, BlockchainError>
pub(crate) async fn simulate_raw( &self, request: SimulatePayload<WithOtherFields<TransactionRequest>>, block_request: Option<BlockRequest<FoundryTxEnvelope>>, block_interval: u64, ) -> Result<Vec<SimulatedBlock<AnyRpcBlock>>, BlockchainError>
Simulates a payload while preserving transaction extension fields.
pub fn get_blob_by_tx_hash(&self, hash: B256) -> Result<Option<Vec<Blob>>>
Sourcepub async fn set_fee_token(
&self,
user: Address,
token: Address,
) -> DatabaseResult<()>
pub async fn set_fee_token( &self, user: Address, token: Address, ) -> DatabaseResult<()>
Sets the fee token for a user address (Tempo-only).
Sourcepub async fn set_validator_fee_token(
&self,
validator: Address,
token: Address,
) -> DatabaseResult<()>
pub async fn set_validator_fee_token( &self, validator: Address, token: Address, ) -> DatabaseResult<()>
Sets the fee token for a validator address (Tempo-only).
Sourcepub async fn set_fee_amm_liquidity(
&self,
user_token: Address,
validator_token: Address,
amount: U256,
) -> DatabaseResult<()>
pub async fn set_fee_amm_liquidity( &self, user_token: Address, validator_token: Address, amount: U256, ) -> DatabaseResult<()>
Mints FeeAMM liquidity for a token pair (Tempo-only).
Sourcepub async fn set_tip20_balance(
&self,
address: Address,
token_address: Address,
balance: U256,
) -> DatabaseResult<()>
pub async fn set_tip20_balance( &self, address: Address, token_address: Address, balance: U256, ) -> DatabaseResult<()>
Sets an account’s balance for a deployed TIP-20 token (Tempo-only).
Sourcepub async fn try_set_tip20_balance(
&self,
address: Address,
token_address: Address,
balance: U256,
) -> DatabaseResult<bool>
pub async fn try_set_tip20_balance( &self, address: Address, token_address: Address, balance: U256, ) -> DatabaseResult<bool>
Sets an account’s balance if the address is a deployed TIP-20 token (Tempo-only).
Sourceasync fn with_tempo_storage<R>(&self, f: impl FnOnce() -> R) -> R
async fn with_tempo_storage<R>(&self, f: impl FnOnce() -> R) -> R
Runs f inside a Tempo storage context initialized from the current state
(Tempo-only).
Source§impl<N> Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
impl<N> Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
Sourcefn validate_mining_pool_transaction_for(
&self,
pool_tx: &PoolTransaction<FoundryTxEnvelope>,
account: &AccountInfo,
evm_env: &EvmEnv,
) -> Result<(), InvalidTransactionError>
fn validate_mining_pool_transaction_for( &self, pool_tx: &PoolTransaction<FoundryTxEnvelope>, account: &AccountInfo, evm_env: &EvmEnv, ) -> Result<(), InvalidTransactionError>
Validates a transaction candidate selected for mining.
Trait Implementations§
Source§impl<N> TransactionValidator<FoundryTxEnvelope> for Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
impl<N> TransactionValidator<FoundryTxEnvelope> for Backend<N>where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + Network,
Source§fn validate_pool_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 PendingTransaction<FoundryTxEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_pool_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 PendingTransaction<FoundryTxEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn validate_pool_transaction_for(
&self,
pending: &PendingTransaction<FoundryTxEnvelope>,
account: &AccountInfo,
evm_env: &EvmEnv,
) -> Result<(), InvalidTransactionError>
fn validate_pool_transaction_for( &self, pending: &PendingTransaction<FoundryTxEnvelope>, account: &AccountInfo, evm_env: &EvmEnv, ) -> Result<(), InvalidTransactionError>
Source§fn validate_for(
&self,
tx: &PendingTransaction<FoundryTxEnvelope>,
account: &AccountInfo,
evm_env: &EvmEnv,
) -> Result<(), InvalidTransactionError>
fn validate_for( &self, tx: &PendingTransaction<FoundryTxEnvelope>, account: &AccountInfo, evm_env: &EvmEnv, ) -> Result<(), InvalidTransactionError>
Auto Trait Implementations§
impl<N> !Freeze for Backend<N>
impl<N> !RefUnwindSafe for Backend<N>
impl<N> !UnwindSafe for Backend<N>
impl<N> Send for Backend<N>where
Blockchain<N>: Send,
impl<N> Sync for Backend<N>where
Blockchain<N>: Sync,
impl<N> Unpin for Backend<N>where
Blockchain<N>: Unpin,
impl<N> UnsafeUnpin for Backend<N>where
Blockchain<N>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Conv for T
impl<T> Conv for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
§fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
TxEnv] from a transaction and a sender address.§impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
§fn from_encoded_tx(tx: &&T, sender: Address, encoded: Bytes) -> TxEnv
fn from_encoded_tx(tx: &&T, sender: Address, encoded: Bytes) -> TxEnv
TxEnv] from a transaction, its sender, and encoded transaction bytes.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].impl<T> MaybeCompact for T
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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: 1200 bytes