Skip to content

Conversation

@antazoey
Copy link
Member

What I did

implements batch requets at the provider level, not sure about a more top level API yet (maybe something like multicall?)

fixes: #2472

How I did it

How to verify it

Checklist

  • All changes are completed
  • Change is covered in tests
  • Documentation is complete

Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

@BobTheBuidler had some sort of batching middleware for Brownie, wonder if that might be useful here to look at

@0xthedance
Copy link
Contributor

I had been looking at this issue, and I'm curious. What is the reason for using JSON and the requests library instead of using batch requests from web3.py? https://web3py.readthedocs.io/en/v7.7.0/web3.main.html#batch-requests

@antazoey
Copy link
Member Author

What is the reason for using JSON and the requests library instead of using batch requests from web3.py? https://web3py.readthedocs.io/en/v7.7.0/web3.main.html#batch-requests

Thanks for pointing this out, let me look into it.


return [
self._get_result_from_rpc_response(uri, r, raise_on_failure=False)
for r in response.json()
Copy link
Contributor

Choose a reason for hiding this comment

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

i remember a bug where erigon returned results out of order, so to be safe we can sort by id

if "jsonrpc" not in request:
request["jsonrpc"] = "2.0"
if "id" not in request:
request["id"] = idx + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

  • enumerate has a second arg for start index
  • if we allow id overrides (any good reason for that?), then we need to check there are no duplicates

@github-actions
Copy link

github-actions bot commented Jul 1, 2025

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale No activity for 30 days label Jul 1, 2025
@fubuloubu fubuloubu removed the stale No activity for 30 days label Jul 1, 2025
@github-actions
Copy link

github-actions bot commented Aug 1, 2025

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale No activity for 30 days label Aug 1, 2025
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

This PR was closed because it has been inactive for 35 days.

@github-actions github-actions bot added the inactive no recent activity, closed label Aug 7, 2025
@github-actions github-actions bot closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inactive no recent activity, closed stale No activity for 30 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support RPC batch requests

4 participants