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

feat: introduce convenience Status::verify_is_active method #1005

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

mina86
Copy link
Contributor

@mina86 mina86 commented Dec 12, 2023

Similarly to ChannelEnd::verify_not_closed, introduce a convenience
method Status::verify_is_active which checks whether client’s status is
active and returns an error if it isn’t. This simplifies whole bunch
of code locations making them more DRY.


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).

Similarly to ChannelEnd::verify_not_closed, introduce a convenience
method Status::verify_active which checks whether client’s status is
active and returns an error if it isn’t.  This simplifies whole bunch
of code locations making them more DRY.
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 (b1f7a1e) 70.69%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1005   +/-   ##
=======================================
  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.

Thank you @mina86. This is a straightforward PR.
Just a few comments, then we can wrap it up.

ibc-core/ics02-client/types/src/status.rs Outdated Show resolved Hide resolved
ibc-core/ics02-client/types/src/status.rs Show resolved Hide resolved
@Farhad-Shabani Farhad-Shabani added the O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding label Dec 12, 2023
@Farhad-Shabani Farhad-Shabani added this to the v0.49.0 milestone Dec 12, 2023
mina86 and others added 2 commits December 13, 2023 01:25
Co-authored-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
@mina86 mina86 changed the title feat: introduce convenience Status::verify_active method feat: introduce convenience Status::verify_is_active method Dec 13, 2023
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 bc7866f into cosmos:main Dec 13, 2023
13 checks passed
@mina86 mina86 deleted the a branch August 1, 2024 23:37
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
* feat: introduce convenience Status::verify_active method

Similarly to ChannelEnd::verify_not_closed, introduce a convenience
method Status::verify_active which checks whether client’s status is
active and returns an error if it isn’t.  This simplifies whole bunch
of code locations making them more DRY.

* Update .changelog/unreleased/improvements/1005-status-verify-active.md

Co-authored-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>

* review

---------

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Co-authored-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants