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

feat: add SparseMerkleClosestProof proof type #27

Merged
merged 13 commits into from
Oct 5, 2023
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.19"]
go: ["1.20"]
name: Go Tests
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
fail-fast: false
matrix:
goarch: ["arm64", "amd64"]
go: ["1.19"]
go: ["1.20"]
timeout-minutes: 5
name: Build for ${{ matrix.goarch }}
steps:
Expand Down
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
Loading