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): sparse trie leaf removal #11752

Merged
merged 25 commits into from
Oct 17, 2024
Merged

feat(trie): sparse trie leaf removal #11752

merged 25 commits into from
Oct 17, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Oct 15, 2024

Closes #11743

Blocked by alloy-rs/trie#58

@shekhirin shekhirin added C-enhancement New feature or request A-trie Related to Merkle Patricia Trie implementation labels Oct 15, 2024
@shekhirin shekhirin marked this pull request as ready for review October 15, 2024 17:45
crates/trie/sparse/src/trie.rs Outdated Show resolved Hide resolved
crates/trie/sparse/src/trie.rs Outdated Show resolved Hide resolved
crates/trie/sparse/src/trie.rs Outdated Show resolved Hide resolved
crates/trie/sparse/src/trie.rs Outdated Show resolved Hide resolved
Comment on lines +280 to +283

// Walk the stack of removed nodes from the back and re-insert them back into the trie,
// adjusting the node type as needed.
while let Some(removed_node) = removed_nodes.pop() {
Copy link
Member

Choose a reason for hiding this comment

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

the leaf node might also be the root. then removed_nodes is empty and we violate the invariant that the trie always contains the root node. would be great to add a test for this too

Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

great job

@rkrasiuk rkrasiuk added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit bac244a Oct 17, 2024
41 checks passed
@rkrasiuk rkrasiuk deleted the alexey/sparse-trie-remove branch October 17, 2024 10:35
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.

trie: sparse trie node removal
2 participants