From 10d72d71f1a07bc8d158faa8a692f5ed552690ad Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 1 Feb 2021 16:18:22 +0100 Subject: [PATCH] Add 1st version of migrate --- simapp/app.go | 26 ++++++++++++ types/module/module.go | 14 +++++++ x/auth/legacy/v040/store.go | 4 ++ x/auth/module.go | 8 ++++ x/auth/vesting/module.go | 8 ++++ x/authz/module.go | 8 ++++ x/bank/legacy/v040/store.go | 25 ++++++++++++ x/bank/legacy/v042/store.go | 59 +++++++++++++++++++++++++++ x/bank/legacy/v042/store_test.go | 7 ++++ x/bank/legacy/v042/types.go | 5 +++ x/bank/module.go | 25 ++++++++++++ x/capability/module.go | 8 ++++ x/crisis/module.go | 8 ++++ x/distribution/module.go | 8 ++++ x/evidence/module.go | 8 ++++ x/feegrant/module.go | 8 ++++ x/genutil/module.go | 8 ++++ x/gov/module.go | 8 ++++ x/ibc/applications/transfer/module.go | 8 ++++ x/ibc/core/module.go | 8 ++++ x/mint/module.go | 8 ++++ x/params/module.go | 8 ++++ x/slashing/module.go | 8 ++++ x/staking/module.go | 8 ++++ x/upgrade/module.go | 8 ++++ 25 files changed, 301 insertions(+) create mode 100644 x/auth/legacy/v040/store.go create mode 100644 x/bank/legacy/v040/store.go create mode 100644 x/bank/legacy/v042/store.go create mode 100644 x/bank/legacy/v042/store_test.go create mode 100644 x/bank/legacy/v042/types.go diff --git a/simapp/app.go b/simapp/app.go index 23ced043d047..9fc5b32dc959 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -598,6 +598,32 @@ func (app *SimApp) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) } +// MigrateStore performs in-place store migrations. This function is not called +// automatically, it is meant to be called from an x/upgrade UpgradeHandler. +// `migrationsMap` is a map of moduleName to fromVersion (unit64), where +// fromVersion denotes the version from which we should migrate the module. +// +// Example: +// app.UpgradeKeeper.SetUpgradeHandler("store-migration", func(ctx sdk.Context, plan upgradetypes.Plan) { +// err := app.MigrateStore(ctx, map[string]unint64{ +// "bank": 1, // Migrate x/bank from v1 to current x/bank's ConsensusVersion +// "staking": 8, // Migrate x/staking from v8 to current x/staking's ConsensusVersion +// }) +// if err != nil { +// panic(err) +// } +// }) +func (app *SimApp) MigrateStore(ctx sdk.Context, migrationsMap map[string]uint64) error { + for moduleName, module := range app.mm.Modules { + err := module.MigrateStore(ctx, app.keys[moduleName], migrationsMap[moduleName]) + if err != nil { + return err + } + } + + return nil +} + // RegisterSwaggerAPI registers swagger route with API Server func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { statikFS, err := fs.New() diff --git a/types/module/module.go b/types/module/module.go index 2379c93d5ebd..e02a85a66a9e 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -174,6 +174,12 @@ type AppModule interface { // RegisterServices allows a module to register services RegisterServices(Configurator) + // ConsensusVersion tracks state-breaking versions of the module + ConsensusVersion() uint64 + + // MigrateStore performs in-place store migrations. + MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error + // ABCI BeginBlock(sdk.Context, abci.RequestBeginBlock) EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate @@ -208,6 +214,14 @@ func (gam GenesisOnlyAppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Que // RegisterServices registers all services. func (gam GenesisOnlyAppModule) RegisterServices(Configurator) {} +// ConsensusVersion tracks state-breaking versions of the module. +func (gam GenesisOnlyAppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (gam GenesisOnlyAppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns an empty module begin-block func (gam GenesisOnlyAppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} diff --git a/x/auth/legacy/v040/store.go b/x/auth/legacy/v040/store.go new file mode 100644 index 000000000000..9fb81b60a749 --- /dev/null +++ b/x/auth/legacy/v040/store.go @@ -0,0 +1,4 @@ +package v040 + +// AddrLen defines a valid address length +const AddrLen = 20 diff --git a/x/auth/module.go b/x/auth/module.go index 73aa9a1066a9..998af5809e97 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -147,6 +147,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the auth module. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index 3cc579a40e37..0e20cc4d800c 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -127,3 +127,11 @@ func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Valid func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONMarshaler) json.RawMessage { return am.DefaultGenesis(cdc) } + +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} diff --git a/x/authz/module.go b/x/authz/module.go index 1bcd388e4df9..faf1c842604f 100644 --- a/x/authz/module.go +++ b/x/authz/module.go @@ -152,6 +152,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} // EndBlock does nothing diff --git a/x/bank/legacy/v040/store.go b/x/bank/legacy/v040/store.go new file mode 100644 index 000000000000..6ff84a34082c --- /dev/null +++ b/x/bank/legacy/v040/store.go @@ -0,0 +1,25 @@ +package v040 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" +) + +// KVStore keys +var ( + BalancesPrefix = []byte("balances") +) + +// AddressFromBalancesStore returns an account address from a balances prefix +// store. The key must not contain the perfix BalancesPrefix as the prefix store +// iterator discards the actual prefix. +func AddressFromBalancesStore(key []byte) sdk.AccAddress { + addr := key[:v040auth.AddrLen] + if len(addr) != v040auth.AddrLen { + panic(fmt.Sprintf("unexpected account address key length; got: %d, expected: %d", len(addr), v040auth.AddrLen)) + } + + return sdk.AccAddress(addr) +} diff --git a/x/bank/legacy/v042/store.go b/x/bank/legacy/v042/store.go new file mode 100644 index 000000000000..42665801ea2e --- /dev/null +++ b/x/bank/legacy/v042/store.go @@ -0,0 +1,59 @@ +package v042 + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" + v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040" +) + +// KVStore keys +var ( + // BalancesPrefix is the for the account balances store. We use a byte + // (instead of say `[]]byte("balances")` to save some disk space). + BalancesPrefix = []byte{0x02} +) + +// AddressFromBalancesStore returns an account address from a balances prefix +// store. The key must not contain the perfix BalancesPrefix as the prefix store +// iterator discards the actual prefix. +func AddressFromBalancesStore(key []byte) sdk.AccAddress { + addrLen := key[0] + addr := key[1 : addrLen+1] + + return sdk.AccAddress(addr) +} + +// CreateAccountBalancesPrefix creates the prefix for an account's balances. +func CreateAccountBalancesPrefix(addr []byte) []byte { + return append(BalancesPrefix, address.MustLengthPrefix(addr)...) +} + +// StoreMigration performs in-place store migrations from v0.40 to v0.42. The +// migration includes: +// +// - Change addresses to be length-prefixed. +// - Change balances prefix to 1 byte +func StoreMigration(store sdk.KVStore) error { + // old key is of format: + // prefix ("balances") || addrBytes (20 bytes) || denomBytes + // new key is of format + // prefix (0x02) || addrLen (1 byte) || addrBytes || denomBytes + oldStore := prefix.NewStore(store, v040bank.BalancesPrefix) + newStore := prefix.NewStore(store, BalancesPrefix) + + oldStoreIter := oldStore.Iterator(nil, nil) + defer oldStoreIter.Close() + + for ; oldStoreIter.Valid(); oldStoreIter.Next() { + addr := v040bank.AddressFromBalancesStore(oldStoreIter.Key()) + denom := oldStoreIter.Key()[1+v040auth.AddrLen:] + newStoreKey := append(CreateAccountBalancesPrefix(addr), denom...) + + newStore.Set(newStoreKey, oldStoreIter.Value()) // Values don't change. + oldStore.Delete(oldStoreIter.Key()) + } + + return nil +} diff --git a/x/bank/legacy/v042/store_test.go b/x/bank/legacy/v042/store_test.go new file mode 100644 index 000000000000..61f87e8b97e6 --- /dev/null +++ b/x/bank/legacy/v042/store_test.go @@ -0,0 +1,7 @@ +package v042_test + +import "testing" + +func TestStoreMigration(t *testing.T) { + // TODO +} diff --git a/x/bank/legacy/v042/types.go b/x/bank/legacy/v042/types.go new file mode 100644 index 000000000000..22534d31f878 --- /dev/null +++ b/x/bank/legacy/v042/types.go @@ -0,0 +1,5 @@ +package v042 + +const ( + ModuleName = "bank" +) diff --git a/x/bank/module.go b/x/bank/module.go index f271fa21975c..547023bcae39 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -22,6 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/client/cli" "github.com/cosmos/cosmos-sdk/x/bank/client/rest" "github.com/cosmos/cosmos-sdk/x/bank/keeper" + v042bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v042" "github.com/cosmos/cosmos-sdk/x/bank/simulation" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -151,6 +152,30 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + // Map of version n -> migrate function from version n to version n+1. + migrationsMap := map[uint64]func(store sdk.KVStore) error{ + 0: v042bank.StoreMigration, + } + + // Run in-place migrations sequentially until current ConsensusVersion. + for i := fromVersion; i < am.ConsensusVersion(); i++ { + migrateFn, found := migrationsMap[i] + if found { + err := migrateFn(ctx.KVStore(storeKey)) + if err != nil { + return err + } + } + } + + return nil +} + // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/capability/module.go b/x/capability/module.go index 7957f57747d6..94809d2cbd99 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -136,6 +136,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(genState) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/crisis/module.go b/x/crisis/module.go index 5d34c1ce28f9..dbe1e2c28da4 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -158,6 +158,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/distribution/module.go b/x/distribution/module.go index 034be6d9651d..962345df8900 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -161,6 +161,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the distribution module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) diff --git a/x/evidence/module.go b/x/evidence/module.go index 4367fe8d58ce..ba6b80933b18 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -175,6 +175,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(ExportGenesis(ctx, am.keeper)) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock executes all ABCI BeginBlock logic respective to the evidence module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) diff --git a/x/feegrant/module.go b/x/feegrant/module.go index 5f4ba807d895..99fd5c6a12ab 100644 --- a/x/feegrant/module.go +++ b/x/feegrant/module.go @@ -167,6 +167,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the feegrant module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/genutil/module.go b/x/genutil/module.go index bfaeb0c59168..ce59f1f59b7a 100644 --- a/x/genutil/module.go +++ b/x/genutil/module.go @@ -110,3 +110,11 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data j func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONMarshaler) json.RawMessage { return am.DefaultGenesis(cdc) } + +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} diff --git a/x/gov/module.go b/x/gov/module.go index ad2191660c08..36d9a1b29dbb 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -177,6 +177,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/ibc/applications/transfer/module.go b/x/ibc/applications/transfer/module.go index 67c736555b8a..5762cc765e55 100644 --- a/x/ibc/applications/transfer/module.go +++ b/x/ibc/applications/transfer/module.go @@ -145,6 +145,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock implements the AppModule interface func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { } diff --git a/x/ibc/core/module.go b/x/ibc/core/module.go index 3371dc88a446..67f1b276ab55 100644 --- a/x/ibc/core/module.go +++ b/x/ibc/core/module.go @@ -156,6 +156,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(ExportGenesis(ctx, *am.keeper)) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the ibc module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { ibcclient.BeginBlocker(ctx, am.keeper.ClientKeeper) diff --git a/x/mint/module.go b/x/mint/module.go index 44e96ce74bda..aa0ad4a794e7 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -146,6 +146,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the mint module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper) diff --git a/x/params/module.go b/x/params/module.go index b0a4584129ef..3b1582a739b9 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -139,6 +139,14 @@ func (am AppModule) ExportGenesis(_ sdk.Context, _ codec.JSONMarshaler) json.Raw return nil } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/slashing/module.go b/x/slashing/module.go index 91ad472e90df..32ce7cffae97 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -159,6 +159,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the slashing module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) diff --git a/x/staking/module.go b/x/staking/module.go index f2e422117476..27ee2d4a0044 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -157,6 +157,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json return cdc.MustMarshalJSON(gs) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock returns the begin blocker for the staking module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper) diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 4e4982a324cf..03cdaed2ebaa 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -120,6 +120,14 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONMarshaler) json.R return am.DefaultGenesis(cdc) } +// ConsensusVersion tracks state-breaking versions of the module. +func (AppModule) ConsensusVersion() uint64 { return 0 } + +// MigrateStore performs in-place store migrations. +func (am AppModule) MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, fromVersion uint64) error { + return nil +} + // BeginBlock calls the upgrade module hooks // // CONTRACT: this is registered in BeginBlocker *before* all other modules' BeginBlock functions