-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix(l1): remove "inconsistent internal tree structure" panics #1288
Conversation
This reverts commit 3c2b46a.
get()
calls for pruned tries// it's potentially a new account. This is because we're using pruned tries | ||
// so the path into a new account might not be included in the pruned state trie. | ||
let mut account_state = match account_state { | ||
Ok(Some(encoded_state)) => AccountState::decode(&encoded_state)?, |
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.
Can't we use "?" instead of matching with multiple Oks/Err?
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.
We can't because we want to match the InconsistentTree
error and interpret it as a "state not found" error instead of propagating it
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! This is very useful! 🚀
Motivation
The
Trie
library assumes that all tries are well-formed: this means that if some node contains the hash of a child, then that child is in the tire's database. If this doesn't hold, then aget()
call panics with aninconsistent internal tree structure
message.For the L2 prover we're using "pruned tries" which only store the relevant nodes for the set of values touched in some execution, breaking the previous hypothesis. One option was to capture the panics on the get calls, but this wasn't safe because
Trie
has internal mutability. The path chosen is to remove the panics altogether and replace them with errors.Description