Skip to content

Commit

Permalink
Remove order check for ICA host and controller upgrade callbacks (#5561)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Jan 11, 2024
1 parent 681c3da commit fcf830f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,13 @@ func (Keeper) OnChanCloseConfirm(
// The following may be changed:
// - tx type (must be supported)
// - encoding (must be supported)
// - order
//
// 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 1 addition & 7 deletions modules/apps/27-interchain-accounts/host/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,13 @@ func (Keeper) OnChanCloseConfirm(
// The following may be changed:
// - tx type (must be supported)
// - encoding (must be supported)
// - order
//
// 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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit fcf830f

Please sign in to comment.