Trait InspectorHandler
pub trait InspectorHandler: Handlerwhere
Self::Evm: InspectorEvmTr,
<Self::Evm as InspectorEvmTr>::Inspector: Inspector<<Self::Evm as EvmTr>::Context, Self::IT>,
Self::Frame: InspectorFrame<IT = Self::IT>,{
type IT: InterpreterTypes;
// Provided methods
fn inspect_run(
&mut self,
evm: &mut Self::Evm,
) -> Result<ResultAndState<Self::HaltReason>, Self::Error> { ... }
fn inspect_run_without_catch_error(
&mut self,
evm: &mut Self::Evm,
) -> Result<ResultAndState<Self::HaltReason>, Self::Error> { ... }
fn inspect_execution(
&mut self,
evm: &mut Self::Evm,
init_and_floor_gas: &InitialAndFloorGas,
) -> Result<FrameResult, Self::Error> { ... }
fn inspect_first_frame_init(
&mut self,
evm: &mut Self::Evm,
frame_input: <Self::Frame as Frame>::FrameInit,
) -> Result<ItemOrResult<Self::Frame, <Self::Frame as Frame>::FrameResult>, Self::Error> { ... }
fn inspect_frame_call(
&mut self,
frame: &mut Self::Frame,
evm: &mut Self::Evm,
) -> Result<ItemOrResult<<Self::Frame as Frame>::FrameInit, <Self::Frame as Frame>::FrameResult>, Self::Error> { ... }
fn inspect_run_exec_loop(
&mut self,
evm: &mut Self::Evm,
frame: Self::Frame,
) -> Result<FrameResult, Self::Error> { ... }
}Expand description
Trait that extends Handler with inspection functionality.
Similar how Handler::run method serves as the entry point,
InspectorHandler::inspect_run method serves as the entry point for inspection.
Notice that when inspection is run it skips few functions from handler, this can be
a problem if custom EVM is implemented and some of skipped functions have changed logic.
For custom EVM, those changed functions would need to be also changed in InspectorHandler.
List of functions that are skipped in InspectorHandler:
Handler::runreplaced withInspectorHandler::inspect_runHandler::run_without_catch_errorreplaced withInspectorHandler::inspect_run_without_catch_errorHandler::executionreplaced withInspectorHandler::inspect_executionHandler::first_frame_initreplaced withInspectorHandler::inspect_first_frame_initHandler::frame_callreplaced withInspectorHandler::inspect_frame_callHandler::run_exec_loopreplaced withInspectorHandler::inspect_run_exec_loop
Required Associated Types§
type IT: InterpreterTypes
Provided Methods§
fn inspect_run(
&mut self,
evm: &mut Self::Evm,
) -> Result<ResultAndState<Self::HaltReason>, Self::Error>
fn inspect_run( &mut self, evm: &mut Self::Evm, ) -> Result<ResultAndState<Self::HaltReason>, Self::Error>
Entry point for inspection.
This method is acts as Handler::run method for inspection.
fn inspect_run_without_catch_error(
&mut self,
evm: &mut Self::Evm,
) -> Result<ResultAndState<Self::HaltReason>, Self::Error>
fn inspect_run_without_catch_error( &mut self, evm: &mut Self::Evm, ) -> Result<ResultAndState<Self::HaltReason>, Self::Error>
Run inspection without catching error.
This method is acts as Handler::run_without_catch_error method for inspection.
fn inspect_execution(
&mut self,
evm: &mut Self::Evm,
init_and_floor_gas: &InitialAndFloorGas,
) -> Result<FrameResult, Self::Error>
fn inspect_execution( &mut self, evm: &mut Self::Evm, init_and_floor_gas: &InitialAndFloorGas, ) -> Result<FrameResult, Self::Error>
Run execution loop with inspection support
This method acts as Handler::execution method for inspection.
fn inspect_first_frame_init(
&mut self,
evm: &mut Self::Evm,
frame_input: <Self::Frame as Frame>::FrameInit,
) -> Result<ItemOrResult<Self::Frame, <Self::Frame as Frame>::FrameResult>, Self::Error>
fn inspect_first_frame_init( &mut self, evm: &mut Self::Evm, frame_input: <Self::Frame as Frame>::FrameInit, ) -> Result<ItemOrResult<Self::Frame, <Self::Frame as Frame>::FrameResult>, Self::Error>
Initialize first frame.
This method replaces the Handler::first_frame_init method from Handler.
- It calls
Inspector::call/Inspector::create/Inspector::eofcreatemethods to allow inspection of the frame and its modification. - If new frame is created a
Inspector::initialize_interpmethod will be called. - If creation of new frame returns the result, the
Inspector_endmethods will be called.
fn inspect_frame_call(
&mut self,
frame: &mut Self::Frame,
evm: &mut Self::Evm,
) -> Result<ItemOrResult<<Self::Frame as Frame>::FrameInit, <Self::Frame as Frame>::FrameResult>, Self::Error>
fn inspect_frame_call( &mut self, frame: &mut Self::Frame, evm: &mut Self::Evm, ) -> Result<ItemOrResult<<Self::Frame as Frame>::FrameInit, <Self::Frame as Frame>::FrameResult>, Self::Error>
Run inspection on frame.
This method acts as Handler::frame_call method for inspection.
Internally it will call Inspector::step, Inspector::step_end for each instruction.
And Inspector::log,Inspector::selfdestruct for each log and selfdestruct instruction.
fn inspect_run_exec_loop(
&mut self,
evm: &mut Self::Evm,
frame: Self::Frame,
) -> Result<FrameResult, Self::Error>
fn inspect_run_exec_loop( &mut self, evm: &mut Self::Evm, frame: Self::Frame, ) -> Result<FrameResult, Self::Error>
Run inspection on execution loop.
This method acts as Handler::run_exec_loop method for inspection.
It will call:
InspectorHandler::inspect_frame_callto inspect Interpreter execution loop.Inspector::call,Inspector::create,Inspector::eofcreateto inspect call, create and eofcreate.Inspector::call_end,Inspector::create_end,Inspector::eofcreate_endto inspect call, create and eofcreate end.Inspector::initialize_interpto inspect initialized interpreter.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.