go-merkle -> merkleeyes/iavl and tmlibs/merkle
This commit is contained in:
parent
dd303dc119
commit
078e617d1c
|
@ -4,8 +4,9 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/tmlibs/merkle"
|
||||
)
|
||||
|
||||
type DummyApplication struct {
|
||||
|
@ -15,7 +16,7 @@ type DummyApplication struct {
|
|||
}
|
||||
|
||||
func NewDummyApplication() *DummyApplication {
|
||||
state := merkle.NewIAVLTree(0, nil)
|
||||
state := iavl.NewIAVLTree(0, nil)
|
||||
return &DummyApplication{state: state}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
abcicli "github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
func testDummy(t *testing.T, app types.Application, tx []byte, key, value string) {
|
||||
|
@ -38,7 +38,7 @@ func testDummy(t *testing.T, app types.Application, tx []byte, key, value string
|
|||
})
|
||||
require.Equal(t, types.CodeType_OK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
proof, err := merkle.ReadProof(resQuery.Proof)
|
||||
proof, err := iavl.ReadProof(resQuery.Proof)
|
||||
require.Nil(t, err)
|
||||
require.True(t, proof.Verify([]byte(key), resQuery.Value, proof.RootHash)) // NOTE: we have no way to verify the RootHash
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string)
|
|||
require.Nil(t, err)
|
||||
require.Equal(t, types.CodeType_OK, resQuery.Code)
|
||||
require.Equal(t, value, string(resQuery.Value))
|
||||
proof, err := merkle.ReadProof(resQuery.Proof)
|
||||
proof, err := iavl.ReadProof(resQuery.Proof)
|
||||
require.Nil(t, err)
|
||||
require.True(t, proof.Verify([]byte(key), resQuery.Value, proof.RootHash)) // NOTE: we have no way to verify the RootHash
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/tendermint/abci/types"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/merkleeyes/iavl"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
dbm "github.com/tendermint/tmlibs/db"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -35,7 +35,7 @@ func NewPersistentDummyApplication(dbDir string) *PersistentDummyApplication {
|
|||
db := dbm.NewDB("dummy", "leveldb", dbDir)
|
||||
lastBlock := LoadLastBlock(db)
|
||||
|
||||
stateTree := merkle.NewIAVLTree(0, db)
|
||||
stateTree := iavl.NewIAVLTree(0, db)
|
||||
stateTree.Load(lastBlock.AppHash)
|
||||
|
||||
log.Notice("Loaded state", "block", lastBlock.Height, "root", stateTree.Hash())
|
||||
|
|
Loading…
Reference in New Issue