EEVM.Block.Receipt (eevm v0.1.0)

Copy Markdown View Source

Per-transaction receipt emitted after execution (Byzantium-and-later layout).

Fields

  • status — 1 if the top-level call completed, 0 if it reverted.
  • cumulative_gas_used — total gas consumed in the block up to and including this transaction. The cumulative_gas_used of the last receipt equals the block's gas_used.
  • logs — every log entry emitted by this transaction, in emission order. Each log is a map matching EEVM.Block.Bloom.log_entry/0.
  • logs_bloom — the 2048-bit bloom filter over this receipt's logs (EEVM.Block.Bloom.from_logs(logs)); stored pre-computed so block-level aggregation is a fast bytewise OR.

Wire encoding (EIP-2718)

  • Legacy (type-0) receipts encode as a plain RLP list: RLP([status, cumulative_gas_used, logs_bloom, logs]).
  • Typed receipts (EIP-2930 / 1559 / 4844) prepend a single type byte to the same RLP list, e.g. <<0x02>> <> RLP([...]) for EIP-1559.

Each log encodes as [address, [topic, ...], data], with the address as a 20-byte big-endian binary and each topic as a 32-byte big-endian binary.

Summary

Functions

Encode a receipt to its wire (RLP) form.

Returns a successful receipt with no logs and zero cumulative gas.

Returns a receipt with the given overrides.

Types

log()

@type log() :: EEVM.Block.Bloom.log_entry()

t()

@type t() :: %EEVM.Block.Receipt{
  cumulative_gas_used: non_neg_integer(),
  logs: [log()],
  logs_bloom: EEVM.Block.Bloom.t(),
  status: 0 | 1
}

tx_type()

@type tx_type() :: :legacy | :eip2930 | :eip1559 | :eip4844 | non_neg_integer()

Functions

encode(receipt, opts \\ [])

@spec encode(
  t(),
  keyword()
) :: binary()

Encode a receipt to its wire (RLP) form.

Pass tx_type: to produce a typed (EIP-2718) receipt. The accepted values are :legacy (default), :eip2930, :eip1559, :eip4844, or the raw integer type byte.

new()

@spec new() :: t()

Returns a successful receipt with no logs and zero cumulative gas.

new(opts)

@spec new(keyword()) :: t()

Returns a receipt with the given overrides.

If :logs is supplied without an explicit :logs_bloom, the bloom is derived from the logs automatically so callers cannot produce a receipt whose bloom is out of sync with its logs.