Merged
Conversation
gregorydemay
commented
Mar 4, 2025
| pub struct Client; | ||
|
|
||
| impl Client { | ||
| pub fn new_with_error<CustomError: From<IcError>>( |
Contributor
Author
There was a problem hiding this comment.
The idea is that the service uses the CustomError type, so that any additional layer that may produce errors need to be mapped to the service error type. This forces the user of the library to handle errors explicitly.
| where | ||
| Converter: Convert<NewRequest, Output = Request>, | ||
| S: Service<Request, Error = Error>, | ||
| Converter::Error: Into<Error>, |
Contributor
Author
There was a problem hiding this comment.
We cannot use tower::filter::Predicate because the use of BoxError is hard-coded.
ninegua
reviewed
Mar 5, 2025
Merged
gregorydemay
added a commit
that referenced
this pull request
Mar 11, 2025
gregorydemay
added a commit
to dfinity/canhttp
that referenced
this pull request
Jul 9, 2025
Follow-up on dfinity/evm-rpc-canister#370, dfinity/evm-rpc-canister#364, and dfinity/evm-rpc-canister#374 to add a conversion layer between request and responses to handle [JSON RPC](https://www.jsonrpc.org/specification) over HTTP. Concretely: 1. Refactor existing infrastructure to handle errors explicitly, instead of having to downcast `BoxError`. This is beneficial since errors may happen at different layers and they all need to be handled by the above observability layer, e.g., add the corresponding metric in case the response has a non successful status. 2. Refactor existing infrastructure to transform request and response to use a single `Convert` trait to convert one type into another with some potential error. 3. Add a layer for `http::Request` and `http::Response` to transform their body into a JSON RPC type. This uses the above `Convert` trait. This conversion layer is behind a feature flag (`json`) since it requires `serde_json` to handle the serialization/deserialization 4. Add a new layer to filter out non-successful HTTP responses.
gregorydemay
added a commit
to dfinity/canhttp
that referenced
this pull request
Jul 9, 2025
Follow-up on dfinity/evm-rpc-canister#370, dfinity/evm-rpc-canister#364, dfinity/evm-rpc-canister#374, and dfinity/evm-rpc-canister#375 to automatically retry requests by doubling its `max_response_bytes` when the response was too big.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up on #370, #364, and #374 to add a conversion layer between request and responses to handle JSON RPC over HTTP.
Concretely:
BoxError. This is beneficial since errors may happen at different layers and they all need to be handled by the above observability layer, e.g., add the corresponding metric in case the response has a non successful status.Converttrait to convert one type into another with some potential error.http::Requestandhttp::Responseto transform their body into a JSON RPC type. This uses the aboveConverttrait. This conversion layer is behind a feature flag (json) since it requiresserde_jsonto handle the serialization/deserialization