From 2e9ad4d95370dca1bc28ce816f105f4e9489c73d Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 10 Jan 2024 11:29:10 +0000 Subject: [PATCH 1/2] chore: remove order check for ICA host and controller upgrade callbacks --- .../controller/keeper/handshake.go | 7 ------- .../controller/keeper/handshake_test.go | 4 ++-- .../27-interchain-accounts/host/keeper/handshake.go | 7 ------- .../host/keeper/handshake_test.go | 12 ++++++------ 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 17234cc62a9..635cf32481e 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -151,17 +151,10 @@ func (Keeper) OnChanCloseConfirm( // - encoding (must be supported) // // The following may not be changed: -// - order // - connectionHops (and subsequently host/controller connectionIDs) // - interchain account address // - ICS27 protocol version func (k Keeper) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { - // verify order has not changed - // support for unordered ICA channels is not implemented yet - if order != channeltypes.ORDERED { - return "", errorsmod.Wrapf(channeltypes.ErrInvalidChannelOrdering, "expected %s channel, got %s", channeltypes.ORDERED, order) - } - // verify connection hops has not changed connectionID, err := k.GetConnectionID(ctx, portID, channelID) if err != nil { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index b2fd351cc06..fae1ab792b4 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -510,11 +510,11 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeInit() { nil, }, { - name: "failure: invalid order", + name: "success: change order", malleate: func() { order = channeltypes.UNORDERED }, - expError: channeltypes.ErrInvalidChannelOrdering, + expError: nil, }, { name: "failure: connectionID not found", diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index 4798563f7c1..62f649e9d89 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -141,17 +141,10 @@ func (Keeper) OnChanCloseConfirm( // - encoding (must be supported) // // The following may not be changed: -// - order // - connectionHops (and subsequently host/controller connectionIDs) // - interchain account address // - ICS27 protocol version func (k Keeper) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { - // verify order has not changed - // support for unordered ICA channels is not implemented yet - if order != channeltypes.ORDERED { - return "", errorsmod.Wrapf(channeltypes.ErrInvalidChannelOrdering, "expected %s channel, got %s", channeltypes.ORDERED, order) - } - if portID != icatypes.HostPortID { return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "expected %s, got %s", icatypes.HostPortID, portID) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index bb69322d40a..c516f5500fa 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -458,18 +458,18 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeTry() { nil, }, { - name: "failure: invalid port ID", + name: "success: change order", malleate: func() { - path.EndpointB.ChannelConfig.PortID = "invalid-port-id" + order = channeltypes.UNORDERED }, - expError: porttypes.ErrInvalidPort, + expError: nil, }, { - name: "failure: invalid order", + name: "failure: invalid port ID", malleate: func() { - order = channeltypes.UNORDERED + path.EndpointB.ChannelConfig.PortID = "invalid-port-id" }, - expError: channeltypes.ErrInvalidChannelOrdering, + expError: porttypes.ErrInvalidPort, }, { name: "failure: invalid proposed connectionHops", From f85a5b556e3c6c1a8e52ed9e8af271ecca212bc9 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 10 Jan 2024 12:38:25 +0000 Subject: [PATCH 2/2] chore: addressing PR feedback --- .../apps/27-interchain-accounts/controller/keeper/handshake.go | 1 + modules/apps/27-interchain-accounts/host/keeper/handshake.go | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 635cf32481e..4b1118540bb 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -149,6 +149,7 @@ func (Keeper) OnChanCloseConfirm( // The following may be changed: // - tx type (must be supported) // - encoding (must be supported) +// - order // // The following may not be changed: // - connectionHops (and subsequently host/controller connectionIDs) diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index 62f649e9d89..8081846e49b 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -139,6 +139,7 @@ func (Keeper) OnChanCloseConfirm( // The following may be changed: // - tx type (must be supported) // - encoding (must be supported) +// - order // // The following may not be changed: // - connectionHops (and subsequently host/controller connectionIDs)