Trait sputnikvm::VM

source ·
pub trait VM {
Show 15 methods 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]Notable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[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> { ... }
}
Expand description

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

Required Methods

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

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

Returns the current status of the VM.

Read the next instruction to be executed.

Read the next opcode to be executed.

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.

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

Returns all fetched or modified addresses.

Returns the out value, if any.

Returns the available gas of this VM.

Returns the refunded gas of this VM.

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

Returns all removed account addresses as for current VM execution.

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.

Provided Methods

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

Implementors