This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
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.
Motivation
Fixes #1119: JSON-RPC error responses are not propagated to (request) callsites for the IPC transport correctly and end up as unhelpful
serde_json
errors.Tangentially, the internal handling of all JSON values creates a lot of intermediate
serde_json::Value
instances, which is inefficient, since this creates potentially nestedHashMap
s.Solution
Instead of calling
Response::to_value
, which converts both success and error responses into aserde_json::Value
we callResponse::into_result
, which propagates error responses asErr
variants.Internal handling of JSON responses and requests is switched from
serde_json::Value
toserde_json::value::RawValue
, which does not create any hashmaps.Not Solved
A potential issue persists, in that internal IPC server errors (such as an unexpected disconnect of the IPC socket, e.g. a node crash) are not propagated to pending subscriptions, for other pending requests, this should be correctly propagated now, but for subscriptions this would require a change to the
PubSubClient
trait definition (i.e., sendingResult
notifications).