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

Optimize storage of default values in VerkleNode #3476

Merged
merged 24 commits into from
Jul 4, 2024

Conversation

acolytec3
Copy link
Contributor

@acolytec3 acolytec3 commented Jun 28, 2024

Optimizes how we store default values for InternalNode and LeafNode so memory footprint is shrunk.

For InternalNode, if an element of internalNode.children has not been written to, the value is stored as null.

For LeafNode, if an element of the values array is 0 and has not been written before, it's stored as 0. If it's 0 and has been deleted, it's stored as 1. Otherwise, it's stored in its 32 byte Uint8Array representation.

Have also added some helpers to create default values (empty leafnode value, deleted leafnode value)

holgerd77
holgerd77 previously approved these changes Jul 1, 2024
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Nice, LGTM!

@acolytec3
Copy link
Contributor Author

Need to fix some bugs locally before we merge. Just noticed I wasn't handling some of the changes correctly in the put method.

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.51%. Comparing base (d24ca11) to head (bb7d30c).
Report is 44 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (d24ca11) and HEAD (bb7d30c). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (d24ca11) HEAD (bb7d30c)
blockchain 1 0
statemanager 1 0
Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 72.71% <ø> (?)
blockchain ?
client 0.00% <ø> (?)
common 94.10% <ø> (-0.20%) ⬇️
devp2p 0.00% <ø> (?)
statemanager ?
tx 78.38% <ø> (?)
util 69.68% <ø> (-11.75%) ⬇️
wallet 0.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@gabrocheleau gabrocheleau merged commit 4947a7e into master Jul 4, 2024
35 of 36 checks passed
@holgerd77 holgerd77 deleted the optimize-node-value-storage branch July 11, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants