Skip to content
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

trie: use go-verkle helper for speedier (*VerkleTrie).RollBackAccount #30242

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

gballet
Copy link
Member

@gballet gballet commented Jul 30, 2024

This is a performance improvement on the account-creation rollback code required for the archive node to support verkle. It uses the utility function DeleteAtStem to remove code and account data per-group instead of doing it leaf by leaf.

It also fixes an index bug, as code is chunked in 31-byte chunks, so comparing with the code size should use 31 as its stride.

@gballet gballet added this to the 1.14.8 milestone Jul 30, 2024
trie/verkle.go Outdated Show resolved Hide resolved
// Delete all further code
for i, chunknr := uint64(32*128), uint64(128); i < codeSize; i, chunknr = i+32, chunknr+1 {
for i, chunknr := uint64(31*128), uint64(128); i < codeSize; i, chunknr = i+31*256, chunknr+256 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i understand correctly, the codeSize in the account header refers to the length of raw contract code;

After code chunkification, for each chunk we store 1 byte metadata and 31 bytes code? It's the reason you only count 31 bytes here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that is the reason

@fjl fjl modified the milestones: 1.14.8, 1.14.9 Aug 12, 2024
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fjl fjl changed the title trie, go.mod: use go-verkle helper for speedier (*VerkleTrie).RollBackAccount trie: use go-verkle helper for speedier (*VerkleTrie).RollBackAccount Aug 20, 2024
@rjl493456442 rjl493456442 merged commit df645e7 into master Aug 21, 2024
4 of 5 checks passed
@holiman holiman deleted the speedier-verkle-account-rollback branch September 20, 2024 07:47
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.

4 participants