Skip to content
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

core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit #29869

Merged
merged 6 commits into from
Jun 12, 2024

Conversation

jwasinger
Copy link
Contributor

The Commit operation performs the commitment computation, computing the changed node-set, internal intermediate roots, and new state root. There's no reason that it should fail and return an error.

trie/verkle.go Outdated
}
func (t *VerkleTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet) {
root := t.root.(*verkle.InternalNode)
nodes, _ := root.BatchSerialize()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this doesn't need to return an error, and opened an upstream PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't get accepted, we can just ignore the error return here IMO. afaict, indicates an internal logic error that we should not experience under normal operation and can't reasonably recover from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a panic if an error is returned here. We assume by this point, that the Trie we are committing is well-formed.

TBQH, I don't fully understand the underlying logic of what is happening here, but it seems clear that this can only return an error if the underlying tree is somehow corrupted or the code logic is wrong, both of which should be unrecoverable IMO. The underlying error originates here.

CC @gballet if there is something I'm missing here.

triedb/pathdb/database_test.go Outdated Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
trie/verkle.go Show resolved Hide resolved
Mazzika1

This comment was marked as spam.

@rjl493456442
Copy link
Member

Test are failing, looks like you accidently push the changes of test submdule. Please revert it.

@karalabe
Copy link
Member

karalabe commented Jun 3, 2024

Pls rebase, I guess gary's PR broke things

trie/verkle.go Outdated
nodes, err := root.BatchSerialize()
if err != nil {
return common.Hash{}, nil, fmt.Errorf("serializing tree nodes: %s", err)
// error return from this function indicates error in the code logic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, please capitalise the first letter of the sentence :P

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@karalabe karalabe added this to the 1.14.6 milestone Jun 12, 2024
@ethereum ethereum deleted a comment from Mazzika1 Jun 12, 2024
@ethereum ethereum deleted a comment from Mazzika1 Jun 12, 2024
@karalabe karalabe merged commit 69351e8 into ethereum:master Jun 12, 2024
2 of 3 checks passed
mask-pp pushed a commit to mask-pp/go-ethereum that referenced this pull request Jun 17, 2024
…rom trie Commit (ethereum#29869)

* core/state, eth/protocols, trie, triedb/pathdb:  remove unused error return from trie Commit

* move set back to account-trie-update block scoping for easier readability

* address review

* undo tests submodule change

* trie:  panic if BatchSerialize returns an error in Verkle trie Commit

* trie: verkle comment nitpicks

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants