Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: implement packet parsing from events in MsgSendPacketWithSender #8012

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

crStiv
Copy link

@crStiv crStiv commented Feb 25, 2025

Implements packet parsing from events in MsgSendPacketWithSender function:

  • Uses existing channeltypesv2.Packet structure
  • Parses packet from EventTypeSendPacket events
  • Adds test coverage for successful and error cases

Closes #7856

var sendResponse channeltypesv2.MsgSendPacketResponse
err = proto.Unmarshal(msgResponse.Value, &sendResponse)
if err != nil {
return channeltypesv2.Packet{}, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be implemented as a function as is specified in the original issue: #7856

clientv2types "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"
channeltypesv2 "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"
hostv2 "github.com/cosmos/ibc-go/v10/modules/core/24-host/v2"
)

// ParsePacketFromEventsV2 parses a packet from events using the encoded packet hex attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at testing/events.go. There is a ParsePacketFromEvents there. This one should be moved there.

channeltypesv2 "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"
)

func TestParsePacketFromEventsV2(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check the tests we have for the previous version of this in testing/events_test.go and make sure we cover the same scenarios. Right off the bat, I see you are not testing what will happen if there are multiple packets in the events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parse packet from events instead of manually constructing in endpoint.MsgSendPacket
2 participants