Open
Description
Component
Forge
Describe the feature you would like
See gakonst/ethers-rs#2508 for details/rationale on the request here
forge batching is not necessarily dependent on that ethers-rs feature, as even without it forge could presumably convert batches calls into multicalls. This could result in significant performance improvements for RPC-heavy scripts and fork tests
Currently instead of eth_call
we simulate the call and use eth_getStorageAt
as needed. This is suboptimal than just using eth_call
directly because:
- Alchemy prices
eth_getStorageAt
at 17 CUPS buteth_call
is 26, so any tx reading 2+ slots is currently paying more (and running slower due to multiple requests) than necessary, especially when you consider that we can batcheth_call
s but can't batcheth_getStorageAt
- Simulating might not give the right result for chains where some opcodes behave differently than on mainnet (e.g. NUMBER returns L2 block number on optimism but L1 block number on arbitrum)
So I think the best path forward is:
- Replace the current behavior to use
eth_call
instead - Then, batch
eth_call
s. The approach here would be:
- Collect all consecutive staticcalls, stop collecting when there's a state changing operation
- If Multicall3 is available on the chain, batch calls with it. If Multicall3 is not available on the chain, either use
eth_call
state overrides to place it there as part of the call, or just send normal requests without Multicall3
Additional context
No response
Metadata
Metadata
Assignees
Type
Projects
Status
Todo