Skip to main content

NestedEvm

Trait NestedEvm 

Source
pub trait NestedEvm {
    type Tx;
    type Block;
    type Spec;

    // Required methods
    fn journal_inner_mut(&mut self) -> &mut JournaledState;
    fn run_execution(
        &mut self,
        frame: FrameInput,
    ) -> Result<FrameResult, EVMError<DatabaseError>>;
    fn transact(
        &mut self,
        tx: Self::Tx,
    ) -> Result<ResultAndState<HaltReason>, EVMError<DatabaseError>>;
    fn to_evm_env(&self) -> EvmEnv<Self::Spec, Self::Block>;
}
Expand description

Object-safe trait exposing the operations that cheatcode nested EVM closures need.

This abstracts over the concrete EVM type (FoundryEvm, future TempoEvm, etc.) so that cheatcode impls can build and run nested EVMs without knowing the concrete type.

Required Associated Types§

Source

type Tx

The transaction environment type.

Source

type Block

The block environment type.

Source

type Spec

The EVM spec (hardfork) type.

Required Methods§

Source

fn journal_inner_mut(&mut self) -> &mut JournaledState

Returns a mutable reference to the journal inner state (JournaledState).

Source

fn run_execution( &mut self, frame: FrameInput, ) -> Result<FrameResult, EVMError<DatabaseError>>

Runs a single execution frame (create or call) through the EVM handler loop.

Source

fn transact( &mut self, tx: Self::Tx, ) -> Result<ResultAndState<HaltReason>, EVMError<DatabaseError>>

Executes a full transaction with the given tx env.

Source

fn to_evm_env(&self) -> EvmEnv<Self::Spec, Self::Block>

Returns a snapshot of the current EVM environment (cfg + block).

Implementors§

Source§

impl<I: EthInspectorExt> NestedEvm for FoundryEvm<'_, I>

Source§

type Tx = TxEnv

Source§

type Block = BlockEnv

Source§

type Spec = SpecId