Convert simple proof to ics23 proof (#6390)

* convert simple proof to ics23 proof

* add CHANGELOG entries

* Apply suggestions from code review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Aditya
2020-06-10 13:23:40 -04:00
committed by GitHub
co-authored by Federico Kunze
parent b9f39c94f8
commit e12fa58e14
6 changed files with 37 additions and 36 deletions
-30
View File
@@ -109,36 +109,6 @@ func TestVerifyMultiStoreQueryProof(t *testing.T) {
require.NotNil(t, err)
}
func TestVerifyMultiStoreQueryProofEmptyStore(t *testing.T) {
// Create main tree for testing.
db := dbm.NewMemDB()
store := NewStore(db)
iavlStoreKey := types.NewKVStoreKey("iavlStoreKey")
store.MountStoreWithDB(iavlStoreKey, types.StoreTypeIAVL, nil)
err := store.LoadVersion(0)
require.NoError(t, err)
cid := store.Commit() // Commit with empty iavl store.
// Get Proof
res := store.Query(abci.RequestQuery{
Path: "/iavlStoreKey/key", // required path to get key/value+proof
Data: []byte("MYKEY"),
Prove: true,
})
require.NotNil(t, res.Proof)
// Verify proof.
prt := DefaultProofRuntime()
err = prt.VerifyAbsence(res.Proof, cid.Hash, "/iavlStoreKey/MYKEY")
require.Nil(t, err)
// Verify (bad) proof.
prt = DefaultProofRuntime()
err = prt.VerifyValue(res.Proof, cid.Hash, "/iavlStoreKey/MYKEY", []byte("MYVALUE"))
require.NotNil(t, err)
}
func TestVerifyMultiStoreQueryProofAbsence(t *testing.T) {
// Create main tree for testing.
db := dbm.NewMemDB()