EEVM.TransactionError exception (eevm v0.1.0)

Copy Markdown View Source

A rejected transaction with the values that broke the rule, returned as {:error, %EEVM.TransactionError{}} by EEVM.transact/4 when it is called with details: true. Without that option the same failure returns the bare reason atom, which stays the stable, matchable part.

FieldDescription
reasonThe error atom, as listed in EEVM.Error
detailsThe values the rule compared, in a map; empty for rules with nothing to compare

details by reason (addresses are integers, amounts in wei, gas in units of gas):

ReasonDetails
:nonce_too_low, :nonce_too_high, :nonce_is_maxsender, tx_nonce, state_nonce
:insufficient_balancesender, balance, required (gas limit at the maximum price, blob gas, and value)
:intrinsic_gas_too_lowgas_limit, intrinsic_gas (the EIP-7623 floor included from Prague)
:gas_limit_exceeds_blockgas_limit, block_gas_limit
:gas_limit_exceeds_capgas_limit, cap (EIP-7825)
:max_fee_below_basefeemax_fee_per_gas, or gas_price for legacy and EIP-2930 transactions, and base_fee
:priority_fee_above_max_feemax_priority_fee_per_gas, max_fee_per_gas
:blob_fee_too_lowmax_fee_per_blob_gas, blob_base_fee
:too_many_blobsblobs, max_blobs
:invalid_versioned_hash, :invalid_authorizationindex of the first bad entry
:initcode_too_largesize, max_size (EIP-3860)
:sender_not_eoasender
:tx_type_not_supportedtype, hardfork

Exception.message/1 and EEVM.Error.message/1 render it like geth:

iex> error = %EEVM.TransactionError{reason: :nonce_too_high, details: %{sender: 0xB0B, tx_nonce: 5, state_nonce: 1}}
iex> Exception.message(error)
"nonce too high: sender 0x0000000000000000000000000000000000000b0b, tx_nonce 5, state_nonce 1"

Summary

Types

t()

@type t() :: %EEVM.TransactionError{
  __exception__: true,
  details: map(),
  reason: EEVM.Error.reason()
}