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

Remove order check for ICA host and controller upgrade callbacks #5561

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

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

can move this to two lines up under The following may be changed

// - 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
Copy link
Contributor

Choose a reason for hiding this comment

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

dittorino

// - 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