Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law committed Sep 30, 2023
1 parent 0e68b9e commit 51f9b03
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 150 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Tests](https://github.com/pokt-network/smt/actions/workflows/test.yml/badge.svg)](https://github.com/pokt-network/smt/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/pokt-network/smt/branch/main/graph/badge.svg)](https://codecov.io/gh/pokt-network/smt)

Note: **Requires Go 1.19+**
Note: **Requires Go 1.20+**

- [Overview](#overview)
- [Documentation](#documentation)
Expand Down
8 changes: 5 additions & 3 deletions bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ func bulkCheckAll(t *testing.T, smt *SMTWithStorage, kv []bulkop) {
if err != nil {
t.Errorf("error: %v", err)
}
if !VerifyProof(proof, smt.Root(), []byte(k), []byte(v), smt.Spec()) {
valid, err := VerifyProof(proof, smt.Root(), []byte(k), []byte(v), smt.Spec())
if !valid || err != nil {
t.Fatalf("Merkle proof failed to verify (i=%d): %v", ki, []byte(k))
}
compactProof, err := ProveCompact([]byte(k), smt)
if err != nil {
t.Errorf("error: %v", err)
}
if !VerifyCompactProof(compactProof, smt.Root(), []byte(k), []byte(v), smt.Spec()) {
valid, err = VerifyCompactProof(compactProof, smt.Root(), []byte(k), []byte(v), smt.Spec())
if !valid || err != nil {
t.Fatalf("Compact Merkle proof failed to verify (i=%d): %v", ki, []byte(k))
}

Expand All @@ -135,7 +137,7 @@ func bulkCheckAll(t *testing.T, smt *SMTWithStorage, kv []bulkop) {
}

ph := smt.Spec().ph
commonPrefix := countCommonPrefix(ph.Path([]byte(k)), ph.Path([]byte(k2)), 0)
commonPrefix := countCommonPrefixBits(ph.Path([]byte(k)), ph.Path([]byte(k2)), 0)
if commonPrefix != smt.Spec().depth() && commonPrefix > largestCommonPrefix {
largestCommonPrefix = commonPrefix
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pokt-network/smt

go 1.19
go 1.20

require (
github.com/dgraph-io/badger/v4 v4.2.0
Expand Down
Loading

0 comments on commit 51f9b03

Please sign in to comment.