Skip to content

Commit

Permalink
Merge branch 'main' into carlos/run-all-tests-go-mods
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton committed Sep 26, 2023
2 parents 3b8439f + 59e42c6 commit 85169c1
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
5 changes: 0 additions & 5 deletions modules/apps/27-interchain-accounts/host/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
4 changes: 0 additions & 4 deletions modules/apps/transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
5 changes: 0 additions & 5 deletions modules/core/02-client/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, &params)

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
Expand Down
5 changes: 0 additions & 5 deletions modules/core/03-connection/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/03-connection/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, &params)

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
Expand Down
2 changes: 1 addition & 1 deletion modules/core/03-connection/keeper/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (suite *KeeperTestSuite) TestMigrateParams() {
func() {
params := types.DefaultParams()
subspace := suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName)
subspace.SetParamSet(suite.chainA.GetContext(), &params) // set params
subspace.SetParamSet(suite.chainA.GetContext(), &params)
},
types.DefaultParams(),
},
Expand Down
9 changes: 0 additions & 9 deletions modules/core/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"))
Expand Down
14 changes: 8 additions & 6 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 85169c1

Please sign in to comment.