Trait EvmTr
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<ItemOrResult<&mut Self::Frame, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>;
fn frame_run(
&mut self,
) -> Result<ItemOrResult<<Self::Frame as FrameTr>::FrameInit, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>;
fn frame_return_result(
&mut self,
result: <Self::Frame as FrameTr>::FrameResult,
) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>;
// 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§
type Context: ContextTr
type Context: ContextTr
The context type that implements ContextTr to provide access to execution state
type Instructions: InstructionProvider
type Instructions: InstructionProvider
The instruction set type that implements InstructionProvider to define available operations
type Precompiles: PrecompileProvider<Self::Context>
type Precompiles: PrecompileProvider<Self::Context>
The type containing the available precompiled contracts
Required Methods§
fn 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.
fn 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.
fn 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.
fn frame_init(
&mut self,
frame_input: <Self::Frame as FrameTr>::FrameInit,
) -> Result<ItemOrResult<&mut Self::Frame, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
fn frame_init( &mut self, frame_input: <Self::Frame as FrameTr>::FrameInit, ) -> Result<ItemOrResult<&mut Self::Frame, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
Initializes the frame for the given frame input. Frame is pushed to the frame stack.
fn frame_run(
&mut self,
) -> Result<ItemOrResult<<Self::Frame as FrameTr>::FrameInit, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
fn frame_run( &mut self, ) -> Result<ItemOrResult<<Self::Frame as FrameTr>::FrameInit, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
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.
fn frame_return_result(
&mut self,
result: <Self::Frame as FrameTr>::FrameResult,
) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
fn frame_return_result( &mut self, result: <Self::Frame as FrameTr>::FrameResult, ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>
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§
§impl<'a, T> EvmTr for &'a mut T
impl<'a, T> 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 <&'a mut T as EvmTr>::Context
fn ctx_mut(&mut self) -> &mut <&'a mut T as EvmTr>::Context
fn ctx_ref(&self) -> &<&'a mut T as EvmTr>::Context
fn ctx_instructions( &mut self, ) -> (&mut <&'a mut T as EvmTr>::Context, &mut <&'a mut T as EvmTr>::Instructions)
fn ctx_precompiles( &mut self, ) -> (&mut <&'a mut T as EvmTr>::Context, &mut <&'a mut T as EvmTr>::Precompiles)
fn frame_stack(&mut self) -> &mut FrameStack<<&'a mut T as EvmTr>::Frame>
fn frame_init( &mut self, frame_input: <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameInit, ) -> Result<ItemOrResult<&mut <&'a mut T as EvmTr>::Frame, <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>
fn frame_run( &mut self, ) -> Result<ItemOrResult<<<&'a mut T as EvmTr>::Frame as FrameTr>::FrameInit, <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>
fn frame_return_result( &mut self, result: <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>
§impl<CTX, INSP, I, P> EvmTr for OpEvm<CTX, INSP, I, P>where
CTX: ContextTr,
I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
P: PrecompileProvider<CTX, Output = InterpreterResult>,
impl<CTX, INSP, I, P> EvmTr for OpEvm<CTX, INSP, I, P>where
CTX: ContextTr,
I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
P: PrecompileProvider<CTX, Output = InterpreterResult>,
§fn frame_return_result(
&mut self,
result: <<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult,
) -> Result<Option<<<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<OpEvm<CTX, INSP, I, P> as EvmTr>::Context as ContextTr>::Db as Database>::Error>>
fn frame_return_result( &mut self, result: <<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<OpEvm<CTX, INSP, I, P> as EvmTr>::Context as ContextTr>::Db as Database>::Error>>
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.