Crate revm_interpreter

Source
Expand description

§revm-interpreter

Interpreter is part of the project that executes EVM instructions.

Re-exports§

pub use gas::Gas;
pub use gas::InitialAndFloorGas;
pub use host::Host;
pub use instruction_context::InstructionContext;
pub use instructions::instruction_table;
pub use instructions::Instruction;
pub use instructions::InstructionTable;
pub use interpreter::num_words;
pub use interpreter::InputsImpl;
pub use interpreter::Interpreter;
pub use interpreter::InterpreterResult;
pub use interpreter::SharedMemory;
pub use interpreter::Stack;
pub use interpreter::STACK_LIMIT;
pub use interpreter_action::CallInput;
pub use interpreter_action::CallInputs;
pub use interpreter_action::CallOutcome;
pub use interpreter_action::CallScheme;
pub use interpreter_action::CallValue;
pub use interpreter_action::CreateInputs;
pub use interpreter_action::CreateOutcome;
pub use interpreter_action::FrameInput;
pub use interpreter_action::InterpreterAction;
pub use interpreter_types::InterpreterTypes;

Modules§

gas
Gas calculation utilities and constants. EVM gas calculation utilities.
host
Host interface for external blockchain state access.
instruction_context
Context passed to instruction implementations.
instructions
EVM instruction implementations organized by category. EVM opcode implementations.
interpreter
Core interpreter implementation for EVM bytecode execution. Core interpreter implementation and components.
interpreter_action
Types for interpreter actions like calls and contract creation.
interpreter_types
Type traits and definitions for interpreter customization.

Macros§

as_isize_saturated
Converts a U256 value to a isize, saturating to isize::MAX if the value is too large.
as_u64_saturated
Converts a U256 value to a u64, saturating to MAX if the value is too large.
as_usize_or_fail
Converts a U256 value to a usize, failing the instruction if the value is too large.
as_usize_or_fail_ret
Converts a U256 value to a usize and returns ret, failing the instruction if the value is too large.
as_usize_saturated
Converts a U256 value to a usize, saturating to MAX if the value is too large.
assume
Macro for asserting assumptions in debug builds. In debug builds, this will trigger unreachable code if the assumption is false. In release builds, this serves as an optimization hint.
check
Check if the SPEC is enabled, and fail the instruction if it is not.
debug_unreachable
Macro that triggers unreachable! in debug builds but uses unchecked unreachable in release builds. This provides better error messages during development while optimizing for performance in release.
gas
Records a gas cost and fails the instruction if it would exceed the available gas.
gas_or_fail
Same as gas!, but with gas as an option.
otry
Macro for optional try - returns early if the expression evaluates to None. Similar to the ? operator but for use in instruction implementations.
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
Macro that matches all error instruction results. Used in pattern matching to handle all error outcomes.
return_ok
Macro that matches all successful instruction results. Used in pattern matching to handle all successful execution outcomes.
return_revert
Macro that matches all revert instruction results. Used in pattern matching to handle all revert outcomes.
tri
const Option ?.

Structs§

SStoreResult
Represents the result of an sstore operation.
SelfDestructResult
Result of a selfdestruct action
StateLoad
State load information that contains the data and if the account or storage is cold loaded

Enums§

CreateScheme
Create scheme
InstructionResult
Result of executing an EVM instruction. This enum represents all possible outcomes when executing an instruction, including successful execution, reverts, and various error conditions.
InternalResult
Internal results that are not exposed externally
SuccessOrHalt
Represents the outcome of instruction execution, distinguishing between success, revert, halt (error), fatal external errors, and internal results.

Constants§

MAX_CODE_SIZE
By default the limit is 0xC000 (49_152 bytes).
MAX_INITCODE_SIZE
By default the limit is 0x12000 (73_728 bytes).