Skip to content

EIP7736 Impact Estimation #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: v1.15.5/master
Choose a base branch
from
Open

Conversation

weiihann
Copy link
Owner

@weiihann weiihann commented Mar 31, 2025

Summary

There are two parts to this task:

  1. Labelling: Label each key-value pair with the last accessed (i.e. read and write) block number
  2. Analysis: Compute the expiry epoch of each stem and analyse how many expired stems can be deleted

Mechanism of Labelling

How it works roughly:

  1. Propagate block number from BlockChain to State
  2. Every access operation updates the block number of stateObject and cached temporarily
  3. During state's commit operation, a diff layer is created, which includes the labels
  4. When diff layer merges to the disk layer, the labels are persisted to the database.

The storage format of the labels:

  • [SnapshotAccountMeta] + Account hash → block number
  • [SnapshotStorageMeta] + Account hash + slot hash → block number

Mechanism of Analysis

This is still work in progress. The implementation will reference the OverlayVerkleTransition function. The rough flow looks something like:

  1. Create a custom command
  2. Iterate over each key-value pair in the snapshot
  3. Using the preimage, get the actual account address and slot number from their hashes
  4. Compute the stems for the required fields to be inserted into Verkle
  5. Get the block number labels, convert into expiry period and match it to the stems
  6. Keep track of the expiry period count
  7. Repeat until all accounts and slots are done
  8. At the end, we should know the percentage of stems that are expired. From there, compare it with the size of Verkle, then we roughly know how much storage can be reduced.

One caveat: In Verkle, contract code is chunkified and split into different stems, it’s possible that only some parts are accessed while some aren’t. Therefore, the actual result should actually be better than the result that we have.

rjl493456442 pushed a commit that referenced this pull request Apr 2, 2025
…ereum#31079)

This PR is #1 of a 3-part series that implements the new log index
intended to replace core/bloombits.
Replaces ethereum#30370

This part implements the new data structure, the log index generator and
the search logic. This PR has most of the complexity but it does not
affect any existing code yet so maybe it is easier to review separately.

FilterMaps data structure explanation:
https://gist.github.com/zsfelfoldi/a60795f9da7ae6422f28c7a34e02a07e

Log index generator code overview:
https://gist.github.com/zsfelfoldi/97105dff0b1a4f5ed557924a24b9b9e7

Search pattern matcher code overview:
https://gist.github.com/zsfelfoldi/5981735641c956afb18065e84f8aff34

Note that the possibility of a tree hashing scheme and remote proof
protocol are mentioned in the documents above but they are not exactly
specified yet. These specs are WIP and will be finalized after the local
log indexer/filter code is finalized and merged.

---------

Co-authored-by: Felix Lange <[email protected]>
@weiihann weiihann force-pushed the v1.15.5/snapshot-meta branch 3 times, most recently from 68d8065 to c6df8c1 Compare April 12, 2025 10:22
@weiihann weiihann force-pushed the v1.15.5/snapshot-meta branch from 0c99620 to d2e52e1 Compare April 14, 2025 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant