Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump up tm-db, iavl and ostracon #107

Merged
merged 2 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test-
# Test runs-specific rules. To add a new test target, just add
# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
# append the new rule to the TEST_TARGETS list.
test-unit: ARGS=-tags='cgo ledger test_ledger_mock norace'
test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino norace'
test-ledger: ARGS=-tags='cgo ledger norace'
test-ledger-mock: ARGS=-tags='ledger test_ledger_mock norace'
test-race: ARGS=-race -tags='cgo ledger test_ledger_mock'
test-unit: ARGS=-tags='cgo ledger test_ledger_mock norace goleveldb'
test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino norace goleveldb'
test-ledger: ARGS=-tags='cgo ledger norace goleveldb'
test-ledger-mock: ARGS=-tags='ledger test_ledger_mock norace goleveldb'
test-race: ARGS=-race -tags='cgo ledger test_ledger_mock goleveldb'
test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION)
$(TEST_TARGETS): run-tests

Expand Down
8 changes: 4 additions & 4 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (

abci "github.com/line/ostracon/abci/types"
ostprototypes "github.com/line/ostracon/proto/ostracon/types"
dbm "github.com/line/tm-db/v2"
"github.com/line/tm-db/v2/memdb"
"github.com/stretchr/testify/require"

sdk "github.com/line/lbm-sdk/v2/types"
)

