Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api)!: make port keeper pointer #4703

Merged
merged 11 commits into from
Sep 19, 2023
21 changes: 21 additions & 0 deletions docs/migrations/v7-to-v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@ There are four sections based on the four potential user groups of this document

## Chains

The type of the `PortKeeper` field of the IBC keeper have been changed to `*portkeeper.Keeper`:
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

```diff
// Keeper defines each ICS keeper for IBC
type Keeper struct {
// implements gRPC QueryServer interface
types.QueryServer

cdc codec.BinaryCodec

ClientKeeper clientkeeper.Keeper
ConnectionKeeper connectionkeeper.Keeper
ChannelKeeper channelkeeper.Keeper
- PortKeeper portkeeper.Keeper
+ PortKeeper *portkeeper.Keeper
Router *porttypes.Router

authority string
}
```

TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to transfer's `GenesisState`)

- You must pass the `authority` to the icahost keeper. ([#3520](https://github.com/cosmos/ibc-go/pull/3520)) See [diff](https://github.com/cosmos/ibc-go/pull/3520/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a).
Expand Down
2 changes: 1 addition & 1 deletion modules/core/05-port/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (suite *KeeperTestSuite) SetupTest() {
app := simapp.Setup(suite.T(), isCheckTx)

suite.ctx = app.BaseApp.NewContext(isCheckTx)
suite.keeper = &app.IBCKeeper.PortKeeper
suite.keeper = app.IBCKeeper.PortKeeper
}

func TestKeeperTestSuite(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions modules/core/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Keeper struct {
ClientKeeper clientkeeper.Keeper
ConnectionKeeper connectionkeeper.Keeper
ChannelKeeper channelkeeper.Keeper
PortKeeper portkeeper.Keeper
PortKeeper *portkeeper.Keeper
Router *porttypes.Router

authority string
Expand Down Expand Up @@ -67,14 +67,14 @@ func NewKeeper(
clientKeeper := clientkeeper.NewKeeper(cdc, key, paramSpace, stakingKeeper, upgradeKeeper)
connectionKeeper := connectionkeeper.NewKeeper(cdc, key, paramSpace, clientKeeper)
portKeeper := portkeeper.NewKeeper(scopedKeeper)
channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, &portKeeper, scopedKeeper)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make portkeeper.NewKeeper return a pointer, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do in a followup if it isn't straightforward of a change


return &Keeper{
cdc: cdc,
ClientKeeper: clientKeeper,
ConnectionKeeper: connectionKeeper,
ChannelKeeper: channelKeeper,
PortKeeper: portKeeper,
PortKeeper: &portKeeper,
authority: authority,
}
}
Expand Down
10 changes: 5 additions & 5 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,24 +436,24 @@
appCodec, keys[ibcfeetypes.StoreKey],
app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper,
app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper,
)

// ICA Controller keeper
app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName),
app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper,
scopedICAControllerKeeper, app.MsgServiceRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

Check failure on line 449 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper value in argument to ibcfeekeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper (missing method BindPort)

Check failure on line 449 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper value in argument to ibcfeekeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper (missing method BindPort)

Check failure on line 449 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper value in argument to ibcfeekeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper (missing method BindPort)

Check failure on line 449 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper value in argument to ibcfeekeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper (missing method BindPort)

Check failure on line 449 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / build (amd64)

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper value in argument to ibcfeekeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types".PortKeeper (missing method BindPort)

// ICA Host keeper
app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName),
app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper,
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(),

Check failure on line 456 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icacontrollerkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 456 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icacontrollerkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 456 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icacontrollerkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 456 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icacontrollerkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 456 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / build (amd64)

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icacontrollerkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

Expand All @@ -462,12 +462,12 @@

// Middleware Stacks

// Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper

Check failure on line 465 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icahostkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 465 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icahostkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 465 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icahostkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 465 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icahostkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)

Check failure on line 465 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / build (amd64)

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper value in argument to icahostkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types".PortKeeper (missing method BindPort)
// since fee middleware will wrap the IBCKeeper for underlying application.
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
Expand All @@ -477,9 +477,9 @@
// Mock Module setup for testing IBC and also acts as the interchain accounts authentication module
// NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do
// not replicate if you do not need to test core IBC or light clients.
mockModule := ibcmock.NewAppModule(&app.IBCKeeper.PortKeeper)
mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper)

// The mock module is used for testing IBC

Check failure on line 482 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper value in argument to ibctransferkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper (missing method BindPort)

Check failure on line 482 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper value in argument to ibctransferkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper (missing method BindPort)

Check failure on line 482 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper value in argument to ibctransferkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper (missing method BindPort)

Check failure on line 482 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / build (amd64)

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper value in argument to ibctransferkeeper.NewKeeper: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types".PortKeeper (missing method BindPort)
mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper))
ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule)

Expand All @@ -489,7 +489,7 @@

// RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way
// channel.RecvPacket -> fee.OnRecvPacket -> transfer.OnRecvPacket

Check failure on line 492 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper value in argument to ibcmock.NewAppModule: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper (missing method BindPort)

Check failure on line 492 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / tests

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper value in argument to ibcmock.NewAppModule: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper (missing method BindPort)

Check failure on line 492 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper value in argument to ibcmock.NewAppModule: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper (missing method BindPort) (typecheck)

Check failure on line 492 in testing/simapp/app.go

View workflow job for this annotation

GitHub Actions / build (amd64)

cannot use &app.IBCKeeper.PortKeeper (value of type **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper) as "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper value in argument to ibcmock.NewAppModule: **"github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper".Keeper does not implement "github.com/cosmos/ibc-go/v8/testing/mock".PortKeeper (missing method BindPort)
// transfer stack contains (from top to bottom):
// - IBC Fee Middleware
// - Transfer
Expand Down
Loading