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
feat: automatically batch consecutive eth_call
s with a multicall
#2508
Comments
I would like to work on this
Motivated by this exact pain point in our already large codebase |
3 tasks
should probably mirror the config options here https://viem.sh/docs/clients/public.html#batch-multicall-optional |
Hey, looking also for the RPC batch request feature in Rust, is there a new solution available since opening this issue/PR ? TY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
viem has a really nice feature where consecutive calls are held in a queue then automatically batched using Multicall3. As you can see from the docs, this enables really nice UX such as:
This UX is much better than manually configuring the multicall. And a multicall results in significantly better performance and reduced RPC bills compared to individual calls
The other motivation for asking this is related to upstream usage in foundry. When users write forge tests or scripts, they'll often make many view calls to fetch data from the chain. Currently each call is a single RPC request, so you quickly end up with a lot of RPC calls, resulting in throttling and slower tests.
Supporting this feature and leveraging it in forge can result in significantly faster fork tests and scripts.
Describe the solution you'd like
I'm not sure how feasible a viem-like solution is in rust, but that's the ideal solution here: abstract away the need for users to worry about multicall but automatically batching calls, e.g. the below should be a single RPC call:
Describe alternatives you've considered
Explicit multicall batching is the main alternative
Additional context
Idea came out of a convo in foundry support telegram: https://t.me/foundry_support/40543
The text was updated successfully, but these errors were encountered: