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

fix: packet sequence in Timeout handlers should be encoded in big-endian #1004

Merged

Conversation

en
Copy link
Contributor

@en en commented Dec 12, 2023

Description

refer to:
// Note: We expect the return to be a u64 encoded in big-endian. Refer to ibc-go:
// https://github.com/cosmos/ibc-go/blob/25767f6bdb5bab2c2a116b41d92d753c93e18121/modules/core/04-channel/client/utils/utils.go#L191

The seq_on_a of MsgTimeout packet should be encoded as a big-endian bytes.
Here's a code snippet to show this problem.
https://gist.github.com/en/e4f6befdef94b1e906ed0054709ccd4b


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (de2c530) 70.69% compared to head (d7e375d) 70.69%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1004   +/-   ##
=======================================
  Coverage   70.69%   70.69%           
=======================================
  Files         178      178           
  Lines       17919    17870   -49     
=======================================
- Hits        12667    12634   -33     
+ Misses       5252     5236   -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

Nice catch @en! Thanks for this complete report. 👌🏻

Let’s apply the following changes:

  1. This should be fixed here as well for the MsgTimeoutOnClose.

  2. Let’s revise this to_vec method with self.0.to_be_bytes.to_vec() implementation and update it’s docstring, so we can afterwards call it on the msg.packet.seq_on_a

  3. Dress up the PR with a unclog.

Then we are all set!

@Farhad-Shabani Farhad-Shabani added this to the v0.49.0 milestone Dec 12, 2023
@Farhad-Shabani Farhad-Shabani added the A: bug Admin: something isn't working label Dec 12, 2023
@Farhad-Shabani Farhad-Shabani changed the title Fix MsgTimeout verification fix: packet sequence in Timeout handlers should be encoded in big-endian Dec 12, 2023
@en en requested a review from Farhad-Shabani December 16, 2023 04:27
Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

🙏🏻

@Farhad-Shabani Farhad-Shabani merged commit 3894b50 into cosmos:main Dec 16, 2023
13 checks passed
en added a commit to octopus-network/ibc-rs that referenced this pull request Dec 17, 2023
en added a commit to octopus-network/ibc-rs that referenced this pull request Dec 17, 2023
en added a commit to octopus-network/ibc-rs that referenced this pull request Dec 17, 2023
Farhad-Shabani pushed a commit that referenced this pull request Dec 22, 2023
…ian (#1004)

* fix: encode package sequence into big endian bytes

* Fix this issue in `to_vec` method.
Farhad-Shabani added a commit that referenced this pull request Jan 2, 2024
* fix: packet sequence in Timeout handlers should be encoded in big-endian (#1004)

* fix: encode package sequence into big endian bytes

* Fix this issue in `to_vec` method.

* fix: recursive call in connection `State` conversion to `i32` (#1010)

* fix state conversion recursive call

* replace match with casting

Co-authored-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Dhruv D Jain <[email protected]>

* chore: add unclog

* nit

---------

Signed-off-by: Dhruv D Jain <[email protected]>
Co-authored-by: Michal Nazarewicz <[email protected]>
Co-authored-by: Farhad Shabani <[email protected]>

* Release v0.48.2

chore: update changelog + summary

deps: bump versions to v0.48.2

---------

Signed-off-by: Dhruv D Jain <[email protected]>
Co-authored-by: Yuanchao Sun <[email protected]>
Co-authored-by: Dhruv D Jain <[email protected]>
Co-authored-by: Michal Nazarewicz <[email protected]>
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
…ian (#1004)

* fix: encode package sequence into big endian bytes

* Fix this issue in `to_vec` method.
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
* fix: packet sequence in Timeout handlers should be encoded in big-endian (#1004)

* fix: encode package sequence into big endian bytes

* Fix this issue in `to_vec` method.

* fix: recursive call in connection `State` conversion to `i32` (#1010)

* fix state conversion recursive call

* replace match with casting

Co-authored-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Dhruv D Jain <[email protected]>

* chore: add unclog

* nit

---------

Signed-off-by: Dhruv D Jain <[email protected]>
Co-authored-by: Michal Nazarewicz <[email protected]>
Co-authored-by: Farhad Shabani <[email protected]>

* Release v0.48.2

chore: update changelog + summary

deps: bump versions to v0.48.2

---------

Signed-off-by: Dhruv D Jain <[email protected]>
Co-authored-by: Yuanchao Sun <[email protected]>
Co-authored-by: Dhruv D Jain <[email protected]>
Co-authored-by: Michal Nazarewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Admin: something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants