EIPs Explained

EIP-6466 · Draft · Core · 2023-02-08

EIP-6466: SSZ receipts

Draft plan to replace RLP-encoded transaction receipts and their Patricia-trie root with SSZ receipts, so individual logs and fields can be proven cheaply.

What problem does it solve?

Every transaction produces a receipt (success flag, gas, logs). Today receipts are RLP-encoded and committed in the block header's receipts_root via a Merkle-Patricia Trie. Two weaknesses follow:

  • Hard to prove pieces. Each receipt is hashed as one blob, so proving a single log means supplying the whole receipt. That is costly for light clients, bridges and L2 fraud proofs.
  • Missing data. JSON-RPC returns from, gasUsed and contractAddress, but the on-chain receipt doesn't contain them, so they cannot be verified against the header (from has to be recovered with ecrecover).

EIP-6466 moves receipts to SSZ (Simple Serialize, the format already used by the consensus layer), part of a broader effort with EIP-6404 for SSZ transactions.

How it works

A Log becomes an SSZ container: address, up to 4 topics, and data.

A Receipt is a tagged union of three shapes that share one Merkle layout, so each field sits at a stable position (generalized index):

Variant Emitted for Fields
BasicReceipt ordinary calls, blob transactions from, gas_used, logs, status
CreateReceipt contract deployments adds contract_address
SetCodeReceipt EIP-7702 set-code transactions adds authorities (failed authorizations appear as the zero address)

status keeps the EIP-658 meaning. gas_used is the gas of that transaction alone. The logs_bloom, the old intermediate state root and cumulative_gas_used are removed.

The header's receipts_root becomes the SSZ hash_tree_root of the list of receipts, and the consensus ExecutionPayload field changes type accordingly. Over JSON-RPC, receipts gain an authorities array, stop returning logsBloom for new receipts, and logIndex counts within the receipt rather than the block (per EIP-8116).

Sample code

SSZ type definitions from the spec (Python-style, as used in consensus specs):

class Log(Container):
    address: ExecutionAddress            # Bytes20
    topics: List[Bytes32, 4]             # LOG0..LOG4
    data: ProgressiveByteList

class BasicReceipt(ProgressiveContainer(active_fields=[1, 1, 0, 1, 1])):
    from_: ExecutionAddress
    gas_used: GasAmount                  # uint64
    logs: ProgressiveList[Log]
    status: boolean

class Receipt(CompatibleUnion({
    0x01: BasicReceipt,
    0x02: CreateReceipt,
    0x03: SetCodeReceipt,
})):
    pass

# Header commitment
block_header.receipts_root = ProgressiveList[Receipt](*receipts).hash_tree_root()

Things to know

  • Status: Draft. It is not scheduled for any network upgrade and depends on several other draft proposals (EIP-6404 transactions, progressive SSZ types, EIP-8116 and others).
  • It is a breaking change for anything that verifies receipts against the header with MPT proofs, and for log filtering that relies on the bloom.
  • RLP and SSZ receipts can collide when encoded, so a given network channel must use only one format; the block header tells you which fork's format applies.
  • Committing from and contract_address lets verifiers skip ecrecover, which also makes future signature-scheme changes easier.

#ssz #receipts #logs #core #serialization

Details

Authors
Etan Kissling (@etan-status), Gajinder Singh (@g11tech), Vitalik Buterin (@vbuterin)
Status
Draft
Type
Standards Track / Core
Created
2023-02-08
Requires
Required by

Machine-readable: Markdown · JSON