Skip to content

Commit c592a8d

Browse files
mergify[bot]damiannolancrodriguezvega
authored
imp!: use expected interface for legacy params subspace (backport #4811) (#4835)
* imp!: use expected interface for legacy params subspace (#4811) * imp: use expected interface for legacy params subspace * chore: define GetParamSet on expected interface and rm explicit type conversions (cherry picked from commit b331851) * add changelog entry --------- Co-authored-by: Damian Nolan <damiannolan@gmail.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
1 parent 9c72121 commit c592a8d

File tree

12 files changed

+48
-17
lines changed

12 files changed

+48
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
6767
* (apps/29-fee) [\#4290](https://github.com/cosmos/ibc-go/pull/4290) Use `types.MetadataFromVersion` helper function for callback handlers.
6868
* (core/04-channel) [\#4155](https://github.com/cosmos/ibc-go/pull/4155) Adding `IsOpen` and `IsClosed` methods to `Channel` type.
6969
* (core/03-connection) [\#4110](https://github.com/cosmos/ibc-go/pull/4110) Remove `Version` interface and casting functions from 03-connection.
70+
* (core) [\#4835](https://github.com/cosmos/ibc-go/pull/4835) Use expected interface for legacy params subspace parameter of keeper constructor functions.
7071

7172
### Features
7273

modules/apps/27-interchain-accounts/controller/keeper/keeper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/cosmos/cosmos-sdk/codec"
1414
sdk "github.com/cosmos/cosmos-sdk/types"
15-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1615

1716
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
1817
"github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
@@ -28,7 +27,7 @@ import (
2827
type Keeper struct {
2928
storeKey storetypes.StoreKey
3029
cdc codec.Codec
31-
legacySubspace paramtypes.Subspace
30+
legacySubspace icatypes.ParamSubspace
3231
ics4Wrapper porttypes.ICS4Wrapper
3332
channelKeeper icatypes.ChannelKeeper
3433
portKeeper icatypes.PortKeeper
@@ -44,7 +43,7 @@ type Keeper struct {
4443

4544
// NewKeeper creates a new interchain accounts controller Keeper instance
4645
func NewKeeper(
47-
cdc codec.Codec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace,
46+
cdc codec.Codec, key storetypes.StoreKey, legacySubspace icatypes.ParamSubspace,
4847
ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
4948
scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, authority string,
5049
) Keeper {

modules/apps/27-interchain-accounts/host/keeper/keeper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/cosmos/cosmos-sdk/codec"
1313
sdk "github.com/cosmos/cosmos-sdk/types"
14-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1514

1615
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
1716
genesistypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/genesis/types"
@@ -27,7 +26,7 @@ import (
2726
type Keeper struct {
2827
storeKey storetypes.StoreKey
2928
cdc codec.Codec
30-
legacySubspace paramtypes.Subspace
29+
legacySubspace icatypes.ParamSubspace
3130

3231
ics4Wrapper porttypes.ICS4Wrapper
3332
channelKeeper icatypes.ChannelKeeper
@@ -45,7 +44,7 @@ type Keeper struct {
4544

4645
// NewKeeper creates a new interchain accounts host Keeper instance
4746
func NewKeeper(
48-
cdc codec.Codec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace,
47+
cdc codec.Codec, key storetypes.StoreKey, legacySubspace icatypes.ParamSubspace,
4948
ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
5049
accountKeeper icatypes.AccountKeeper, scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter,
5150
authority string,

modules/apps/27-interchain-accounts/types/expected_keepers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55

66
sdk "github.com/cosmos/cosmos-sdk/types"
7+
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
78

89
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
910
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
@@ -32,3 +33,8 @@ type PortKeeper interface {
3233
BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
3334
IsBound(ctx sdk.Context, portID string) bool
3435
}
36+
37+
// ParamSubspace defines the expected Subspace interface for module parameters.
38+
type ParamSubspace interface {
39+
GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet)
40+
}

modules/apps/transfer/keeper/keeper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/cosmos/cosmos-sdk/codec"
1414
sdk "github.com/cosmos/cosmos-sdk/types"
1515
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
16-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1716

1817
tmbytes "github.com/cometbft/cometbft/libs/bytes"
1918

@@ -28,7 +27,7 @@ import (
2827
type Keeper struct {
2928
storeKey storetypes.StoreKey
3029
cdc codec.BinaryCodec
31-
legacySubspace paramtypes.Subspace
30+
legacySubspace types.ParamSubspace
3231

3332
ics4Wrapper porttypes.ICS4Wrapper
3433
channelKeeper types.ChannelKeeper
@@ -46,7 +45,7 @@ type Keeper struct {
4645
func NewKeeper(
4746
cdc codec.BinaryCodec,
4847
key storetypes.StoreKey,
49-
legacySubspace paramtypes.Subspace,
48+
legacySubspace types.ParamSubspace,
5049
ics4Wrapper porttypes.ICS4Wrapper,
5150
channelKeeper types.ChannelKeeper,
5251
portKeeper types.PortKeeper,

modules/apps/transfer/types/expected_keepers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
sdk "github.com/cosmos/cosmos-sdk/types"
77
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
8+
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
89

910
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
1011
connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
@@ -54,3 +55,8 @@ type ConnectionKeeper interface {
5455
type PortKeeper interface {
5556
BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
5657
}
58+
59+
// ParamSubspace defines the expected Subspace interface for module parameters.
60+
type ParamSubspace interface {
61+
GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet)
62+
}

modules/core/02-client/keeper/keeper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/cosmos/cosmos-sdk/codec"
1616
sdk "github.com/cosmos/cosmos-sdk/types"
17-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1817

1918
"github.com/cometbft/cometbft/light"
2019

@@ -32,13 +31,13 @@ import (
3231
type Keeper struct {
3332
storeKey storetypes.StoreKey
3433
cdc codec.BinaryCodec
35-
legacySubspace paramtypes.Subspace
34+
legacySubspace types.ParamSubspace
3635
stakingKeeper types.StakingKeeper
3736
upgradeKeeper types.UpgradeKeeper
3837
}
3938

4039
// NewKeeper creates a new NewKeeper instance
41-
func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace, sk types.StakingKeeper, uk types.UpgradeKeeper) Keeper {
40+
func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace types.ParamSubspace, sk types.StakingKeeper, uk types.UpgradeKeeper) Keeper {
4241
return Keeper{
4342
storeKey: key,
4443
cdc: cdc,

modules/core/02-client/types/expected_keepers.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66

77
upgradetypes "cosmossdk.io/x/upgrade/types"
88

9+
sdk "github.com/cosmos/cosmos-sdk/types"
10+
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
911
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
1012
)
1113

@@ -25,3 +27,8 @@ type UpgradeKeeper interface {
2527
SetUpgradedConsensusState(ctx context.Context, planHeight int64, bz []byte) error
2628
ScheduleUpgrade(ctx context.Context, plan upgradetypes.Plan) error
2729
}
30+
31+
// ParamSubspace defines the expected Subspace interface for module parameters.
32+
type ParamSubspace interface {
33+
GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet)
34+
}

modules/core/03-connection/keeper/keeper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/cosmos/cosmos-sdk/codec"
1111
sdk "github.com/cosmos/cosmos-sdk/types"
12-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1312

1413
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
1514
"github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
@@ -24,13 +23,13 @@ type Keeper struct {
2423
types.QueryServer
2524

2625
storeKey storetypes.StoreKey
27-
legacySubspace paramtypes.Subspace
26+
legacySubspace types.ParamSubspace
2827
cdc codec.BinaryCodec
2928
clientKeeper types.ClientKeeper
3029
}
3130

3231
// NewKeeper creates a new IBC connection Keeper instance
33-
func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace paramtypes.Subspace, ck types.ClientKeeper) Keeper {
32+
func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace types.ParamSubspace, ck types.ClientKeeper) Keeper {
3433
return Keeper{
3534
storeKey: key,
3635
cdc: cdc,

modules/core/03-connection/types/expected_keepers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
storetypes "cosmossdk.io/store/types"
55

66
sdk "github.com/cosmos/cosmos-sdk/types"
7+
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
78

89
"github.com/cosmos/ibc-go/v8/modules/core/exported"
910
)
@@ -18,3 +19,8 @@ type ClientKeeper interface {
1819
IterateClientStates(ctx sdk.Context, prefix []byte, cb func(string, exported.ClientState) bool)
1920
ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore
2021
}
22+
23+
// ParamSubspace defines the expected Subspace interface for module parameters.
24+
type ParamSubspace interface {
25+
GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet)
26+
}

0 commit comments

Comments
 (0)