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::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 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
- 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 withgas
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§
- SStore
Result - Represents the result of an
sstore
operation. - Self
Destruct Result - Result of a selfdestruct action
- State
Load - State load information that contains the data and if the account or storage is cold loaded
Enums§
- Create
Scheme - Create scheme
- Instruction
Result - Result of executing an EVM instruction. This enum represents all possible outcomes when executing an instruction, including successful execution, reverts, and various error conditions.
- Internal
Result - Internal results that are not exposed externally
- Success
OrHalt - 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).