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

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

Open
wants to merge 1 commit 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 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.

None yet

4 participants