Struct evm::Machine [] [src]

pub struct Machine<M, P: Patch> { /* fields omitted */ }

A VM state with PC.

Methods

impl<M: Memory + Default, P: Patch> Machine<M, P>
[src]

Lifecycle of a Machine

When a new non-invoked transaction is created, initialize_call or initialize_create should be called. After this, the machine can be stepped as normal. When the machine meets a CALL/CALLCODE or CREATE instruction, a sub-machine will be created. This submachine should first call invoke_call or invoke_create. After the submachine is finished, it should call apply_sub. When the non-invoked transaction is finished, it should first call code_deposit if it is a contract creation transaction. After that, it should call finalize.

[src]

Initialize a MessageCall transaction.

[src]

Initialize the runtime as a call from a CALL or CALLCODE opcode.

[src]

Initialize a ContractCreation transaction.

[src]

Initialize the runtime as a call from a CREATE opcode.

[src]

Deposit code for a ContractCreation transaction or a CREATE opcode.

[src]

Finalize a transaction. This should not be used when invoked by an opcode.

[src]

Apply a sub runtime into the current runtime. This sub runtime should have been created by the current runtime's derive function. Depending whether the current runtime is invoking a ContractCreation or MessageCall instruction, it will apply various states back.

impl<M: Memory + Default, P: Patch> Machine<M, P>
[src]

[src]

Create a new runtime.

[src]

Create a new runtime with the given states.

[src]

Derive this runtime to create a sub runtime. This will not modify the current runtime, and it will have a chance to review whether it wants to accept the result of this sub runtime afterwards.

[src]

Commit a new account into this runtime.

[src]

Commit a new blockhash into this runtime.

[src]

Check the next instruction about whether it will return errors.

[src]

Step a precompiled runtime. This function returns true if the runtime is indeed a precompiled address. Otherwise return false with state unchanged.

[src]

Step an instruction in the PC. The eval result is refected by the runtime status, and it will only return an error if there're accounts or blockhashes to be committed to this runtime for it to run. In that case, the state of the current runtime will not be affected.

[src]

Get the runtime state.

[src]

Get the current runtime status.