Crate interpreter
Expand description
§revm-interpreter
Interpreter is part of the project that executes EVM instructions.
Modules§
- gas
- EVM gas calculation utilities.
- host
- instructions
- EVM opcode implementations.
- interpreter
- interpreter_
action - interpreter_
types
Macros§
- as_
isize_ saturated - Converts a
U256
value to aisize
, saturating toisize::MAX
if the value is too large. - as_
u64_ saturated - Converts a
U256
value to au64
, saturating toMAX
if the value is too large. - as_
usize_ or_ fail - Converts a
U256
value to ausize
, failing the instruction if the value is too large. - as_
usize_ or_ fail_ ret - Converts a
U256
value to ausize
and returnsret
, failing the instruction if the value is too large. - as_
usize_ saturated - Converts a
U256
value to ausize
, saturating toMAX
if the value is too large. - assume
- check
- Check if the
SPEC
is enabled, and fail the instruction if it is not. - debug_
unreachable - gas
- Records a
gas
cost and fails the instruction if it would exceed the available gas. - gas_
or_ fail - Same as
gas!
, but withgas
as an option. - otry
- popn
- Pops n values from the stack. Fails the instruction if n values can’t be popped.
- popn_
top - Pops n values from the stack and returns the top value. Fails the instruction if n values can’t be popped.
- push
- Pushes a
B256
value onto the stack. Fails the instruction if the stack is full. - require_
eof - Error if the current call is executing EOF.
- require_
non_ staticcall - Fails the instruction if the current call is static.
- resize_
memory - Resizes the interpreterreter memory if necessary. Fails the instruction if the memory or gas limit is exceeded.
- return_
error - return_
ok - return_
revert - tri
const
Option?
.
Structs§
- Call
Inputs - Inputs for a call.
- Call
Outcome - Represents the outcome of a call operation in a virtual machine.
- Create
Inputs - Inputs for a create call
- Create
Outcome - Represents the outcome of a create operation in an interpreter.
- EOFCreate
Inputs - Inputs for EOF Create call
- Gas
- Represents the state of gas during execution.
- Initial
AndFloor Gas - Init and floor gas from transaction
- Inputs
Impl - Interpreter
- Main interpreter structure that contains all components defines in
InterpreterTypes
.s - Interpreter
Result - The result of an interpreter operation.
- SStore
Result - Represents the result of an
sstore
operation. - Self
Destruct Result - Result of a selfdestruct action
- Shared
Memory - A sequential memory shared between calls, which uses
a
Vec
for internal representation. A SharedMemory instance should always be obtained using thenew
static method to ensure memory safety. - Stack
- EVM stack with STACK_LIMIT capacity of words.
- State
Load - State load information that contains the data and if the account or storage is cold loaded
Enums§
- Call
Scheme - Call scheme.
- Call
Value - Call value.
- Create
Scheme - Create scheme
- EOFCreate
Kind - EOF create can be called from two places:
- Frame
Input - Instruction
Result - Internal
Result - Internal results that are not exposed externally
- Interpreter
Action - Success
OrHalt
Constants§
- EMPTY_
SHARED_ MEMORY - Empty shared memory.
- MAX_
CODE_ SIZE - EIP-170: Contract code size limit
- MAX_
INITCODE_ SIZE - EIP-3860: Limit and meter initcode
- STACK_
LIMIT - EVM interpreter stack limit.
Traits§
- Host
- Host trait with all methods that are needed by the Interpreter.
- Interpreter
Types - Memory
Getter
Functions§
- instruction_
table - Returns the instruction table for the given spec.
- num_
words - Returns number of words what would fit to provided number of bytes, i.e. it rounds up the number bytes to number of words.
Type Aliases§
- Instruction
- EVM opcode function signature.
- Instruction
Table - Instruction table is list of instruction function pointers mapped to 256 EVM opcodes.