Repository navigation
fix(node,cli): observable origin-replay range guard + zero-address guards on all resolved addresses (#1152, #1153) - #1209
Conversation
…ards on all resolved addresses (#1152, #1153) #1152: bootstrap_cache replays ContentClaimed over [replay_from, latest]. Since the replay floor resumes from a persisted checkpoint (#1108), a stale RPC head can put replay_from > latest, and backfill_windows silently yields no windows — skipping the replay with no signal. Guard the range with check_backfill_range: warn + bump a new decdn_origin_directory_bootstrap_range_anomaly_total counter, keeping the routing-only posture (bootstrap is one-shot; propagating would crash startup). Mirrors the buyer-reconcile consumer of the same range check. #1153: route all four resolved contract addresses (capacity_bond, slash_appeal, publisher_registry, origin_assignment) through a shared parse_nonzero_address guard so a misconfigured 0x0 fails fast at resolve time instead of as an opaque on-chain revert. Previously only slash_appeal was guarded. Adds unit tests for the three newly-guarded addresses and the new metrics counter, plus CHANGELOG entries. Co-Authored-By: Claude Opus 4.8 <[email protected]>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThe PR adds non-zero Ethereum address validation across CLI coordinate resolvers and changes origin-directory bootstrap replay to detect inverted ranges, emit warnings, increment a metric, and skip replay for the affected boot. ChangesCLI address validation
Origin bootstrap anomaly handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ChainOriginDirectory
participant check_backfill_range
participant Metrics
ChainOriginDirectory->>check_backfill_range: Validate replay range
check_backfill_range-->>ChainOriginDirectory: Return range status
ChainOriginDirectory->>Metrics: Increment anomaly counter on inverted range
ChainOriginDirectory-->>ChainOriginDirectory: Skip ContentClaimed replay for this boot
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.92% (2488/2798 lines) |
There was a problem hiding this comment.
Code Review
This pull request introduces two main improvements. First, it updates the CLI to reject the zero address for all resolved contract addresses (including capacity bond, publisher registry, and origin assignment addresses) using a shared parse_nonzero_address guard to fail fast with a clear error. Second, it ensures that the origin-directory genesis replay does not silently skip on an inverted block range (e.g., due to a lagging RPC head); it now logs a warning and increments a new decdn_origin_directory_bootstrap_range_anomaly_total metric. Corresponding unit tests have been added for both features. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage reportTotal: 80.45% (was 80.44%, ▲ +0.01%) — 47603/59169 lines
History
|
…esses (#1153) PR review flagged the doc/CHANGELOG wording ('every'/'sole'/'all four') as overclaiming: other CLI contract addresses (fetch.rs, channel.rs, setup.rs) still parse via plain parse_address and accept 0x0. Narrow the parse_nonzero_address doc, the resolve_appeal comment, and the CHANGELOG to state precisely that the guard covers the four addresses resolved by resolve / resolve_appeal / resolve_publish, and note the remaining gap is tracked separately. No behavior change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…oritative getOrigins (#1152) When the origin-directory genesis replay is skipped on an inverted range, `namespaces_of` stays empty, so the `getOrigins` loop is a no-op and per-namespace membership is absent that boot — claimed hashes fall back to the default-open set (namespace 0) until the live tail re-surfaces claims. The prior "membership stays authoritative via getOrigins" wording overclaimed coverage. Reword the guard comment, warn! string, both metric doc comments, and the CHANGELOG entry to match. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Fixes two pre-existing latent bugs spun out of the #1151 review. Both touch adjacent resolver/bootstrap code, are small and independent, and ship together as one PR.
Closes #1152.
Closes #1153.
#1152 — origin-directory genesis replay silently proceeds on a
from > latestrange anomalybootstrap_cache(crates/node/src/dht/chain_origin_directory.rs) replaysContentClaimedoverbackfill_windows(replay_from, latest, …). Since the replay floor now resumes from a persisted checkpoint (#1108), a stale/lagging RPC head can putreplay_from > latest;backfill_windowsyields no windows for an inverted range, so the replay was silently skipped with no log or metric.The fix makes the anomaly observable without changing the graceful posture — it does not propagate the error, because the bootstrap call site (
runtime/mod.rs) is one-shot with no retry and a propagatedErrwould turn a transient RPC anomaly into a fatal node-startup crash. Instead it warns and bumps a new counter, mirroring the buyer-reconcile consumer of the samecheck_backfill_rangehelper (buyer_channel.rs):warn!on the inverted range (routing-only until re-surfaced by the live tail; membership stays authoritative viagetOrigins).decdn_origin_directory_bootstrap_range_anomaly_totalcounter (mirrors theorigin_directory_watcher_restartspattern, DHT: chain-backed StakerSet + OriginDirectory + alloy bindings for the on-chain fallback #651).#1153 — zero-address guard only on the appeal address
Only
slash_appeal_addresswas guarded againstAddress::ZERO. The identical rationale (a zero address parses fine but is never a real deployment and only surfaces as an opaque on-chain revert) applies verbatim to the other three resolved contract addresses. All four now route through a sharedparse_nonzero_addresshelper incrates/cli/src/commands/chain_ctx.rs:capacity_bond_address(resolve)slash_appeal_address(resolve_appeal)publisher_registry_address,origin_assignment_address(resolve_publish, present-but-zero only; unset optionals still resolve toNone)A misconfigured
0x0000…0000now fails fast at resolve time with a clear "must not be the zero address" error. This is a new hard error on0x0for the three previously-unguarded addresses (noted in the CHANGELOG).Tests
capacity_bond_address,publisher_registry_address,origin_assignment_address(mirroring the existing appeal test).origin_directory_bootstrap_range_anomalycounter unit test (starts at 0, increments) — the range-validation logic itself is already covered bycheck_backfill_range_boundary; the RPC path isn't behind a mock seam, so a new seam was out of scope.Verification
🤖 Generated with Claude Code
Summary by CodeRabbit