Pre-flight checks on a wire transaction.
This phase handles steps 1-3 of the transaction pipeline (Yellow Paper §6):
- Decode the wire bytes (or accept an already-decoded typed struct).
- Recover sender via secp256k1 ecrecover on the typed signing hash.
- Validate intrinsic gas, nonce, balance, EOA sender, EIP-1559 fee constraints, blob/initcode size rules.
Outputs {:ok, %EEVM.Context.Transaction{}} ready for the next phase, or
{:error, reason} for any failure.
Summary
Functions
Build the EEVM.Context.Transaction the EVM sees from a decoded transaction.
Convert a 20-byte address to its integer form.
Decode wire bytes into a typed transaction struct, or pass a struct through.
Recover the 20-byte sender address; see EEVM.Transaction.Signer.recover_sender/2.
Use opts[:config] if given, else build one from opts[:hardfork] (default :cancun).
Validate the transaction against state; see EEVM.Transaction.Validator.validate/4.
Types
@type decoded_tx() :: EEVM.Transaction.Legacy.t() | EEVM.Transaction.AccessList.t() | EEVM.Transaction.FeeMarket.t() | EEVM.Transaction.Blob.t() | EEVM.Transaction.SetCode.t()
@type wire_tx() :: decoded_tx() | binary()
Functions
@spec build_tx_context(decoded_tx(), binary()) :: {:ok, EEVM.Context.Transaction.t()}
Build the EEVM.Context.Transaction the EVM sees from a decoded transaction.
@spec decode_address(binary()) :: non_neg_integer()
Convert a 20-byte address to its integer form.
@spec ensure_decoded(wire_tx()) :: {:ok, decoded_tx()} | {:error, atom()}
Decode wire bytes into a typed transaction struct, or pass a struct through.
@spec recover_sender(decoded_tx(), non_neg_integer()) :: {:ok, binary()} | {:error, atom()}
Recover the 20-byte sender address; see EEVM.Transaction.Signer.recover_sender/2.
@spec resolve_config(keyword()) :: EEVM.Config.t()
Use opts[:config] if given, else build one from opts[:hardfork] (default :cancun).
@spec validate( EEVM.Context.Transaction.t(), EEVM.Database.t(), EEVM.Context.Block.t(), EEVM.HardforkConfig.t() ) :: :ok | {:error, atom()}
Validate the transaction against state; see EEVM.Transaction.Validator.validate/4.