diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 0ac0ececc24..9af2a2a32cd 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -48,11 +48,6 @@ func NewKeeper( ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper, scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, authority string, ) Keeper { - // set KeyTable if it has not already been set - if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable()) - } - if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index d063c9a932a..da9ba160325 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -55,11 +55,6 @@ func NewKeeper( panic(errors.New("the Interchain Accounts module account has not been set")) } - // set KeyTable if it has not already been set - if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable()) - } - if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) } diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 782fcdb94b8..18ff530ae4b 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -59,10 +59,6 @@ func NewKeeper( if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { panic(errors.New("the IBC transfer module account has not been set")) } - // set KeyTable if it has not already been set - if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable()) - } if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 887587ce9c9..b1e63b943fe 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -39,11 +39,6 @@ type Keeper struct { // NewKeeper creates a new NewKeeper instance func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace, sk types.StakingKeeper, uk types.UpgradeKeeper) Keeper { - // set KeyTable if it has not already been set - if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ storeKey: key, cdc: cdc, diff --git a/modules/core/02-client/keeper/migrations.go b/modules/core/02-client/keeper/migrations.go index b41f7024556..54620867928 100644 --- a/modules/core/02-client/keeper/migrations.go +++ b/modules/core/02-client/keeper/migrations.go @@ -39,10 +39,10 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { func (m Migrator) MigrateParams(ctx sdk.Context) error { var params types.Params m.keeper.legacySubspace.GetParamSet(ctx, ¶ms) - if err := params.Validate(); err != nil { return err } + m.keeper.SetParams(ctx, params) m.keeper.Logger(ctx).Info("successfully migrated client to self-manage params") return nil diff --git a/modules/core/03-connection/keeper/keeper.go b/modules/core/03-connection/keeper/keeper.go index d6621a52473..b4f8cf506c7 100644 --- a/modules/core/03-connection/keeper/keeper.go +++ b/modules/core/03-connection/keeper/keeper.go @@ -31,11 +31,6 @@ type Keeper struct { // NewKeeper creates a new IBC connection Keeper instance func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace, ck types.ClientKeeper) Keeper { - // set KeyTable if it has not already been set - if !legacySubspace.HasKeyTable() { - legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ storeKey: key, cdc: cdc, diff --git a/modules/core/03-connection/keeper/migrations.go b/modules/core/03-connection/keeper/migrations.go index 528bc86c9d7..64b84e7885e 100644 --- a/modules/core/03-connection/keeper/migrations.go +++ b/modules/core/03-connection/keeper/migrations.go @@ -30,10 +30,10 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { func (m Migrator) MigrateParams(ctx sdk.Context) error { var params types.Params m.keeper.legacySubspace.GetParamSet(ctx, ¶ms) - if err := params.Validate(); err != nil { return err } + m.keeper.SetParams(ctx, params) m.keeper.Logger(ctx).Info("successfully migrated connection to self-manage params") return nil diff --git a/modules/core/03-connection/keeper/migrations_test.go b/modules/core/03-connection/keeper/migrations_test.go index ee1db7e6c20..36907ff4f96 100644 --- a/modules/core/03-connection/keeper/migrations_test.go +++ b/modules/core/03-connection/keeper/migrations_test.go @@ -18,7 +18,7 @@ func (suite *KeeperTestSuite) TestMigrateParams() { func() { params := types.DefaultParams() subspace := suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName) - subspace.SetParamSet(suite.chainA.GetContext(), ¶ms) // set params + subspace.SetParamSet(suite.chainA.GetContext(), ¶ms) }, types.DefaultParams(), }, diff --git a/modules/core/keeper/keeper.go b/modules/core/keeper/keeper.go index 1b9bcb14de8..6831be40bda 100644 --- a/modules/core/keeper/keeper.go +++ b/modules/core/keeper/keeper.go @@ -14,7 +14,6 @@ import ( clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" connectionkeeper "github.com/cosmos/ibc-go/v8/modules/core/03-connection/keeper" - connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channelkeeper "github.com/cosmos/ibc-go/v8/modules/core/04-channel/keeper" portkeeper "github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" @@ -45,14 +44,6 @@ func NewKeeper( stakingKeeper clienttypes.StakingKeeper, upgradeKeeper clienttypes.UpgradeKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, authority string, ) *Keeper { - // register paramSpace at top level keeper - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - keyTable := clienttypes.ParamKeyTable() - keyTable.RegisterParamSet(&connectiontypes.Params{}) - paramSpace = paramSpace.WithKeyTable(keyTable) - } - // panic if any of the keepers passed in is empty if isEmpty(stakingKeeper) { panic(errors.New("cannot initialize IBC keeper: empty staking keeper")) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index df0d84e034e..cd275c7d9db 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -123,6 +123,7 @@ import ( ibc "github.com/cosmos/ibc-go/v8/modules/core" ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" @@ -1005,12 +1006,13 @@ func BlockedAddresses() map[string]bool { func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - // TODO: ibc module subspaces can be removed after migration of params - // https://github.com/cosmos/ibc-go/issues/2010 - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) return paramsKeeper }