feat: Add error handling to Commit() function#467
feat: Add error handling to Commit() function#467Apostlex0 wants to merge 1 commit intoethereum:masterfrom
Conversation
|
Hey, @gballet could you please review the pr and see if the changes are of any help. |
gballet
left a comment
There was a problem hiding this comment.
Thanks for the PR. This repo is currently no longer used in geth and will probably be archived soon (although I will keep it alive if it's useful to some people).
In order to merge this, the requested changes have to be applied, but on top of that, extra care needs to be taken that if something goes wrong, there is enough information given to debug this. Which means that info about the curve point needs to be added to the only error that can arise in commitNodesAtLevel.
| // reconsider splitting the interface or find some safer workaround. | ||
| panic("can not commit a hash node") | ||
| func (n HashedNode) Commit() (*Point, error) { | ||
| return n.Commitment(), nil |
There was a problem hiding this comment.
this is a no-op change, and it removes some comments that are useful in case we want to resurrect this repo later.
| } | ||
| } else { | ||
| var wg sync.WaitGroup | ||
| errChan := make(chan error, 1) |
There was a problem hiding this comment.
this is incorrect, as more than one goroutine can write an error to the channel. If so, multiple goroutines can leak.
There was a problem hiding this comment.
so this needs to be something like:
| errChan := make(chan error, 1) | |
| errChan := make(chan error, (len(nodes) + batchSize - 1) / batchSize) |
Description
This PR adds error handling to the
Commit()function in the Verkle tree implementation. Previously, theCommit()function did not return errors, which could lead to silent failures.Changes
VerkleNodeinterface to makeCommit()return(*Point, error)Commit()to properly handle and return errorsCommit()to handle the returned errorCommit()Why
The original implementation did not handle potential errors during commitment computation, which could lead to:
Testing
Commit()and they passRelated Issues