forge::revm

Trait Inspector

pub trait Inspector<DB>
where DB: Database,
{ // Provided methods fn initialize_interp( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, ) { ... } fn step(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>) { ... } fn step_end( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, ) { ... } fn log( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, log: &Log, ) { ... } fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome> { ... } fn call_end( &mut self, context: &mut EvmContext<DB>, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome { ... } fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome> { ... } fn create_end( &mut self, context: &mut EvmContext<DB>, inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome { ... } fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome> { ... } fn eofcreate_end( &mut self, context: &mut EvmContext<DB>, inputs: &EOFCreateInputs, outcome: CreateOutcome, ) -> CreateOutcome { ... } fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, ) { ... } }
Expand description

EVM Interpreter callbacks.

Provided Methods§

fn initialize_interp( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, )

Called before the interpreter is initialized.

If interp.instruction_result is set to anything other than crate::interpreter::InstructionResult::Continue then the execution of the interpreter is skipped.

fn step(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

Called on each step of the interpreter.

Information about the current execution, including the memory, stack and more is available on interp (see Interpreter).

§Example

To get the current opcode, use interp.current_opcode().

fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

Called after step when the instruction has been executed.

Setting interp.instruction_result to anything other than crate::interpreter::InstructionResult::Continue alters the execution of the interpreter.

fn log( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, log: &Log, )

Called when a log is emitted.

fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome>

Called whenever a call to a contract is about to start.

InstructionResulting anything other than crate::interpreter::InstructionResult::Continue overrides the result of the call.

fn call_end( &mut self, context: &mut EvmContext<DB>, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome

Called when a call to a contract has concluded.

The returned CallOutcome is used as the result of the call.

This allows the inspector to modify the given result before returning it.

fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome>

Called when a contract is about to be created.

If this returns Some then the CreateOutcome is used to override the result of the creation.

If this returns None then the creation proceeds as normal.

fn create_end( &mut self, context: &mut EvmContext<DB>, inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

Called when a contract has been created.

InstructionResulting anything other than the values passed to this function ((ret, remaining_gas, address, out)) will alter the result of the create.

fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome>

Called when EOF creating is called.

This can happen from create TX or from EOFCREATE opcode.

fn eofcreate_end( &mut self, context: &mut EvmContext<DB>, inputs: &EOFCreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

Called when eof creating has ended.

fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, )

Called when a contract has been self-destructed with funds transferred to target.

Implementations on Foreign Types§

§

impl<'a, DB, T> Inspector<DB> for &'a mut T
where DB: Database, T: 'a + Inspector<DB> + ?Sized,

§

fn initialize_interp( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, )

§

fn step(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn log( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, log: &Log, )

§

fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome>

§

fn call_end( &mut self, context: &mut EvmContext<DB>, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome

§

fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome>

§

fn create_end( &mut self, context: &mut EvmContext<DB>, inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome>

§

fn eofcreate_end( &mut self, context: &mut EvmContext<DB>, inputs: &EOFCreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, )

§

impl<DB> Inspector<DB> for MuxInspector
where DB: Database,

§

fn initialize_interp( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, )

§

fn step(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn log( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, log: &Log, )

§

fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome>

§

fn call_end( &mut self, context: &mut EvmContext<DB>, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome

§

fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome>

§

fn create_end( &mut self, context: &mut EvmContext<DB>, inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome>

§

fn eofcreate_end( &mut self, context: &mut EvmContext<DB>, inputs: &EOFCreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, )

§

impl<DB> Inspector<DB> for OpcodeCountInspector
where DB: Database,

§

fn step(&mut self, _interp: &mut Interpreter, _context: &mut EvmContext<DB>)

§

impl<DB> Inspector<DB> for OpcodeGasInspector
where DB: Database,

§

fn step(&mut self, interp: &mut Interpreter, _context: &mut EvmContext<DB>)

§

fn step_end(&mut self, interp: &mut Interpreter, _context: &mut EvmContext<DB>)

§

impl<DB> Inspector<DB> for TransferInspector
where DB: Database,

§

fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome>

§

fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome>

§

fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome>

§

fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, )

§

impl<DB, T> Inspector<DB> for Box<T>
where DB: Database, T: Inspector<DB> + ?Sized,

§

fn initialize_interp( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, )

§

fn step(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>)

§

fn log( &mut self, interp: &mut Interpreter, context: &mut EvmContext<DB>, log: &Log, )

§

fn call( &mut self, context: &mut EvmContext<DB>, inputs: &mut CallInputs, ) -> Option<CallOutcome>

§

fn call_end( &mut self, context: &mut EvmContext<DB>, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome

§

fn create( &mut self, context: &mut EvmContext<DB>, inputs: &mut CreateInputs, ) -> Option<CreateOutcome>

§

fn create_end( &mut self, context: &mut EvmContext<DB>, inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn eofcreate( &mut self, context: &mut EvmContext<DB>, inputs: &mut EOFCreateInputs, ) -> Option<CreateOutcome>

§

fn eofcreate_end( &mut self, context: &mut EvmContext<DB>, inputs: &EOFCreateInputs, outcome: CreateOutcome, ) -> CreateOutcome

§

fn selfdestruct( &mut self, contract: Address, target: Address, value: Uint<256, 4>, )

Implementors§

§

impl Inspector<&mut dyn DatabaseExt<Error = DatabaseError>> for Cheatcodes

§

impl Inspector<&mut dyn DatabaseExt<Error = DatabaseError>> for InspectorStack

Source§

impl<DB> Inspector<DB> for Fuzzer
where DB: Database,

§

impl<DB> Inspector<DB> for AccessListInspector
where DB: Database,

§

impl<DB> Inspector<DB> for ChiselState
where DB: Database,

§

impl<DB> Inspector<DB> for CoverageCollector
where DB: Database,

§

impl<DB> Inspector<DB> for LogCollector
where DB: Database,

§

impl<DB> Inspector<DB> for FourByteInspector
where DB: Database,

§

impl<DB> Inspector<DB> for TracingInspector
where DB: Database,

§

impl<DB> Inspector<DB> for CustomPrintTracer
where DB: Database,

§

impl<DB> Inspector<DB> for GasInspector
where DB: Database,

§

impl<DB> Inspector<DB> for NoOpInspector
where DB: Database,