Skip to content

Do not reattempt block ranges that are too high for particular JSON-RPC servers #716

@PaulRBerg

Description

@PaulRBerg

Problem

When using RPC to fetch events, Envio does not remember the maximum block range specified by the JSON-RPC server in the error messages.

For example, Alchemy enforces a limit of 2000 blocks for eth_getLogs, but Envio continues to attempt to query 2500 blocks at a time:

Image

This is problematic because it can lead to an excessive number of queries made to the JSON-RPC server.

Solution

Parse the JSON-RPC error message and infer what the maximum block range is for that particular JSON-RPC server, and never make a query with the same range again (to that particular server).

For example, this is the error returned by Alchemy:

{"error":{"code":-32000,"message":"block range too large (2500), maximum allowed is 2000 blocks"}}

Related

This issue has been previously discussed here: #603 (comment)

And another related issue is: #688

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions