From c5d1b5e86921447e3b7699f098e789180c479d5f Mon Sep 17 00:00:00 2001 From: khanh-notional <50263489+catShaark@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:38:21 +0700 Subject: [PATCH 1/2] use controller module address instead of module name for NewMsgChannelOpenInit (#2568) ## Description In controller keeper's `registerInterchainAccount` we execute a `MsgChannelOpenInit` to set up an ica channel. Currently, we have [`icatypes.ModuleName`](https://github.com/cosmos/ibc-go/blob/95cec44c9fb10a2e84a327cdd98c7d588f091f42/modules/apps/27-interchain-accounts/controller/keeper/account.go#L63) as the msg signer. This is not good because the [`ValidateBasic()`](https://github.com/cosmos/ibc-go/blob/692790402a033c1d9647c1e1eded5351332283bf/modules/core/04-channel/types/msgs.go#L34) of `MsgChannelOpenInit` has check if msg signer is bech32 or not. ref #2566 closes: #2559 --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/10-structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing) - [ ] Updated relevant documentation (`docs/`) or specification (`x//spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes (cherry picked from commit 6105db491a0a1c5a1e4358494dc186401ed1eb26) # Conflicts: # modules/apps/27-interchain-accounts/controller/keeper/account.go --- .../apps/27-interchain-accounts/controller/keeper/account.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index 282b6e2e77a..bf51a8a93dd 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" @@ -36,6 +37,7 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner s } } +<<<<<<< HEAD connectionEnd, err := k.channelKeeper.GetConnection(ctx, connectionID) if err != nil { return err @@ -57,6 +59,9 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner s } msg := channeltypes.NewMsgChannelOpenInit(portID, string(versionBytes), channeltypes.ORDERED, []string{connectionID}, icatypes.PortID, icatypes.ModuleName) +======= + msg := channeltypes.NewMsgChannelOpenInit(portID, version, channeltypes.ORDERED, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) +>>>>>>> 6105db4 (use controller module address instead of module name for NewMsgChannelOpenInit (#2568)) handler := k.msgRouter.Handler(msg) res, err := handler(ctx, msg) From 86a4794a0e6579a82f6195b210a082e6c6e69151 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Thu, 27 Oct 2022 10:48:14 +0200 Subject: [PATCH 2/2] resolving conflicts --- .../27-interchain-accounts/controller/keeper/account.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index bf51a8a93dd..5087ac5a9da 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -37,7 +37,6 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner s } } -<<<<<<< HEAD connectionEnd, err := k.channelKeeper.GetConnection(ctx, connectionID) if err != nil { return err @@ -58,10 +57,7 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner s return err } - msg := channeltypes.NewMsgChannelOpenInit(portID, string(versionBytes), channeltypes.ORDERED, []string{connectionID}, icatypes.PortID, icatypes.ModuleName) -======= - msg := channeltypes.NewMsgChannelOpenInit(portID, version, channeltypes.ORDERED, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) ->>>>>>> 6105db4 (use controller module address instead of module name for NewMsgChannelOpenInit (#2568)) + msg := channeltypes.NewMsgChannelOpenInit(portID, string(versionBytes), channeltypes.ORDERED, []string{connectionID}, icatypes.PortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) handler := k.msgRouter.Handler(msg) res, err := handler(ctx, msg)