-
Notifications
You must be signed in to change notification settings - Fork 621
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
Hex Packet Data #144
Hex Packet Data #144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the proposed solution. Applications should hex encode before passing it to core IBC. We should check that the packet data is utf-8 in packet ValidateBasic, if anything
Edit: I changed my opinion, see below
cc relayer teams: @ethanfrey @ancazamfir
|
@colin-axner Why? That doesn't make any sense to me. If I want to protobuf encode my packet data i should just be able to do that. With your proposal, I either shouldn't use protobuf. Or I need to do a secondary encoding to make it utf-8, and then decode twice in my application RecvPacket callback. This doesn't make sense. Packet Data is raw data (marshaled in whatever preference of the app developer), it's not a string. It's up to us as core IBC to make sure that raw data gets to the other end correctly so that it can be unmarshaled as expected by app developer. It's not up to app developer to make their raw data look like a "string" for our convenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it some more thought and this solution sounds good since it only changes how events are emitted.
If applications are using proto to marshal their packet data, then I don't see why other applications won't run into the same issue we are facing here. Is there usefulness in not hex encoding packet data before passing it to core IBC?
can you add a section to the migrations doc? |
This fix makes it such that applications that use proto to marshal won't face this issue at all. Assuming relayers upgrade to use the new attribute. So regardless of the encoding format that applications choose, IBC will work. As I tested, proto-marshalling transfer packet data works seamlessly if you encode/decode with hex. It breaks when you try to just do a raw conversion. Without this fix, we are limiting application choice on encoding without a good reason. Note applications are returning a byte slice, not a string in |
Codecov Report
@@ Coverage Diff @@
## main #144 +/- ##
===========================================
+ Coverage 65.22% 78.86% +13.64%
===========================================
Files 127 109 -18
Lines 8413 6468 -1945
===========================================
- Hits 5487 5101 -386
+ Misses 2561 1008 -1553
+ Partials 365 359 -6
|
Thanks for the quick fix. |
Description
Encoding packet data in hex allows for more robust encoding/decoding for relayers. Proto-encoded packets were breaking with old bare string conversion. Raw binary can be passed through events using hex.
Tested live with go-relayer and two-chainz script
closes: #XXXX
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes