From cbdc846c291d39adb7566676b624970f239ba4dd Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Fri, 23 Jun 2023 11:51:45 +0300 Subject: [PATCH] Address feedback. --- modules/core/04-channel/keeper/packet.go | 2 +- modules/core/04-channel/keeper/packet_test.go | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index feb97e91d3a..47f0ea514b5 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -137,7 +137,7 @@ func (k Keeper) RecvPacket( if channel.State != types.OPEN && (channel.FlushStatus != types.FLUSHING || counterpartyLastPacketSent > packet.GetSequence()) { return errorsmod.Wrapf( types.ErrInvalidChannelState, - "channel state is not OPEN (got %s)", channel.State.String(), + "packets cannot be received on channel with state (%s) and flush status (%s)", channel.State, channel.FlushStatus, ) } diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 26f6cca48bb..7127298b45b 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -331,8 +331,8 @@ func (suite *KeeperTestSuite) TestRecvPacket() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, true}, { - msg: "success with closed channel: FLUSHING status", - malleate: func() { + "success with channel in ACKUPGRADE: FLUSHING status", + func() { suite.coordinator.Setup(path) sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -340,15 +340,15 @@ func (suite *KeeperTestSuite) TestRecvPacket() { channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) channel := path.EndpointB.GetChannel() - channel.State = types.CLOSED + channel.State = types.ACKUPGRADE channel.FlushStatus = types.FLUSHING path.EndpointB.SetChannel(channel) }, - expPass: true, + true, }, { - msg: "failure with closed channel counterparty sequence > packet sequence", - malleate: func() { + "failure with closed channel counterparty sequence > packet sequence", + func() { suite.coordinator.Setup(path) sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -362,11 +362,11 @@ func (suite *KeeperTestSuite) TestRecvPacket() { suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.SetCounterpartyLastPacketSequence(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sequence+1) }, - expPass: false, + false, }, { - msg: "failure with closed channel not flushing", - malleate: func() { + "failure with closed channel not flushing", + func() { suite.coordinator.Setup(path) sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) @@ -380,7 +380,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.SetCounterpartyLastPacketSequence(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sequence) }, - expPass: false, + false, }, {"packet already relayed ORDERED channel (no-op)", func() { expError = types.ErrNoOpMsg