Repository navigation
Description
Summary
The from_block-seeded event watchers (slash_watcher, blacklist_watcher, chain_origin_directory) re-scan the entire range [from_block, head] on every process start, with no cursor persisted across restarts. When from_block is the contract deploy block, that is a multi-hundred-million-block scan on each boot — tens of thousands of eth_getLogs calls in a burst. On any rate- or quota-limited RPC endpoint this exceeds the limit immediately; we observed it crash-loop a node against a keyed free tier. We should find a cheaper way to establish watcher state at startup.
Observed impact (Arbitrum Sepolia, 2026-07-12)
Internal instance node bcl, onboarded today:
from_block(config) = deploy block 11,249,862; head 286,533,334 → gap 275,283,472 blocks.- Backfill window =
MAX_BACKFILL_BLOCK_SPAN(10,000), so ~27,528eth_getLogscalls per genesis-seeded watcher, ×3 watchers ≈ ~82,000 calls per process start. - Pointed at a keyed Infura free endpoint (needed for
eth_newFilter, see Node event watchers hard-depend on eth_newFilter; switch to eth_getLogs polling #1106), the startup burst tripped Infura's rate limit →429 Too Many Requestson the startup reachability check → process exit → systemd restart → repeat. Restart counter climbed past 30; the burst re-rate-limited every attempt. - The previous public endpoint (
sepolia-rollup.arbitrum.io) only tolerated this because it does not throttle — but it lackseth_newFilter, so it is not a real option (Node event watchers hard-depend on eth_newFilter; switch to eth_getLogs polling #1106).
Net: a correctly-registered node cannot stay up against a rate-limited RPC purely because of startup backfill volume.
Where it comes from
crates/node/src/slash_watcher.rs— rebuilds its in-memory slash store "fromfrom_blockon every process start" (no persisted cursor); scans[from_block, head]on the first cycle. The doc comment intendsfrom_blockto be the "30-day appeal window," but the shipped/config default seeds it at theSlashJudgedeploy block.crates/node/src/blacklist_watcher.rs— windowedHashBlacklistedreplay fromfrom_block(REPLAY_WINDOW_BLOCKS = 9_000), checkpoint held in memory only.crates/node/src/dht/chain_origin_directory.rs— same pattern fromorigin_directory_from_block.crates/node/src/payment_settlement.rs— NOTE: this one already does the right thing (resolve_backfill_start(last_seen, head, margin)bounds the scan to a recent window), and is the model to generalize from.- Config knobs (all default to the deploy block in the internal-devops inventory):
slash_judge_from_block,content_blacklist_from_block,origin_directory_from_block.
Directions to explore
- Persist the scan cursor/checkpoint to disk so restarts resume incrementally instead of re-scanning
[from_block, head]every boot. (Biggest win — turns an O(chain age) startup into O(downtime).) - Bound each watcher's default lookback to what it actually needs. Slash only needs the ~30-day appeal window, not genesis. Generalize
payment_settlement's recent-window approach. - Seed from current state instead of replaying all history where a state read exists — e.g. read
ContentBlacklist's current version + enumerate active entries once, then only stream new events, rather than replaying every historicalHashBlacklisted. - Rate-aware backfill — cap in-flight
getLogsconcurrency / add pacing so a cold start degrades gracefully under a throttling provider instead of tripping a fatal reachability failure. - Make the startup RPC reachability preflight resilient to a transient
429(retry/backoff) rather than exiting the process.
Acceptance criteria
- A cold start against a rate-limited free RPC (e.g. Infura free) completes without tripping the rate limit or crash-looping.
- A restart does not re-scan the full
[from_block, head]range (cursor persisted, or state-seeded). - Historical correctness is preserved (no missed blacklist/origin entries) via a state snapshot or persisted cursor rather than a shortened
from_block. - Startup reachability check tolerates a transient
429/5xx with backoff instead of exiting.
Context
Found while bringing up the internal instance node bcl (decdn/internal-devops). Related: #1106 (the eth_newFilter dependency that forces a keyed/rate-limited provider in the first place) and #1092 (chain_events watcher refactor — a natural home for a shared, cursor-persisting backfill+stream helper). The operator-side stopgap is to raise from_block to a recent block, but that trades away historical replay and shouldn't be the permanent answer.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(node): harden resumable-watcher failure paths from multi-agent re…
feat(node): eth_getLogs resumable watcher, off eth_newFilter (#1106, #…
fix(node,cli): observable origin-replay range guard + zero-address gu…
feat(node): share one eth_blockNumber read across all chain watchers (#…
feat(node): share one eth_blockNumber read across all chain watchers (#…
feat(node): share one eth_blockNumber read across all chain watchers (#…
fix(node): degrade bootstrap nodeIdOf, correct timed's policy taxonomy
fix(node,common): bound every sink-internal chain read (#1228) (#1233)