EEVM.Error (eevm v0.1.0)

Copy Markdown View Source

Reference for all error atoms used across the EEVM codebase.

EEVM uses tagged tuples for error handling: {:error, reason} or {:error, reason, state}. This module documents every error reason atom and which modules produce them.

Execution Errors

These errors halt the current execution frame:

ErrorSourceMeaning
:stack_underflowEEVM.Interpreter (pre-dispatch check), EEVM.Interpreter.StackAttempted to pop/peek from an empty stack
:stack_overflowEEVM.Interpreter (pre-dispatch check), EEVM.Interpreter.StackAttempted to push onto a full stack (1,024 elements)
:out_of_gasEEVM.Interpreter.MachineStateGas consumed exceeds available gas
:invalid_jump_destinationEEVM.Interpreter.Instructions.ControlFlowJUMP/JUMPI target is not a JUMPDEST
:static_state_modificationEEVM.Interpreter, EEVM.Interpreter.Instructions.System.CallsState-mutating opcode or value-bearing CALL inside a STATICCALL frame (EIP-214)
:return_data_out_of_boundsEEVM.Interpreter.Instructions.Environment.DataRETURNDATACOPY reads past the end of the return data buffer
:insufficient_balanceEEVM.WorldStateTransfer amount exceeds account balance
:max_call_depthEEVM.Interpreter.MachineStateNested call depth exceeds 1,024
:empty_call_stackEEVM.Interpreter.MachineStateAttempted to pop a frame with no frames on stack

Precompile Errors

Returned by precompiled contract implementations:

ErrorSourceMeaning
:out_of_gasAll precompilesGas limit insufficient for the operation
:invalid_inputBN256, Blake2F, KZG, ModExp (EIP-7823)Input data has wrong length or format
:invalid_pointBN256Elliptic curve point not on the alt_bn128 curve
:invalid_versioned_hashKZGVersioned hash doesn't match expected format
:invalid_field_elementKZGField element is not in the valid range
:proof_verification_failedKZGKZG proof verification returned false
:not_implementedEEVM.PrecompilesPrecompile address has no implementation

Transaction Validation Errors

Returned by EEVM.Transaction.Validator.validate/4 (and so by EEVM.Handler.execute/4) before any state changes. Checks run in the order listed and the first failure wins.

ErrorMeaning
:tx_type_not_supportedSet-code (type 4) transaction before Prague (EIP-7702)
:set_code_tx_no_creationSet-code transaction has no to address (EIP-7702)
:empty_authorization_listSet-code transaction carries no authorizations (EIP-7702)
:invalid_authorizationAn authorization field is out of range, such as a nonce of 2^64 or more (EIP-7702)
:intrinsic_gas_too_lowgas_limit is below the intrinsic gas (or, from Prague, the EIP-7623 calldata floor)
:gas_limit_exceeds_capgas_limit is above 2^24 (EIP-7825, from Osaka)
:gas_limit_exceeds_blockgas_limit is above the block gas limit
:nonce_too_lownonce is below the sender's account nonce
:nonce_too_highnonce is above the sender's account nonce
:priority_fee_above_max_feemax_priority_fee_per_gas exceeds max_fee_per_gas (EIP-1559)
:max_fee_below_basefeemax_fee_per_gas is below the block base fee (EIP-1559)
:insufficient_balanceBalance can't cover gas_limit * max price + blob gas * max_fee_per_blob_gas + value
:sender_not_eoaSender has code other than a delegation designator (EIP-3607, EIP-7702)
:blob_tx_no_creationBlob transaction has no to address (EIP-4844)
:no_blob_dataBlob transaction carries no blob hashes (EIP-4844)
:blob_fee_too_lowmax_fee_per_blob_gas is below the block blob base fee (EIP-4844)
:initcode_too_largeContract-creation data exceeds 49,152 bytes (EIP-3860)

Block Header Validation Errors

Returned by EEVM.Block.HeaderValidator.validate/3 when a header is not a valid successor of its parent. Checks run in the order listed and the first failure wins.

