Skip to content

Commit

Permalink
make test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
grepsuzette committed Apr 10, 2023
1 parent 81cac3b commit f65e6ce
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tm2/pkg/iavl/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package iavl

import (
"bytes"
"errors"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -230,7 +231,7 @@ func verifyProof(t *testing.T, proof *RangeProof, root []byte) {
}
// may be invalid... errors are okay
if err == nil {
assert.Errorf(t, badProof.Verify(root),
assert.Errorf(t, rangeProofVerify(badProof, root),
"Proof was still valid after a random mutation:\n%X\n%X",
proofBytes, badProofBytes)
}
Expand All @@ -239,6 +240,16 @@ func verifyProof(t *testing.T, proof *RangeProof, root []byte) {

// ----------------------------------------

func rangeProofVerify(rangeProof *RangeProof, root []byte) (namedError error) {
defer func() {
if e := recover(); e != nil {
namedError = errors.New(e.(string))
}
}()
namedError = rangeProof.Verify(root)
return
}

func flatten(bzz [][]byte) (res []byte) {
for _, bz := range bzz {
res = append(res, bz...)
Expand Down

0 comments on commit f65e6ce

Please sign in to comment.