Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Jun 29, 2023
1 parent 4f4ecf9 commit cbdc846
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}

Expand Down
20 changes: 10 additions & 10 deletions modules/core/04-channel/keeper/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,24 +331,24 @@ 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)
packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp)
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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit cbdc846

Please sign in to comment.