The instruction_result.rs Module

The instruction_result.rs module of this Rust EVM implementation includes the definitions of the InstructionResult and SuccessOrHalt enum, which represent the possible outcomes of EVM instruction execution, and functions to work with these types.

  • InstructionResult Enum

    The InstructionResult enum categorizes the different types of results that can arise from executing an EVM instruction. This enumeration uses the #[repr(u8)] attribute, meaning its variants have an explicit storage representation of an 8-bit unsigned integer. The different instruction results represent outcomes such as successful continuation, stop, return, self-destruction, reversion, deep call, out of funds, out of gas, and various error conditions.

  • SuccessOrHalt Enum

    The SuccessOrHalt enum represents the outcome of a transaction execution, distinguishing successful operations, reversion, halting conditions, fatal external errors, and internal continuation. It also provides several methods to check the kind of result and to extract the value of the successful evaluation or halt.

  • From<InstructionResult> for SuccessOrHalt Implementation

    This implementation provides a way to convert an InstructionResult into a SuccessOrHalt. It maps each instruction result to the corresponding SuccessOrHalt variant.

  • Macros for returning instruction results

    The module provides two macros, return_ok! and return_revert!, which simplify returning some common sets of instruction results.