Skip to content

Commit

Permalink
chore: added test case to verify proof failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton committed Oct 15, 2024
1 parent 61a5227 commit 794ede7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion modules/core/04-channel/v2/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() {
var (
path *ibctesting.Path
packet channeltypesv2.Packet
ack channeltypesv2.Acknowledgement
)
testCases := []struct {
name string
Expand Down Expand Up @@ -380,6 +381,13 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() {
},
expError: channeltypesv2.ErrInvalidPacket,
},
{
name: "failure: failed membership verification",
malleate: func() {
ack.AcknowledgementResults[0].RecvPacketResult.Acknowledgement = mock.MockFailPacketData
},
expError: errors.New("failed packet acknowledgement verification"),
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
Expand All @@ -399,7 +407,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() {
suite.Require().NoError(err)

// Construct expected acknowledgement
ack := channeltypesv2.Acknowledgement{
ack = channeltypesv2.Acknowledgement{
AcknowledgementResults: []channeltypesv2.AcknowledgementResult{
{
AppName: mockv2.ModuleNameB,
Expand Down
2 changes: 1 addition & 1 deletion testing/endpoint_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (endpoint *Endpoint) MsgRecvPacket(packet channeltypesv2.Packet) error {
return endpoint.Counterparty.UpdateClient()
}

// MsgAcknowledgePacket
// MsgAcknowledgePacket sends a MsgAcknowledgement on the associated endpoint with the provided packet and ack.
func (endpoint *Endpoint) MsgAcknowledgePacket(packet channeltypesv2.Packet, ack channeltypesv2.Acknowledgement) error {
packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationChannel, packet.Sequence)
proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey)
Expand Down

0 comments on commit 794ede7

Please sign in to comment.