Skip to content

Commit

Permalink
Remove check on flush status for send packet.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Aug 17, 2023
1 parent cd250cb commit 16f1f14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
9 changes: 1 addition & 8 deletions modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ func (k Keeper) SendPacket(
}

if channel.State != types.OPEN {
return 0, errorsmod.Wrapf(
types.ErrInvalidChannelState,
"channel is not OPEN (got %s)", channel.State.String(),
)
}

if channel.FlushStatus != types.NOTINFLUSH {
return 0, errorsmod.Wrapf(types.ErrInvalidFlushStatus, "expected flush status to be %s during packet send, got %s", types.NOTINFLUSH, channel.FlushStatus)
return 0, errorsmod.Wrapf(types.ErrInvalidChannelState, "channel is not OPEN (got %s)", channel.State)
}

if !k.scopedKeeper.AuthenticateCapability(ctx, channelCap, host.ChannelCapabilityPath(sourcePort, sourceChannel)) {
Expand Down
15 changes: 10 additions & 5 deletions modules/core/04-channel/keeper/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/cosmos/ibc-go/v7/testing/mock"
ibcmock "github.com/cosmos/ibc-go/v7/testing/mock"
)

Expand Down Expand Up @@ -224,7 +225,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
sourceChannel = path.EndpointA.ChannelID

channel := path.EndpointA.GetChannel()
channel.FlushStatus = types.FLUSHING
channel.State = types.STATE_FLUSHING
path.EndpointA.SetChannel(channel)
},
false,
Expand All @@ -236,19 +237,23 @@ func (suite *KeeperTestSuite) TestSendPacket() {
sourceChannel = path.EndpointA.ChannelID

channel := path.EndpointA.GetChannel()
channel.FlushStatus = types.FLUSHCOMPLETE
channel.State = types.STATE_FLUSHCOMPLETE
path.EndpointA.SetChannel(channel)
},
false,
},
{
"channel is in INITUPGRADE state",
"channel is in FLUSHING state",
func() {
suite.coordinator.Setup(path)

path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibcmock.UpgradeVersion
path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion
path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion

err := path.EndpointB.ChanUpgradeInit()
suite.Require().NoError(err)

err := path.EndpointA.ChanUpgradeInit()
err = path.EndpointA.ChanUpgradeTry()
suite.Require().NoError(err)
},
false,
Expand Down

0 comments on commit 16f1f14

Please sign in to comment.