Enum vm::Error

source · []
pub enum Error {
Show 15 variants OutOfGas, BadJumpDestination { destination: usize, }, BadInstruction { instruction: u8, }, StackUnderflow { instruction: &'static str, wanted: usize, on_stack: usize, }, OutOfStack { instruction: &'static str, wanted: usize, limit: usize, }, SubStackUnderflow { wanted: usize, on_stack: usize, }, OutOfSubStack { wanted: usize, limit: usize, }, InvalidSubEntry, BuiltIn(&'static str), MutableCallInStaticContext, InvalidCode, Internal(String), Wasm(String), OutOfBounds, Reverted,
}
Expand description

VM errors.

Variants

OutOfGas

OutOfGas is returned when transaction execution runs out of gas. The state should be reverted to the state from before the transaction execution. But it does not mean that transaction was invalid. Balance still should be transfered and nonce should be increased.

BadJumpDestination

Fields

destination: usize

Position the code tried to jump to.

BadJumpDestination is returned when execution tried to move to position that wasn’t marked with JUMPDEST instruction

BadInstruction

Fields

instruction: u8

Unrecognized opcode

BadInstructions is returned when given instruction is not supported

StackUnderflow

Fields

instruction: &'static str

Invoked instruction

wanted: usize

How many stack elements was requested by instruction

on_stack: usize

How many elements were on stack

StackUnderflow when there is not enough stack elements to execute instruction

OutOfStack

Fields

instruction: &'static str

Invoked instruction

wanted: usize

How many stack elements instruction wanted to push

limit: usize

What was the stack limit

When execution would exceed defined Stack Limit

SubStackUnderflow

Fields

wanted: usize

How many stack elements was requested by instruction

on_stack: usize

How many elements were on stack

When there is not enough subroutine stack elements to return from

OutOfSubStack

Fields

wanted: usize

How many stack elements instruction wanted to pop

limit: usize

What was the stack limit

When execution would exceed defined subroutine Stack Limit

InvalidSubEntry

When the code walks into a subroutine, that is not allowed

BuiltIn(&'static str)

Built-in contract failed on given input

MutableCallInStaticContext

When execution tries to modify the state in static context

InvalidCode

Invalid code to deploy as a contract

Internal(String)

Likely to cause consensus issues.

Wasm(String)

Wasm runtime error

OutOfBounds

Out of bounds access in RETURNDATACOPY.

Reverted

Execution has been reverted with REVERT.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.