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

feat(trie): retain branch nodes in sparse trie #12291

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Nov 3, 2024

Doesn't collect removed branch nodes yet, only updated ones.

@shekhirin shekhirin added C-enhancement New feature or request A-trie Related to Merkle Patricia Trie implementation labels Nov 3, 2024
@shekhirin shekhirin force-pushed the alexey/sparse-trie-retain-branch-nodes branch from 47ede04 to 8c04ef0 Compare November 18, 2024 10:03
Comment on lines +752 to +753
let mut tree_mask_values = Vec::new();
let mut hash_mask_values = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

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

why are these vecs and not bitmasks (TrieMasks) from the start

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it requires checking the children set in state_mask to correctly set the bits in tree_mask and hash_mask, so I would suggest we do it in a follow-up PR because it requires changes to alloy-trie

crates/trie/sparse/src/trie.rs Outdated Show resolved Hide resolved
path,
RlpNode::word_rlp(&hash),
false,
SparseNodeType::Branch { store_in_db_trie: true },
Copy link
Member

Choose a reason for hiding this comment

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

why is the flag set to true in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, fixed by memoizing in the same way as we do with hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trie Related to Merkle Patricia Trie implementation C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants