-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: add SparseMerkleClosestProof
proof type
#27
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
- Coverage 84.77% 78.32% -6.45%
==========================================
Files 8 8
Lines 1241 1375 +134
==========================================
+ Hits 1052 1077 +25
- Misses 138 242 +104
- Partials 51 56 +5
☔ View full report in Codecov by Sentry. |
c2292fe
to
c5c4a56
Compare
@h5law Please try to avoid force pushes after something has started to be reviewed in the future. I understand the need to do so from a git workflow perspective, but it puts a lot more onus on the reviewer (and reviewing code is not a fun job as is). |
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.
This is looking really good but I requested a few more changes to clean it up just because of how important this PR is.
} | ||
|
||
// VerifySumProof verifies a Merkle proof for a sum tree. | ||
func VerifySumProof(proof *SparseMerkleProof, root, key, value []byte, sum uint64, spec *TreeSpec) bool { | ||
func VerifySumProof(proof *SparseMerkleProof, root, key, value []byte, sum uint64, spec *TreeSpec) (bool, error) { |
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.
You should generate a godoc for this in the future! All these exported functions will show up.
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.
wdym generate a godoc?
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.
Sorry for the long turnaround, but I think the final work is amazing!
Description
Summary generated by Reviewpad on 05 Oct 23 15:28 UTC
This pull request includes the following changes:
In the "bulk_test.go" file, improvements have been made to the error handling and validation of Merkle proofs and compact proofs in the code. The "bulkCheckAll" function now includes error handling and return values for "VerifyProof" and "VerifyCompactProof" functions. The code also checks if the Merkle proof and Compact Merkle proof failed to verify, and if the proof is valid or if there is an error. Additionally, the "ProveCompact" function has similar modifications.
The "go.mod" file has been modified, updating the "go" version from 1.19 to 1.20 and adding a new dependency "github.com/dgraph-io/badger/v4" with version "v4.2.0".
The ".github/workflows/test.yml" file has changes related to the "Go Tests" job and the "Build for ${{ matrix.goarch }}" job, updating the value of the "go" matrix parameter from 1.19 to 1.20.
In the "proofs_test.go" file, there are several changes related to imports, function names, and the code for compact and decompact proofs. These modifications focus on refactoring and improving the code related to proofs in the "smt" package.
The "smst_test.go" file has changes related to error handling and validation in the test case for the "TotalSum" function in the "SMST" struct.
The "README.md" file has a minor change in the required version of Go, updating it from 1.19+ to 1.20+.
The "types.go" file has changes modifying the return type of the "ProveClosest" method in the "SparseMerkleTree" and "SparseMerkleSumTree" interfaces. The method now returns a "proof" of type "SparseMerkleClosestProof" instead of separate values.
In the "smt.go" file, there are changes related to function names, return types, the addition of new fields, and improvements in code functionality and clarity.
In the "placeholder" file, there are changes related to import statements and the addition of new functions for converting integers to byte slices and vice versa.
These changes indicate improvements in error handling, validation, code functionality, and clarity throughout the codebase. Let me know if you need more details or if there is anything else I can assist you with!
Issue
Fixes N/A
Type of change
Please mark the relevant option(s):
List of changes
SparseMerkleClosestProof
type and verification methodsTesting
go test ...
go test ...
go test -v
Required Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist