From 50bb3599aa27656038fe8f90e4a3500d43798588 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 16 Aug 2023 16:06:11 +0100 Subject: [PATCH 1/7] chore: remove restore logic in try handler, fast forward upgrade sequence in try hander --- modules/apps/29-fee/ibc_middleware_test.go | 320 +++++++++--------- modules/core/04-channel/keeper/events.go | 8 +- modules/core/04-channel/keeper/upgrade.go | 24 +- .../core/04-channel/keeper/upgrade_test.go | 149 ++++---- modules/core/keeper/msg_server.go | 12 +- modules/core/keeper/msg_server_test.go | 43 +-- 6 files changed, 265 insertions(+), 291 deletions(-) diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index bac7cdd8c83..9336ef6965c 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -328,35 +328,35 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( + ctx sdk.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, false, }, { "RefundFeesOnChannelClosure continues - invalid refund address", func() { - // store the fee in state & update escrow account balance - packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) - packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) + // store the fee in state & update escrow account balance + packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) + packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) - suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) - err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) - suite.Require().NoError(err) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) + err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) + suite.Require().NoError(err) + }, true, }, { "fee module locked", func() { - lockFeeModule(suite.chainA) - }, + lockFeeModule(suite.chainA) + }, false, }, { "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, true, }, } @@ -417,35 +417,35 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( + ctx sdk.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, false, }, { "RefundChannelFeesOnClosure continues - refund address is invalid", func() { - // store the fee in state & update escrow account balance - packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) - packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) + // store the fee in state & update escrow account balance + packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) + packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) - suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) - err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) - suite.Require().NoError(err) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) + err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) + suite.Require().NoError(err) + }, true, }, { "fee module locked", func() { - lockFeeModule(suite.chainA) - }, + lockFeeModule(suite.chainA) + }, false, }, { "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, true, }, } @@ -1120,132 +1120,132 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { }) } } - -func (suite *FeeTestSuite) TestOnChanUpgradeTry() { - var ( - expFeeEnabled bool - path *ibctesting.Path - ) - - testCases := []struct { - name string - malleate func() - expError error - }{ - { - "success", - func() {}, - nil, - }, - { - "success disable fees", - func() { - // create a new path using a fee enabled channel and downgrade it to disable fees - expFeeEnabled = false - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - mockFeeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) - path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort - path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort - path.EndpointA.ChannelConfig.Version = mockFeeVersion - path.EndpointB.ChannelConfig.Version = mockFeeVersion - - upgradeVersion := ibcmock.Version - path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - - suite.coordinator.Setup(path) - err := path.EndpointA.ChanUpgradeInit() - suite.Require().NoError(err) - }, - nil, - }, - { - "invalid upgrade version", - func() { - expFeeEnabled = false - counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() - counterpartyUpgrade.Fields.Version = ibctesting.InvalidID - path.EndpointA.SetChannelUpgrade(counterpartyUpgrade) - - suite.coordinator.CommitBlock(suite.chainA) - - // intentionally force the error here so we can assert that a passthrough occurs when fees should not be enabled for this channel - suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { - return "", ibcmock.MockApplicationCallbackError - } - }, - channeltypes.NewUpgradeError(1, ibcmock.MockApplicationCallbackError), - }, - { - "invalid fee version", - func() { - expFeeEnabled = false - upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: ibctesting.InvalidID, AppVersion: ibcmock.Version})) - - counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() - counterpartyUpgrade.Fields.Version = upgradeVersion - path.EndpointA.SetChannelUpgrade(counterpartyUpgrade) - - suite.coordinator.CommitBlock(suite.chainA) - }, - channeltypes.NewUpgradeError(1, types.ErrInvalidVersion), - }, - { - "underlying app callback returns error", - func() { - expFeeEnabled = false - suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { - return "", ibcmock.MockApplicationCallbackError - } - }, - channeltypes.NewUpgradeError(1, ibcmock.MockApplicationCallbackError), - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupTest() - - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - // configure the initial path to create an unincentivized mock channel - path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort - path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort - path.EndpointA.ChannelConfig.Version = ibcmock.Version - path.EndpointB.ChannelConfig.Version = ibcmock.Version - - suite.coordinator.Setup(path) - - // configure the channel upgrade version to enabled ics29 fee middleware - expFeeEnabled = true - upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) - path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion - - err := path.EndpointA.ChanUpgradeInit() - suite.Require().NoError(err) - - tc.malleate() - - err = path.EndpointB.ChanUpgradeTry() - suite.Require().NoError(err) - - isFeeEnabled := suite.chainB.GetSimApp().IBCFeeKeeper.IsFeeEnabled(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - suite.Require().Equal(expFeeEnabled, isFeeEnabled) - - if tc.expError != nil { - // NOTE: application callback failure in OnChanUpgradeTry results in an ErrorReceipt being written to state signaling for cancellation - if expUpgradeError, ok := tc.expError.(*channeltypes.UpgradeError); ok { - errorReceipt, found := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - suite.Require().True(found) - suite.Require().Equal(expUpgradeError.GetErrorReceipt(), errorReceipt) - } - } - }) - } -} +// +//func (suite *FeeTestSuite) TestOnChanUpgradeTry() { +// var ( +// expFeeEnabled bool +// path *ibctesting.Path +// ) +// +// testCases := []struct { +// name string +// malleate func() +// expError error +// }{ +// { +// "success", +// func() {}, +// nil, +// }, +// { +// "success disable fees", +// func() { +// // create a new path using a fee enabled channel and downgrade it to disable fees +// expFeeEnabled = false +// path = ibctesting.NewPath(suite.chainA, suite.chainB) +// +// mockFeeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) +// path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort +// path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort +// path.EndpointA.ChannelConfig.Version = mockFeeVersion +// path.EndpointB.ChannelConfig.Version = mockFeeVersion +// +// upgradeVersion := ibcmock.Version +// path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion +// path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion +// +// suite.coordinator.Setup(path) +// err := path.EndpointA.ChanUpgradeInit() +// suite.Require().NoError(err) +// }, +// nil, +// }, +// { +// "invalid upgrade version", +// func() { +// expFeeEnabled = false +// counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() +// counterpartyUpgrade.Fields.Version = ibctesting.InvalidID +// path.EndpointA.SetChannelUpgrade(counterpartyUpgrade) +// +// suite.coordinator.CommitBlock(suite.chainA) +// +// // intentionally force the error here so we can assert that a passthrough occurs when fees should not be enabled for this channel +// suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { +// return "", ibcmock.MockApplicationCallbackError +// } +// }, +// channeltypes.NewUpgradeError(1, ibcmock.MockApplicationCallbackError), +// }, +// { +// "invalid fee version", +// func() { +// expFeeEnabled = false +// upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: ibctesting.InvalidID, AppVersion: ibcmock.Version})) +// +// counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() +// counterpartyUpgrade.Fields.Version = upgradeVersion +// path.EndpointA.SetChannelUpgrade(counterpartyUpgrade) +// +// suite.coordinator.CommitBlock(suite.chainA) +// }, +// channeltypes.NewUpgradeError(1, types.ErrInvalidVersion), +// }, +// { +// "underlying app callback returns error", +// func() { +// expFeeEnabled = false +// suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { +// return "", ibcmock.MockApplicationCallbackError +// } +// }, +// channeltypes.NewUpgradeError(1, ibcmock.MockApplicationCallbackError), +// }, +// } +// +// for _, tc := range testCases { +// tc := tc +// suite.Run(tc.name, func() { +// suite.SetupTest() +// +// path = ibctesting.NewPath(suite.chainA, suite.chainB) +// +// // configure the initial path to create an unincentivized mock channel +// path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort +// path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort +// path.EndpointA.ChannelConfig.Version = ibcmock.Version +// path.EndpointB.ChannelConfig.Version = ibcmock.Version +// +// suite.coordinator.Setup(path) +// +// // configure the channel upgrade version to enabled ics29 fee middleware +// expFeeEnabled = true +// upgradeVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})) +// path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion +// path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = upgradeVersion +// +// err := path.EndpointA.ChanUpgradeInit() +// suite.Require().NoError(err) +// +// tc.malleate() +// +// err = path.EndpointB.ChanUpgradeTry() +// suite.Require().NoError(err) +// +// isFeeEnabled := suite.chainB.GetSimApp().IBCFeeKeeper.IsFeeEnabled(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) +// suite.Require().Equal(expFeeEnabled, isFeeEnabled) +// +// if tc.expError != nil { +// // NOTE: application callback failure in OnChanUpgradeTry results in an ErrorReceipt being written to state signaling for cancellation +// if expUpgradeError, ok := tc.expError.(*channeltypes.UpgradeError); ok { +// errorReceipt, found := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) +// suite.Require().True(found) +// suite.Require().Equal(expUpgradeError.GetErrorReceipt(), errorReceipt) +// } +// } +// }) +// } +//} // TODO: Revisit these testcases when core refactor is completed // func (suite *FeeTestSuite) TestOnChanUpgradeAck() { diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index 0be29594515..624d7ad46b9 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -405,7 +405,7 @@ func emitChannelUpgradeTimeoutEvent(ctx sdk.Context, portID string, channelID st } // emitErrorReceiptEvent emits an error receipt event -func emitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, currentChannel types.Channel, upgrade types.Upgrade, err error) { +func emitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, currentChannel types.Channel, upgradeFields types.UpgradeFields, err error) { ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeInit, @@ -413,9 +413,9 @@ func emitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, cur sdk.NewAttribute(types.AttributeKeyChannelID, channelID), sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId), sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId), - sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]), - sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version), - sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()), + sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgradeFields.ConnectionHops[0]), + sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgradeFields.Version), + sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgradeFields.Ordering.String()), sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)), sdk.NewAttribute(types.AttributeKeyUpgradeErrorReceipt, err.Error()), ), diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index 8e5f53badbe..e99080fa9b9 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -114,8 +114,13 @@ func (k Keeper) ChanUpgradeTry( if found { proposedUpgradeFields = upgrade.Fields } else { - // TODO: add fast forward feature - // https://github.com/cosmos/ibc-go/issues/3794 + // if the counterparty sequence is greater than the current sequence, we fast-forward to the counterparty sequence. + if counterpartyUpgradeSequence > channel.UpgradeSequence { + // using -1 as WriteUpgradeInitChannel increments the sequence + channel.UpgradeSequence = counterpartyUpgradeSequence - 1 + k.SetChannel(ctx, portID, channelID, channel) + } + // NOTE: OnChanUpgradeInit will not be executed by the application upgrade, err = k.ChanUpgradeInit(ctx, portID, channelID, proposedUpgradeFields) if err != nil { @@ -154,8 +159,11 @@ func (k Keeper) ChanUpgradeTry( return types.Upgrade{}, errorsmod.Wrap(err, "failed to verify counterparty channel state") } - if err := k.syncUpgradeSequence(ctx, portID, channelID, channel, counterpartyUpgradeSequence); err != nil { - return types.Upgrade{}, err + + if counterpartyUpgradeSequence < channel.UpgradeSequence { + return upgrade, types.NewUpgradeError(channel.UpgradeSequence-1, errorsmod.Wrapf( + types.ErrInvalidUpgradeSequence, "counterparty upgrade sequence < current upgrade sequence (%d < %d)", counterpartyUpgradeSequence, channel.UpgradeSequence, + )) } // verifies the proof that a particular proposed upgrade has been stored in the upgrade path of the counterparty @@ -892,7 +900,7 @@ func (k Keeper) abortUpgrade(ctx sdk.Context, portID, channelID string, err erro upgradeError = types.NewUpgradeError(channel.UpgradeSequence, err) } - if err := k.writeErrorReceipt(ctx, portID, channelID, upgrade, upgradeError); err != nil { + if err := k.WriteErrorReceipt(ctx, portID, channelID, upgrade.Fields, upgradeError); err != nil { return err } @@ -911,14 +919,14 @@ func (k Keeper) restoreChannel(ctx sdk.Context, portID, channelID string, upgrad k.deleteUpgradeInfo(ctx, portID, channelID) } -// writeErrorReceipt will write an error receipt from the provided UpgradeError. -func (k Keeper) writeErrorReceipt(ctx sdk.Context, portID, channelID string, upgrade types.Upgrade, upgradeError *types.UpgradeError) error { +// WriteErrorReceipt will write an error receipt from the provided UpgradeError. +func (k Keeper) WriteErrorReceipt(ctx sdk.Context, portID, channelID string, upgradeFields types.UpgradeFields, upgradeError *types.UpgradeError) error { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } k.SetUpgradeErrorReceipt(ctx, portID, channelID, upgradeError.GetErrorReceipt()) - emitErrorReceiptEvent(ctx, portID, channelID, channel, upgrade, upgradeError) + emitErrorReceiptEvent(ctx, portID, channelID, channel, upgradeFields, upgradeError) return nil } diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index f687612293e..9c015cf2ff3 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -254,7 +254,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTry() { channel.UpgradeSequence = 5 path.EndpointB.SetChannel(channel) }, - types.NewUpgradeError(6, types.ErrInvalidUpgradeSequence), // max sequence + 1 will be returned + types.NewUpgradeError(5, types.ErrInvalidUpgradeSequence), // channel sequence - 1 will be returned }, } @@ -307,7 +307,6 @@ func (suite *KeeperTestSuite) TestChanUpgradeTry() { suite.Require().Equal(latestSequenceSend-1, upgrade.LatestSequenceSend) } else { suite.assertUpgradeError(err, tc.expError) - suite.Require().Empty(upgrade) } }) } @@ -1101,79 +1100,79 @@ func (suite *KeeperTestSuite) TestWriteChannelUpgradeAck() { // }) // } // } - -func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { - suite.SetupTest() - - path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.Setup(path) - - path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion - path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion - - suite.Require().NoError(path.EndpointA.ChanUpgradeInit()) - - // cause the upgrade to fail on chain b so an error receipt is written. - suite.chainB.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func( - ctx sdk.Context, portID, channelID string, order types.Order, connectionHops []string, counterpartyVersion string, - ) (string, error) { - return "", fmt.Errorf("mock app callback failed") - } - - err := path.EndpointB.ChanUpgradeTry() - suite.Require().NoError(err) - - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - errorReceipt, ok := suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - suite.Require().True(ok) - - ctx := suite.chainA.GetContext() - suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.WriteUpgradeCancelChannel(ctx, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, errorReceipt.Sequence) - - channel := path.EndpointA.GetChannel() - - // Verify that channel has been restored to previous state - suite.Require().Equal(types.OPEN, channel.State) - suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) - suite.Require().Equal(mock.Version, channel.Version) - suite.Require().Equal(errorReceipt.Sequence, channel.UpgradeSequence) - - // Assert that state stored for upgrade has been deleted - upgrade, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - suite.Require().Equal(types.Upgrade{}, upgrade) - suite.Require().False(found) - - lastPacketSequence, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetCounterpartyLastPacketSequence(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - - // we need to find the event values from the proposed upgrade as the actual upgrade has been deleted. - proposedUpgrade := path.EndpointA.GetProposedUpgrade() - events := ctx.EventManager().Events().ToABCIEvents() - expEvents := ibctesting.EventsMap{ - types.EventTypeChannelUpgradeCancel: { - types.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, - types.AttributeKeyChannelID: path.EndpointA.ChannelID, - types.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, - types.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, - types.AttributeKeyUpgradeConnectionHops: proposedUpgrade.Fields.ConnectionHops[0], - types.AttributeKeyUpgradeVersion: proposedUpgrade.Fields.Version, - types.AttributeKeyUpgradeOrdering: proposedUpgrade.Fields.Ordering.String(), - types.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), - }, - sdk.EventTypeMessage: { - sdk.AttributeKeyModule: types.AttributeValueCategory, - }, - } - - suite.Require().Equal(uint64(0), lastPacketSequence) - suite.Require().False(found) - ibctesting.AssertEvents(&suite.Suite, expEvents, events) - - counterpartyUpgrade, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetCounterpartyUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - suite.Require().Equal(types.Upgrade{}, counterpartyUpgrade) - suite.Require().False(found) -} +// +//func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { +// suite.SetupTest() +// +// path := ibctesting.NewPath(suite.chainA, suite.chainB) +// suite.coordinator.Setup(path) +// +// path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion +// path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion +// +// suite.Require().NoError(path.EndpointA.ChanUpgradeInit()) +// +// // cause the upgrade to fail on chain b so an error receipt is written. +// suite.chainB.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func( +// ctx sdk.Context, portID, channelID string, order types.Order, connectionHops []string, counterpartyVersion string, +// ) (string, error) { +// return "", fmt.Errorf("mock app callback failed") +// } +// +// err := path.EndpointB.ChanUpgradeTry() +// suite.Require().NoError(err) +// +// err = path.EndpointA.UpdateClient() +// suite.Require().NoError(err) +// +// errorReceipt, ok := suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) +// suite.Require().True(ok) +// +// ctx := suite.chainA.GetContext() +// suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.WriteUpgradeCancelChannel(ctx, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, errorReceipt.Sequence) +// +// channel := path.EndpointA.GetChannel() +// +// // Verify that channel has been restored to previous state +// suite.Require().Equal(types.OPEN, channel.State) +// suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) +// suite.Require().Equal(mock.Version, channel.Version) +// suite.Require().Equal(errorReceipt.Sequence, channel.UpgradeSequence) +// +// // Assert that state stored for upgrade has been deleted +// upgrade, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) +// suite.Require().Equal(types.Upgrade{}, upgrade) +// suite.Require().False(found) +// +// lastPacketSequence, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetCounterpartyLastPacketSequence(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) +// +// // we need to find the event values from the proposed upgrade as the actual upgrade has been deleted. +// proposedUpgrade := path.EndpointA.GetProposedUpgrade() +// events := ctx.EventManager().Events().ToABCIEvents() +// expEvents := ibctesting.EventsMap{ +// types.EventTypeChannelUpgradeCancel: { +// types.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID, +// types.AttributeKeyChannelID: path.EndpointA.ChannelID, +// types.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID, +// types.AttributeCounterpartyChannelID: path.EndpointB.ChannelID, +// types.AttributeKeyUpgradeConnectionHops: proposedUpgrade.Fields.ConnectionHops[0], +// types.AttributeKeyUpgradeVersion: proposedUpgrade.Fields.Version, +// types.AttributeKeyUpgradeOrdering: proposedUpgrade.Fields.Ordering.String(), +// types.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence), +// }, +// sdk.EventTypeMessage: { +// sdk.AttributeKeyModule: types.AttributeValueCategory, +// }, +// } +// +// suite.Require().Equal(uint64(0), lastPacketSequence) +// suite.Require().False(found) +// ibctesting.AssertEvents(&suite.Suite, expEvents, events) +// +// counterpartyUpgrade, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetCounterpartyUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) +// suite.Require().Equal(types.Upgrade{}, counterpartyUpgrade) +// suite.Require().False(found) +//} // func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { // var ( diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 9baa44f7dea..096b021cab3 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -764,8 +764,7 @@ func (k Keeper) ChannelUpgradeTry(goCtx context.Context, msg *channeltypes.MsgCh if err != nil { ctx.Logger().Error("channel upgrade try failed", "error", errorsmod.Wrap(err, "channel upgrade try failed")) if channeltypes.IsUpgradeError(err) { - k.ChannelKeeper.MustAbortUpgrade(ctx, msg.PortId, msg.ChannelId, err) - cbs.OnChanUpgradeRestore(ctx, msg.PortId, msg.ChannelId) + _ = k.ChannelKeeper.WriteErrorReceipt(ctx, msg.PortId, msg.ChannelId, upgrade.Fields, err.(*channeltypes.UpgradeError)) // NOTE: a FAILURE result is returned to the client and an error receipt is written to state. // This signals to the relayer to begin the cancel upgrade handshake subprotocol. @@ -776,16 +775,11 @@ func (k Keeper) ChannelUpgradeTry(goCtx context.Context, msg *channeltypes.MsgCh return nil, errorsmod.Wrap(err, "channel upgrade try failed") } - cacheCtx, writeFn := ctx.CacheContext() - upgradeVersion, err := cbs.OnChanUpgradeTry(cacheCtx, msg.PortId, msg.ChannelId, upgrade.Fields.Ordering, upgrade.Fields.ConnectionHops, upgrade.Fields.Version) + upgradeVersion, err := cbs.OnChanUpgradeTry(ctx, msg.PortId, msg.ChannelId, upgrade.Fields.Ordering, upgrade.Fields.ConnectionHops, upgrade.Fields.Version) if err != nil { ctx.Logger().Error("channel upgrade try callback failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", err.Error()) - k.ChannelKeeper.MustAbortUpgrade(ctx, msg.PortId, msg.ChannelId, err) - cbs.OnChanUpgradeRestore(ctx, msg.PortId, msg.ChannelId) - - return &channeltypes.MsgChannelUpgradeTryResponse{Result: channeltypes.FAILURE}, nil + return nil, err } - writeFn() channel, upgrade := k.ChannelKeeper.WriteUpgradeTryChannel(ctx, msg.PortId, msg.ChannelId, upgrade, upgradeVersion, upgrade.LatestSequenceSend) diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index c0a425a5dbc..22f4759104b 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -832,34 +832,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { errorReceipt, found := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) suite.Require().True(found) - suite.Require().Equal(uint64(100), errorReceipt.Sequence) - }, - }, - { - "application callback error writes upgrade error receipt", - func() { - suite.chainB.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func( - ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string, - ) (string, error) { - // set arbitrary value in store to mock application state changes - store := ctx.KVStore(suite.chainB.GetSimApp().GetKey(exported.ModuleName)) - store.Set([]byte("foo"), []byte("bar")) - return "", fmt.Errorf("mock app callback failed") - } - }, - func(res *channeltypes.MsgChannelUpgradeTryResponse, err error) { - suite.Require().NoError(err) - - suite.Require().NotNil(res) - suite.Require().Equal(channeltypes.FAILURE, res.Result) - - errorReceipt, found := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - suite.Require().True(found) - suite.Require().Equal(uint64(1), errorReceipt.Sequence) - - // assert application state changes are not committed - store := suite.chainB.GetContext().KVStore(suite.chainB.GetSimApp().GetKey(exported.ModuleName)) - suite.Require().False(store.Has([]byte("foo"))) + suite.Require().Equal(uint64(99), errorReceipt.Sequence) }, }, } @@ -1226,13 +1199,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // }, // expErr: channeltypes.ErrInvalidUpgradeSequence, // }, - { - name: "capability not found", - malleate: func() { - msg.ChannelId = ibctesting.InvalidID - }, - expErr: capabilitytypes.ErrCapabilityNotFound, - }, + //{ + // name: "capability not found", + // malleate: func() { + // msg.ChannelId = ibctesting.InvalidID + // }, + // expErr: capabilitytypes.ErrCapabilityNotFound, + //}, } for _, tc := range cases { From bf8f276ed598b978092234151cf4fe4c3d814f44 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 16 Aug 2023 16:10:35 +0100 Subject: [PATCH 2/7] chore: fix linter --- modules/apps/29-fee/ibc_middleware_test.go | 74 +++++++++---------- modules/core/04-channel/keeper/upgrade.go | 2 - .../core/04-channel/keeper/upgrade_test.go | 4 +- modules/core/keeper/msg_server_test.go | 4 +- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 9336ef6965c..fe59b6bf291 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -328,35 +328,35 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( + ctx sdk.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, false, }, { "RefundFeesOnChannelClosure continues - invalid refund address", func() { - // store the fee in state & update escrow account balance - packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) - packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) + // store the fee in state & update escrow account balance + packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) + packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) - suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) - err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) - suite.Require().NoError(err) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) + err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) + suite.Require().NoError(err) + }, true, }, { "fee module locked", func() { - lockFeeModule(suite.chainA) - }, + lockFeeModule(suite.chainA) + }, false, }, { "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, true, }, } @@ -417,35 +417,35 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( + ctx sdk.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, false, }, { "RefundChannelFeesOnClosure continues - refund address is invalid", func() { - // store the fee in state & update escrow account balance - packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) - packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) + // store the fee in state & update escrow account balance + packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) + packetFees := types.NewPacketFees([]types.PacketFee{types.NewPacketFee(fee, "invalid refund address", nil)}) - suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) - err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) - suite.Require().NoError(err) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, packetFees) + err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) + suite.Require().NoError(err) + }, true, }, { "fee module locked", func() { - lockFeeModule(suite.chainA) - }, + lockFeeModule(suite.chainA) + }, false, }, { "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - }, + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, true, }, } @@ -1120,8 +1120,8 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { }) } } -// -//func (suite *FeeTestSuite) TestOnChanUpgradeTry() { + +// func (suite *FeeTestSuite) TestOnChanUpgradeTry() { // var ( // expFeeEnabled bool // path *ibctesting.Path @@ -1245,7 +1245,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { // } // }) // } -//} +// } // TODO: Revisit these testcases when core refactor is completed // func (suite *FeeTestSuite) TestOnChanUpgradeAck() { diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index e99080fa9b9..d6b93f12f55 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -158,8 +158,6 @@ func (k Keeper) ChanUpgradeTry( ); err != nil { return types.Upgrade{}, errorsmod.Wrap(err, "failed to verify counterparty channel state") } - - if counterpartyUpgradeSequence < channel.UpgradeSequence { return upgrade, types.NewUpgradeError(channel.UpgradeSequence-1, errorsmod.Wrapf( types.ErrInvalidUpgradeSequence, "counterparty upgrade sequence < current upgrade sequence (%d < %d)", counterpartyUpgradeSequence, channel.UpgradeSequence, diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index 9c015cf2ff3..c3112ca7554 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -1101,7 +1101,7 @@ func (suite *KeeperTestSuite) TestWriteChannelUpgradeAck() { // } // } // -//func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { +// func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { // suite.SetupTest() // // path := ibctesting.NewPath(suite.chainA, suite.chainB) @@ -1172,7 +1172,7 @@ func (suite *KeeperTestSuite) TestWriteChannelUpgradeAck() { // counterpartyUpgrade, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetCounterpartyUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // suite.Require().Equal(types.Upgrade{}, counterpartyUpgrade) // suite.Require().False(found) -//} +// } // func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { // var ( diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 22f4759104b..54ac7899e2e 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -1199,13 +1199,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeCancel() { // }, // expErr: channeltypes.ErrInvalidUpgradeSequence, // }, - //{ + // { // name: "capability not found", // malleate: func() { // msg.ChannelId = ibctesting.InvalidID // }, // expErr: capabilitytypes.ErrCapabilityNotFound, - //}, + // }, } for _, tc := range cases { From 729d0d60c3f7e4949ee52321614413c4dcee17fa Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 16 Aug 2023 19:05:47 +0200 Subject: [PATCH 3/7] refactor: remove channel flush status from ack msg and handler --- modules/core/04-channel/keeper/upgrade.go | 12 +- .../core/04-channel/keeper/upgrade_test.go | 16 +- modules/core/04-channel/types/msgs.go | 17 +- modules/core/04-channel/types/msgs_test.go | 3 +- modules/core/04-channel/types/tx.pb.go | 288 ++++++++---------- modules/core/keeper/msg_server.go | 4 +- modules/core/keeper/msg_server_test.go | 25 +- proto/ibc/core/channel/v1/tx.proto | 17 +- testing/endpoint.go | 1 - 9 files changed, 165 insertions(+), 218 deletions(-) diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index d6b93f12f55..f9e5dc1cb59 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -195,11 +195,6 @@ func (k Keeper) WriteUpgradeTryChannel(ctx sdk.Context, portID, channelID string previousState := channel.State channel.State = types.TRYUPGRADE - channel.FlushStatus = types.FLUSHING - - if !k.HasInflightPackets(ctx, portID, channelID) { - channel.FlushStatus = types.FLUSHCOMPLETE - } upgrade.Fields.Version = upgradeVersion @@ -221,7 +216,6 @@ func (k Keeper) ChanUpgradeAck( ctx sdk.Context, portID, channelID string, - counterpartyFlushStatus types.FlushStatus, counterpartyUpgrade types.Upgrade, proofChannel, proofUpgrade []byte, @@ -236,10 +230,6 @@ func (k Keeper) ChanUpgradeAck( return errorsmod.Wrapf(types.ErrInvalidChannelState, "expected one of [%s, %s], got %s", types.OPEN, types.STATE_FLUSHING, channel.State) } - if !collections.Contains(counterpartyFlushStatus, []types.FlushStatus{types.FLUSHING, types.FLUSHCOMPLETE}) { - return errorsmod.Wrapf(types.ErrInvalidFlushStatus, "expected one of [%s, %s], got %s", types.FLUSHING, types.FLUSHCOMPLETE, counterpartyFlushStatus) - } - connection, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) if !found { return errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0]) @@ -257,7 +247,7 @@ func (k Keeper) ChanUpgradeAck( Counterparty: types.NewCounterparty(portID, channelID), Version: channel.Version, UpgradeSequence: channel.UpgradeSequence, - FlushStatus: counterpartyFlushStatus, // provided by the relayer + FlushStatus: types.NOTINFLUSH, // TODO: remove flush status from channel end } // verify the counterparty channel state containing the upgrade sequence diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index c3112ca7554..a011b5f6e84 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -406,9 +406,8 @@ func (suite *KeeperTestSuite) TestWriteUpgradeTry() { func (suite *KeeperTestSuite) TestChanUpgradeAck() { var ( - path *ibctesting.Path - counterpartyFlushStatus types.FlushStatus - counterpartyUpgrade types.Upgrade + path *ibctesting.Path + counterpartyUpgrade types.Upgrade ) testCases := []struct { @@ -455,13 +454,6 @@ func (suite *KeeperTestSuite) TestChanUpgradeAck() { }, types.ErrInvalidChannelState, }, - { - "counterparty flush status is not in FLUSHING or FLUSHCOMPLETE", - func() { - counterpartyFlushStatus = types.NOTINFLUSH - }, - types.ErrInvalidFlushStatus, - }, { "connection not found", func() { @@ -573,8 +565,6 @@ func (suite *KeeperTestSuite) TestChanUpgradeAck() { path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion - counterpartyFlushStatus = types.FLUSHING - err := path.EndpointA.ChanUpgradeInit() suite.Require().NoError(err) @@ -597,7 +587,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeAck() { proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() err = suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeAck( - suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, counterpartyFlushStatus, counterpartyUpgrade, + suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, counterpartyUpgrade, proofChannel, proofUpgrade, proofHeight, ) diff --git a/modules/core/04-channel/types/msgs.go b/modules/core/04-channel/types/msgs.go index 186aac58230..289e6e5c892 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -579,16 +579,15 @@ var _ sdk.Msg = &MsgChannelUpgradeAck{} // NewMsgChannelUpgradeAck constructs a new MsgChannelUpgradeAck // nolint:interfacer -func NewMsgChannelUpgradeAck(portID, channelID string, counterpartyFlushStatus FlushStatus, counterpartyUpgrade Upgrade, proofChannel, proofUpgrade []byte, proofHeight clienttypes.Height, signer string) *MsgChannelUpgradeAck { +func NewMsgChannelUpgradeAck(portID, channelID string, counterpartyUpgrade Upgrade, proofChannel, proofUpgrade []byte, proofHeight clienttypes.Height, signer string) *MsgChannelUpgradeAck { return &MsgChannelUpgradeAck{ - PortId: portID, - ChannelId: channelID, - CounterpartyFlushStatus: counterpartyFlushStatus, - CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, - ProofHeight: proofHeight, - Signer: signer, + PortId: portID, + ChannelId: channelID, + CounterpartyUpgrade: counterpartyUpgrade, + ProofChannel: proofChannel, + ProofUpgrade: proofUpgrade, + ProofHeight: proofHeight, + Signer: signer, } } diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index 4bb6fff6a3e..e91a7b1d7e0 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -656,8 +656,7 @@ func (suite *TypesTestSuite) TestMsgChannelUpgradeAckValidateBasic() { msg = types.NewMsgChannelUpgradeAck( ibctesting.MockPort, ibctesting.FirstChannelID, - types.FLUSHING, upgrade, - suite.proof, suite.proof, + upgrade, suite.proof, suite.proof, height, addr, ) diff --git a/modules/core/04-channel/types/tx.pb.go b/modules/core/04-channel/types/tx.pb.go index b10b1c58562..5dc20feadf9 100644 --- a/modules/core/04-channel/types/tx.pb.go +++ b/modules/core/04-channel/types/tx.pb.go @@ -1045,14 +1045,13 @@ var xxx_messageInfo_MsgChannelUpgradeTryResponse proto.InternalMessageInfo // MsgChannelUpgradeAck defines the request type for the ChannelUpgradeAck rpc type MsgChannelUpgradeAck struct { - PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - CounterpartyFlushStatus FlushStatus `protobuf:"varint,3,opt,name=counterparty_flush_status,json=counterpartyFlushStatus,proto3,enum=ibc.core.channel.v1.FlushStatus" json:"counterparty_flush_status,omitempty"` - CounterpartyUpgrade Upgrade `protobuf:"bytes,4,opt,name=counterparty_upgrade,json=counterpartyUpgrade,proto3" json:"counterparty_upgrade"` - ProofChannel []byte `protobuf:"bytes,5,opt,name=proof_channel,json=proofChannel,proto3" json:"proof_channel,omitempty"` - ProofUpgrade []byte `protobuf:"bytes,6,opt,name=proof_upgrade,json=proofUpgrade,proto3" json:"proof_upgrade,omitempty"` - ProofHeight types.Height `protobuf:"bytes,7,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` - Signer string `protobuf:"bytes,8,opt,name=signer,proto3" json:"signer,omitempty"` + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + CounterpartyUpgrade Upgrade `protobuf:"bytes,3,opt,name=counterparty_upgrade,json=counterpartyUpgrade,proto3" json:"counterparty_upgrade"` + ProofChannel []byte `protobuf:"bytes,4,opt,name=proof_channel,json=proofChannel,proto3" json:"proof_channel,omitempty"` + ProofUpgrade []byte `protobuf:"bytes,5,opt,name=proof_upgrade,json=proofUpgrade,proto3" json:"proof_upgrade,omitempty"` + ProofHeight types.Height `protobuf:"bytes,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgChannelUpgradeAck) Reset() { *m = MsgChannelUpgradeAck{} } @@ -1493,121 +1492,119 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) } var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ - // 1815 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcf, 0x6f, 0xdb, 0x46, - 0x16, 0x36, 0x25, 0x59, 0xb2, 0x9f, 0x9d, 0xc8, 0xa6, 0x9c, 0x58, 0xa1, 0x6d, 0x59, 0xf1, 0x02, - 0x89, 0xe3, 0x8d, 0xa5, 0xd8, 0x49, 0x76, 0x91, 0x20, 0xc0, 0xae, 0xad, 0x95, 0x37, 0x06, 0xe2, - 0xd8, 0xa0, 0xec, 0xfd, 0x91, 0x04, 0x15, 0x64, 0x6a, 0x2c, 0x11, 0x92, 0x48, 0x86, 0xa4, 0x94, - 0xb8, 0x40, 0x81, 0x22, 0xa7, 0x20, 0x87, 0xa2, 0x87, 0x5e, 0x03, 0x14, 0xe8, 0xb9, 0x40, 0x4e, - 0x3d, 0x34, 0xed, 0xa1, 0x87, 0x02, 0x39, 0xe6, 0x18, 0x14, 0x68, 0x50, 0xc4, 0x87, 0x9c, 0xfa, - 0x27, 0x14, 0x28, 0x38, 0x1c, 0x52, 0xa4, 0x34, 0x94, 0x28, 0x4b, 0x49, 0x73, 0xe8, 0x8d, 0x9c, - 0xf9, 0xe6, 0xbd, 0x79, 0xdf, 0xf7, 0xde, 0x70, 0x66, 0x24, 0x98, 0x15, 0xf7, 0x85, 0xb4, 0x20, - 0xab, 0x28, 0x2d, 0x94, 0x0b, 0x92, 0x84, 0xaa, 0xe9, 0xc6, 0x4a, 0x5a, 0x7f, 0x98, 0x52, 0x54, - 0x59, 0x97, 0xd9, 0x98, 0xb8, 0x2f, 0xa4, 0x8c, 0xde, 0x14, 0xe9, 0x4d, 0x35, 0x56, 0xb8, 0xa9, - 0x92, 0x5c, 0x92, 0x71, 0x7f, 0xda, 0x78, 0x32, 0xa1, 0xdc, 0xb4, 0x20, 0x6b, 0x35, 0x59, 0x4b, - 0xd7, 0xb4, 0x92, 0x61, 0xa2, 0xa6, 0x95, 0x48, 0xc7, 0x7c, 0xd3, 0x43, 0x55, 0x44, 0x92, 0x6e, - 0xf4, 0x9a, 0x4f, 0x04, 0x70, 0x96, 0x36, 0x05, 0xcb, 0x5f, 0x07, 0x48, 0x5d, 0x29, 0xa9, 0x85, - 0x22, 0x32, 0x21, 0x0b, 0x5f, 0x30, 0xc0, 0x6e, 0x69, 0xa5, 0x8c, 0xd9, 0xbf, 0xad, 0x20, 0x69, - 0x53, 0x12, 0x75, 0x76, 0x1a, 0x22, 0x8a, 0xac, 0xea, 0x79, 0xb1, 0x18, 0x67, 0x92, 0xcc, 0xe2, - 0x28, 0x1f, 0x36, 0x5e, 0x37, 0x8b, 0xec, 0x0d, 0x88, 0x10, 0x5b, 0xf1, 0x40, 0x92, 0x59, 0x1c, - 0x5b, 0x9d, 0x4d, 0x51, 0x82, 0x4d, 0x11, 0x7b, 0xeb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, 0xbe, 0x7d, 0xb6, 0xc4, 0xac, 0xe7, - 0x5e, 0xbc, 0x49, 0x30, 0x2f, 0xdf, 0x24, 0x98, 0x5f, 0xde, 0x24, 0x98, 0xcf, 0x8f, 0x12, 0x43, - 0x2f, 0x8f, 0x12, 0x43, 0xaf, 0x8e, 0x12, 0x43, 0x77, 0xae, 0x95, 0x44, 0xbd, 0x5c, 0xdf, 0x4f, - 0x09, 0x72, 0x2d, 0x4d, 0xfe, 0x0f, 0x23, 0xee, 0x0b, 0xcb, 0x25, 0x39, 0xdd, 0xf8, 0x7b, 0xba, - 0x26, 0x17, 0xeb, 0x55, 0xa4, 0x99, 0xff, 0x63, 0xb9, 0x74, 0x65, 0xd9, 0xfa, 0x2b, 0x8b, 0x7e, - 0xa8, 0x20, 0x6d, 0x3f, 0x8c, 0xff, 0xc6, 0x72, 0xf9, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, - 0x94, 0xa5, 0x6b, 0x91, 0x23, 0x00, 0x00, + // 1785 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcf, 0x6f, 0x13, 0x47, + 0x14, 0xce, 0xda, 0x8e, 0x9d, 0xbc, 0x04, 0x9c, 0xac, 0x03, 0x31, 0x9b, 0xc4, 0x31, 0xa9, 0x04, + 0x21, 0x25, 0x36, 0x09, 0xd0, 0x0a, 0x84, 0xd4, 0x26, 0xae, 0x29, 0x91, 0x08, 0x89, 0xd6, 0x49, + 0x7f, 0x40, 0x55, 0xcb, 0x59, 0x0f, 0xf6, 0xca, 0xf6, 0xee, 0xb2, 0xbb, 0x36, 0xa4, 0x52, 0xa5, + 0x8a, 0x13, 0xe2, 0x50, 0xf5, 0xd0, 0x2b, 0x52, 0xa5, 0x9e, 0x2b, 0x71, 0xea, 0xa1, 0x3f, 0x0e, + 0x3d, 0x54, 0xe2, 0xc8, 0x11, 0x55, 0x02, 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b, 0x25, 0x51, 0x2f, + 0xd7, 0xf7, 0x52, 0x82, 0x5c, 0x4b, 0x93, 0x7f, 0xac, 0x88, 0x7b, 0xc2, 0x72, 0x49, 0x4e, 0x37, + 0xde, 0x4f, 0xd7, 0xe4, 0x62, 0xbd, 0x8a, 0x34, 0xf3, 0x9f, 0x26, 0xe7, 0x2e, 0x2c, 0x5b, 0x7f, + 0x36, 0xd1, 0xf7, 0x15, 0xa4, 0xed, 0x85, 0xf1, 0x1f, 0x4d, 0xce, 0xff, 0x17, 0x00, 0x00, 0xff, + 0xff, 0xd3, 0x2d, 0x23, 0x23, 0x33, 0x23, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3464,7 +3461,7 @@ func (m *MsgChannelUpgradeAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } { size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) @@ -3475,20 +3472,20 @@ func (m *MsgChannelUpgradeAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 if len(m.ProofUpgrade) > 0 { i -= len(m.ProofUpgrade) copy(dAtA[i:], m.ProofUpgrade) i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUpgrade))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.ProofChannel) > 0 { i -= len(m.ProofChannel) copy(dAtA[i:], m.ProofChannel) i = encodeVarintTx(dAtA, i, uint64(len(m.ProofChannel))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } { size, err := m.CounterpartyUpgrade.MarshalToSizedBuffer(dAtA[:i]) @@ -3499,12 +3496,7 @@ func (m *MsgChannelUpgradeAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - if m.CounterpartyFlushStatus != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.CounterpartyFlushStatus)) - i-- - dAtA[i] = 0x18 - } + dAtA[i] = 0x1a if len(m.ChannelId) > 0 { i -= len(m.ChannelId) copy(dAtA[i:], m.ChannelId) @@ -4469,9 +4461,6 @@ func (m *MsgChannelUpgradeAck) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.CounterpartyFlushStatus != 0 { - n += 1 + sovTx(uint64(m.CounterpartyFlushStatus)) - } l = m.CounterpartyUpgrade.Size() n += 1 + l + sovTx(uint64(l)) l = len(m.ProofChannel) @@ -8386,25 +8375,6 @@ func (m *MsgChannelUpgradeAck) Unmarshal(dAtA []byte) error { m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyFlushStatus", wireType) - } - m.CounterpartyFlushStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CounterpartyFlushStatus |= FlushStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyUpgrade", wireType) } @@ -8437,7 +8407,7 @@ func (m *MsgChannelUpgradeAck) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProofChannel", wireType) } @@ -8471,7 +8441,7 @@ func (m *MsgChannelUpgradeAck) Unmarshal(dAtA []byte) error { m.ProofChannel = []byte{} } iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProofUpgrade", wireType) } @@ -8505,7 +8475,7 @@ func (m *MsgChannelUpgradeAck) Unmarshal(dAtA []byte) error { m.ProofUpgrade = []byte{} } iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) } @@ -8538,7 +8508,7 @@ func (m *MsgChannelUpgradeAck) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 096b021cab3..e94eadd7ef4 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -809,7 +809,7 @@ func (k Keeper) ChannelUpgradeAck(goCtx context.Context, msg *channeltypes.MsgCh return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } - err = k.ChannelKeeper.ChanUpgradeAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyFlushStatus, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) + err = k.ChannelKeeper.ChanUpgradeAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) if err != nil { ctx.Logger().Error("channel upgrade ack failed", "error", errorsmod.Wrap(err, "channel upgrade ack failed")) if channeltypes.IsUpgradeError(err) { @@ -843,7 +843,7 @@ func (k Keeper) ChannelUpgradeAck(goCtx context.Context, msg *channeltypes.MsgCh // Move channel to OPEN state if both chains have finished flushing any in-flight packets. Counterparty flush status // has been verified in ChanUpgradeAck. - if msg.CounterpartyFlushStatus == channeltypes.FLUSHCOMPLETE && !k.ChannelKeeper.HasInflightPackets(ctx, msg.PortId, msg.ChannelId) { + if !k.ChannelKeeper.HasInflightPackets(ctx, msg.PortId, msg.ChannelId) { cbs.OnChanUpgradeOpen(ctx, msg.PortId, msg.ChannelId) k.ChannelKeeper.WriteUpgradeOpenChannel(ctx, msg.PortId, msg.ChannelId) diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 54ac7899e2e..4e5427713a4 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -943,13 +943,16 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { { "core handler returns error and no upgrade error receipt is written", func() { - // force an error by overriding the counterparty flush status to an invalid value - msg.CounterpartyFlushStatus = channeltypes.NOTINFLUSH + // force an error by overriding the channel state to an invalid value + channel := path.EndpointA.GetChannel() + channel.State = channeltypes.CLOSED + + path.EndpointA.SetChannel(channel) }, func(res *channeltypes.MsgChannelUpgradeAckResponse, err error) { suite.Require().Error(err) suite.Require().Nil(res) - suite.Require().ErrorIs(err, channeltypes.ErrInvalidFlushStatus) + suite.Require().ErrorIs(err, channeltypes.ErrInvalidChannelState) errorReceipt, found := suite.chainA.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) suite.Require().Empty(errorReceipt) @@ -1026,20 +1029,18 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { err = path.EndpointA.UpdateClient() suite.Require().NoError(err) - counterpartyChannel := path.EndpointB.GetChannel() counterpartyUpgrade := path.EndpointB.GetChannelUpgrade() proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() msg = &channeltypes.MsgChannelUpgradeAck{ - PortId: path.EndpointA.ChannelConfig.PortID, - ChannelId: path.EndpointA.ChannelID, - CounterpartyFlushStatus: counterpartyChannel.FlushStatus, - CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, - ProofHeight: proofHeight, - Signer: suite.chainA.SenderAccount.GetAddress().String(), + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + CounterpartyUpgrade: counterpartyUpgrade, + ProofChannel: proofChannel, + ProofUpgrade: proofUpgrade, + ProofHeight: proofHeight, + Signer: suite.chainA.SenderAccount.GetAddress().String(), } tc.malleate() diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index 42b1e83899f..1e413dc8719 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -330,15 +330,14 @@ message MsgChannelUpgradeTryResponse { message MsgChannelUpgradeAck { option (cosmos.msg.v1.signer) = "signer"; - option (gogoproto.goproto_getters) = false; - string port_id = 1; - string channel_id = 2; - FlushStatus counterparty_flush_status = 3; - Upgrade counterparty_upgrade = 4 [(gogoproto.nullable) = false]; - bytes proof_channel = 5; - bytes proof_upgrade = 6; - ibc.core.client.v1.Height proof_height = 7 [(gogoproto.nullable) = false]; - string signer = 8; + option (gogoproto.goproto_getters) = false; + string port_id = 1; + string channel_id = 2; + Upgrade counterparty_upgrade = 3 [(gogoproto.nullable) = false]; + bytes proof_channel = 4; + bytes proof_upgrade = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; } // MsgChannelUpgradeAckResponse defines MsgChannelUpgradeAck response type diff --git a/testing/endpoint.go b/testing/endpoint.go index 92c737d9eb1..70af492ce10 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -643,7 +643,6 @@ func (endpoint *Endpoint) ChanUpgradeAck() error { msg := channeltypes.NewMsgChannelUpgradeAck( endpoint.ChannelConfig.PortID, endpoint.ChannelID, - endpoint.Counterparty.GetChannel().FlushStatus, counterpartyUpgrade, proofChannel, proofUpgrade, From a4803867bca7559968a43d974357a5505abd6693 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 16 Aug 2023 19:30:38 +0200 Subject: [PATCH 4/7] fix: address test acknowledgement failing testcase, replace flush status with channel state assertion --- modules/core/04-channel/keeper/packet.go | 8 +++----- modules/core/04-channel/keeper/packet_test.go | 2 +- modules/core/04-channel/keeper/upgrade_test.go | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index 1d1c39e616e..916026df50e 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -381,11 +381,9 @@ func (k Keeper) AcknowledgePacket( ) } - if channel.State != types.OPEN && channel.FlushStatus != types.FLUSHING { - return errorsmod.Wrapf( - types.ErrInvalidChannelState, - "packets cannot be acknowledged on channel with state (%s) and flush status (%s)", channel.State, channel.FlushStatus, - ) + // TODO(damian): update TRYUPGRADE to FLUSHING following https://github.com/cosmos/ibc-go/issues/4243 + if !collections.Contains(channel.State, []types.State{types.OPEN, types.TRYUPGRADE}) { + return errorsmod.Wrapf(types.ErrInvalidChannelState, "packets cannot be acknowledged on channel with state (%s)", channel.State) } // Authenticate capability to ensure caller has authority to receive packet on this channel diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 20b69744a54..a444cd76f3a 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -773,7 +773,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, - {"success on channel in tryupgrade and flush status in flushing", func() { + {"success on channel in flushing state", func() { // setup uses an UNORDERED channel suite.coordinator.Setup(path) diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index a011b5f6e84..0a8f0df2132 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -396,9 +396,9 @@ func (suite *KeeperTestSuite) TestWriteUpgradeTry() { ibctesting.AssertEvents(&suite.Suite, expEvents, events) if tc.hasPacketCommitments { - suite.Require().Equal(types.FLUSHING, channel.FlushStatus) + suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) } else { - suite.Require().Equal(types.FLUSHCOMPLETE, channel.FlushStatus) + suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) } }) } From fa111f194186347edae362e025c49c331978bf27 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 16 Aug 2023 19:50:02 +0200 Subject: [PATCH 5/7] fix: linter crying --- modules/core/04-channel/keeper/upgrade_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index 0a8f0df2132..167789c82d9 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -397,8 +397,6 @@ func (suite *KeeperTestSuite) TestWriteUpgradeTry() { if tc.hasPacketCommitments { suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) - } else { - suite.Require().Equal(types.NOTINFLUSH, channel.FlushStatus) } }) } From c82beaac475bb19035a50273bcc9db48eba1fd66 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 16 Aug 2023 20:59:19 +0200 Subject: [PATCH 6/7] adding back failure testcase for AcknowledgePacket --- modules/core/04-channel/keeper/packet_test.go | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index a444cd76f3a..0c0e7d1ddf3 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -788,15 +788,11 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - // Move channel to correct state. - path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion - path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion - - err = path.EndpointB.ChanUpgradeInit() - suite.Require().NoError(err) + // TODO(damian): update TRYUPGRADE to FLUSHING following https://github.com/cosmos/ibc-go/issues/4243 + channel := path.EndpointA.GetChannel() + channel.State = types.TRYUPGRADE - err = path.EndpointA.ChanUpgradeTry() - suite.Require().NoError(err) + path.EndpointA.SetChannel(channel) }, true}, {"packet already acknowledged ordered channel (no-op)", func() { expError = types.ErrNoOpMsg @@ -855,31 +851,23 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { suite.Require().NoError(err) channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, - // {"channel in ackupgrade and flush status flush complete", func() { - // expError = types.ErrInvalidChannelState - - // suite.coordinator.Setup(path) - // packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - // channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - - // // Send a packet on B to disallow channel automatically moving to OPEN on UpgradeAck - // sequence, err := path.EndpointB.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) - // suite.Require().Equal(uint64(1), sequence) - // suite.Require().NoError(err) + {"channel in ackupgrade and flush status flush complete", func() { + expError = types.ErrInvalidChannelState - // // Move channel to correct state. - // path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion - // path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion + suite.coordinator.Setup(path) + packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) + channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - // err = path.EndpointA.ChanUpgradeInit() - // suite.Require().NoError(err) + // Send a packet on B to disallow channel automatically moving to OPEN on UpgradeAck + sequence, err := path.EndpointB.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) + suite.Require().Equal(uint64(1), sequence) + suite.Require().NoError(err) - // err = path.EndpointB.ChanUpgradeTry() - // suite.Require().NoError(err) + channel := path.EndpointA.GetChannel() + channel.State = types.STATE_FLUSHCOMPLETE - // err = path.EndpointA.ChanUpgradeAck() - // suite.Require().NoError(err) - // }, false}, + path.EndpointA.SetChannel(channel) + }, false}, {"capability authentication failed ORDERED", func() { expError = types.ErrInvalidChannelCapability From 1c335d11e146ec2494bedb648710e428b0b2648a Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 16 Aug 2023 21:01:41 +0200 Subject: [PATCH 7/7] updating testcase name to be more reflective of channel state --- modules/core/04-channel/keeper/packet_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 0c0e7d1ddf3..f427ab5579e 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -851,7 +851,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { suite.Require().NoError(err) channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, - {"channel in ackupgrade and flush status flush complete", func() { + {"channel in flush complete state", func() { expError = types.ErrInvalidChannelState suite.coordinator.Setup(path)