-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
trie, core/state: revert error removal in (*state.Trie).Commit #27544
trie, core/state: revert error removal in (*state.Trie).Commit #27544
Conversation
What kind of errors can happen in the verkle tree during commit? |
core/state/state_object.go
Outdated
s.data.Root = root | ||
return nodes, nil | ||
root, nodes, err := tr.Commit(false) | ||
if err == nil { |
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 would prefer to reform the code like
root, nodes, err := tr.Commit(false)
if err != nil {
return nil, err
}
s.data.Root = root
return nodes, nil
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 have nothing to against, if verkle needs to return error.
Only a nitpick, lgtm.
Looking at the code:
None of that should happen in practice, but if it does it'd be vital to capture that error. |
Co-Authored-By: rjl493456442 <garyrong0905@gmail.com>
Yeah, in MPT, (2) node encoding will never fail since we always write to a local buffer and (3) we won't do any database write even in current master in commit function. But I think it's ok to return an error. Error might occurs in verkle, e.g. some cryptography operations. |
…eum#27544) * trie, core/state: revert error removal in (*state.Trie).Commit * Gary's nitpick :) Co-Authored-By: rjl493456442 <garyrong0905@gmail.com> --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
ethereum#27544)" This reverts commit fd024dc.
ethereum#27544)" This reverts commit fd024dc.
This has been discussed with @rjl493456442 : the
error
result was removed from(*state.Trie).Commit
as no error could occur in the MPT'sCommit
function. In verkle, however, errors can happen and should be reported.