-
Notifications
You must be signed in to change notification settings - Fork 130
feat(l2): introduce FlatTrie as a zkVM performant MPT #5554
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?
Conversation
Lines of code reportTotal lines added: Detailed view |
Benchmark for 595856aClick to view benchmark
|
| /// A leaf node doesn't have any childs | ||
| Leaf, | ||
| /// An extension node always has a branch as a child | ||
| Extension { child: Option<usize> }, |
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.
Why is the child an option, if it's guaranteed to exist and be a branch?
| rkyv::Archive, | ||
| )] | ||
| pub enum NodeChilds { | ||
| /// A leaf node doesn't have any childs |
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.
| /// A leaf node doesn't have any childs | |
| /// A leaf node doesn't have any children |
| if let NodeRef::Node(child_node, _) = &node.child { | ||
| recursive(child_node, trie); | ||
| child = Some(trie.views.len() - 1); | ||
| } |
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.
How can we tell when a given child is unpopulated from it just being in hashed form?
| }; | ||
|
|
||
| let offset = trie.data.len(); | ||
| trie.data.extend(value.encode_to_vec()); |
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.
It's probably better to do:
| trie.data.extend(value.encode_to_vec()); | |
| value.encode(&mut trie.data); |
That should save a memcpy and a second realloc.
| /// Recursively traverses the trie, hashes each node's data and checks that their parents reference | ||
| /// those same hashes. This way the data gets authenticated. | ||
| /// | ||
| /// Initializes `Self::root_hash` if successful, and returns a boolean indicating success. |
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.
Shouldn't auth failure be an error?
Benchmark for 6f9b9baClick to view benchmark
|
Benchmark for c42b68bClick to view benchmark
|
Benchmark for 51d2f20Click to view benchmark
|
Benchmark for 91bc7caClick to view benchmark
|
Benchmark for 31c08dfClick to view benchmark
|
Benchmark for ea76b6dClick to view benchmark
|
Benchmark for f8e1ec3Click to view benchmark
|
Benchmark Results ComparisonNo significant difference was registered for any benchmark run. Detailed ResultsBenchmark Results: BubbleSort
Benchmark Results: ERC20Approval
Benchmark Results: ERC20Mint
Benchmark Results: ERC20Transfer
Benchmark Results: Factorial
Benchmark Results: FactorialRecursive
Benchmark Results: Fibonacci
Benchmark Results: FibonacciRecursive
Benchmark Results: ManyHashes
Benchmark Results: MstoreBench
Benchmark Results: Push
Benchmark Results: SstoreBench_no_opt
|
Benchmark for 5e71131Click to view benchmark
|
Motivation
Description
Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.Closes #issue_number