From 8e801e1809016d9aaa2e3d5ee7952de3e63bf2c2 Mon Sep 17 00:00:00 2001 From: Woosang Son Date: Tue, 6 Apr 2021 18:42:05 +0900 Subject: [PATCH 1/2] chore: bump up tm-db and remove Domain() call --- go.mod | 6 ++-- go.sum | 19 ++++++++----- server/start.go | 2 +- server/tm_cmds.go | 2 +- store/cachekv/memiterator.go | 15 ++++++++-- store/cachekv/mergeiterator.go | 21 -------------- store/cachekv/store.go | 4 +-- store/gaskv/store.go | 5 ---- store/gaskv/store_test.go | 3 -- store/prefix/store_test.go | 16 ----------- store/rootmulti/store.go | 5 ++-- store/tracekv/store.go | 5 ---- store/tracekv/store_test.go | 8 ------ tests/mocks/account_retriever.go | 20 +++++++------- tests/mocks/tendermint_tm_db_DB.go | 44 +++++++++++++++++++++++++----- x/wasm/linkwasmd/go.mod | 4 +-- 16 files changed, 82 insertions(+), 97 deletions(-) diff --git a/go.mod b/go.mod index 5d516bb534..6ef8e6a215 100644 --- a/go.mod +++ b/go.mod @@ -25,9 +25,9 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/golang-lru v0.5.4 - github.com/line/iavl/v2 v2.0.0-init.1.0.20210325055816-6304f1fd2f09 - github.com/line/ostracon v0.34.9-0.20210325081149-c7c246b1be58 - github.com/line/tm-db/v2 v2.0.0-init.1.0.20210325025547-0ea105c02281 + github.com/line/iavl/v2 v2.0.0-init.1.0.20210406065347-cfd73e5acce0 + github.com/line/ostracon v0.34.9-0.20210406083837-4183d649b30c + github.com/line/tm-db/v2 v2.0.0-init.1.0.20210406062110-9424ca70955a github.com/magiconair/properties v1.8.4 github.com/mattn/go-isatty v0.0.12 github.com/otiai10/copy v1.4.2 diff --git a/go.sum b/go.sum index ec5e62d194..cd628d2339 100644 --- a/go.sum +++ b/go.sum @@ -104,7 +104,6 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/iavl v0.15.3 h1:xE9r6HW8GeKeoYJN4zefpljZ1oukVScP/7M8oj6SUts= github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= @@ -145,10 +144,14 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= @@ -332,15 +335,17 @@ github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOS github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/line/iavl/v2 v2.0.0-init.1.0.20210325055816-6304f1fd2f09 h1:11L4wU4iYYRfOP20qo7909Q0gkd1NG8GOjSPu3Bblcg= -github.com/line/iavl/v2 v2.0.0-init.1.0.20210325055816-6304f1fd2f09/go.mod h1:lOUXCMWnB9G5wDfungP5nhnHAFgVBwB0/iqFhH44OIs= +github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55 h1:cXVtMiJkvQ4kn0pxM2svH1ncJbFgQsLHtnFC9qJj2VM= +github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55/go.mod h1:DHRJroSL7NaRkpvocRx3OtRsleXVsYSxBI9SfHFlTQ0= +github.com/line/iavl/v2 v2.0.0-init.1.0.20210406065347-cfd73e5acce0 h1:Pcp/mxkvFmasaiPi9DS2ZXCKOalfDGtBKYjdswmF0nI= +github.com/line/iavl/v2 v2.0.0-init.1.0.20210406065347-cfd73e5acce0/go.mod h1:Z2UTxsbKefd7bnEywGNxxmVYYGy9Ecd4nd1IZyR0bQM= github.com/line/lbm-sdk v0.39.2-0.2.0 h1:tlQHZcf+AXejSBAhYgO5Tn1NaoCF0XRNf/6c0jeo3HE= github.com/line/lbm-sdk v0.39.2-0.2.0/go.mod h1:UTxdYWx+OeRezEP8P5BxipddlFpq4q92uYydSeYN7B0= github.com/line/ostracon v0.34.9-0.20210315041958-2a1f43c788f5/go.mod h1:1THU+kF+6fxLaNYQKcdNyLCO6t9LnqSMaExDMiLozbM= -github.com/line/ostracon v0.34.9-0.20210325081149-c7c246b1be58 h1:k+/hsrZ1RFIlL9+PRDzKPY+5YKFDWklReIgbeYmt+c4= -github.com/line/ostracon v0.34.9-0.20210325081149-c7c246b1be58/go.mod h1:JQ5id/iSwal6/BAoN119QEzfTKm90DNPqB1mPiCR8Jk= -github.com/line/tm-db/v2 v2.0.0-init.1.0.20210325025547-0ea105c02281 h1:HwehzGvsgPHND01825UbjjiKgwfbqIYFAnvn6OheLQs= -github.com/line/tm-db/v2 v2.0.0-init.1.0.20210325025547-0ea105c02281/go.mod h1:TiTwPFffNAqep0nV0YWaxPjElbCp6yG4K8SCxy69mE4= +github.com/line/ostracon v0.34.9-0.20210406083837-4183d649b30c h1:OYIm2Wu22kFoocMgnjU5O/TIphYLHw9q9+e6AsKPkOA= +github.com/line/ostracon v0.34.9-0.20210406083837-4183d649b30c/go.mod h1:/Ov0QcWRleL6TKmHpPMyIx9roxAc/DD1m3N8xST2b0I= +github.com/line/tm-db/v2 v2.0.0-init.1.0.20210406062110-9424ca70955a h1:qSt/WwORC5+nVRnNqx+A0oo5gOCsoVJ0HmHF5Db1YvY= +github.com/line/tm-db/v2 v2.0.0-init.1.0.20210406062110-9424ca70955a/go.mod h1:wmkyPabXjtVZ1dvRofmurjaceghywtCSYGqFuFS+TbI= github.com/line/wasmvm v0.12.0-0.1.0 h1:Xul8w8pLWZDcp0kkz1Y9M6tfZ4WnmMt9g0U/d6lXdE4= github.com/line/wasmvm v0.12.0-0.1.0/go.mod h1:tbXGE9Jz6sYpiJroGr71OQ5TFOufq/P5LWsruA2u6JE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= diff --git a/server/start.go b/server/start.go index c66016b21a..5faa5ba18c 100644 --- a/server/start.go +++ b/server/start.go @@ -9,7 +9,7 @@ import ( "time" "github.com/line/ostracon/abci/server" - ostcmd "github.com/line/ostracon/cmd/tendermint/commands" + ostcmd "github.com/line/ostracon/cmd/ostracon/commands" ostos "github.com/line/ostracon/libs/os" "github.com/line/ostracon/node" "github.com/line/ostracon/p2p" diff --git a/server/tm_cmds.go b/server/tm_cmds.go index d41dbce962..96891faff4 100644 --- a/server/tm_cmds.go +++ b/server/tm_cmds.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - ostcmd "github.com/line/ostracon/cmd/tendermint/commands" + ostcmd "github.com/line/ostracon/cmd/ostracon/commands" "github.com/line/ostracon/libs/cli" "github.com/line/ostracon/p2p" pvm "github.com/line/ostracon/privval" diff --git a/store/cachekv/memiterator.go b/store/cachekv/memiterator.go index 936d77f1ac..a1d264a769 100644 --- a/store/cachekv/memiterator.go +++ b/store/cachekv/memiterator.go @@ -1,11 +1,10 @@ package cachekv import ( + "bytes" "container/list" "errors" - tmdb "github.com/line/tm-db/v2" - "github.com/line/lbm-sdk/v2/types/kv" ) @@ -18,6 +17,16 @@ type memIterator struct { ascending bool } +func IsKeyInDomain(key, start, end []byte) bool { + if bytes.Compare(key, start) < 0 { + return false + } + if end != nil && bytes.Compare(end, key) <= 0 { + return false + } + return true +} + func newMemIterator(start, end []byte, items *list.List, ascending bool) *memIterator { itemsInDomain := make([]*kv.Pair, 0, items.Len()) @@ -25,7 +34,7 @@ func newMemIterator(start, end []byte, items *list.List, ascending bool) *memIte for e := items.Front(); e != nil; e = e.Next() { item := e.Value.(*kv.Pair) - if !tmdb.IsKeyInDomain(item.Key, start, end) { + if !IsKeyInDomain(item.Key, start, end) { if entered { break } diff --git a/store/cachekv/mergeiterator.go b/store/cachekv/mergeiterator.go index c5ab8b6d68..5964cf06cb 100644 --- a/store/cachekv/mergeiterator.go +++ b/store/cachekv/mergeiterator.go @@ -32,27 +32,6 @@ func newCacheMergeIterator(parent, cache types.Iterator, ascending bool) *cacheM return iter } -// Domain implements Iterator. -// If the domains are different, returns the union. -func (iter *cacheMergeIterator) Domain() (start, end []byte) { - startP, endP := iter.parent.Domain() - startC, endC := iter.cache.Domain() - - if iter.compare(startP, startC) < 0 { - start = startP - } else { - start = startC - } - - if iter.compare(endP, endC) < 0 { - end = endC - } else { - end = endP - } - - return start, end -} - // Valid implements Iterator. func (iter *cacheMergeIterator) Valid() bool { return iter.skipUntilExistsOrInvalid() diff --git a/store/cachekv/store.go b/store/cachekv/store.go index ea0097264e..52b86610b1 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -10,8 +10,6 @@ import ( "time" "unsafe" - tmdb "github.com/line/tm-db/v2" - "github.com/line/lbm-sdk/v2/store/tracekv" "github.com/line/lbm-sdk/v2/store/types" "github.com/line/lbm-sdk/v2/telemetry" @@ -207,7 +205,7 @@ func (store *Store) dirtyItems(start, end []byte) { n := len(store.unsortedCache) for key := range store.unsortedCache { - if tmdb.IsKeyInDomain(strToByte(key), start, end) { + if IsKeyInDomain(strToByte(key), start, end) { cacheValue := store.cache[key] unsorted = append(unsorted, &kv.Pair{Key: []byte(key), Value: cacheValue.value}) } diff --git a/store/gaskv/store.go b/store/gaskv/store.go index d4b58293d8..09b451159d 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -129,11 +129,6 @@ func newGasIterator(gasMeter types.GasMeter, gasConfig types.GasConfig, parent t } } -// Implements Iterator. -func (gi *gasIterator) Domain() (start []byte, end []byte) { - return gi.parent.Domain() -} - // Implements Iterator. func (gi *gasIterator) Valid() bool { return gi.parent.Valid() diff --git a/store/gaskv/store_test.go b/store/gaskv/store_test.go index a8838ef1bb..744787a005 100644 --- a/store/gaskv/store_test.go +++ b/store/gaskv/store_test.go @@ -50,9 +50,6 @@ func TestGasKVStoreIterator(t *testing.T) { st.Set(keyFmt(2), valFmt(2)) iterator := st.Iterator(nil, nil) - start, end := iterator.Domain() - require.Nil(t, start) - require.Nil(t, end) require.NoError(t, iterator.Error()) t.Cleanup(func() { diff --git a/store/prefix/store_test.go b/store/prefix/store_test.go index 9bfa522f50..7a4629ba53 100644 --- a/store/prefix/store_test.go +++ b/store/prefix/store_test.go @@ -167,7 +167,6 @@ func TestPrefixStoreIteratorEdgeCase(t *testing.T) { iter := prefixStore.Iterator(nil, nil) - checkDomain(t, iter, nil, nil) checkItem(t, iter, []byte{}, bz("")) checkNext(t, iter, true) checkItem(t, iter, []byte{0x00}, bz("")) @@ -197,7 +196,6 @@ func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { iter := prefixStore.ReverseIterator(nil, nil) - checkDomain(t, iter, nil, nil) checkItem(t, iter, []byte{0x00}, bz("")) checkNext(t, iter, true) checkItem(t, iter, []byte{}, bz("")) @@ -224,7 +222,6 @@ func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { iter = prefixStore.ReverseIterator(nil, nil) - checkDomain(t, iter, nil, nil) checkItem(t, iter, []byte{0x00}, bz("")) checkNext(t, iter, true) checkItem(t, iter, []byte{}, bz("")) @@ -268,12 +265,6 @@ func checkNext(t *testing.T, itr types.Iterator, expected bool) { require.Equal(t, expected, valid) } -func checkDomain(t *testing.T, itr types.Iterator, start, end []byte) { - ds, de := itr.Domain() - require.Equal(t, start, ds) - require.Equal(t, end, de) -} - func checkItem(t *testing.T, itr types.Iterator, key, value []byte) { require.Exactly(t, key, itr.Key()) require.Exactly(t, value, itr.Value()) @@ -321,7 +312,6 @@ func TestPrefixDBIterator1(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.Iterator(nil, nil) - checkDomain(t, itr, nil, nil) checkItem(t, itr, bz(""), bz("value")) checkNext(t, itr, true) checkItem(t, itr, bz("1"), bz("value1")) @@ -339,7 +329,6 @@ func TestPrefixDBIterator2(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.Iterator(nil, bz("")) - checkDomain(t, itr, nil, bz("")) checkInvalid(t, itr) itr.Close() } @@ -349,7 +338,6 @@ func TestPrefixDBIterator3(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.Iterator(bz(""), nil) - checkDomain(t, itr, bz(""), nil) checkItem(t, itr, bz(""), bz("value")) checkNext(t, itr, true) checkItem(t, itr, bz("1"), bz("value1")) @@ -367,7 +355,6 @@ func TestPrefixDBIterator4(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.Iterator(bz(""), bz("")) - checkDomain(t, itr, bz(""), bz("")) checkInvalid(t, itr) itr.Close() } @@ -377,7 +364,6 @@ func TestPrefixDBReverseIterator1(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.ReverseIterator(nil, nil) - checkDomain(t, itr, nil, nil) checkItem(t, itr, bz("3"), bz("value3")) checkNext(t, itr, true) checkItem(t, itr, bz("2"), bz("value2")) @@ -395,7 +381,6 @@ func TestPrefixDBReverseIterator2(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.ReverseIterator(bz(""), nil) - checkDomain(t, itr, bz(""), nil) checkItem(t, itr, bz("3"), bz("value3")) checkNext(t, itr, true) checkItem(t, itr, bz("2"), bz("value2")) @@ -413,7 +398,6 @@ func TestPrefixDBReverseIterator3(t *testing.T) { pstore := NewStore(store, bz("key")) itr := pstore.ReverseIterator(nil, bz("")) - checkDomain(t, itr, nil, bz("")) checkInvalid(t, itr) itr.Close() } diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 76df836dbc..cac4b1d3b7 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -15,6 +15,7 @@ import ( iavltree "github.com/line/iavl/v2" abci "github.com/line/ostracon/abci/types" tmdb "github.com/line/tm-db/v2" + "github.com/line/tm-db/v2/prefixdb" "github.com/pkg/errors" "github.com/line/lbm-sdk/v2/snapshots" @@ -814,10 +815,10 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID var db tmdb.DB if params.db != nil { - db = tmdb.NewPrefixDB(params.db, []byte("s/_/")) + db = prefixdb.NewDB(params.db, []byte("s/_/")) } else { prefix := "s/k:" + params.key.Name() + "/" - db = tmdb.NewPrefixDB(rs.db, []byte(prefix)) + db = prefixdb.NewDB(rs.db, []byte(prefix)) } switch params.typ { diff --git a/store/tracekv/store.go b/store/tracekv/store.go index f41d9bd563..7bfc60c379 100644 --- a/store/tracekv/store.go +++ b/store/tracekv/store.go @@ -114,11 +114,6 @@ func newTraceIterator(w io.Writer, parent types.Iterator, tc types.TraceContext) return &traceIterator{writer: w, parent: parent, context: tc} } -// Domain implements the Iterator interface. -func (ti *traceIterator) Domain() (start []byte, end []byte) { - return ti.parent.Domain() -} - // Valid implements the Iterator interface. func (ti *traceIterator) Valid() bool { return ti.parent.Valid() diff --git a/store/tracekv/store_test.go b/store/tracekv/store_test.go index 1138dfe4cc..3b6be91838 100644 --- a/store/tracekv/store_test.go +++ b/store/tracekv/store_test.go @@ -164,10 +164,6 @@ func TestTestTraceKVStoreIterator(t *testing.T) { store := newTraceKVStore(&buf) iterator := store.Iterator(nil, nil) - s, e := iterator.Domain() - require.Equal(t, []byte(nil), s) - require.Equal(t, []byte(nil), e) - testCases := []struct { expectedKey []byte expectedValue []byte @@ -220,10 +216,6 @@ func TestTestTraceKVStoreReverseIterator(t *testing.T) { store := newTraceKVStore(&buf) iterator := store.ReverseIterator(nil, nil) - s, e := iterator.Domain() - require.Equal(t, []byte(nil), s) - require.Equal(t, []byte(nil), e) - testCases := []struct { expectedKey []byte expectedValue []byte diff --git a/tests/mocks/account_retriever.go b/tests/mocks/account_retriever.go index 3b86a8397f..292c93f8d6 100644 --- a/tests/mocks/account_retriever.go +++ b/tests/mocks/account_retriever.go @@ -7,8 +7,8 @@ package mocks import ( gomock "github.com/golang/mock/gomock" client "github.com/line/lbm-sdk/v2/client" - cryptotypes "github.com/line/lbm-sdk/v2/crypto/types" - types "github.com/line/lbm-sdk/v2/types" + types "github.com/line/lbm-sdk/v2/crypto/types" + types0 "github.com/line/lbm-sdk/v2/types" reflect "reflect" ) @@ -36,10 +36,10 @@ func (m *MockAccount) EXPECT() *MockAccountMockRecorder { } // GetAddress mocks base method -func (m *MockAccount) GetAddress() types.AccAddress { +func (m *MockAccount) GetAddress() types0.AccAddress { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAddress") - ret0, _ := ret[0].(types.AccAddress) + ret0, _ := ret[0].(types0.AccAddress) return ret0 } @@ -50,10 +50,10 @@ func (mr *MockAccountMockRecorder) GetAddress() *gomock.Call { } // GetPubKey mocks base method -func (m *MockAccount) GetPubKey() cryptotypes.PubKey { +func (m *MockAccount) GetPubKey() types.PubKey { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPubKey") - ret0, _ := ret[0].(cryptotypes.PubKey) + ret0, _ := ret[0].(types.PubKey) return ret0 } @@ -115,7 +115,7 @@ func (m *MockAccountRetriever) EXPECT() *MockAccountRetrieverMockRecorder { } // GetAccount mocks base method -func (m *MockAccountRetriever) GetAccount(clientCtx client.Context, addr types.AccAddress) (client.Account, error) { +func (m *MockAccountRetriever) GetAccount(clientCtx client.Context, addr types0.AccAddress) (client.Account, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccount", clientCtx, addr) ret0, _ := ret[0].(client.Account) @@ -130,7 +130,7 @@ func (mr *MockAccountRetrieverMockRecorder) GetAccount(clientCtx, addr interface } // GetAccountWithHeight mocks base method -func (m *MockAccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr types.AccAddress) (client.Account, int64, error) { +func (m *MockAccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr types0.AccAddress) (client.Account, int64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccountWithHeight", clientCtx, addr) ret0, _ := ret[0].(client.Account) @@ -146,7 +146,7 @@ func (mr *MockAccountRetrieverMockRecorder) GetAccountWithHeight(clientCtx, addr } // EnsureExists mocks base method -func (m *MockAccountRetriever) EnsureExists(clientCtx client.Context, addr types.AccAddress) error { +func (m *MockAccountRetriever) EnsureExists(clientCtx client.Context, addr types0.AccAddress) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EnsureExists", clientCtx, addr) ret0, _ := ret[0].(error) @@ -160,7 +160,7 @@ func (mr *MockAccountRetrieverMockRecorder) EnsureExists(clientCtx, addr interfa } // GetAccountNumberSequence mocks base method -func (m *MockAccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr types.AccAddress) (uint64, uint64, error) { +func (m *MockAccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr types0.AccAddress) (uint64, uint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccountNumberSequence", clientCtx, addr) ret0, _ := ret[0].(uint64) diff --git a/tests/mocks/tendermint_tm_db_DB.go b/tests/mocks/tendermint_tm_db_DB.go index a08e7a5e65..2e9429adc6 100644 --- a/tests/mocks/tendermint_tm_db_DB.go +++ b/tests/mocks/tendermint_tm_db_DB.go @@ -6,7 +6,7 @@ package mocks import ( gomock "github.com/golang/mock/gomock" - tmdb "github.com/line/tm-db/v2" + db "github.com/line/tm-db/v2" reflect "reflect" ) @@ -106,10 +106,10 @@ func (mr *MockDBMockRecorder) Has(arg0 interface{}) *gomock.Call { } // Iterator mocks base method -func (m *MockDB) Iterator(arg0, arg1 []byte) (tmdb.Iterator, error) { +func (m *MockDB) Iterator(arg0, arg1 []byte) (db.Iterator, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Iterator", arg0, arg1) - ret0, _ := ret[0].(tmdb.Iterator) + ret0, _ := ret[0].(db.Iterator) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -121,10 +121,10 @@ func (mr *MockDBMockRecorder) Iterator(arg0, arg1 interface{}) *gomock.Call { } // NewBatch mocks base method -func (m *MockDB) NewBatch() tmdb.Batch { +func (m *MockDB) NewBatch() db.Batch { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NewBatch") - ret0, _ := ret[0].(tmdb.Batch) + ret0, _ := ret[0].(db.Batch) return ret0 } @@ -134,6 +134,21 @@ func (mr *MockDBMockRecorder) NewBatch() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBatch", reflect.TypeOf((*MockDB)(nil).NewBatch)) } +// PrefixIterator mocks base method +func (m *MockDB) PrefixIterator(arg0 []byte) (db.Iterator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PrefixIterator", arg0) + ret0, _ := ret[0].(db.Iterator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PrefixIterator indicates an expected call of PrefixIterator +func (mr *MockDBMockRecorder) PrefixIterator(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrefixIterator", reflect.TypeOf((*MockDB)(nil).PrefixIterator), arg0) +} + // Print mocks base method func (m *MockDB) Print() error { m.ctrl.T.Helper() @@ -149,10 +164,10 @@ func (mr *MockDBMockRecorder) Print() *gomock.Call { } // ReverseIterator mocks base method -func (m *MockDB) ReverseIterator(arg0, arg1 []byte) (tmdb.Iterator, error) { +func (m *MockDB) ReverseIterator(arg0, arg1 []byte) (db.Iterator, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReverseIterator", arg0, arg1) - ret0, _ := ret[0].(tmdb.Iterator) + ret0, _ := ret[0].(db.Iterator) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -163,6 +178,21 @@ func (mr *MockDBMockRecorder) ReverseIterator(arg0, arg1 interface{}) *gomock.Ca return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReverseIterator", reflect.TypeOf((*MockDB)(nil).ReverseIterator), arg0, arg1) } +// ReversePrefixIterator mocks base method +func (m *MockDB) ReversePrefixIterator(arg0 []byte) (db.Iterator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReversePrefixIterator", arg0) + ret0, _ := ret[0].(db.Iterator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReversePrefixIterator indicates an expected call of ReversePrefixIterator +func (mr *MockDBMockRecorder) ReversePrefixIterator(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReversePrefixIterator", reflect.TypeOf((*MockDB)(nil).ReversePrefixIterator), arg0) +} + // Set mocks base method func (m *MockDB) Set(arg0, arg1 []byte) error { m.ctrl.T.Helper() diff --git a/x/wasm/linkwasmd/go.mod b/x/wasm/linkwasmd/go.mod index 284cdec681..e3bfdb354a 100644 --- a/x/wasm/linkwasmd/go.mod +++ b/x/wasm/linkwasmd/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/cosmos/cosmos-sdk v0.39.2 github.com/google/go-cmp v0.5.2 // indirect - "github.com/line/lbm-sdk/v2/ v0.2.0 + github.com/line/lbm-sdk/v2/ v0.2.0 github.com/onsi/ginkgo v1.13.0 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/spf13/cobra v1.1.1 @@ -21,4 +21,4 @@ replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0. replace github.com/cosmos/cosmos-sdk => github.com/line/cosmos-sdk v0.39.2-0.2.0 -replace "github.com/line/lbm-sdk/v2/ => ../../.. +replace github.com/line/lbm-sdk/v2/ => ../../.. From 811f761f1b4a7b09d40072b5ef77f57e017db8df Mon Sep 17 00:00:00 2001 From: Woosang Son Date: Wed, 7 Apr 2021 08:49:22 +0900 Subject: [PATCH 2/2] chore: use linemint, line/tm-db --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 6ef8e6a215..bcea7f3487 100644 --- a/go.mod +++ b/go.mod @@ -60,7 +60,7 @@ replace ( github.com/CosmWasm/wasmvm => github.com/line/wasmvm v0.12.0-0.1.0 github.com/cosmos/cosmos-sdk => github.com/line/lbm-sdk v0.39.2-0.2.0 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/tendermint/tendermint => github.com/tendermint/tendermint v0.33.9 - github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.5.2 + github.com/tendermint/tendermint => github.com/line/linemint v1.0.0 + github.com/tendermint/tm-db => github.com/line/tm-db v0.5.2 google.golang.org/grpc => google.golang.org/grpc v1.33.2 ) diff --git a/go.sum b/go.sum index cd628d2339..7ca1e6d707 100644 --- a/go.sum +++ b/go.sum @@ -341,9 +341,13 @@ github.com/line/iavl/v2 v2.0.0-init.1.0.20210406065347-cfd73e5acce0 h1:Pcp/mxkvF github.com/line/iavl/v2 v2.0.0-init.1.0.20210406065347-cfd73e5acce0/go.mod h1:Z2UTxsbKefd7bnEywGNxxmVYYGy9Ecd4nd1IZyR0bQM= github.com/line/lbm-sdk v0.39.2-0.2.0 h1:tlQHZcf+AXejSBAhYgO5Tn1NaoCF0XRNf/6c0jeo3HE= github.com/line/lbm-sdk v0.39.2-0.2.0/go.mod h1:UTxdYWx+OeRezEP8P5BxipddlFpq4q92uYydSeYN7B0= +github.com/line/linemint v1.0.0 h1:sTrDaGP67/5Klxtsuid8wOkQ2y43Y5QkmD8cDMmDeaA= +github.com/line/linemint v1.0.0/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= github.com/line/ostracon v0.34.9-0.20210315041958-2a1f43c788f5/go.mod h1:1THU+kF+6fxLaNYQKcdNyLCO6t9LnqSMaExDMiLozbM= github.com/line/ostracon v0.34.9-0.20210406083837-4183d649b30c h1:OYIm2Wu22kFoocMgnjU5O/TIphYLHw9q9+e6AsKPkOA= github.com/line/ostracon v0.34.9-0.20210406083837-4183d649b30c/go.mod h1:/Ov0QcWRleL6TKmHpPMyIx9roxAc/DD1m3N8xST2b0I= +github.com/line/tm-db v0.5.2 h1:P8kMpcrm9Xyfl6QLyafssNIoIeC01k0fhw2zDvKhtl4= +github.com/line/tm-db v0.5.2/go.mod h1:VrPTx04QJhQ9d8TFUTc2GpPBvBf/U9vIdBIzkjBk7Lk= github.com/line/tm-db/v2 v2.0.0-init.1.0.20210406062110-9424ca70955a h1:qSt/WwORC5+nVRnNqx+A0oo5gOCsoVJ0HmHF5Db1YvY= github.com/line/tm-db/v2 v2.0.0-init.1.0.20210406062110-9424ca70955a/go.mod h1:wmkyPabXjtVZ1dvRofmurjaceghywtCSYGqFuFS+TbI= github.com/line/wasmvm v0.12.0-0.1.0 h1:Xul8w8pLWZDcp0kkz1Y9M6tfZ4WnmMt9g0U/d6lXdE4= @@ -582,10 +586,6 @@ github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2l github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.14.3 h1:tuiUAqJdA3OOyPU/9P3pMYnAcd+OL7BUdzNiE3ytUwQ= github.com/tendermint/iavl v0.14.3/go.mod h1:vHLYxU/zuxBmxxr1v+5Vnd/JzcIsyK17n9P9RDubPVU= -github.com/tendermint/tendermint v0.33.9 h1:rRKIfu5qAXX5f9bwX1oUXSZz/ALFJjDuivhkbGUQxiU= -github.com/tendermint/tendermint v0.33.9/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tm-db v0.5.2 h1:QG3IxQZBubWlr7kGQcYIavyTNmZRO+r//nENxoq0g34= -github.com/tendermint/tm-db v0.5.2/go.mod h1:VrPTx04QJhQ9d8TFUTc2GpPBvBf/U9vIdBIzkjBk7Lk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=