diff --git a/glide.lock b/glide.lock index 4a6213884f..5d0c74a713 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: 2848c30b31fb205f846dd7dfca14ebed8a3249cbc5aaa759066b2bab3e4bbf42 -updated: 2017-07-27T16:46:31.962147949-04:00 +updated: 2017-08-04T15:38:45.048261895+02:00 imports: - name: github.com/bgentry/speakeasy version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd @@ -119,7 +119,7 @@ imports: - edwards25519 - extra25519 - name: github.com/tendermint/go-crypto - version: bf355d1b58b27d4e98d8fb237eb14887b93a88f7 + version: 03d2b2446e8587f159e52070b1f1e0def971a2c7 subpackages: - cmd - keys @@ -142,7 +142,7 @@ imports: - certifiers/files - proofs - name: github.com/tendermint/merkleeyes - version: 0310013053953eef80def3619aeb1e3a3254f452 + version: 44c4c64c731db5be4261ff3971b01b7e19729419 subpackages: - client - iavl diff --git a/state/bonsai.go b/state/bonsai.go index 9800ba54fb..7eb98568a9 100644 --- a/state/bonsai.go +++ b/state/bonsai.go @@ -3,7 +3,7 @@ package state import ( "math/rand" - "github.com/tendermint/tmlibs/merkle" + "github.com/tendermint/merkleeyes/iavl" ) // store nonce as it's own type so no one can even try to fake it @@ -12,13 +12,13 @@ type nonce int64 // Bonsai is a deformed tree forced to fit in a small pot type Bonsai struct { id nonce - Tree merkle.Tree + Tree *iavl.IAVLTree } var _ SimpleDB = &Bonsai{} // NewBonsai wraps a merkle tree and tags it to track children -func NewBonsai(tree merkle.Tree) *Bonsai { +func NewBonsai(tree *iavl.IAVLTree) *Bonsai { return &Bonsai{ id: nonce(rand.Int63()), Tree: tree, @@ -46,8 +46,8 @@ func (b *Bonsai) Remove(key []byte) (value []byte) { return } -func (b *Bonsai) Proof(key []byte) (value []byte, proof []byte, exists bool) { - return b.Tree.Proof(key) +func (b *Bonsai) GetWithProof(key []byte) ([]byte, *iavl.KeyExistsProof, *iavl.KeyNotExistsProof, error) { + return b.Tree.GetWithProof(key) } func (b *Bonsai) List(start, end []byte, limit int) []Model { diff --git a/state/merkle.go b/state/merkle.go index 666cac0bc4..4d6ac45f7c 100644 --- a/state/merkle.go +++ b/state/merkle.go @@ -1,9 +1,6 @@ package state -import ( - "github.com/tendermint/merkleeyes/iavl" - "github.com/tendermint/tmlibs/merkle" -) +import "github.com/tendermint/merkleeyes/iavl" // State represents the app states, separating the commited state (for queries) // from the working state (for CheckTx and AppendTx) @@ -14,7 +11,7 @@ type State struct { persistent bool } -func NewState(tree merkle.Tree, persistent bool) State { +func NewState(tree *iavl.IAVLTree, persistent bool) State { base := NewBonsai(tree) return State{ committed: base, @@ -59,10 +56,7 @@ func (s *State) Hash() ([]byte, error) { func (s *State) BatchSet(key, value []byte) { if s.persistent { // This is in the batch with the Save, but not in the tree - tree, ok := s.committed.Tree.(*iavl.IAVLTree) - if ok { - tree.BatchSet(key, value) - } + s.committed.Tree.BatchSet(key, value) } }