[][src]Trait ethereumvm::VM

pub trait VM {
    fn commit_account(
        &mut self,
        commitment: AccountCommitment
    ) -> Result<(), CommitError>;
fn commit_blockhash(
        &mut self,
        number: U256,
        hash: H256
    ) -> Result<(), CommitError>;
fn status(&self) -> VMStatus;
fn peek(&self) -> Option<Instruction>;
fn peek_opcode(&self) -> Option<Opcode>;
fn step(&mut self) -> Result<(), RequireError>;
fn accounts(&self) -> Values<Address, AccountChange>;
fn used_addresses(&self) -> Set<Address>;
fn out(&self) -> &[u8];
fn available_gas(&self) -> Gas;
fn refunded_gas(&self) -> Gas;
fn logs(&self) -> &[Log];
fn removed(&self) -> &[Address];
fn used_gas(&self) -> Gas; fn fire(&mut self) -> Result<(), RequireError> { ... } }

Represents an EVM. This is usually the main interface for clients to interact with.

Required methods

fn commit_account(
    &mut self,
    commitment: AccountCommitment
) -> Result<(), CommitError>

Commit an account information to this VM. This should only be used when receiving RequireError.

fn commit_blockhash(
    &mut self,
    number: U256,
    hash: H256
) -> Result<(), CommitError>

Commit a block hash to this VM. This should only be used when receiving RequireError.

fn status(&self) -> VMStatus

Returns the current status of the VM.

fn peek(&self) -> Option<Instruction>

Read the next instruction to be executed.

fn peek_opcode(&self) -> Option<Opcode>

Read the next opcode to be executed.

fn step(&mut self) -> Result<(), RequireError>

Run one instruction and return. If it succeeds, VM status can still be Running. If the call stack has more than one items, this will only executes the last items' one single instruction.

fn accounts(&self) -> Values<Address, AccountChange>

Returns the changed or committed accounts information up to current execution status.

fn used_addresses(&self) -> Set<Address>

Returns all fetched or modified addresses.

fn out(&self) -> &[u8]

Returns the out value, if any.

fn available_gas(&self) -> Gas

Returns the available gas of this VM.

fn refunded_gas(&self) -> Gas

Returns the refunded gas of this VM.

fn logs(&self) -> &[Log]

Returns logs to be appended to the current block if the user decided to accept the running status of this VM.

fn removed(&self) -> &[Address]

Returns all removed account addresses as for current VM execution.

fn used_gas(&self) -> Gas

Returns the real used gas by the transaction or the VM context. Only available when the status of the VM is exited. Otherwise returns zero.

Loading content...

Provided methods

fn fire(&mut self) -> Result<(), RequireError>

Run instructions until it reaches a RequireError or exits. If this function succeeds, the VM status can only be either ExitedOk or ExitedErr.

Loading content...

Implementors

impl<'a, M: Memory, P: Patch> VM for ContextVM<'a, M, P>[src]

impl<'a, M: Memory, P: Patch> VM for TransactionVM<'a, M, P>[src]

Loading content...