Skip to content

Commit

Permalink
use endpoint.SendPacket in recv test.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Aug 8, 2024
1 parent 830fcd1 commit 2241c14
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions modules/core/packet-server/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,19 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
path = ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupV2()

packet = channeltypes.NewPacketWithVersion(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ClientID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ClientID, defaultTimeoutHeight, disabledTimeoutTimestamp, "")

// For now, set packet commitment on A for each case and update clients. Use SendPacket after 7048.
suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), packet.SourcePort, packet.SourceChannel, packet.Sequence, channeltypes.CommitPacket(packet))
// send packet
sequence, err := path.EndpointA.SendPacketV2(defaultTimeoutHeight, disabledTimeoutTimestamp, "", ibctesting.MockPacketData)
suite.Require().NoError(err)

suite.coordinator.CommitBlock(path.EndpointA.Chain)
suite.Require().NoError(path.EndpointB.UpdateClient())
packet = channeltypes.NewPacketWithVersion(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ClientID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ClientID, defaultTimeoutHeight, disabledTimeoutTimestamp, "")

tc.malleate()

// get proof of packet commitment from chainA
packetKey := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence())
proof, proofHeight := path.EndpointA.QueryProof(packetKey)

_, err := suite.chainB.App.GetPacketServer().RecvPacket(suite.chainB.GetContext(), nil, packet, proof, proofHeight)
_, err = suite.chainB.App.GetPacketServer().RecvPacket(suite.chainB.GetContext(), nil, packet, proof, proofHeight)

expPass := tc.expError == nil
if expPass {
Expand Down

0 comments on commit 2241c14

Please sign in to comment.