func TestGetBlockRentionHeight(t *testing.T) {
logger := defaultLogger()
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()

testCases := map[string]struct {
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestGetBlockRentionHeight(t *testing.T) {
for name, tc := range testCases {
tc := tc

tc.bapp.SetParamStore(&paramStore{db: dbm.NewMemDB()})
tc.bapp.SetParamStore(&paramStore{db: memdb.NewDB()})
tc.bapp.InitChain(abci.RequestInitChain{
ConsensusParams: &abci.ConsensusParams{
Evidence: &ostprototypes.EvidenceParams{
Expand All @@ -124,7 +124,7 @@ func TestBaseAppCreateQueryContextRejectsNegativeHeights(t *testing.T) {
t.Parallel()

logger := defaultLogger()
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil)

Expand Down
6 changes: 3 additions & 3 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/line/ostracon/crypto/tmhash"
"github.com/line/ostracon/libs/log"
ostproto "github.com/line/ostracon/proto/ostracon/types"
dbm "github.com/line/tm-db/v2"
tmdb "github.com/line/tm-db/v2"

"github.com/line/lbm-sdk/v2/codec/types"
"github.com/line/lbm-sdk/v2/snapshots"
Expand Down Expand Up @@ -48,7 +48,7 @@ type BaseApp struct { // nolint: maligned
// initialized on creation
logger log.Logger
name string // application name from abci.Info
db dbm.DB // common DB backend
db tmdb.DB // common DB backend
cms sdk.CommitMultiStore // Main (uncached) state
storeLoader StoreLoader // function to handle store loading, may be overridden with SetStoreLoader()
router sdk.Router // handle any kind of message
Expand Down Expand Up @@ -136,7 +136,7 @@ type BaseApp struct { // nolint: maligned
//
// NOTE: The db is used to store the version number for now.
func NewBaseApp(
name string, logger log.Logger, db dbm.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp),
name string, logger log.Logger, db tmdb.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp),
) *BaseApp {
app := &BaseApp{
logger: logger,
Expand Down
39 changes: 20 additions & 19 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (
abci "github.com/line/ostracon/abci/types"
"github.com/line/ostracon/libs/log"
ostproto "github.com/line/ostracon/proto/ostracon/types"
dbm "github.com/line/tm-db/v2"
tmdb "github.com/line/tm-db/v2"
"github.com/line/tm-db/v2/memdb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -38,7 +39,7 @@ var (
)

type paramStore struct {
db *dbm.MemDB
db *memdb.MemDB
}

func (ps *paramStore) Set(_ sdk.Context, key []byte, value interface{}) {
Expand Down Expand Up @@ -80,7 +81,7 @@ func defaultLogger() log.Logger {

func newBaseApp(name string, options ...func(*BaseApp)) *BaseApp {
logger := defaultLogger()
db := dbm.NewMemDB()
db := memdb.NewDB()
codec := codec.NewLegacyAmino()
registerTestCodec(codec)
return NewBaseApp(name, logger, db, testTxDecoder(codec), options...)
Expand Down Expand Up @@ -112,7 +113,7 @@ func setupBaseApp(t *testing.T, options ...func(*BaseApp)) *BaseApp {
require.Equal(t, t.Name(), app.Name())

app.MountStores(capKey1, capKey2)
app.SetParamStore(&paramStore{db: dbm.NewMemDB()})
app.SetParamStore(&paramStore{db: memdb.NewDB()})

// stores are mounted
err := app.LoadLatestVersion()
Expand All @@ -136,7 +137,7 @@ func setupBaseAppWithSnapshots(t *testing.T, blocks uint, blockTxs int, options
snapshotTimeout := 1 * time.Minute
snapshotDir, err := ioutil.TempDir("", "baseapp")
require.NoError(t, err)
snapshotStore, err := snapshots.NewStore(dbm.NewMemDB(), snapshotDir)
snapshotStore, err := snapshots.NewStore(memdb.NewDB(), snapshotDir)
require.NoError(t, err)
teardown := func() {
os.RemoveAll(snapshotDir)
Expand Down Expand Up @@ -207,7 +208,7 @@ func TestMountStores(t *testing.T) {
func TestLoadVersion(t *testing.T) {
logger := defaultLogger()
pruningOpt := SetPruning(store.PruneNothing)
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil, pruningOpt)

Expand Down Expand Up @@ -257,7 +258,7 @@ func useDefaultLoader(app *BaseApp) {
app.SetStoreLoader(DefaultStoreLoader)
}

func initStore(t *testing.T, db dbm.DB, storeKey string, k, v []byte) {
func initStore(t *testing.T, db tmdb.DB, storeKey string, k, v []byte) {
rs := rootmulti.NewStore(db)
rs.SetPruning(store.PruneNothing)
key := sdk.NewKVStoreKey(storeKey)
Expand All @@ -274,7 +275,7 @@ func initStore(t *testing.T, db dbm.DB, storeKey string, k, v []byte) {
require.Equal(t, int64(1), commitID.Version)
}

func checkStore(t *testing.T, db dbm.DB, ver int64, storeKey string, k, v []byte) {
func checkStore(t *testing.T, db tmdb.DB, ver int64, storeKey string, k, v []byte) {
rs := rootmulti.NewStore(db)
rs.SetPruning(store.PruneDefault)
key := sdk.NewKVStoreKey(storeKey)
Expand Down Expand Up @@ -315,7 +316,7 @@ func TestSetLoader(t *testing.T) {
tc := tc
t.Run(name, func(t *testing.T) {
// prepare a db with some data
db := dbm.NewMemDB()
db := memdb.NewDB()
initStore(t, db, tc.origStoreKey, k, v)

// load the app with the existing db
Expand Down Expand Up @@ -343,7 +344,7 @@ func TestSetLoader(t *testing.T) {
func TestAppVersionSetterGetter(t *testing.T) {
logger := defaultLogger()
pruningOpt := SetPruning(store.PruneDefault)
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil, pruningOpt)

Expand All @@ -363,7 +364,7 @@ func TestAppVersionSetterGetter(t *testing.T) {
func TestLoadVersionInvalid(t *testing.T) {
logger := log.NewNopLogger()
pruningOpt := SetPruning(store.PruneNothing)
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil, pruningOpt)

Expand Down Expand Up @@ -400,7 +401,7 @@ func TestLoadVersionPruning(t *testing.T) {
Interval: 1,
}
pruningOpt := SetPruning(pruningOptions)
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil, pruningOpt)

Expand Down Expand Up @@ -457,7 +458,7 @@ func testLoadVersionHelper(t *testing.T, app *BaseApp, expectedHeight int64, exp

func TestOptionFunction(t *testing.T) {
logger := defaultLogger()
db := dbm.NewMemDB()
db := memdb.NewDB()
bap := NewBaseApp("starting name", logger, db, nil, testChangeNameHelper("new name"))
require.Equal(t, bap.name, "new name", "BaseApp should have had name changed via option function")
}
Expand Down Expand Up @@ -554,7 +555,7 @@ func TestInitChainer(t *testing.T) {
name := t.Name()
// keep the db and logger ourselves so
// we can reload the same app later
db := dbm.NewMemDB()
db := memdb.NewDB()
logger := defaultLogger()
app := NewBaseApp(name, logger, db, nil)
capKey := sdk.NewKVStoreKey("main")
Expand Down Expand Up @@ -633,7 +634,7 @@ func TestInitChainer(t *testing.T) {

func TestInitChain_WithInitialHeight(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
db := memdb.NewDB()
logger := defaultLogger()
app := NewBaseApp(name, logger, db, nil)

Expand All @@ -649,7 +650,7 @@ func TestInitChain_WithInitialHeight(t *testing.T) {

func TestBeginBlock_WithInitialHeight(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
db := memdb.NewDB()
logger := defaultLogger()
app := NewBaseApp(name, logger, db, nil)

Expand Down Expand Up @@ -902,7 +903,7 @@ func incrementingCounter(t *testing.T, store sdk.KVStore, counterKey []byte, cou
return &sdk.Result{}, nil
}

//---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Tx processing - CheckTx, DeliverTx, SimulateTx.
// These tests use the serialized tx as input, while most others will use the
// Check(), Deliver(), Simulate() methods directly.
Expand Down Expand Up @@ -2005,7 +2006,7 @@ func TestWithRouter(t *testing.T) {
}

func TestBaseApp_EndBlock(t *testing.T) {
db := dbm.NewMemDB()
db := memdb.NewDB()
name := t.Name()
logger := defaultLogger()

Expand All @@ -2016,7 +2017,7 @@ func TestBaseApp_EndBlock(t *testing.T) {
}

app := NewBaseApp(name, logger, db, nil)
app.SetParamStore(&paramStore{db: dbm.NewMemDB()})
app.SetParamStore(&paramStore{db: memdb.NewDB()})
app.InitChain(abci.RequestInitChain{
ConsensusParams: cp,
})
Expand Down
4 changes: 2 additions & 2 deletions baseapp/grpcrouter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/line/ostracon/libs/log"
dbm "github.com/line/tm-db/v2"
"github.com/line/tm-db/v2/memdb"
"github.com/stretchr/testify/require"

"github.com/line/lbm-sdk/v2/baseapp"
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestGRPCGatewayRouter(t *testing.T) {

func TestRegisterQueryServiceTwice(t *testing.T) {
// Setup baseapp.
db := dbm.NewMemDB()
db := memdb.NewDB()
encCfg := simapp.MakeTestEncodingConfig()
app := baseapp.NewBaseApp("test", log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, encCfg.TxConfig.TxDecoder())
app.SetInterfaceRegistry(encCfg.InterfaceRegistry)
Expand Down
8 changes: 4 additions & 4 deletions baseapp/msg_service_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
abci "github.com/line/ostracon/abci/types"
"github.com/line/ostracon/libs/log"
ostproto "github.com/line/ostracon/proto/ostracon/types"
dbm "github.com/line/tm-db/v2"
"github.com/line/tm-db/v2/memdb"
"github.com/stretchr/testify/require"

"github.com/line/lbm-sdk/v2/baseapp"
Expand All @@ -19,7 +19,7 @@ import (
)

func TestRegisterMsgService(t *testing.T) {
db := dbm.NewMemDB()
db := memdb.NewDB()

// Create an encoding config that doesn't register testdata Msg services.
encCfg := simapp.MakeTestEncodingConfig()
Expand All @@ -44,7 +44,7 @@ func TestRegisterMsgService(t *testing.T) {

func TestRegisterMsgServiceTwice(t *testing.T) {
// Setup baseapp.
db := dbm.NewMemDB()
db := memdb.NewDB()
encCfg := simapp.MakeTestEncodingConfig()
app := baseapp.NewBaseApp("test", log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, encCfg.TxConfig.TxDecoder())
app.SetInterfaceRegistry(encCfg.InterfaceRegistry)
Expand All @@ -71,7 +71,7 @@ func TestMsgService(t *testing.T) {
priv, _, _ := testdata.KeyTestPubAddr()
encCfg := simapp.MakeTestEncodingConfig()
testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
db := dbm.NewMemDB()
db := memdb.NewDB()
app := baseapp.NewBaseApp("test", log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, encCfg.TxConfig.TxDecoder())
app.SetInterfaceRegistry(encCfg.InterfaceRegistry)
testdata.RegisterMsgServer(
Expand Down
4 changes: 2 additions & 2 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"io"

dbm "github.com/line/tm-db/v2"
tmdb "github.com/line/tm-db/v2"

"github.com/line/lbm-sdk/v2/codec/types"
"github.com/line/lbm-sdk/v2/snapshots"
Expand Down Expand Up @@ -104,7 +104,7 @@ func (app *BaseApp) SetAppVersion(v string) {
app.appVersion = v
}

func (app *BaseApp) SetDB(db dbm.DB) {
func (app *BaseApp) SetDB(db tmdb.DB) {
if app.sealed {
panic("SetDB() on sealed BaseApp")
}
Expand Down
6 changes: 3 additions & 3 deletions crypto/keyring/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

ostos "github.com/line/ostracon/libs/os"
dbm "github.com/line/tm-db/v2"
tmdb "github.com/line/tm-db/v2"
"github.com/pkg/errors"

"github.com/line/lbm-sdk/v2/crypto"
Expand Down Expand Up @@ -45,12 +45,12 @@ var _ LegacyKeybase = dbKeybase{}
//
// NOTE: dbKeybase will be deprecated in favor of keyringKeybase.
type dbKeybase struct {
db dbm.DB
db tmdb.DB
}

// newDBKeybase creates a new dbKeybase instance using the provided DB for
// reading and writing keys.
func newDBKeybase(db dbm.DB) dbKeybase {
func newDBKeybase(db tmdb.DB) dbKeybase {
return dbKeybase{
db: db,
}
Expand Down
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@ module github.com/line/lbm-sdk/v2

require (
github.com/99designs/keyring v1.1.6
github.com/DataDog/zstd v1.4.5 // indirect
github.com/armon/go-metrics v0.3.6
github.com/bgentry/speakeasy v0.1.0
github.com/btcsuite/btcd v0.21.0-beta
github.com/btcsuite/btcutil v1.0.2
github.com/confio/ics23/go v0.6.3
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ledger-cosmos-go v0.11.1
github.com/dgraph-io/ristretto v0.0.3 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25
github.com/gogo/gateway v1.1.0
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.2 // indirect
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
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
github.com/line/ostracon v0.34.9-0.20210316071456-5fea666cc7ce
github.com/line/tm-db/v2 v2.0.0-init.1
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/magiconair/properties v1.8.4
github.com/mattn/go-isatty v0.0.12
github.com/otiai10/copy v1.4.2
Expand Down
Loading