Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Fix handling of json rpc errors that use "details" instead of "message" #2707

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eranrund
Copy link

@eranrund eranrund commented Jan 5, 2024

Motivation

I ran into an issue when using the RetryClient with a Polygon Mumbia RPC endpoint (https://rpc-mumbai.maticvigil.com/). The error it returns looks like this:
{"error":{"details":"Bad parameters in JSONRPC request: eth_getLogs.","code":-32005},"jsonrpc":"2.0","id":19}

Without this change the JsonRpcError fails to deserialize and the retry logic that is dependent on the JSON error code does not run.

Solution

Make the deserialization a bit more flexible, and have it support both "message" and "details".

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Thank you!

@DaniPopes
Copy link
Collaborator

DaniPopes commented Feb 12, 2024

cc @mattsse @prestwich
Is this right? Can we add this to Alloy?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this looks more like a server error because this is off spec:

https://www.jsonrpc.org/specification#response_object

@prestwich
Copy link
Collaborator

this looks more like a server error because this is off spec:

agree with this. but is the wrong version widely deployed enough to warrant supporting it? 😮‍💨

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants