-
Notifications
You must be signed in to change notification settings - Fork 326
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
Allow sub-contexts to have different Error
types with functions to inject errors into Self::Error
#2932
Allow sub-contexts to have different Error
types with functions to inject errors into Self::Error
#2932
Conversation
Only remaining fix needed is the same error constraint in BatchContext, which can be fixed in #2816.
✅ Deploy Preview for ibc-rs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Relay::SrcChain: OfaFullChain, | ||
// TODO: do not require the chain error to be the same as relay error. | ||
// this can be fixed in #2816. | ||
Relay::SrcChain: OfaFullChain<Error = Relay::Error>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
fn runtime(&self) -> &Self::Runtime; | ||
|
||
fn runtime_error(e: <Self::Runtime as HasErrorType>::Error) -> Self::Error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally wanted HasRuntime
to has InjectError<<Self::Runtime as HasError>::Error>
as the supertrait. But I realized that it would require the implementor to have a generic implementation of InjectError
, which is not allowed by Rust due to overlapping implementations.
So instead we would have explicit conversion methods for the sub-error types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems great! Just curious about your opinion on the implementation of From
} | ||
} | ||
|
||
#[async_trait] | ||
impl<Error> OfaRuntime for TokioRuntimeContext<Error> | ||
where | ||
Error: From<TokioError> + Debug + Async, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the constraint From<TokioError>
is removed, should the implementation, https://github.com/informalsystems/hermes/blob/soares/explicit-error-injection/crates/relayer-cosmos/src/base/error.rs#L59, be kept or not ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it can be removed if there is no compile error. Thanks for pointing out!
Closes: #2844
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.