-
Notifications
You must be signed in to change notification settings - Fork 144
chore(l1): fast validate #5713
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
base: main
Are you sure you want to change the base?
chore(l1): fast validate #5713
Conversation
Lines of code reportTotal lines added: Detailed view |
Benchmark for 2c37b03Click to view benchmark
|
Benchmark for 398d407Click to view benchmark
|
Benchmark for e28a603Click to view benchmark
|
87ca44e to
e4f21e2
Compare
Benchmark for 60c8be6Click to view benchmark
|
| for (_, node) in self.into_iter() { | ||
| expected_count -= 1; | ||
| match node { | ||
| Node::Branch(branch_node) => { | ||
| expected_count += branch_node | ||
| .choices | ||
| .iter() | ||
| .filter(|child| child.is_valid()) | ||
| .count(); | ||
| } | ||
| Node::Extension(_) => { | ||
| expected_count += 1; | ||
| } | ||
| Node::Leaf(_) => {} | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we checking the hashes match at some point? Does the iterator still do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The iterator uses get_node_checked, which will stop the iteration, which will make expected_count return a value indicating that the trie is not valid.
Oppen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but see comment.
Benchmark for 8b9433aClick to view benchmark
|
Motivation
We want to validate the tree quicker and consume less memory.
Description