Skip to content

Commit

Permalink
Amend timeoutPacket to allow timeouts on any channel state. (#4367)
Browse files Browse the repository at this point in the history
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
  • Loading branch information
DimitrisJim and damiannolan authored Aug 24, 2023
1 parent 404da25 commit 9d7ddac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
7 changes: 0 additions & 7 deletions modules/core/04-channel/keeper/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions modules/core/04-channel/keeper/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d7ddac

Please sign in to comment.