EIPs Explained

EIP-7495 · Review · Core · 2023-08-18

EIP-7495: SSZ ProgressiveContainer

A new SSZ container type whose fields keep the same Merkle position across forks, so light clients and on-chain proof verifiers do not break when consensus structures gain or lose fields.

What problem does it solve?

Ethereum's consensus layer encodes data structures such as BeaconState and blocks in SSZ (Simple Serialize), and commits to them with a Merkle root. Anyone can then prove a single field, for example a validator balance, with a Merkle proof that walks to a specific generalized index (gindex) in the tree.

The problem is that the tree's shape depends on how many fields a container has. When a fork adds fields and the count crosses a power of two, or a field is removed or changes type, every gindex can shift. Verifiers that hard-code gindices, such as smart contracts reading beacon roots via EIP-4788, bridges or hardware wallets, then break and need upgrades, even if the field they care about did not change.

ProgressiveContainer gives each field a permanent slot so proofs keep working across versions.

How it works

  • A container is declared with an active_fields bit list. Each 1 marks a slot occupied by the next declared field; each 0 is a gap (a field that does not exist in this version, e.g. one that was removed).
  • Merkleization uses the progressive Merkle tree from EIP-7916, which grows gradually with the number of slots instead of jumping to the next power of two. Existing slots never move as new ones are appended.
  • Absent slots are filled with a zero hash. The root is then mixed with active_fields: hash(root, pack_bits(active_fields)), so a removed field cannot be confused with a field whose value is zero.
  • Serialization and JSON are unchanged from a regular Container: absent fields take no space on the wire.
  • Rules: at least one field, at most 256 active_fields entries, the list must not end in 0, and the number of 1s must equal the number of fields.

Sample code

Two shapes sharing a stable position for color (from the spec, Python/remerkleable notation):

class Square(ProgressiveContainer(active_fields=[1, 0, 1])):
    side: uint16   # slot 0
    color: uint8   # slot 2

class Circle(ProgressiveContainer(active_fields=[0, 1, 1])):
    radius: uint16 # slot 1
    color: uint8   # slot 2  -> same gindex as Square.color

# Merkleization (pseudocode)
def hash_tree_root(value):
    roots = []
    it = iter(fields_of(value))
    for bit in value.active_fields:
        roots.append(hash_tree_root(next(it)) if bit else Bytes32())
    return hash(merkleize_progressive(roots), pack_bits(value.active_fields))

A verifier that proves color uses the same gindex for both types, and keeps working if a later version appends more fields.

Things to know

  • Status is Review. It is a consensus-layer data-structure change; which containers adopt it, and in which fork, is decided separately.
  • It depends on EIP-7916 (progressive Merkle trees / ProgressiveList).
  • The 256-field cap counts deprecated slots too. The spec suggests nesting a further ProgressiveContainer in a field if that limit is ever reached.
  • Optional fields are explicitly out of scope and left to a future proposal.
  • Reference implementation and tests live in ethereum/remerkleable and the consensus-specs SSZ generic tests.

#ssz #consensus #merkle #light-client

Details

Authors
Etan Kissling (@etan-status), Cayman (@wemeetagain)
Status
Review
Type
Standards Track / Core
Created
2023-08-18
Requires
Required by

Machine-readable: Markdown · JSON