-
Notifications
You must be signed in to change notification settings - Fork 239
Description
Version
0.15.15
Current behavior
We are doing some benchmarking on ponder using Alchemy RPC, and noticed that the block range used is much smaller than is expected from extracting the error message recommendation: https://github.com/ponder-sh/ponder/blob/main/packages/utils/src/getLogsRetryHelper.ts#L124-L142
14:57:09.308 INFO Indexed block range chain=mainnet event_count=1 block_range=[20492181,20492369] (2ms)
14:57:09.384 INFO Indexed block range chain=mainnet event_count=6 block_range=[20492370,20492652] (2ms)
14:57:10.093 INFO Indexed block range chain=mainnet event_count=13 block_range=[20492653,20493076] (2ms)
14:57:10.214 INFO Indexed block range chain=mainnet event_count=12 block_range=[20493077,20493712] (2ms)
14:57:10.301 INFO Indexed block range chain=mainnet event_count=4 block_range=[20493713,20494666] (2ms)
From testing, the Alchemy recommendation will almost always provide a block range such that ~5000 events will be returned.
We setup a very simple event handler, and ran ponder, and let it run for 10 minutes, after which it provided an estimated time to completion of ~3h30min (didn't let it finish).
We also setup a script which extracts logs for the exact same event, and parses the alchemy recommended block range and it finishes within <2.5min.
✓ 20076206-20519381: 5000 events
✓ 20519382-20811428: 4997 events
✓ 20811429-21129450: 4999 events
✓ 21129451-21373540: 5000 events
✓ 21373541-21492385: 5000 events
✓ 21492386-21592690: 5000 events
Curious to understand why ponder is using such a small block range even tho it has the logic which should allow 5000 event extraction, and where this magnitude of difference in performance is coming from?
Expected behavior
No response
Steps to reproduce
// ponder.config.ts
import { createConfig } from "ponder";
import { parseAbi } from "viem";
export default createConfig({
chains: {
mainnet: { id: 1, rpc: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}` },
},
contracts: {
MorphoBlue: {
abi: parseAbi(["event Supply(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares)"]),
address: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
chain: "mainnet",
startBlock: 18883124,
},
},
});
// handler.ts
ponder.on("MorphoBlue:Supply", async ({ event, context }) => {
// Do nothing...
});Link to repository
No response
Anything else?
No response