mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-23 16:34:38 +00:00
Merge branch 'master' into jae/verifyingcachineprovider
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type errNoData struct{}
|
||||
@@ -12,13 +12,10 @@ func (e errNoData) Error() string {
|
||||
|
||||
// IsErrNoData checks whether an error is due to a query returning empty data
|
||||
func IsErrNoData(err error) bool {
|
||||
if err_, ok := err.(cmn.Error); ok {
|
||||
_, ok := err_.Data().(errNoData)
|
||||
return ok
|
||||
}
|
||||
return false
|
||||
_, ok := errors.Cause(err).(errNoData)
|
||||
return ok
|
||||
}
|
||||
|
||||
func ErrNoData() error {
|
||||
return cmn.ErrorWrap(errNoData{}, "")
|
||||
return errors.Wrap(errNoData{}, "")
|
||||
}
|
||||
|
||||
+4
-3
@@ -4,9 +4,10 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto/merkle"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/lite"
|
||||
lerr "github.com/tendermint/tendermint/lite/errors"
|
||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||
@@ -83,7 +84,7 @@ func GetWithProofOptions(prt *merkle.ProofRuntime, path string, key []byte, opts
|
||||
kp = kp.AppendKey(resp.Key, merkle.KeyEncodingURL)
|
||||
err = prt.VerifyValue(resp.Proof, signedHeader.AppHash, kp.String(), resp.Value)
|
||||
if err != nil {
|
||||
return nil, cmn.ErrorWrap(err, "Couldn't verify value proof")
|
||||
return nil, errors.Wrap(err, "Couldn't verify value proof")
|
||||
}
|
||||
return &ctypes.ResultABCIQuery{Response: resp}, nil
|
||||
} else {
|
||||
@@ -92,7 +93,7 @@ func GetWithProofOptions(prt *merkle.ProofRuntime, path string, key []byte, opts
|
||||
// XXX How do we encode the key into a string...
|
||||
err = prt.VerifyAbsence(resp.Proof, signedHeader.AppHash, string(resp.Key))
|
||||
if err != nil {
|
||||
return nil, cmn.ErrorWrap(err, "Couldn't verify absence proof")
|
||||
return nil, errors.Wrap(err, "Couldn't verify absence proof")
|
||||
}
|
||||
return &ctypes.ResultABCIQuery{Response: resp}, nil
|
||||
}
|
||||
|
||||
@@ -143,13 +143,13 @@ func TestTxProofs(t *testing.T) {
|
||||
|
||||
// First let's make sure a bogus transaction hash returns a valid non-existence proof.
|
||||
key := types.Tx([]byte("bogus")).Hash()
|
||||
res, err := cl.Tx(key, true)
|
||||
_, err = cl.Tx(key, true)
|
||||
require.NotNil(err)
|
||||
require.Contains(err.Error(), "not found")
|
||||
|
||||
// Now let's check with the real tx root hash.
|
||||
key = types.Tx(tx).Hash()
|
||||
res, err = cl.Tx(key, true)
|
||||
res, err := cl.Tx(key, true)
|
||||
require.NoError(err, "%#v", err)
|
||||
require.NotNil(res)
|
||||
keyHash := merkle.SimpleHashFromByteSlices([][]byte{key})
|
||||
|
||||
Reference in New Issue
Block a user