Skip to content

Conversation

wetkeyboard
Copy link

I found some RPC providers doesn't support to query eth_logs in a large range, eg:

Fetch the USDT Transfer logs from block 17,000,000 to 18,000,000:

cast logs --from-block 17000000 --to-block 18000000 --address 0xdac17f958d2ee523a2206206994597c13d831ec7 "Transfer(address,address,uint256)"

The rpc provider response with:

Error: server returned an error response: error code -32600: params: fromBlock and toBlock the block range with a limit of 10000 blocks.

So here I propose to add a --batch flag to split the large range into smaller batches, and fetch the logs in batch, and a --count flag to only output the count of the logs.

@grandizzy
Copy link
Collaborator

thank you @wetkeyboard I though don't think we should add such in cast but rather let external tools to deal with... @zerosnacks wdyt?

@wetkeyboard
Copy link
Author

thank you @wetkeyboard I though don't think we should add such in cast but rather let external tools to deal with... @zerosnacks wdyt?

@grandizzy This feature would be really helpful for querying events over large block ranges. For example, when you need to track Upgraded events for a proxy contract across months of history, or analyze token transfers over extended periods - many RPC providers limit you to 10k blocks per request.
Having this built into cast saves users from writing custom batching logic every time they hit these limits. The flags are optional so it doesn't affect existing workflows.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

imo this is something we can add to alloy as a helper type and then reuse here?

wdyt @wetkeyboard

@wetkeyboard
Copy link
Author

imo this is something we can add to alloy as a helper type and then reuse here?

wdyt @wetkeyboard

Sure, but I'm new to alloy, will try my best to handle it, may need some time here.

@onbjerg
Copy link
Contributor

onbjerg commented Sep 19, 2025

Blocked by alloy-rs/alloy#2884

@onbjerg onbjerg self-assigned this Sep 19, 2025
@grandizzy grandizzy moved this to Blocked in Foundry Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-blocked Type: blocked
Projects
Status: Blocked
Development

Successfully merging this pull request may close these issues.

4 participants