diff --git a/x/gov/keeper/migrations.go b/x/gov/keeper/migrations.go index cad01432bb7d..b6b4721b27d9 100644 --- a/x/gov/keeper/migrations.go +++ b/x/gov/keeper/migrations.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" v043 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v043" + v3 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v3" ) // Migrator is a struct for handling in-place store migrations. @@ -19,3 +20,8 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v043.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) } + +// Migrate2to3 migrates from version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateStore(ctx, m.keeper.paramSpace) +} diff --git a/x/gov/legacy/v3/store.go b/x/gov/legacy/v3/store.go index dd25e9338b2b..7caa06db1bbe 100644 --- a/x/gov/legacy/v3/store.go +++ b/x/gov/legacy/v3/store.go @@ -3,7 +3,6 @@ package v3 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) @@ -16,12 +15,12 @@ var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) // The migration includes: // // - Setting the minimum deposit param in the paramstore. -func MigrateStore(ctx sdk.Context, paramstore paramtypes.Subspace) error { +func MigrateStore(ctx sdk.Context, paramstore types.ParamSubspace) error { migrateParamsStore(ctx, paramstore) return nil } -func migrateParamsStore(ctx sdk.Context, paramstore paramtypes.Subspace) { +func migrateParamsStore(ctx sdk.Context, paramstore types.ParamSubspace) { var depositParams types.DepositParams paramstore.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams) depositParams.MinInitialDepositRatio = minInitialDepositRatio diff --git a/x/gov/module.go b/x/gov/module.go index 69f6d5572839..65ddb730ed4f 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -161,6 +161,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err != nil { panic(err) } + cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the gov module. It returns