Skip to content

Commit

Permalink
test: ensure ics27 optimistic packet sends are disallowed (#842) (#843)
Browse files Browse the repository at this point in the history
(cherry picked from commit c7ea0e8)

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
  • Loading branch information
mergify[bot] and damiannolan authored Feb 3, 2022
1 parent 8306273 commit a59c033
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// absolute timeoutTimestamp must be provided. If the packet is timed out, the channel will be closed.
// In the case of channel closure, a new channel may be reopened to reconnect to the host chain.
func (k Keeper) SendTx(ctx sdk.Context, chanCap *capabilitytypes.Capability, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
activeChannelID, found := k.GetActiveChannelID(ctx, connectionID, portID)
activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID)
if !found {
return 0, sdkerrors.Wrapf(icatypes.ErrActiveChannelNotFound, "failed to retrieve active channel on connection %s for port %s", connectionID, portID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ func (suite *KeeperTestSuite) TestSendTx() {
},
false,
},
{
"channel in INIT state - optimistic packet sends fail",
func() {
channel, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)
suite.Require().True(found)

channel.State = channeltypes.INIT
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)
},
false,
},
{
"sendPacket fails - channel closed",
func() {
Expand Down

0 comments on commit a59c033

Please sign in to comment.