Skip to main content

FoundryExecutionHooks

Trait FoundryExecutionHooks 

Source
pub trait FoundryExecutionHooks: EvmTypes {
    // Provided methods
    fn sync_transaction(_evm: &mut Evm<'_, Self>) { ... }
    fn refresh_transaction(_evm: &mut Evm<'_, Self>) { ... }
    fn refresh_switched_transaction(
        evm: &mut Evm<'_, Self>,
        _original: &AddressMap<Option<AccountInfo>>,
    ) { ... }
    fn tx_call_depth_offset(_tx: &Self::Tx) -> u16 { ... }
}
Expand description

Execution-family hooks for state Foundry changes outside ordinary EVM execution.

These operate on the running EVM, independently of factory configuration. evm2 still owns transaction and frame execution; the lifecycle and inspectors coordinate these hooks.

Provided Methods§

Source

fn sync_transaction(_evm: &mut Evm<'_, Self>)

Folds the running transaction’s execution so far into network state derived from it, such as Monad’s reserve-balance tracker. Call it before Foundry changes that state outside execution, then call Self::refresh_transaction.

Source

fn refresh_transaction(_evm: &mut Evm<'_, Self>)

Rebases network state derived from the running transaction’s state onto that state after Foundry changed it outside execution, such as cheatcode writes and isolated calls. The change itself is not execution: Monad’s reserve-balance tracker recomputes the thresholds of its tracked accounts without recording debits or credits.

Source

fn refresh_switched_transaction( evm: &mut Evm<'_, Self>, _original: &AddressMap<Option<AccountInfo>>, )

Like Self::refresh_transaction, after a fork switch accepted the running transaction’s changes: original holds the transaction-start info of the persistent accounts it carried.

Source

fn tx_call_depth_offset(_tx: &Self::Tx) -> u16

Returns how many levels below the transaction its handler runs tx’s top-level calls, such as one for Tempo’s AA transactions. A nested transaction lowers its initial call depth by it, so its calls keep their depth in the surrounding trace.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FoundryExecutionHooks for BaseEvmTypes

Available on crate feature base only.
Source§

impl FoundryExecutionHooks for BaseEvmTypes

Source§

impl FoundryExecutionHooks for MonadEvmTypes

Available on crate feature monad only.
Source§

fn sync_transaction(evm: &mut Evm<'_, Self>)

Source§

fn refresh_transaction(evm: &mut Evm<'_, Self>)

Source§

fn refresh_switched_transaction( evm: &mut Evm<'_, Self>, original: &AddressMap<Option<AccountInfo>>, )

Source§

impl FoundryExecutionHooks for OpEvmTypes

Available on crate feature optimism only.
Source§

impl FoundryExecutionHooks for TempoEvmTypes

Source§

fn tx_call_depth_offset(tx: &TempoTxEnv) -> u16

Implementors§