revm_inspector

Trait Inspector

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

EVM [Interpreter] callbacks.

Provided Methods§

Source

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

Called before the interpreter is initialized.

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

Source

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

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().

Source

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

Called after step when the instruction has been executed.

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

Source

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

Called when a log is emitted.

Source

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

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

InstructionResulting anything other than [revm::interpreter::InstructionResult::Continue] overrides the result of the call.

Source

fn call_end( &mut self, context: &mut EvmContext<EvmWiringT>, 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.

Source

fn create( &mut self, context: &mut EvmContext<EvmWiringT>, 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.

Source

fn create_end( &mut self, context: &mut EvmContext<EvmWiringT>, 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.

Source

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

Called when EOF creating is called.

This can happen from create TX or from EOFCREATE opcode.

Source

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

Called when eof creating has ended.

Source

fn selfdestruct(&mut self, contract: Address, target: Address, value: U256)

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

Implementations on Foreign Types§

Source§

impl<'a, EvmWiringT: EvmWiring, T: 'a + Inspector<EvmWiringT> + ?Sized> Inspector<EvmWiringT> for &'a mut T

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn selfdestruct(&mut self, contract: Address, target: Address, value: U256)

Source§

impl<EvmWiringT: EvmWiring, T: Inspector<EvmWiringT> + ?Sized> Inspector<EvmWiringT> for Box<T>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn selfdestruct(&mut self, contract: Address, target: Address, value: U256)

Implementors§

Source§

impl<EvmWiringT: EvmWiring> Inspector<EvmWiringT> for CustomPrintTracer

Source§

impl<EvmWiringT: EvmWiring> Inspector<EvmWiringT> for GasInspector

Source§

impl<EvmWiringT: EvmWiring> Inspector<EvmWiringT> for NoOpInspector

Source§

impl<EvmWiringT: EvmWiring> Inspector<EvmWiringT> for TracerEip3155