From ab13269bc6c2030c72d9c3dd597264581cc2d0a0 Mon Sep 17 00:00:00 2001 From: mossid Date: Fri, 26 Oct 2018 12:42:34 +0200 Subject: [PATCH] finalize rebase --- baseapp/baseapp.go | 16 ++++++++-------- baseapp/baseapp_test.go | 4 ++-- cmd/gaia/app/app.go | 18 +++++++++--------- cmd/gaia/cmd/gaiadebug/hack.go | 10 +++++----- x/auth/feekeeper.go | 4 ++-- x/auth/mapper.go | 4 ++-- x/distribution/keeper/keeper.go | 4 ++-- x/distribution/keeper/test_common.go | 14 +++++++------- x/gov/keeper.go | 4 ++-- x/mint/keeper.go | 4 ++-- x/mock/app.go | 6 +++--- x/params/keeper.go | 6 +++--- x/params/subspace/subspace.go | 6 +++--- x/params/subspace/test_common.go | 4 ++-- x/slashing/keeper.go | 4 ++-- x/slashing/test_common.go | 12 ++++++------ x/stake/keeper/keeper.go | 6 +++--- x/stake/keeper/test_common.go | 10 +++++----- 18 files changed, 68 insertions(+), 68 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 42369fc70f4b..40d06e1029e3 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -124,7 +124,7 @@ func (app *BaseApp) RegisterCodespace(codespace sdk.CodespaceType) sdk.Codespace } // Mount IAVL stores to the provided keys in the BaseApp multistore -func (app *BaseApp) MountStoresIAVL(keys ...*sdk.KVStoreKey) { +func (app *BaseApp) MountStoresIAVL(keys ...sdk.KVStoreKey) { for _, key := range keys { app.MountStore(key) } @@ -138,17 +138,17 @@ func (app *BaseApp) MountStoresTransient(keys ...*sdk.TransientStoreKey) { } // Mount a store to the provided key in the BaseApp multistore, using a specified DB -func (app *BaseApp) MountStoreWithDB(key sdk.StoreKey, db dbm.DB) { - app.cms.MountStoreWithDB(key, db) +func (app *BaseApp) MountStoreWithDB(key sdk.KVStoreKey, db dbm.DB) { + app.cms.MountKVStoreWithDB(key, db) } // Mount a store to the provided key in the BaseApp multistore, using the default DB -func (app *BaseApp) MountStore(key sdk.StoreKey) { - app.cms.MountStoreWithDB(key, nil) +func (app *BaseApp) MountStore(key sdk.KVStoreKey) { + app.cms.MountKVStoreWithDB(key, nil) } // load latest application version -func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error { +func (app *BaseApp) LoadLatestVersion(mainKey sdk.KVStoreKey) error { err := app.cms.LoadLatestVersion() if err != nil { return err @@ -157,7 +157,7 @@ func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error { } // load application version -func (app *BaseApp) LoadVersion(version int64, mainKey sdk.StoreKey) error { +func (app *BaseApp) LoadVersion(version int64, mainKey sdk.KVStoreKey) error { err := app.cms.LoadMultiStoreVersion(version) if err != nil { return err @@ -176,7 +176,7 @@ func (app *BaseApp) LastBlockHeight() int64 { } // initializes the remaining logic from app.cms -func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error { +func (app *BaseApp) initFromStore(mainKey sdk.KVStoreKey) error { // main store should exist. // TODO: we don't actually need the main store here main := app.cms.GetKVStore(mainKey) diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index ff6cbb83418f..33387dc23a3e 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -366,7 +366,7 @@ func testTxDecoder(cdc *codec.Codec) sdk.TxDecoder { } } -func anteHandlerTxTest(t *testing.T, capKey *sdk.KVStoreKey, storeKey []byte) sdk.AnteHandler { +func anteHandlerTxTest(t *testing.T, capKey sdk.KVStoreKey, storeKey []byte) sdk.AnteHandler { return func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, res sdk.Result, abort bool) { store := ctx.KVStore(capKey) msgCounter := tx.(txTest).Counter @@ -375,7 +375,7 @@ func anteHandlerTxTest(t *testing.T, capKey *sdk.KVStoreKey, storeKey []byte) sd } } -func handlerMsgCounter(t *testing.T, capKey *sdk.KVStoreKey, deliverKey []byte) sdk.Handler { +func handlerMsgCounter(t *testing.T, capKey sdk.KVStoreKey, deliverKey []byte) sdk.Handler { return func(ctx sdk.Context, msg sdk.Msg) sdk.Result { store := ctx.KVStore(capKey) var msgCount int64 diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 33c606105e2d..ff5d3ca1d789 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -43,17 +43,17 @@ type GaiaApp struct { cdc *codec.Codec // keys to access the substores - keyMain *sdk.KVStoreKey - keyAccount *sdk.KVStoreKey - keyStake *sdk.KVStoreKey + keyMain sdk.KVStoreKey + keyAccount sdk.KVStoreKey + keyStake sdk.KVStoreKey tkeyStake *sdk.TransientStoreKey - keySlashing *sdk.KVStoreKey - keyMint *sdk.KVStoreKey - keyDistr *sdk.KVStoreKey + keySlashing sdk.KVStoreKey + keyMint sdk.KVStoreKey + keyDistr sdk.KVStoreKey tkeyDistr *sdk.TransientStoreKey - keyGov *sdk.KVStoreKey - keyFeeCollection *sdk.KVStoreKey - keyParams *sdk.KVStoreKey + keyGov sdk.KVStoreKey + keyFeeCollection sdk.KVStoreKey + keyParams sdk.KVStoreKey tkeyParams *sdk.TransientStoreKey // Manage getting and setting accounts diff --git a/cmd/gaia/cmd/gaiadebug/hack.go b/cmd/gaia/cmd/gaiadebug/hack.go index 5e307709ac5e..c0b232e8449c 100644 --- a/cmd/gaia/cmd/gaiadebug/hack.go +++ b/cmd/gaia/cmd/gaiadebug/hack.go @@ -129,12 +129,12 @@ type GaiaApp struct { cdc *codec.Codec // keys to access the substores - keyMain *sdk.KVStoreKey - keyAccount *sdk.KVStoreKey - keyStake *sdk.KVStoreKey + keyMain sdk.KVStoreKey + keyAccount sdk.KVStoreKey + keyStake sdk.KVStoreKey tkeyStake *sdk.TransientStoreKey - keySlashing *sdk.KVStoreKey - keyParams *sdk.KVStoreKey + keySlashing sdk.KVStoreKey + keyParams sdk.KVStoreKey tkeyParams *sdk.TransientStoreKey // Manage getting and setting accounts diff --git a/x/auth/feekeeper.go b/x/auth/feekeeper.go index a6be2e12def0..242c4161719d 100644 --- a/x/auth/feekeeper.go +++ b/x/auth/feekeeper.go @@ -14,13 +14,13 @@ var ( type FeeCollectionKeeper struct { // The (unexposed) key used to access the fee store from the Context. - key sdk.StoreKey + key sdk.KVStoreKey // The codec codec for binary encoding/decoding of accounts. cdc *codec.Codec } -func NewFeeCollectionKeeper(cdc *codec.Codec, key sdk.StoreKey) FeeCollectionKeeper { +func NewFeeCollectionKeeper(cdc *codec.Codec, key sdk.KVStoreKey) FeeCollectionKeeper { return FeeCollectionKeeper{ key: key, cdc: cdc, diff --git a/x/auth/mapper.go b/x/auth/mapper.go index dd127c7312e3..fb13044dc88d 100644 --- a/x/auth/mapper.go +++ b/x/auth/mapper.go @@ -13,7 +13,7 @@ var globalAccountNumberKey = []byte("globalAccountNumber") type AccountKeeper struct { // The (unexposed) key used to access the store from the Context. - key sdk.StoreKey + key sdk.KVStoreKey // The prototypical Account constructor. proto func() Account @@ -25,7 +25,7 @@ type AccountKeeper struct { // NewAccountKeeper returns a new sdk.AccountKeeper that // uses go-amino to (binary) encode and decode concrete sdk.Accounts. // nolint -func NewAccountKeeper(cdc *codec.Codec, key sdk.StoreKey, proto func() Account) AccountKeeper { +func NewAccountKeeper(cdc *codec.Codec, key sdk.KVStoreKey, proto func() Account) AccountKeeper { return AccountKeeper{ key: key, proto: proto, diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 0ccf76ca63db..1604094e670d 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -9,7 +9,7 @@ import ( // keeper of the stake store type Keeper struct { - storeKey sdk.StoreKey + storeKey sdk.KVStoreKey cdc *codec.Codec paramSpace params.Subspace bankKeeper types.BankKeeper @@ -20,7 +20,7 @@ type Keeper struct { codespace sdk.CodespaceType } -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, ck types.BankKeeper, +func NewKeeper(cdc *codec.Codec, key sdk.KVStoreKey, paramSpace params.Subspace, ck types.BankKeeper, sk types.StakeKeeper, fck types.FeeCollectionKeeper, codespace sdk.CodespaceType) Keeper { keeper := Keeper{ diff --git a/x/distribution/keeper/test_common.go b/x/distribution/keeper/test_common.go index 2ef9218c027b..55bd19d1a181 100644 --- a/x/distribution/keeper/test_common.go +++ b/x/distribution/keeper/test_common.go @@ -94,13 +94,13 @@ func CreateTestInputAdvanced(t *testing.T, isCheckTx bool, initCoins int64, db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(keyDistr, db) - ms.MountStoreWithDB(tkeyStake, nil) - ms.MountStoreWithDB(keyStake, db) - ms.MountStoreWithDB(keyAcc, db) - ms.MountStoreWithDB(keyFeeCollection, db) - ms.MountStoreWithDB(keyParams, db) - ms.MountStoreWithDB(tkeyParams, db) + ms.MountKVStoreWithDB(keyDistr, db) + ms.MountKVStoreWithDB(tkeyStake, nil) + ms.MountKVStoreWithDB(keyStake, db) + ms.MountKVStoreWithDB(keyAcc, db) + ms.MountKVStoreWithDB(keyFeeCollection, db) + ms.MountKVStoreWithDB(keyParams, db) + ms.MountKVStoreWithDB(tkeyParams, db) err := ms.LoadLatestVersion() require.Nil(t, err) diff --git a/x/gov/keeper.go b/x/gov/keeper.go index d061f1206232..92d23df7964f 100644 --- a/x/gov/keeper.go +++ b/x/gov/keeper.go @@ -46,7 +46,7 @@ type Keeper struct { ds sdk.DelegationSet // The (unexposed) keys used to access the stores from the Context. - storeKey sdk.StoreKey + storeKey sdk.KVStoreKey // The codec codec for binary encoding/decoding. cdc *codec.Codec @@ -60,7 +60,7 @@ type Keeper struct { // - depositing funds into proposals, and activating upon sufficient funds being deposited // - users voting on proposals, with weight proportional to stake in the system // - and tallying the result of the vote. -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramsKeeper params.Keeper, paramSpace params.Subspace, ck bank.Keeper, ds sdk.DelegationSet, codespace sdk.CodespaceType) Keeper { +func NewKeeper(cdc *codec.Codec, key sdk.KVStoreKey, paramsKeeper params.Keeper, paramSpace params.Subspace, ck bank.Keeper, ds sdk.DelegationSet, codespace sdk.CodespaceType) Keeper { return Keeper{ storeKey: key, paramsKeeper: paramsKeeper, diff --git a/x/mint/keeper.go b/x/mint/keeper.go index 6e6a642f48c3..bfef1d64b240 100644 --- a/x/mint/keeper.go +++ b/x/mint/keeper.go @@ -8,14 +8,14 @@ import ( // keeper of the stake store type Keeper struct { - storeKey sdk.StoreKey + storeKey sdk.KVStoreKey cdc *codec.Codec paramSpace params.Subspace sk StakeKeeper fck FeeCollectionKeeper } -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, +func NewKeeper(cdc *codec.Codec, key sdk.KVStoreKey, paramSpace params.Subspace, sk StakeKeeper, fck FeeCollectionKeeper) Keeper { keeper := Keeper{ diff --git a/x/mock/app.go b/x/mock/app.go index bf00f2f17225..782f2a5dc5a8 100644 --- a/x/mock/app.go +++ b/x/mock/app.go @@ -24,8 +24,8 @@ const chainID = "" type App struct { *bam.BaseApp Cdc *codec.Codec // Cdc is public since the codec is passed into the module anyways - KeyMain *sdk.KVStoreKey - KeyAccount *sdk.KVStoreKey + KeyMain sdk.KVStoreKey + KeyAccount sdk.KVStoreKey // TODO: Abstract this out from not needing to be auth specifically AccountKeeper auth.AccountKeeper @@ -75,7 +75,7 @@ func NewApp() *App { // CompleteSetup completes the application setup after the routes have been // registered. -func (app *App) CompleteSetup(newKeys ...sdk.StoreKey) error { +func (app *App) CompleteSetup(newKeys ...sdk.KVStoreKey) error { newKeys = append(newKeys, app.KeyMain) newKeys = append(newKeys, app.KeyAccount) diff --git a/x/params/keeper.go b/x/params/keeper.go index cf78b60ff4f3..da8d4da8a560 100644 --- a/x/params/keeper.go +++ b/x/params/keeper.go @@ -10,14 +10,14 @@ import ( // Keeper of the global paramstore type Keeper struct { cdc *codec.Codec - key sdk.StoreKey - tkey sdk.StoreKey + key sdk.KVStoreKey + tkey sdk.KVStoreKey spaces map[string]*Subspace } // NewKeeper constructs a params keeper -func NewKeeper(cdc *codec.Codec, key *sdk.KVStoreKey, tkey *sdk.TransientStoreKey) (k Keeper) { +func NewKeeper(cdc *codec.Codec, key sdk.KVStoreKey, tkey *sdk.TransientStoreKey) (k Keeper) { k = Keeper{ cdc: cdc, key: key, diff --git a/x/params/subspace/subspace.go b/x/params/subspace/subspace.go index 313b41795e7c..3f42ac81ef68 100644 --- a/x/params/subspace/subspace.go +++ b/x/params/subspace/subspace.go @@ -14,8 +14,8 @@ import ( // recording whether the parameter has been changed or not type Subspace struct { cdc *codec.Codec - key sdk.StoreKey // []byte -> []byte, stores parameter - tkey sdk.StoreKey // []byte -> bool, stores parameter change + key sdk.KVStoreKey // []byte -> []byte, stores parameter + tkey sdk.KVStoreKey // []byte -> bool, stores parameter change name []byte @@ -23,7 +23,7 @@ type Subspace struct { } // NewSubspace constructs a store with namestore -func NewSubspace(cdc *codec.Codec, key sdk.StoreKey, tkey sdk.StoreKey, name string) (res Subspace) { +func NewSubspace(cdc *codec.Codec, key sdk.KVStoreKey, tkey sdk.KVStoreKey, name string) (res Subspace) { res = Subspace{ cdc: cdc, key: key, diff --git a/x/params/subspace/test_common.go b/x/params/subspace/test_common.go index bd8c071a08d8..ebf2d5d31ab3 100644 --- a/x/params/subspace/test_common.go +++ b/x/params/subspace/test_common.go @@ -30,8 +30,8 @@ func DefaultTestComponents(t *testing.T, table TypeTable) (sdk.Context, Subspace tracer := ms.GetTracer() tracer.SetWriter(os.Stdout) tracer.SetContext(sdk.TraceContext{}) - ms.MountStoreWithDB(key, db) - ms.MountStoreWithDB(tkey, db) + ms.MountKVStoreWithDB(key, db) + ms.MountKVStoreWithDB(tkey, db) err := ms.LoadLatestVersion() require.Nil(t, err) ctx := sdk.NewContext(ms, abci.Header{}, false, log.NewTMLogger(os.Stdout)) diff --git a/x/slashing/keeper.go b/x/slashing/keeper.go index 647a9df09863..5f81cf966110 100644 --- a/x/slashing/keeper.go +++ b/x/slashing/keeper.go @@ -16,7 +16,7 @@ import ( // Keeper of the slashing store type Keeper struct { - storeKey sdk.StoreKey + storeKey sdk.KVStoreKey cdc *codec.Codec validatorSet sdk.ValidatorSet paramspace params.Subspace @@ -26,7 +26,7 @@ type Keeper struct { } // NewKeeper creates a slashing keeper -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, vs sdk.ValidatorSet, paramspace params.Subspace, codespace sdk.CodespaceType) Keeper { +func NewKeeper(cdc *codec.Codec, key sdk.KVStoreKey, vs sdk.ValidatorSet, paramspace params.Subspace, codespace sdk.CodespaceType) Keeper { keeper := Keeper{ storeKey: key, cdc: cdc, diff --git a/x/slashing/test_common.go b/x/slashing/test_common.go index 59e2ec7bf472..9d84530a9e7c 100644 --- a/x/slashing/test_common.go +++ b/x/slashing/test_common.go @@ -58,12 +58,12 @@ func createTestInput(t *testing.T, defaults Params) (sdk.Context, bank.Keeper, s tkeyParams := sdk.NewTransientStoreKey("transient_params") db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(keyAcc, db) - ms.MountStoreWithDB(tkeyStake, nil) - ms.MountStoreWithDB(keyStake, db) - ms.MountStoreWithDB(keySlashing, db) - ms.MountStoreWithDB(keyParams, db) - ms.MountStoreWithDB(tkeyParams, db) + ms.MountKVStoreWithDB(keyAcc, db) + ms.MountKVStoreWithDB(tkeyStake, nil) + ms.MountKVStoreWithDB(keyStake, db) + ms.MountKVStoreWithDB(keySlashing, db) + ms.MountKVStoreWithDB(keyParams, db) + ms.MountKVStoreWithDB(tkeyParams, db) err := ms.LoadLatestVersion() require.Nil(t, err) diff --git a/x/stake/keeper/keeper.go b/x/stake/keeper/keeper.go index 17ee31268cff..743d332f1f37 100644 --- a/x/stake/keeper/keeper.go +++ b/x/stake/keeper/keeper.go @@ -11,8 +11,8 @@ import ( // keeper of the stake store type Keeper struct { - storeKey sdk.StoreKey - storeTKey sdk.StoreKey + storeKey sdk.KVStoreKey + storeTKey sdk.KVStoreKey cdc *codec.Codec bankKeeper bank.Keeper hooks sdk.StakingHooks @@ -22,7 +22,7 @@ type Keeper struct { codespace sdk.CodespaceType } -func NewKeeper(cdc *codec.Codec, key, tkey sdk.StoreKey, ck bank.Keeper, paramstore params.Subspace, codespace sdk.CodespaceType) Keeper { +func NewKeeper(cdc *codec.Codec, key, tkey sdk.KVStoreKey, ck bank.Keeper, paramstore params.Subspace, codespace sdk.CodespaceType) Keeper { keeper := Keeper{ storeKey: key, storeTKey: tkey, diff --git a/x/stake/keeper/test_common.go b/x/stake/keeper/test_common.go index 7d404d70fc63..8992c201dc55 100644 --- a/x/stake/keeper/test_common.go +++ b/x/stake/keeper/test_common.go @@ -84,11 +84,11 @@ func CreateTestInput(t *testing.T, isCheckTx bool, initCoins int64) (sdk.Context db := dbm.NewMemDB() ms := rootmulti.NewStore(db) - ms.MountStoreWithDB(tkeyStake, nil) - ms.MountStoreWithDB(keyStake, db) - ms.MountStoreWithDB(keyAcc, db) - ms.MountStoreWithDB(keyParams, db) - ms.MountStoreWithDB(tkeyParams, db) + ms.MountKVStoreWithDB(tkeyStake, nil) + ms.MountKVStoreWithDB(keyStake, db) + ms.MountKVStoreWithDB(keyAcc, db) + ms.MountKVStoreWithDB(keyParams, db) + ms.MountKVStoreWithDB(tkeyParams, db) err := ms.LoadLatestVersion() require.Nil(t, err)