pub trait EvmTr {
type Context: ContextTr;
type Instructions: InstructionProvider;
type Precompiles: PrecompileProvider<Self::Context>;
type Frame: FrameTr;
// Required methods
fn ctx(&mut self) -> &mut Self::Context;
fn ctx_ref(&self) -> &Self::Context;
fn ctx_instructions(
&mut self,
) -> (&mut Self::Context, &mut Self::Instructions);
fn ctx_precompiles(
&mut self,
) -> (&mut Self::Context, &mut Self::Precompiles);
fn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>;
fn frame_init(
&mut self,
frame_input: <Self::Frame as FrameTr>::FrameInit,
) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<Self::Context>>;
fn frame_run(
&mut self,
) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<Self::Context>>;
fn frame_return_result(
&mut self,
result: <Self::Frame as FrameTr>::FrameResult,
) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>;
// Provided method
fn ctx_mut(&mut self) -> &mut Self::Context { ... }
}
Expand description
A trait that integrates context, instruction set, and precompiles to create an EVM struct.
In addition to execution capabilities, this trait provides getter methods for its component fields.
Required Associated Types§
Sourcetype Context: ContextTr
type Context: ContextTr
The context type that implements ContextTr to provide access to execution state
Sourcetype Instructions: InstructionProvider
type Instructions: InstructionProvider
The instruction set type that implements InstructionProvider to define available operations
Sourcetype Precompiles: PrecompileProvider<Self::Context>
type Precompiles: PrecompileProvider<Self::Context>
The type containing the available precompiled contracts
Required Methods§
Sourcefn ctx_instructions(&mut self) -> (&mut Self::Context, &mut Self::Instructions)
fn ctx_instructions(&mut self) -> (&mut Self::Context, &mut Self::Instructions)
Returns mutable references to both the context and instruction set. This enables atomic access to both components when needed.
Sourcefn ctx_precompiles(&mut self) -> (&mut Self::Context, &mut Self::Precompiles)
fn ctx_precompiles(&mut self) -> (&mut Self::Context, &mut Self::Precompiles)
Returns mutable references to both the context and precompiles. This enables atomic access to both components when needed.
Sourcefn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>
fn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>
Returns a mutable reference to the frame stack.
Sourcefn frame_init(
&mut self,
frame_input: <Self::Frame as FrameTr>::FrameInit,
) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<Self::Context>>
fn frame_init( &mut self, frame_input: <Self::Frame as FrameTr>::FrameInit, ) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<Self::Context>>
Initializes the frame for the given frame input. Frame is pushed to the frame stack.
Sourcefn frame_run(
&mut self,
) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<Self::Context>>
fn frame_run( &mut self, ) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<Self::Context>>
Run the frame from the top of the stack. Returns the frame init or result.
If frame has returned result it would mark it as finished.
Sourcefn frame_return_result(
&mut self,
result: <Self::Frame as FrameTr>::FrameResult,
) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>
fn frame_return_result( &mut self, result: <Self::Frame as FrameTr>::FrameResult, ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>
Returns the result of the frame to the caller. Frame is popped from the frame stack. Consumes the frame result or returns it if there is more frames to run.
Provided Methods§
Implementations on Foreign Types§
Source§impl<'a, T: 'a + EvmTr + ?Sized> EvmTr for &'a mut T
impl<'a, T: 'a + EvmTr + ?Sized> EvmTr for &'a mut T
type Context = <T as EvmTr>::Context
type Instructions = <T as EvmTr>::Instructions
type Precompiles = <T as EvmTr>::Precompiles
type Frame = <T as EvmTr>::Frame
fn ctx(&mut self) -> &mut Self::Context
fn ctx_mut(&mut self) -> &mut Self::Context
fn ctx_ref(&self) -> &Self::Context
fn ctx_instructions(&mut self) -> (&mut Self::Context, &mut Self::Instructions)
fn ctx_precompiles(&mut self) -> (&mut Self::Context, &mut Self::Precompiles)
fn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>
fn frame_init( &mut self, frame_input: <Self::Frame as FrameTr>::FrameInit, ) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<Self::Context>>
fn frame_run( &mut self, ) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<Self::Context>>
fn frame_return_result( &mut self, result: <Self::Frame as FrameTr>::FrameResult, ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>
Source§impl<CTX, INSP, I, P> EvmTr for Evm<CTX, INSP, I, P, EthFrame<EthInterpreter>>where
CTX: ContextTr,
I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
P: PrecompileProvider<CTX, Output = InterpreterResult>,
impl<CTX, INSP, I, P> EvmTr for Evm<CTX, INSP, I, P, EthFrame<EthInterpreter>>where
CTX: ContextTr,
I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
P: PrecompileProvider<CTX, Output = InterpreterResult>,
Source§fn frame_init(
&mut self,
frame_input: <Self::Frame as FrameTr>::FrameInit,
) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<CTX>>
fn frame_init( &mut self, frame_input: <Self::Frame as FrameTr>::FrameInit, ) -> Result<FrameInitResult<'_, Self::Frame>, ContextDbError<CTX>>
Initializes the frame for the given frame input. Frame is pushed to the frame stack.
Source§fn frame_run(
&mut self,
) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<CTX>>
fn frame_run( &mut self, ) -> Result<FrameInitOrResult<Self::Frame>, ContextDbError<CTX>>
Run the frame from the top of the stack. Returns the frame init or result.
Source§fn frame_return_result(
&mut self,
result: <Self::Frame as FrameTr>::FrameResult,
) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>
fn frame_return_result( &mut self, result: <Self::Frame as FrameTr>::FrameResult, ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextDbError<Self::Context>>
Returns the result of the frame to the caller. Frame is popped from the frame stack.