Struct evm::executor::StackExecutor[][src]

pub struct StackExecutor<'config, S> { /* fields omitted */ }
Expand description

Stack-based executor.

Implementations

impl<'config, S: StackState<'config>> StackExecutor<'config, S>[src]

pub fn new(state: S, config: &'config Config) -> Self[src]

Create a new stack-based executor.

pub fn config(&self) -> &'config Config[src]

Return a reference of the Config.

pub fn new_with_precompile(
    state: S,
    config: &'config Config,
    precompile: fn(_: H160, _: &[u8], _: Option<u64>, _: &Context) -> Option<Result<PrecompileOutput, ExitError>>
) -> Self
[src]

Create a new stack-based executor with given precompiles.

pub fn state(&self) -> &S[src]

pub fn state_mut(&mut self) -> &mut S[src]

pub fn into_state(self) -> S[src]

pub fn enter_substate(&mut self, gas_limit: u64, is_static: bool)[src]

Create a substate executor from the current executor.

pub fn exit_substate(&mut self, kind: StackExitKind) -> Result<(), ExitError>[src]

Exit a substate. Panic if it results an empty substate stack.

pub fn execute(&mut self, runtime: &mut Runtime<'_>) -> ExitReason[src]

Execute the runtime until it returns.

pub fn gas(&self) -> u64[src]

Get remaining gas.

pub fn transact_create(
    &mut self,
    caller: H160,
    value: U256,
    init_code: Vec<u8>,
    gas_limit: u64
) -> ExitReason
[src]

Execute a CREATE transaction.

pub fn transact_create2(
    &mut self,
    caller: H160,
    value: U256,
    init_code: Vec<u8>,
    salt: H256,
    gas_limit: u64
) -> ExitReason
[src]

Execute a CREATE2 transaction.

pub fn transact_call(
    &mut self,
    caller: H160,
    address: H160,
    value: U256,
    data: Vec<u8>,
    gas_limit: u64
) -> (ExitReason, Vec<u8>)
[src]

Execute a CALL transaction.

pub fn used_gas(&self) -> u64[src]

Get used gas for the current executor, given the price.

pub fn fee(&self, price: U256) -> U256[src]

Get fee needed for the current executor, given the price.

pub fn nonce(&self, address: H160) -> U256[src]

Get account nonce.

pub fn create_address(&self, scheme: CreateScheme) -> H160[src]

Get the create address from given scheme.

Trait Implementations

impl<'config, S: StackState<'config>> Handler for StackExecutor<'config, S>[src]

type CreateInterrupt = Infallible

Type of CREATE interrupt.

type CreateFeedback = Infallible

Feedback value for CREATE interrupt.

type CallInterrupt = Infallible

Type of CALL interrupt.

type CallFeedback = Infallible

Feedback value of CALL interrupt.

fn balance(&self, address: H160) -> U256[src]

Get balance of address.

fn code_size(&self, address: H160) -> U256[src]

Get code size of address.

fn code_hash(&self, address: H160) -> H256[src]

Get code hash of address.

fn code(&self, address: H160) -> Vec<u8>[src]

Get code of address.

fn storage(&self, address: H160, index: H256) -> H256[src]

Get storage value of address at index.

fn original_storage(&self, address: H160, index: H256) -> H256[src]

Get original storage value of address at index.

fn exists(&self, address: H160) -> bool[src]

Check whether an address exists.

fn gas_left(&self) -> U256[src]

Get the gas left value.

fn gas_price(&self) -> U256[src]

Get the gas price value.

fn origin(&self) -> H160[src]

Get execution origin.

fn block_hash(&self, number: U256) -> H256[src]

Get environmental block hash.

fn block_number(&self) -> U256[src]

Get environmental block number.

fn block_coinbase(&self) -> H160[src]

Get environmental coinbase.

fn block_timestamp(&self) -> U256[src]

Get environmental block timestamp.

fn block_difficulty(&self) -> U256[src]

Get environmental block difficulty.

fn block_gas_limit(&self) -> U256[src]

Get environmental gas limit.

fn chain_id(&self) -> U256[src]

Get environmental chain ID.

fn deleted(&self, address: H160) -> bool[src]

Check whether an address has already been deleted.

fn set_storage(
    &mut self,
    address: H160,
    index: H256,
    value: H256
) -> Result<(), ExitError>
[src]

Set storage value of address at index.

fn log(
    &mut self,
    address: H160,
    topics: Vec<H256>,
    data: Vec<u8>
) -> Result<(), ExitError>
[src]

Create a log owned by address with given topics and data.

fn mark_delete(&mut self, address: H160, target: H160) -> Result<(), ExitError>[src]

Mark an address to be deleted, with funds transferred to target.

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>
[src]

Invoke a create operation.

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>
[src]

Invoke a call operation.

fn pre_validate(
    &mut self,
    context: &Context,
    opcode: Opcode,
    stack: &Stack
) -> Result<(), ExitError>
[src]

Pre-validation step for the runtime.

fn create_feedback(
    &mut self,
    _feedback: Self::CreateFeedback
) -> Result<(), ExitError>
[src]

Feed in create feedback.

fn call_feedback(
    &mut self,
    _feedback: Self::CallFeedback
) -> Result<(), ExitError>
[src]

Feed in call feedback.

fn other(
    &mut self,
    _opcode: Opcode,
    _stack: &mut Machine
) -> Result<(), ExitError>
[src]

Handle other unknown external opcodes.

Auto Trait Implementations

impl<'config, S> RefUnwindSafe for StackExecutor<'config, S> where
    S: RefUnwindSafe

impl<'config, S> Send for StackExecutor<'config, S> where
    S: Send

impl<'config, S> Sync for StackExecutor<'config, S> where
    S: Sync

impl<'config, S> Unpin for StackExecutor<'config, S> where
    S: Unpin

impl<'config, S> UnwindSafe for StackExecutor<'config, S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.