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

Improve error handling and string conversion in IBC crates. #726

Merged
merged 8 commits into from
Jul 5, 2023
Merged

Improve error handling and string conversion in IBC crates. #726

merged 8 commits into from
Jul 5, 2023

Conversation

DaviRain-Su
Copy link
Contributor

@DaviRain-Su DaviRain-Su commented Jun 21, 2023

Closes: #655

Description


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

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage: 77.65% and project coverage change: -0.01 ⚠️

Comparison is base (1c5b50b) 72.33% compared to head (6e6c49b) 72.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #726      +/-   ##
==========================================
- Coverage   72.33%   72.33%   -0.01%     
==========================================
  Files         116      116              
  Lines       15529    15546      +17     
==========================================
+ Hits        11233    11245      +12     
- Misses       4296     4301       +5     
Impacted Files Coverage Δ
...src/core/ics04_channel/events/packet_attributes.rs 10.69% <0.00%> (-0.14%) ⬇️
crates/ibc/src/core/ics23_commitment/error.rs 0.00% <ø> (ø)
crates/ibc/src/serializers.rs 0.00% <0.00%> (ø)
...nts/ics07_tendermint/client_state/update_client.rs 76.47% <40.00%> (-3.05%) ⬇️
crates/ibc/src/mock/header.rs 72.00% <66.66%> (+0.37%) ⬆️
crates/ibc/src/core/timestamp.rs 69.11% <70.00%> (-0.12%) ⬇️
crates/ibc/src/core/ics23_commitment/merkle.rs 3.73% <75.00%> (-4.33%) ⬇️
crates/ibc/src/mock/context.rs 73.83% <79.31%> (-0.07%) ⬇️
...s/ibc/src/clients/ics07_tendermint/client_state.rs 69.86% <100.00%> (-0.15%) ⬇️
crates/ibc/src/clients/ics07_tendermint/header.rs 71.29% <100.00%> (ø)
... and 8 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@plafer plafer 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 PR, this is greatly appreciated! Left a few things to adjust

crates/ibc/src/core/ics02_client/events.rs Outdated Show resolved Hide resolved
crates/ibc/src/core/ics23_commitment/commitment.rs Outdated Show resolved Hide resolved
crates/ibc/src/core/ics23_commitment/commitment.rs Outdated Show resolved Hide resolved
crates/ibc/src/core/timestamp.rs Outdated Show resolved Hide resolved
crates/ibc/src/core/timestamp.rs Outdated Show resolved Hide resolved
crates/ibc/src/core/timestamp.rs Outdated Show resolved Hide resolved
crates/ibc/src/lib.rs Show resolved Hide resolved
crates/ibc/src/lib.rs Outdated Show resolved Hide resolved
@plafer
Copy link
Contributor

plafer commented Jun 22, 2023

Can you also add a changelog entry?

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

🙏

@plafer plafer merged commit 9809939 into cosmos:main Jul 5, 2023
@DaviRain-Su DaviRain-Su deleted the remove-unwrap branch July 6, 2023 02:11
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* Improve error handling and string conversion in IBC crates.

* Refactor crate to disallow usage of unwrap(), add more informative error messages and improve UTF-8 compliance. Update try_from convenience methods to return error messages for incorrect data ranges.

* Refactor client_state.rs: Fix tests to use height.min() in expect.

* Refactor host block retrieval in MockContext struct.

---------

Signed-off-by: Davirain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Deny use of unwrap() throughout the crate
2 participants