From 078e617d1c107e39b756ef278e4c867d6befdcd9 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 21 Apr 2017 18:28:49 -0400 Subject: [PATCH] go-merkle -> merkleeyes/iavl and tmlibs/merkle --- example/dummy/dummy.go | 5 +++-- example/dummy/dummy_test.go | 8 ++++---- example/dummy/persistent_dummy.go | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index f384cc98f..4485deac8 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -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} } diff --git a/example/dummy/dummy_test.go b/example/dummy/dummy_test.go index aa040948a..57aac4ef2 100644 --- a/example/dummy/dummy_test.go +++ b/example/dummy/dummy_test.go @@ -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 } diff --git a/example/dummy/persistent_dummy.go b/example/dummy/persistent_dummy.go index 258cb3014..84793bc91 100644 --- a/example/dummy/persistent_dummy.go +++ b/example/dummy/persistent_dummy.go @@ -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())