-
Notifications
You must be signed in to change notification settings - Fork 38
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/237 mpt trie ext to branch collapse error #455
Feat/237 mpt trie ext to branch collapse error #455
Conversation
- While `Nibbles::default()` already does this, I think having an explicit method that makes an empty `Nibbles` is a bit cleaner, even if it's a bit redundant.
- Unsafe, as if the extension was pointing to a (hashed) leaf, then we must collapse the extension into the leaf. - However, because the leaf is hashed, we can not tell that the hash node is from a leaf and also can not extract the leaf's key. - It's the user's responsibility to ensure that this scenario never occurs, so we need to return an error when it does.
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 find the "collapse into" phrasing a bit overloaded/confusing, but I think I understand
Ugh, how did I do that? I meant too just remove the changes of the calls to |
9b3e1b5
to
1c47d09
Compare
Should be good now. 👍 |
1c47d09
to
08543c2
Compare
08543c2
to
610c00b
Compare
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.
Thanks!
* Added `Nibbles::empty()` - While `Nibbles::default()` already does this, I think having an explicit method that makes an empty `Nibbles` is a bit cleaner, even if it's a bit redundant. * Now returns an error if we collapse an `E --> H` - Unsafe, as if the extension was pointing to a (hashed) leaf, then we must collapse the extension into the leaf. - However, because the leaf is hashed, we can not tell that the hash node is from a leaf and also can not extract the leaf's key. - It's the user's responsibility to ensure that this scenario never occurs, so we need to return an error when it does. * Requested PR changes for #455
Resolves #237.
Also slipped in a QoL method
Nibbles::empty()
, which maybe should have been a separate PR (sorry!). I felt that an explicitempty
method was a bit more clear than callingNibbles::default()
whenever we wanted an emptyNibbles
.