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

modules: Clean up modules' errors #1334

Merged
merged 4 commits into from
Sep 14, 2021

Conversation

yito88
Copy link
Contributor

@yito88 yito88 commented Sep 8, 2021

Closes: informalsystems/ibc-rs#72
based on #1283

Description

  • Add Ics02Error and Ics03Error to Ics04Error
  • Give the port ID and the channel ID to MissingNext*Seq error
  • Remove redundant errors

For contributor use:

  • Added a changelog entry, using unclog.
  • If applicable: Unit tests written, added test to CI.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments.
  • Re-reviewed Files changed in the Github PR explorer.

@yito88 yito88 changed the title Yuji/cleanup errors Clean up modules' errors Sep 8, 2021
@yito88 yito88 changed the title Clean up modules' errors modules: Clean up modules' errors Sep 8, 2021
modules/src/ics04_channel/error.rs Outdated Show resolved Hide resolved
modules/src/mock/context.rs Outdated Show resolved Hide resolved
modules/src/mock/context.rs Outdated Show resolved Hide resolved
@adizere
Copy link
Member

adizere commented Sep 9, 2021

One more remark @yito88: your contributions are very valuable and we're very thankful! I think you will receive rights (cc @romac) to open branches in this repository, unless you can already do that. In future PRs, could you consider opening merges from a branch in this repo (as opposed to your own fork)? That would slightly improve reviewing experience since it will make it easier for us to switch to your dev branch and read code on own local copy.

Edit: I stand corrected. We'll talk within Informal and there may be org-level restrictions about allowing non-org members to write to our repos. We may need to continue with the same approach as we currently do (i.e., continue opening PRs from the fork). Also, Romain drew my attention to gh which can help alleviate the burden of checking out locally branches from forks.

Copy link
Member

@hu55a1n1 hu55a1n1 left a comment

Choose a reason for hiding this comment

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

Thanks @yito88! Just one more thing - compilation is currently failing for tests. Here's a fix ->

diff --git a/modules/src/ics04_channel/handler/chan_open_try.rs b/modules/src/ics04_channel/handler/chan_open_try.rs
index dd71eb65..5191e0ef 100644
--- a/modules/src/ics04_channel/handler/chan_open_try.rs
+++ b/modules/src/ics04_channel/handler/chan_open_try.rs
@@ -370,12 +370,16 @@ mod tests {
                 msg: ChannelMsg::ChannelOpenTry(msg.clone()),
                 want_pass: false,
                 match_error: Box::new(|e| match e {
-                    error::ErrorDetail::Ics02Client(e) => {
+                    error::ErrorDetail::Ics03Connection(e) => {
                         assert_eq!(
                             e.source,
-                            ics02_error::ErrorDetail::ClientNotFound(
-                                ics02_error::ClientNotFoundSubdetail {
-                                    client_id: ClientId::new(ClientType::Mock, 45).unwrap()
+                            ics03_error::ErrorDetail::Ics02Client(
+                                ics03_error::Ics02ClientSubdetail {
+                                    source: ics02_error::ErrorDetail::ClientNotFound(
+                                        ics02_error::ClientNotFoundSubdetail {
+                                            client_id: ClientId::new(ClientType::Mock, 45).unwrap()
+                                        }
+                                    )
                                 }
                             )
                         );

Once #1283 is merged, it would be great if you could rebase on/merge with master.

@yito88 yito88 force-pushed the yuji/cleanup_errors branch from 024bc17 to ceddb00 Compare September 10, 2021 07:53
@yito88
Copy link
Contributor Author

yito88 commented Sep 10, 2021

Thank you for reviewing and fixing!
I've rebased on master.

Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

Nice idea to consolidate the errors like this. Great work!

error::ErrorDetail::Ics03Connection(e) => {
assert_eq!(
e.source,
ics03_error::ErrorDetail::Ics02Client(
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit of a mouthful, but on the other hand, it's good we can decompose the error here and assert on the precise details. This is just a remark, not a suggestion for any change.

@adizere adizere merged commit 1b51851 into informalsystems:master Sep 14, 2021
@yito88 yito88 deleted the yuji/cleanup_errors branch September 14, 2021 21:19
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* clean up redundant errors

* add a log

* remove ics02_error from ics04_error

* fix a test to check the correct error
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.

3 participants