EIP-6873 Preserving original address/slot hash values (Preimage retention)
No call decision · Scaling & data · EIP status Stagnant · created 2023-04-14
Ahead of the transition to the Verge, this requires execution clients to store the original values (preimages) of address and slot hashes generated from the fork just before the Verge through the Verge itself.
Why it is needed
For Ethereum to switch its state storage structure from the Merkle Patricia Trie to the Verkle tree, every key must be rehashed. However, most execution clients store only the hashed values of addresses and slots and discard the original values before hashing. If the transition is done by having each node recompute its own keys, these original values are essential. At present the total preimage volume on mainnet is about 70GB, and having every node redo a full sync at the moment of transition would take the entire network offline for days, which is not realistic. Downloading a file is not a viable alternative either, since the chain keeps progressing so the file quickly goes stale, and receiving 70GB within a single slot time is impossible. So, to ensure all preimages are ready in time for the transition, every node is required to accumulate them itself for the span from the pre-Verge fork through the Verge.
What changes
Today
- Most execution clients store only the hashed values of addresses and slots and discard the original values.
- At the time of the Verkle transition, nodes without preimages would have to redo a full sync that takes days.
- Even if received as a shared file, new addresses keep being created as the chain progresses, so it quickly goes stale.
After EIP-6873
- Clients are required to store the original values of all address and slot hashes generated from just before the fork (T_p) through the Verge (T_v).
- Preimages outside this range may optionally also be stored.
- For hashes generated within this range, the client must be able to show the original value from its database.
- Preimages generated before the Verge must be downloadable from a publicly available data repository.
Who is affected
- Client teams: Execution clients must enable preimage storage as default behavior during the specified period.
- Full node and validator operators: Additional disk space (on the order of about 70GB) must be secured for preimage storage.
- Verkle tree transition work: Because every node can rehash its own keys, the transition becomes possible without a centralized conversion process.
In depth
What is a preimage
When storing an address or storage slot in the tree, the hashed value is used as the key. The original value before this hash is produced is called a 'preimage'. To save disk space, most execution clients store only the hash value and discard the preimage.
Mandatory storage period
Letting T_p be the time of the fork immediately preceding the Verge and T_v the time of the Verge itself, EL clients MUST store the preimages of all address and slot hashes produced while executing every block generated between T_p and T_v. Storing additional preimages outside this range is optional (MAY).
Lookup and distribution availability requirements
For hashes generated between T_p and T_v, the client should be able to show that the corresponding preimage exists in its database (SHOULD). It should also be possible to download preimages of address and slot hashes generated before the Verge from a publicly available data repository (SHOULD).
Why per-node storage is mandated
The Verkle tree transition requires fully rehashing every tree key. The total preimage volume on mainnet is about 70GB. There are two ways to secure this: turning on preimage storage and redoing a full sync, which takes nodes offline for days and cannot be demanded of the entire network simultaneously, or downloading it as a file, which fails because the chain keeps progressing so the file quickly goes stale, and receiving 70GB within a single slot time is also impossible. So the only realistic alternative is to require each node to build up its own preimage list for the period around the transition.
Implementation status
The source document states that all clients have already implemented preimage retention as an option. The Security Considerations section is left blank as "needs discussion" and no Test Cases have been written. This EIP is currently marked Stagnant.