[Feature] Add detection & warning when connected RPC is pruned or unable to serve historical logs
Summary
When users configure Rindexer with a startBlock that lies outside the history retained by their execution client, indexing may silently produce incomplete or incorrect results. Different clients behave differently when queried for pruned history — some return JSON-RPC errors (e.g., Erigon), while others return empty results (e.g., Reth), which makes it difficult for users to know that their node cannot serve the requested range.
Rindexer should detect this situation early and warn the user before indexing begins.
Proposed Solution
On startup, before indexing begins, Rindexer should perform a history support probe against the configured RPC:
- Identify the client (optional, for logging):
- Call
web3_clientVersion
- Call
- Probe the configured
startBlock:
- Call
eth_getLogsfor a very small window:fromBlock = startBlock, toBlock = startBlock + 10 - If this returns:
- A RPC error (Erigon-style pruning errors) → treat as pruned
- An empty array → ambiguous, continue to step 3
- Normal logs → OK
- If ambiguous, probe receipts:
- Fetch the block via
eth_getBlockByNumber - If it contains transactions, call
eth_getTransactionReceipton one of them - If receipts return error/null/inconsistent data → treat as pruned
- If the node appears pruned, Rindexer should:
- Print a clear warning and/or refuse to continue, and/or
- Allow an override flag like
--ignore-prune-warnings
This approach works consistently across Erigon, Reth, Geth, and others, and avoids relying on non-standard client-specific introspection.