ErrorMeaning
:unknown_parentparent_hash doesn't match the parent header's hash
:invalid_block_numbernumber isn't the parent's number plus one
:invalid_timestamptimestamp isn't greater than the parent's
:extra_data_too_bigextra_data is longer than 32 bytes
:invalid_gas_limitgas_limit is below 5,000 or moves by parent_gas_limit / 1024 or more
:gas_limit_too_biggas_limit exceeds the signed 64-bit maximum
:invalid_base_feebase_fee_per_gas differs from the value derived from the parent (EIP-1559, from London)
:invalid_difficultydifficulty isn't 0 (EIP-3675, from Paris)
:invalid_noncenonce isn't eight zero bytes (EIP-3675, from Paris)
:invalid_ommers_hashommers_hash isn't the empty-list hash (EIP-3675, from Paris)
:missing_header_fieldsA field the fork defines (base_fee_per_gas, withdrawals_root, the blob fields, parent_beacon_block_root, requests_hash) is nil
:unexpected_header_fieldsA field from a later fork is set
:invalid_blob_gas_usedblob_gas_used isn't a multiple of 131,072 or exceeds the fork's per-block maximum (EIP-4844, EIP-7691)
:invalid_excess_blob_gasexcess_blob_gas differs from the value derived from the parent (EIP-4844, EIP-7918 from Osaka)

Block Errors

Returned by EEVM.Block.decode/1, validate/3, execute/4, and build/4, in addition to every header validation error above.

ErrorMeaning
:invalid_block_encodingThe bytes aren't a canonical RLP block
:rlp_block_size_exceededThe encoded block is over 8,388,608 bytes (EIP-7934, from Osaka)
:invalid_transactions_roottransactions_root doesn't commit to the block's transactions
:invalid_withdrawals_rootwithdrawals_root doesn't commit to the withdrawals, or withdrawals are present before Shanghai or missing after
:invalid_ommers_hashommers_hash doesn't commit to the block's ommers
:invalid_blob_gas_usedblob_gas_used differs from the transactions' total blob gas
{:tx_failed, index, reason}Transaction index (0-based) was rejected: reason is an EEVM.Handler error, or :gas_allowance_exceeded when its gas limit exceeds the gas left in the block
:invalid_gas_usedgas_used differs from the gas the transactions used
:invalid_logs_bloomlogs_bloom differs from the receipts' combined bloom
:invalid_receipts_rootreceipts_root differs from the receipts' root
:invalid_state_rootstate_root differs from the post-block state

Registry Errors

ErrorSourceMeaning
:unknown_opcodeEEVM.Interpreter.Instructions.RegistryOpcode byte has no known metadata

Machine State Status Values

The MachineState.status field uses these atoms (not errors, but related):

  • :running — execution in progress
  • :stopped — normal termination (STOP or RETURN)
  • :reverted — controlled failure (REVERT)
  • :invalid — INVALID opcode or unknown opcode executed
  • :out_of_gas — gas exhausted
  • {:error, reason} — wrapped error from opcode execution

Summary

Types

block_error()

@type block_error() ::
  :invalid_block_encoding
  | :rlp_block_size_exceeded
  | header_validation_error()
  | :invalid_transactions_root
  | :invalid_withdrawals_root
  | :invalid_blob_gas_used
  | {:tx_failed, non_neg_integer(), atom()}
  | :invalid_gas_used
  | :invalid_logs_bloom
  | :invalid_receipts_root
  | :invalid_state_root

execution_error()

@type execution_error() ::
  :stack_underflow
  | :stack_overflow
  | :out_of_gas
  | :invalid_jump_destination
  | :static_state_modification
  | :return_data_out_of_bounds
  | :insufficient_balance
  | :max_call_depth
  | :empty_call_stack

header_validation_error()

@type header_validation_error() ::
  :unknown_parent
  | :invalid_block_number
  | :invalid_timestamp
  | :extra_data_too_big
  | :invalid_gas_limit
  | :gas_limit_too_big
  | :invalid_base_fee
  | :invalid_difficulty
  | :invalid_nonce
  | :invalid_ommers_hash
  | :missing_header_fields
  | :unexpected_header_fields
  | :invalid_blob_gas_used
  | :invalid_excess_blob_gas

precompile_error()

@type precompile_error() ::
  :out_of_gas
  | :invalid_input
  | :invalid_point
  | :invalid_versioned_hash
  | :invalid_field_element
  | :proof_verification_failed
  | :not_implemented

reason()

@type reason() ::
  execution_error()
  | precompile_error()
  | :unknown_opcode
  | transaction_validation_error()
  | block_error()

transaction_validation_error()

@type transaction_validation_error() ::
  :tx_type_not_supported
  | :set_code_tx_no_creation
  | :empty_authorization_list
  | :invalid_authorization
  | :intrinsic_gas_too_low
  | :gas_limit_exceeds_cap
  | :gas_limit_exceeds_block
  | :nonce_too_low
  | :nonce_too_high
  | :priority_fee_above_max_fee
  | :max_fee_below_basefee
  | :insufficient_balance
  | :sender_not_eoa
  | :blob_tx_no_creation
  | :no_blob_data
  | :blob_fee_too_low
  | :initcode_too_large