pokt-network / smt

A Go library that implements a Sparse Merkle Trie for a key-value map.
https://pkg.go.dev/github.com/pokt-network/smt
Other
16 stars 4 forks source link

feat: add `SparseMerkleClosestProof` proof type #27

Closed h5law closed 11 months ago

h5law commented 11 months ago

Description

Summary generated by Reviewpad on 05 Oct 23 15:28 UTC

This pull request includes the following changes:

  1. 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.

  2. 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".

  3. 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.

  4. 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.

  5. 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.

  6. The "README.md" file has a minor change in the required version of Go, updating it from 1.19+ to 1.20+.

  7. 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.

  8. 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.

  9. 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

Testing

Required Checklist

If Applicable Checklist

codecov[bot] commented 11 months ago

Codecov Report

Attention: 116 lines in your changes are missing coverage. Please review.

Comparison is base (8cbd915) 84.77% compared to head (c2292fe) 78.32%.

:exclamation: Current head c2292fe differs from pull request most recent head b2f18c8. Consider uploading reports for the commit b2f18c8 to get more accurate results

Additional details and impacted files ```diff @@ 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 ``` | [Files](https://app.codecov.io/gh/pokt-network/smt/pull/27?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pokt-network) | Coverage Δ | | |---|---|---| | [smst.go](https://app.codecov.io/gh/pokt-network/smt/pull/27?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pokt-network#diff-c21zdC5nbw==) | `94.82% <100.00%> (+3.65%)` | :arrow_up: | | [types.go](https://app.codecov.io/gh/pokt-network/smt/pull/27?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pokt-network#diff-dHlwZXMuZ28=) | `93.02% <ø> (ø)` | | | [smt.go](https://app.codecov.io/gh/pokt-network/smt/pull/27?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pokt-network#diff-c210Lmdv) | `80.34% <77.77%> (+0.31%)` | :arrow_up: | | [proofs.go](https://app.codecov.io/gh/pokt-network/smt/pull/27?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pokt-network#diff-cHJvb2ZzLmdv) | `58.04% <17.03%> (-30.42%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Olshansk commented 11 months ago

Screenshot 2023-10-03 at 11 47 41 AM Screenshot 2023-10-03 at 11 49 08 AM

@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).