Repository navigation
fix(node): shrink the eth_getLogs window on provider range caps; alert on never-ticked watchers - #2152
Conversation
…t on never-ticked watchers The chain-event poller scanned [cursor, head] in fixed 10 000-block windows and never read the error. A provider with a lower range cap (dRPC free tier ~150 blocks, Alchemy free tier 10) rejected every window; the cursor held and each backoff retry asked for a wider range, so all five chain watchers stayed blind until restart. - run_tick walks windows with a per-poller span. A JSON-RPC error whose message names a range or result limit halves the attempted window and retries at once; the smaller span holds for the process lifetime. Timeouts, rate limits and other errors keep the backoff path. - blockchain.get_logs_max_block_span (default 10 000, > 0) sets the starting span; surfaced in config validate and the default template. - The five *WatcherStalled alerts gain a decdn_<watcher>_watcher_down_seconds > 180 arm: the tick arm's > 0 guard hid a watcher that never ticked. The three watcher-tick panels show such a watcher by its down-seconds instead of dropping it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Two moderate poller findings remain unresolved, along with one documentation nit.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Improves chain-watcher recovery from capped eth_getLogs ranges and makes never-ticked watchers observable.
Changes:
- Adds adaptive range shrinking and configurable starting spans.
- Updates watcher alerts and dashboards to include downtime.
- Updates configuration, tests, runbook, ADR, and changelog.
| File | Summary | Review notes |
|---|---|---|
monitoring/prometheus-alerts.yml |
Adds downtime-based stalled-watcher alerts. | — |
monitoring/grafana-dashboard.json |
Updates fleet watcher-age panels. | — |
monitoring/dashboard-chain.json |
Updates watcher freshness panels. | — |
docs/runbook.md |
Documents capped-provider diagnosis. | Nit (1 vote): Correct the listed alert names and include DecdnFeeSharesWatcherStalled. |
crates/node/tests/sighup_signal.rs |
Updates test configuration. | — |
crates/node/tests/anvil_bringup_shutdown_e2e.rs |
Updates E2E configuration. | — |
crates/node/src/runtime/reload.rs |
Updates reload test configuration. | — |
crates/node/src/runtime/mod.rs |
Wires the configured polling span. | — |
crates/node/src/chain_events/resumable_watcher.rs |
Updates watcher scanning documentation. | — |
crates/node/src/chain_events/multiplexed_poller.rs |
Implements adaptive polling and coverage. | Moderate (2 votes): Avoid overflow when halving a span covering [0, u64::MAX]. Moderate (1 vote): Narrow results matching to result-limit-specific wording. |
crates/node/src/chain_events/mod.rs |
Updates chain-event exports. | — |
crates/node/src/chain_events/backfill.rs |
Replaces fixed window generation. | — |
crates/common/src/config/types.rs |
Adds the configuration-file option. | — |
crates/common/src/config/resolved.rs |
Adds the resolved setting. | — |
crates/common/src/config/mod.rs |
Resolves, validates, and tests the setting. | — |
crates/cli/tests/config_validate.rs |
Updates validation fixtures. | — |
crates/cli/src/commands/config.rs |
Exposes the setting in validation and templates. | — |
CHANGELOG.md |
Documents the fixes and new option. | — |
adr/appendix-observability.md |
Updates watcher alert guidance. | — |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit f04c411 in the Show a line coverage summary of the most impacted files.
Updated |
- halved_span computes half a rejected window from end - start, so a window spanning all of u64 cannot overflow. - A "results" message counts as a range rejection only with a limit word (more than / exceed / max / limit / too many). - Runbook: list the five stalled alerts that exist. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Other overview items, fixed in 4af7395:
|
Review follow-ups for the range-cap shrink: - is_range_rejection now needs range/results wording AND a limit word (limit, max, exceed, up to, over, more than, too many/wide/large, not supported). Head-lag errors such as "block range extends beyond current head block" no longer shrink the sticky span. - A rejected one-block window fails with context saying the provider cannot serve the chain watchers. - Test: a result cap on a later window retries from that window's start; each log is applied exactly once. - Docs: the runbook leads with the shrink warn! and says to configure the logged span, not the provider's quoted limit; stalled-alert descriptions cover failing ticks; ADR watcher-liveness text names all five watchers and multiplexed_poller; span docs say "half the rejected window"; stale watcher counts and panel names fixed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…flapping watchers Review follow-ups that were deferred from the range-cap shrink: - WindowSpan (chain_events/backfill.rs) owns the learned span: halve on a rejection, double after 32 accepted full windows up to the ceiling. A transient or misclassified rejection no longer costs throughput until restart. Shrinks to a new low log at warn; the regrow/re-shrink cycle against a known cap logs at debug. - decdn_chain_get_logs_span and decdn_chain_get_logs_range_rejections_total, wired through poller-level hooks; plotted on the chain dashboard. - DecdnChainWatcherFlapping: >= 5 drift windows in 30 m for 15 m on any watcher's restarts_total. Each recovery resets the stalled alerts, so a watcher failing on and off lagged head unseen (hil1: 8-17 windows per 30 m for ~8 h; healthy nodes 0-2). - runtime::chain_poller_builder carries the config-driven poller settings; a unit test pins that get_logs_max_block_span reaches the poller. - ADR registry rows and flapping alert row, runbook, CHANGELOG. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Follow-ups from the multi-agent review, all in 1720644:
3969/3969 tests pass. Clippy ( |
Second review round on the span follow-ups:
- WindowSpan counts every accepted window toward the regrow, the short
live-tail ones too. A caught-up node now climbs back to the ceiling
after a transient rejection instead of parking the span (and the gauge)
far below it for good. A real cap shows as rejections that keep coming.
- shrink never goes above the current span; the ceiling is a NonZeroU64
(one validation point in build()); shrink/record_success are
#[must_use]; the result is a named Shrunk { span, rejected_probe }.
- Log level follows the probe, not an all-time minimum: warn on any
shrink except a rejected regrow probe, so a later real cap above an old
transient low is still logged at warn.
- DecdnChainWatcherFlapping uses increase() over a label_replace subquery
(a daemon restart no longer clears it), folds the five watchers into one
alert per node, and needs >= 4 windows per 30 m held for 45 m, so a
single burst cannot fire it. Checked on 3 days of fleet data.
- Tests: metric wiring through chain_poller_builder, run()'s starting
span, one-block rejection counted, re-rejection after a regrow, and a
gate pinning what the flapping rule's name pattern matches.
- Docs: the rejection counter, not the gauge, is the cap signal; ADR note
heading, poison note, runbook, dashboard legend calcs, CHANGELOG.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Second review round (code, tests, comments, silent failures, type design), fixed in f04c411:
3972/3972 tests pass. Clippy ( |

What
After the testnet RPC moved to dRPC's free tier, every chain watcher on all 7 nodes (blacklist, slash, staker_set, settlement, fee_shares) went blind, and nothing alerted.
eth_getLogsfailed withcode 35: ranges over 10000 blocks are not supported on free plan; the real cap is about 100–178 blocks. The multiplexed poller scanned[cursor, head]in fixed 10 000-block windows and never looked at the error. The cursor held, and each backoff retry asked for a wider range, so it never recovered.*WatcherStalledrule and every watcher-tick panel filterslast_tick > 0. A watcher that never ticked reads0, so it was invisible.*_watcher_down_secondswas climbing, but no rule reads it.Poller fix (
crates/node/src/chain_events/multiplexed_poller.rs)run_tickwalks the range one window at a time with a per-poller span.is_range_rejection), the poller halves the attempted window and retries at once. The smaller span holds for the process lifetime.New knob:
blockchain.get_logs_max_block_span(default 10 000, must be > 0) sets the starting span. It appears inconfig validateand in the default template.Monitoring fix
*WatcherStalledrules gain anor decdn_<watcher>_watcher_down_seconds > 180arm. down_seconds counts from the first failed tick, and it stays 0 for an unregistered fee_shares route.Reviewer notes
is_range_rejectionand thewhile start <= toloop inrun_tickfirst.35, Alchemy-32600, Infura-32005, QuickNode-32614), and the shrink is sticky. A generic "any non-rate-limit error" rule would let one transient-32000pin the span at 1.backfill_windowsis replaced by a one-windowwindow_end, because the span can change between windows.MAX_BACKFILL_BLOCK_SPANmoves todecdn_common::config::DEFAULT_GET_LOGS_MAX_BLOCK_SPAN.Verification
cargo fmt -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings, andRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemsare all clean.cargo nextest run --workspace: 3960/3960 passed. This includes new poller tests:-32600rejection halves the window and the tick completes; a429and a one-block rejection both take the backoff path.is_range_rejectionover the dRPC, Alchemy, Infura, QuickNode, rate-limit, out-of-range and transport cases.Ran the new alert expression against live Grafana Cloud data during the current outage: it fires for all 7 nodes, where the old rules were silent. The new panel expression returns every watcher with its down_seconds (about 1 600 s).
pre-commit runpasses.cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest runUser-visible change:
CHANGELOG.mdentry addedPR title uses an allowed type, lowercase subject
🤖 Generated with Claude Code