- 
                Notifications
    You must be signed in to change notification settings 
- Fork 115
refactor(l1): make TrieError::InconsistentTree more specific #4836
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
Conversation
| Lines of code reportTotal lines added:  Detailed view | 
| Benchmark for e4c2504Click to view benchmark
 | 
| Benchmark for cbc8b39Click to view benchmark
 | 
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.
I believe ok_or() eagerly builds the error, so even when the trie node is found both format! and compute_hash() will run, this means we'll be hashing every time.
I suggest replacing ok_or for ok_or_else( || { TrieError::... }) as this one takes a closure that is only executed if the Option is None.
| Benchmark for 786dd32Click to view benchmark
 | 
| Benchmark for 4765370Click to view benchmark
 | 
| Benchmark for 3ea5de1Click to view benchmark
 | 
| Benchmark for 6e31a3dClick to view benchmark
 | 
| Benchmark for 636eb5cClick to view benchmark
 | 
| Benchmark for 1291411Click to view benchmark
 | 
| Benchmark for 37f9166Click to view benchmark
 | 
| Benchmark for 1360e78Click to view benchmark
 | 
| Benchmark for b594f6aClick to view benchmark
 | 
| Benchmark for 7658ea2Click to view benchmark
 | 
| Benchmark for 4087ed1Click to view benchmark
 | 
| Benchmark for 842abe6Click to view benchmark
 | 
| Benchmark for 599e1dcClick to view benchmark
 | 
| Benchmark for 6d061a3Click to view benchmark
 | 
…rex into more-specific-trie-error
| Benchmark for 3be8b5cClick to view benchmark
 | 
| Benchmark for 8a71b46Click to view benchmark
 | 
Motivation
Adding some metadata to
TrieError::InconsistentTreeto have more information when we don't find a node in the database.Description
This pr introduces a new enum to make the
TrieError::InconsistentTreemore specific:Then I got InconsistentTreeError boxed because for some error variants it surpasses the 168 bytes limit allowed by clippy on results.
Closes #4786