From 9d7ddacbeac2beb53bb6a51bc085a0c4117b7036 Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Thu, 24 Aug 2023 18:52:27 +0300 Subject: [PATCH] Amend timeoutPacket to allow timeouts on any channel state. (#4367) Co-authored-by: Damian Nolan --- modules/core/04-channel/keeper/timeout.go | 7 ------- modules/core/04-channel/keeper/timeout_test.go | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index d3c251dba2e..ebc2c9e8044 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -84,13 +84,6 @@ func (k Keeper) TimeoutPacket( return types.ErrNoOpMsg } - if channel.State != types.OPEN { - return errorsmod.Wrapf( - types.ErrInvalidChannelState, - "channel state is not OPEN (got %s)", channel.State.String(), - ) - } - packetCommitment := types.CommitPacket(k.cdc, packet) // verify we sent the packet and haven't cleared it out yet diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index a69a9882968..4af271bc88e 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -98,22 +98,6 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { suite.coordinator.Setup(path) packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) }, false}, - {"channel not open", func() { - expError = types.ErrInvalidChannelState - suite.coordinator.Setup(path) - - timeoutHeight := path.EndpointA.GetClientState().GetLatestHeight().Increment().(clienttypes.Height) - - sequence, err := path.EndpointA.SendPacket(timeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) - suite.Require().NoError(err) - packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, disabledTimeoutTimestamp) - // need to update chainA's client representing chainB to prove missing ack - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - err = path.EndpointA.SetChannelState(types.CLOSED) - suite.Require().NoError(err) - }, false}, {"packet destination port ≠ channel counterparty port", func() { expError = types.ErrInvalidPacket suite.coordinator.Setup(path)