feat: configurable batch block header retrieval via RPCClientConfig#1601
Conversation
Moves BlockHeadersResult and ErrNotFound/IsErrNotFound to the types package and adds RetrieveBlockHeaders to the CustomEthereumClienter interface so callers no longer need to manage separate ethClient and rpcClient references for header retrieval. Adds BatchBlockHeaderRetrieval bool (default true) to RPCClientConfig, letting operators disable JSON-RPC batch requests for nodes that do not support them. The DefaultEthClient implements the new method and routes to batch or legacy mode based on that flag. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @joanestebanr's task in 1m 53s —— View job PR Review Complete🚀 What's NewThis PR makes batch block header retrieval configurable via 🐛 Bug FixesNone 📋 Config UpdatesNew optional field in BatchBlockHeaderRetrieval = true # default value; disable for nodes without batch support
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05b2e25af4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds operator-configurable block header batch retrieval and consolidates header retrieval logic behind the Ethereum client interface, while relocating shared header/error result types into the types package.
Changes:
- Introduces
BatchBlockHeaderRetrievalinRPCClientConfig(defaulttrue) and wires it intoDefaultEthClient’s header retrieval behavior. - Adds
RetrieveBlockHeaders(ctx, blockNumbers, maxConcurrency)toCustomEthereumClienterand updates multidownloader call sites/tests to use it. - Moves
BlockHeadersResultand not-found error helpers intotypes, keepingethermanaliases/wrappers for compatibility.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
types/eth_client.go |
Extends client interface with RetrieveBlockHeaders. |
types/errors.go |
Defines ErrNotFound and IsErrNotFound in types. |
types/block_headers_result.go |
Adds BlockHeadersResult implementation in types. |
etherman/default_eth_client.go |
Implements RetrieveBlockHeaders with batch/legacy selection based on config. |
etherman/config/network.go |
Adds BatchBlockHeaderRetrieval to RPCClientConfig and default config. |
etherman/batch_requests.go |
Keeps backward-compatible aliases to types.BlockHeadersResult. |
etherman/errors.go |
Delegates ErrNotFound / IsErrNotFound to types. |
multidownloader/evm_multidownloader.go |
Replaces standalone helper calls with ethClient.RetrieveBlockHeaders. |
multidownloader/evm_multidownloader_test.go |
Updates tests to mock RetrieveBlockHeaders. |
multidownloader/reorg_processor_port.go |
Switches not-found check to types.IsErrNotFound. |
types/mocks/* |
Regenerates mocks to include RetrieveBlockHeaders. |
test/helpers/simulated.go |
Adds RetrieveBlockHeaders passthrough on TestClient. |
docs/common_config.md |
Documents RPCClientConfig, including the new batch flag. |
config/default.go |
Adds BatchBlockHeaderRetrieval = true to rendered defaults. |
config/config_test.go |
Asserts new default behavior for the config field. |
|
…lientConfig (#1606) ## 🔄 Changes Summary Cherry-pick of #1601 (originally merged into `release/0.10`) into `develop`. - Moves `BlockHeadersResult`, `ErrNotFound` and `IsErrNotFound` from `etherman` to the `types` package - Adds `RetrieveBlockHeaders(ctx, blockNumbers, maxConcurrency)` to the `CustomEthereumClienter` interface, implemented by `DefaultEthClient` - Adds `BatchBlockHeaderRetrieval bool` (default `true`) to `RPCClientConfig` — operators can disable batch RPC requests for nodes that do not support them - Simplifies `multidownloader` call sites: the three `etherman.RetrieveBlockHeaders(ctx, log, ethClient, rpcClient, ...)` calls collapse to `dh.ethClient.RetrieveBlockHeaders(ctx, ...)` - Documents `RPCClientConfig` in `docs/common_config.md` ##⚠️ Breaking Changes N/A ## 📋 Config Updates - 🧾 New optional field in `[L1NetworkConfig.RPC]` and `[Common.L2RPC]`: ```toml BatchBlockHeaderRetrieval = true # default, disable for nodes without batch support ``` ## ✅ Testing - 🤖 **Automatic**: existing unit tests updated; `TestLoadDefaultConfig` asserts the new default - Cherry-picked from: #1601 ## 📝 Notes - `etherman.BlockHeadersResult` and `etherman.NewBlockHeadersResult` are kept as type aliases for backward compatibility - `etherman.ErrNotFound` and `etherman.IsErrNotFound` are kept as wrappers delegating to `types` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>



🔄 Changes Summary
BlockHeadersResult,ErrNotFoundandIsErrNotFoundfromethermanto thetypespackageRetrieveBlockHeaders(ctx, blockNumbers, maxConcurrency)to theCustomEthereumClienterinterface, implemented byDefaultEthClientBatchBlockHeaderRetrieval bool(defaulttrue) toRPCClientConfig— operators can disable batch RPC requests for nodes that do not support themmultidownloadercall sites: the threeetherman.RetrieveBlockHeaders(ctx, log, ethClient, rpcClient, ...)calls collapse todh.ethClient.RetrieveBlockHeaders(ctx, ...)RPCClientConfigindocs/common_config.mdN/A
📋 Config Updates
[L1NetworkConfig.RPC]and[Common.L2RPC]:✅ Testing
TestEVMMultidownloader_MoveUnsafeToSafeIfPossible,TestEVMMultidownloader_StepSafe);TestLoadDefaultConfigasserts the new defaultgo build ./...), unit tests pass (go test ./types/... ./etherman/... ./multidownloader/... ./config/...)📝 Notes
etherman.BlockHeadersResultandetherman.NewBlockHeadersResultare kept as type aliases for backward compatibility with existing callersetherman.ErrNotFoundandetherman.IsErrNotFoundare kept as wrappers delegating totypesetherman.RetrieveBlockHeaders,RetrieveBlockHeadersBatch,RetrieveBlockHeadersLegacyfunctions remain for direct use in tests and other callers outside the multidownloader