Struct sputnikvm::ContextVM
[−]
[src]
pub struct ContextVM<M, P: Patch> { /* fields omitted */ }
A VM that executes using a context and block information.
Methods
impl<M: Memory + Default, P: Patch> ContextVM<M, P>
[src]
fn new(context: Context, block: HeaderParams) -> Self
[src]
Create a new VM using the given context, block header and patch.
fn with_states(
context: Context,
block: HeaderParams,
account_state: AccountState<P::Account>,
blockhash_state: BlockhashState
) -> Self
[src]
context: Context,
block: HeaderParams,
account_state: AccountState<P::Account>,
blockhash_state: BlockhashState
) -> Self
Create a new VM with the given account state and blockhash state.
fn with_init<F: FnOnce(&mut ContextVM<M, P>)>(
context: Context,
block: HeaderParams,
account_state: AccountState<P::Account>,
blockhash_state: BlockhashState,
f: F
) -> Self
[src]
context: Context,
block: HeaderParams,
account_state: AccountState<P::Account>,
blockhash_state: BlockhashState,
f: F
) -> Self
Create a new VM with customized initialization code.
fn with_previous(
context: Context,
block: HeaderParams,
vm: &ContextVM<M, P>
) -> Self
[src]
context: Context,
block: HeaderParams,
vm: &ContextVM<M, P>
) -> Self
Create a new VM with the result of the previous VM. This is usually used by transaction for chainning them.
fn current_state(&self) -> &State<M, P>
[src]
Returns the current state of the VM.
fn current_machine(&self) -> &Machine<M, P>
[src]
Returns the current runtime machine.
fn add_context_history_hook<F: 'static + Fn(&Context)>(&mut self, f: F)
[src]
Add a new context history hook.
Trait Implementations
impl<M: Memory + Default, P: Patch> VM for ContextVM<M, P>
[src]
fn commit_account(
&mut self,
commitment: AccountCommitment
) -> Result<(), CommitError>
[src]
&mut self,
commitment: AccountCommitment
) -> Result<(), CommitError>
Commit an account information to this VM. This should only be used when receiving RequireError
. Read more
fn commit_blockhash(
&mut self,
number: U256,
hash: H256
) -> Result<(), CommitError>
[src]
&mut self,
number: U256,
hash: H256
) -> Result<(), CommitError>
Commit a block hash to this VM. This should only be used when receiving RequireError
. Read more
fn status(&self) -> VMStatus
[src]
Returns the current status of the VM.
fn peek(&self) -> Option<Instruction>
[src]
Read the next instruction to be executed.
fn peek_opcode(&self) -> Option<Opcode>
[src]
Read the next opcode to be executed.
fn step(&mut self) -> Result<(), RequireError>
[src]
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. Read more
fn fire(&mut self) -> Result<(), RequireError>
[src]
Run instructions until it reaches a RequireError
or exits. If this function succeeds, the VM status can only be either ExitedOk
or ExitedErr
. Read more
fn accounts(&self) -> Values<Address, AccountChange>
[src]
Returns the changed or committed accounts information up to current execution status. Read more
fn used_addresses(&self) -> Set<Address>
[src]
Returns all fetched or modified addresses.
fn out(&self) -> &[u8]
[src]
Returns the out value, if any.
fn available_gas(&self) -> Gas
[src]
Returns the available gas of this VM.
fn refunded_gas(&self) -> Gas
[src]
Returns the refunded gas of this VM.
fn logs(&self) -> &[Log]
[src]
Returns logs to be appended to the current block if the user decided to accept the running status of this VM. Read more
fn removed(&self) -> &[Address]
[src]
Returns all removed account addresses as for current VM execution.
fn used_gas(&self) -> Gas
[src]
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. Read more