Skip to content

imp: remove order_matches from ChannelEnd impl #1095

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

Merged
merged 9 commits into from
Feb 21, 2024

Conversation

tuantran1702
Copy link

@tuantran1702 tuantran1702 commented Feb 19, 2024

Closes: #394

Description

Remove the order_matches method, refactor the current usage of order_matches to use match statements instead.


PR author checklist:

  • Added changelog entry, using unclog.
  • 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).

@tuantran1702 tuantran1702 marked this pull request as ready for review February 19, 2024 12:17
@tuantran1702
Copy link
Author

Hi @Farhad-Shabani, please take a look at this PR. Thank you.

@tuantran1702 tuantran1702 requested a review from rnbguy February 19, 2024 15:06
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Thanks @tropicaldog for the PR 🙏

Last nit before I approve the PR !

Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Awesome ! Thanks ✨

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: 41 lines in your changes are missing coverage. Please review.

Comparison is base (49e66de) 66.58% compared to head (15a215b) 66.53%.

Files Patch % Lines
...core/ics04-channel/src/handler/timeout_on_close.rs 36.36% 21 Missing ⚠️
ibc-core/ics04-channel/src/handler/recv_packet.rs 60.71% 11 Missing ⚠️
ibc-core/ics04-channel/src/handler/timeout.rs 72.72% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1095      +/-   ##
==========================================
- Coverage   66.58%   66.53%   -0.06%     
==========================================
  Files         204      204              
  Lines       20519    20532      +13     
==========================================
- Hits        13663    13661       -2     
- Misses       6856     6871      +15     

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

@tuantran1702 tuantran1702 requested a review from rnbguy February 20, 2024 16:11
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.

Thank you @tropicaldog for handling this PR and @rnbguy for the review. Just wanted to make a point:

We consider Order::None as an invalid order type, explicitly disallowing the creation of a channel with this order type. This validation aligns with the check conducted in ibc-go.

Therefore, if our IBC handlers encounter a channel end with an order of None during the retrieval process from a store, it signals a potential manipulation in the storage. In such cases, I believe it should be treated as an error.

@Farhad-Shabani Farhad-Shabani added this to the 0.51.0 milestone Feb 21, 2024
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Thanks @tropicaldog ! Just a nit request. Then we are ready to merge 🙂

tuantran1702 and others added 2 commits February 21, 2024 19:25
additional blank line for consistency

Co-authored-by: Rano | Ranadeep <[email protected]>
Signed-off-by: Tuan Tran <[email protected]>
@rnbguy rnbguy enabled auto-merge (squash) February 21, 2024 13:46
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Nice work, @tropicaldog 🚀

Thanks for the first contribution 💜

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.

Thank you for the fix! 👌🏻

@rnbguy rnbguy merged commit e048e34 into informalsystems:main Feb 21, 2024
@tuantran1702 tuantran1702 deleted the tuan/remove-order-match branch February 24, 2024 14:49
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* replace if-else branch to match statement, remove order_matches helper from ChannelEnd impl

* add unclog

* deprecate instead of delete the method

* update changelog

* Update .changelog/unreleased/improvements/394-remove-order-match.md

Co-authored-by: Rano | Ranadeep <[email protected]>
Signed-off-by: Tuan Tran <[email protected]>

* fix: return err on Order::None

* Update ibc-core/ics04-channel/src/handler/timeout.rs

additional blank line for consistency

Co-authored-by: Rano | Ranadeep <[email protected]>
Signed-off-by: Tuan Tran <[email protected]>

---------

Signed-off-by: Tuan Tran <[email protected]>
Co-authored-by: Rano | Ranadeep <[email protected]>
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.

Remove ChannelEnd::order_matches()
3 participants