pub struct StackExecutor<'config, 'precompiles, S, P> { /* private fields */ }Expand description
Stack-based executor.
Implementations§
Source§impl<'config, 'precompiles, S: StackState, P: PrecompileSet> StackExecutor<'config, 'precompiles, S, P>
impl<'config, 'precompiles, S: StackState, P: PrecompileSet> StackExecutor<'config, 'precompiles, S, P>
Sourcepub fn precompiles(&self) -> &'precompiles P
pub fn precompiles(&self) -> &'precompiles P
Return a reference to the precompile set.
Sourcepub fn new_with_precompiles(
state: S,
config: &'config Config,
precompile_set: &'precompiles P,
) -> Self
pub fn new_with_precompiles( state: S, config: &'config Config, precompile_set: &'precompiles P, ) -> Self
Create a new stack-based executor with given precompiles.
pub fn state(&self) -> &S
pub fn state_mut(&mut self) -> &mut S
pub fn into_state(self) -> S
Sourcepub fn enter_substate(&mut self, is_static: bool)
pub fn enter_substate(&mut self, is_static: bool)
Create a substate executor from the current executor.
Sourcepub fn exit_substate(&mut self, kind: StackExitKind) -> Result<(), ExitError>
pub fn exit_substate(&mut self, kind: StackExitKind) -> Result<(), ExitError>
Exit a substate. Panic if it results an empty substate stack.
Sourcepub fn execute(&mut self, runtime: &mut Runtime<'_>) -> ExitReason
pub fn execute(&mut self, runtime: &mut Runtime<'_>) -> ExitReason
Execute the runtime until it returns.
Sourcepub fn transact_create(
&mut self,
caller: H160,
value: U256,
init_code: Vec<u8>,
access_list: Vec<(H160, Vec<H256>)>,
) -> (ExitReason, Vec<u8>)
pub fn transact_create( &mut self, caller: H160, value: U256, init_code: Vec<u8>, access_list: Vec<(H160, Vec<H256>)>, ) -> (ExitReason, Vec<u8>)
Execute a CREATE transaction.
Sourcepub fn transact_create2(
&mut self,
caller: H160,
value: U256,
init_code: Vec<u8>,
salt: H256,
access_list: Vec<(H160, Vec<H256>)>,
) -> (ExitReason, Vec<u8>)
pub fn transact_create2( &mut self, caller: H160, value: U256, init_code: Vec<u8>, salt: H256, access_list: Vec<(H160, Vec<H256>)>, ) -> (ExitReason, Vec<u8>)
Execute a CREATE2 transaction.
Sourcepub fn transact_call(
&mut self,
caller: H160,
address: H160,
value: U256,
data: Vec<u8>,
access_list: Vec<(H160, Vec<H256>)>,
) -> (ExitReason, Vec<u8>)
pub fn transact_call( &mut self, caller: H160, address: H160, value: U256, data: Vec<u8>, access_list: Vec<(H160, Vec<H256>)>, ) -> (ExitReason, Vec<u8>)
Execute a CALL transaction with a given caller, address, value and
gas limit and data.
Takes in an additional access_list parameter for EIP-2930 which was
introduced in the Ethereum Berlin hard fork. If you do not wish to use
this functionality, just pass in an empty vector.
Sourcepub fn create_address(&self, scheme: CreateScheme) -> H160
pub fn create_address(&self, scheme: CreateScheme) -> H160
Get the create address from given scheme.
pub fn initialize_with_access_list( &mut self, access_list: Vec<(H160, Vec<H256>)>, )
Trait Implementations§
Source§impl<'config, 'precompiles, S: StackState, P: PrecompileSet> Handler for StackExecutor<'config, 'precompiles, S, P>
impl<'config, 'precompiles, S: StackState, P: PrecompileSet> Handler for StackExecutor<'config, 'precompiles, S, P>
Source§type CreateInterrupt = Infallible
type CreateInterrupt = Infallible
Type of
CREATE interrupt.Source§type CreateFeedback = Infallible
type CreateFeedback = Infallible
Feedback value for
CREATE interrupt.Source§type CallInterrupt = Infallible
type CallInterrupt = Infallible
Type of
CALL interrupt.Source§type CallFeedback = Infallible
type CallFeedback = Infallible
Feedback value of
CALL interrupt.Source§fn original_storage(&self, address: H160, index: H256) -> H256
fn original_storage(&self, address: H160, index: H256) -> H256
Get original storage value of address at index.
Source§fn is_cold(&self, address: H160, maybe_index: Option<H256>) -> bool
fn is_cold(&self, address: H160, maybe_index: Option<H256>) -> bool
Checks if the address or (address, index) pair has been previously accessed
(or set in
accessed_addresses / accessed_storage_keys via an access list
transaction).
References: Read moreSource§fn block_hash(&self, number: U256) -> H256
fn block_hash(&self, number: U256) -> H256
Get environmental block hash.
Source§fn block_number(&self) -> U256
fn block_number(&self) -> U256
Get environmental block number.
Source§fn block_coinbase(&self) -> H160
fn block_coinbase(&self) -> H160
Get environmental coinbase.
Source§fn block_timestamp(&self) -> U256
fn block_timestamp(&self) -> U256
Get environmental block timestamp.
Source§fn block_difficulty(&self) -> U256
fn block_difficulty(&self) -> U256
Get environmental block difficulty.
Source§fn block_gas_limit(&self) -> U256
fn block_gas_limit(&self) -> U256
Get environmental gas limit.
Source§fn block_base_fee_per_gas(&self) -> U256
fn block_base_fee_per_gas(&self) -> U256
Environmental block base fee.
Source§fn set_storage(
&mut self,
address: H160,
index: H256,
value: H256,
) -> Result<(), ExitError>
fn set_storage( &mut self, address: H160, index: H256, value: H256, ) -> Result<(), ExitError>
Set storage value of address at index.
Source§fn log(
&mut self,
address: H160,
topics: Vec<H256>,
data: Vec<u8>,
) -> Result<(), ExitError>
fn log( &mut self, address: H160, topics: Vec<H256>, data: Vec<u8>, ) -> Result<(), ExitError>
Create a log owned by address with given topics and data.
Source§fn mark_delete(&mut self, address: H160, target: H160) -> Result<(), ExitError>
fn mark_delete(&mut self, address: H160, target: H160) -> Result<(), ExitError>
Mark an address to be deleted, with funds transferred to target.
Source§fn create(
&mut self,
caller: H160,
scheme: CreateScheme,
value: U256,
init_code: Vec<u8>,
_target_gas: Option<u64>,
) -> Capture<(ExitReason, Option<H160>, Vec<u8>), Self::CreateInterrupt>
fn create( &mut self, caller: H160, scheme: CreateScheme, value: U256, init_code: Vec<u8>, _target_gas: Option<u64>, ) -> Capture<(ExitReason, Option<H160>, Vec<u8>), Self::CreateInterrupt>
Invoke a create operation.
Source§fn call(
&mut self,
code_address: H160,
transfer: Option<Transfer>,
input: Vec<u8>,
_target_gas: Option<u64>,
is_static: bool,
context: Context,
) -> Capture<(ExitReason, Vec<u8>), Self::CallInterrupt>
fn call( &mut self, code_address: H160, transfer: Option<Transfer>, input: Vec<u8>, _target_gas: Option<u64>, is_static: bool, context: Context, ) -> Capture<(ExitReason, Vec<u8>), Self::CallInterrupt>
Invoke a call operation.
Source§fn pre_validate(
&mut self,
_context: &Context,
_opcode: Opcode,
_stack: &Stack,
) -> Result<(), ExitError>
fn pre_validate( &mut self, _context: &Context, _opcode: Opcode, _stack: &Stack, ) -> Result<(), ExitError>
Pre-validation step for the runtime.
Source§fn create_feedback(
&mut self,
_feedback: Self::CreateFeedback,
) -> Result<(), ExitError>
fn create_feedback( &mut self, _feedback: Self::CreateFeedback, ) -> Result<(), ExitError>
Feed in create feedback.
Source§fn call_feedback(
&mut self,
_feedback: Self::CallFeedback,
) -> Result<(), ExitError>
fn call_feedback( &mut self, _feedback: Self::CallFeedback, ) -> Result<(), ExitError>
Feed in call feedback.
Auto Trait Implementations§
impl<'config, 'precompiles, S, P> Freeze for StackExecutor<'config, 'precompiles, S, P>where
S: Freeze,
impl<'config, 'precompiles, S, P> RefUnwindSafe for StackExecutor<'config, 'precompiles, S, P>where
S: RefUnwindSafe,
P: RefUnwindSafe,
impl<'config, 'precompiles, S, P> Send for StackExecutor<'config, 'precompiles, S, P>
impl<'config, 'precompiles, S, P> Sync for StackExecutor<'config, 'precompiles, S, P>
impl<'config, 'precompiles, S, P> Unpin for StackExecutor<'config, 'precompiles, S, P>where
S: Unpin,
impl<'config, 'precompiles, S, P> UnwindSafe for StackExecutor<'config, 'precompiles, S, P>where
S: UnwindSafe,
P: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more