Repository navigation
feat: remove speculative prefetch mechanism (#1396) - #1399
Conversation
|
Warning Review limit reached
Next review available in: 39 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (4)
WalkthroughThe PR removes speculative prefetch configuration and implementation, including acquisition, popularity tracking, runtime wiring, metrics, and tests. ADRs and operator-facing documentation now describe reactive cache-miss pull-through and authorized-origin gating. ChangesReactive demand model
Configuration surface removal
Node runtime integration removal
Reload and integration test alignment
Estimated code review effort: 4 (Complex) | ~60 minutes 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 |
There was a problem hiding this comment.
Pull request overview
This PR removes the node’s speculative prefetch feature (previously driven by DHT FIND_VALUE query-frequency signals) so that content propagation relies on the reactive, paid cache-miss pull-through path (plus explicit operator pinning). It also updates configuration surfaces, metrics, tests, and ADR documentation to eliminate the prefetch mechanism and re-home the remaining “authorized origin” semantics under ADR 022 for the pull-through gate and FIND_VALUE fallback.
Changes:
- Deletes the speculative prefetch engine, wiring, config schema, metrics family, and related tests.
- Removes prefetch-related hooks from DHT and client handlers, runtime wiring, and node-origin post-pull observation.
- Updates ADRs and config examples to describe reactive-only propagation and to document the pull-through authorized-origin gate semantics in ADR 022.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/configs/arbitrum-sepolia.toml | Updates origin-directory comment to reflect pull-through gate + FIND_VALUE fallback usage. |
| crates/node/tests/sighup_signal.rs | Removes prefetch from resolved config seeding and reload-warning expectations. |
| crates/node/tests/node_origin_pull.rs | Removes end-to-end prefetch tests and prefetch-only wiring fields. |
| crates/node/tests/dht_loopback.rs | Removes DHT→prefetch integration test and related imports. |
| crates/node/tests/anvil_bringup_shutdown_e2e.rs | Removes prefetch from resolved config fixture. |
| crates/node/src/runtime/reload.rs | Removes prefetch section restart-required warnings and defaults in fixtures. |
| crates/node/src/runtime/mod.rs | Removes prefetch engine construction/wiring/shutdown; clarifies origin-directory sharing for pull-through + fallback only. |
| crates/node/src/prefetch/popularity.rs | Deletes prefetch popularity oracle implementation. |
| crates/node/src/prefetch/mod.rs | Deletes prefetch engine + acquisition observer implementation. |
| crates/node/src/prefetch/decision.rs | Deletes prefetch policy/ledger decision engine. |
| crates/node/src/prefetch/acquirer.rs | Deletes background speculative acquisition machinery. |
| crates/node/src/prefetch/acquired.rs | Deletes prefetch-acquired tagging set implementation. |
| crates/node/src/node_origin.rs | Removes acquisition observer hook and prefetch-ledger delta narrowing. |
| crates/node/src/metrics.rs | Removes prefetch metric family and the prefetch-ledger delta overflow counter. |
| crates/node/src/lib.rs | Removes prefetch module export. |
| crates/node/src/handlers/dht.rs | Removes prefetch feed from FIND_VALUE handling and engine attachment API. |
| crates/node/src/handlers/client/voucher.rs | Removes serve-path crediting of served bytes to prefetch demand-quality ratio. |
| crates/node/src/handlers/client/mod.rs | Removes prefetch engine dependency from ClientHandlerDeps/ClientHandler. |
| crates/node/src/handlers/client/dispatch.rs | Updates pull-through authorized-origin gate comments to remove prefetch coupling. |
| crates/node/src/dht/origin.rs | Updates docs to remove prefetch references; keeps origin-directory contract for gate/fallback. |
| crates/node/src/dht/chain_origin_directory.rs | Updates docs to describe pull-through gate + fallback consumers (no prefetch). |
| crates/common/src/config/types.rs | Removes [prefetch] config schema; updates blockchain/cache docs re: origin directory and pull-through gate. |
| crates/common/src/config/resolved.rs | Removes ResolvedPrefetch; updates resolved blockchain docs for origin directory behavior. |
| crates/common/src/config/mod.rs | Removes prefetch resolution/defaults/validation; updates origin-directory resolution docs. |
| crates/common/src/cli/run.rs | Updates CLI arg docs for origin-directory addresses (no prefetch). |
| crates/cli/tests/config_validate.rs | Removes prefetch validate-summary test and fixture field. |
| crates/cli/src/commands/config.rs | Removes prefetch-related validate-summary output and template config block; updates origin-directory summary text. |
| adr/architecture.md | Updates ADR 022 index description to remove prefetch demand-signal mention. |
| adr/appendix-observability.md | Deletes the prefetch metrics subsection. |
| adr/037-regional-proxy-warming.md | Updates narrative and references to remove prefetch; points gate semantics to ADR 022. |
| adr/022-content-discovery.md | Rewrites popularity section to reactive-only; adds “Origin authorization for cache warming” section. |
| adr/017-privacy.md | Removes prefetch-trigger mention in references. |
| adr/001-network.md | Updates NodeAnnounce description to remove prefetch demand-signal language. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .origin_assignment_address | ||
| .as_deref() | ||
| .unwrap_or("(unset — origin directory empty: prefetch gate finds no origins)") | ||
| .unwrap_or("(unset — origin directory empty: pull-through gate finds no origins)") |
There was a problem hiding this comment.
Fixed: the unset message now reads "pull-through gate and FIND_VALUE fallback find no origins" — the empty directory disables both consumers.
| .publisher_registry_address | ||
| .as_deref() | ||
| .unwrap_or("(unset — origin directory empty: prefetch gate finds no origins)") | ||
| .unwrap_or("(unset — origin directory empty: pull-through gate finds no origins)") |
There was a problem hiding this comment.
Fixed alongside the origin_assignment_address line above — same "pull-through gate and FIND_VALUE fallback find no origins" wording.
| /// empty (deny-all): the pull-through authorized-origin gate finds no on-chain | ||
| /// origins. |
There was a problem hiding this comment.
Fixed: the help text now notes an unset origin directory disables both the pull-through authorized-origin gate and the FIND_VALUE last-resort fallback.
| /// `publisher_registry_address`); `None` => empty deny-all directory, so | ||
| /// the prefetch authorized-origin gate finds no origins (ADR 022). | ||
| /// the pull-through authorized-origin gate finds no origins (ADR 022). |
There was a problem hiding this comment.
Fixed: the ResolvedBlockchain doc now names both the pull-through gate and the FIND_VALUE last-resort origin fallback.
altanoruc
left a comment
There was a problem hiding this comment.
The implementation-side removal is coherent, and I verified cargo fmt -- --check plus cargo check --workspace --all-targets locally at 5c135e1. I found two documentation/behavior inconsistencies that should be resolved before merge. The PR is also currently CONFLICTING with main, so the first item is especially important during the rebase.
One upgrade concern to confirm explicitly: deleting FileConfig::prefetch under deny_unknown_fields makes every existing config containing [prefetch] fail startup after upgrade. Issue #1396 left accept-and-warn vs hard rejection open; the PR body implies hard rejection is intentional, but this should be a deliberate compatibility/release-note decision.
| - Many FIND_VALUE queries for H → H is in high demand. | ||
| - The node is already well-positioned to be a STORE target for H. | ||
| - Prefetching H and publishing a STORE record turns incoming routing queries into paid delivery opportunities. | ||
| The cache role is permissionless: any bonded operator may serve any hash it holds, and the cache-miss pull-through path used to fulfill an in-flight `cdn/client/v1` `StreamRequest` from a paying customer pulls and warm-caches unconditionally, driven by an active paid request rather than any speculative inference. An operator who does not want the reactive path to relay or warm *unclaimed* content MAY restrict it to authorized origins with the opt-in `pull_through_require_authorized_origin` gate ([ADR 037 § Seed-leech caps](037-regional-proxy-warming.md#seed-leech-caps)), which resolves authorization through the same on-chain origin directory as the FIND_VALUE fallback (§ [FIND_VALUE Flow](#find_value-flow-cache-miss--dht-lookup)). |
There was a problem hiding this comment.
[P1] Preserve #1395's namespace-addressed model when rebasing. main now says the requester already knows namespaceId, there is no on-chain hash→namespace lookup, and namespaceId == 0 has no on-chain origin directory/default-open allow-list. This paragraph (and the following “truly-unclaimed hash” wording) reintroduces the superseded hash-derived/default-open model. Since this PR is currently merge-conflicting with #1395's ADR edits, please resolve those conflicts by retaining #1395's semantics and applying only the prefetch removal.
There was a problem hiding this comment.
Rebased onto current main. The branch predated #1395, which is why this paragraph still carried the superseded default-open / hash→namespace model. Conflicts resolved by keeping #1395's semantics and applying only the prefetch removal: namespaceId == 0 has no authorized origins throughout now, and grep -r default-open adr/ is empty.
| 18. A `BatchStoreRequest` consumes between 1 and `n` tokens from each rate-limit bucket: stage 1 charges 1 token before deserialization; stage 2 charges up to `n - 1` more after reading `n = hashes.len()`, bounded by remaining budget. The first `k` admitted hashes pass per-hash processing; the remaining `n - k` are marked `false` in the ack without further processing. | ||
| 19. A `BatchStoreRequest` with `hashes.len() > 256` is rejected by closing the stream with `MALFORMED_MESSAGE` (`0x03`); the publisher MUST split larger publish sets across multiple batches. | ||
| 20. A publisher whose `BatchStoreRequest` to a given receiver results in stream-close-without-ack MUST fall back to per-hash `StoreRequest` for subsequent publications to that receiver; the publisher SHOULD cache the negative result for some bounded duration to avoid repeated drop-and-fallback cycles. | ||
| 7. FIND_VALUE-query frequency and per-hash cache-miss frequency are emitted as observability metrics in [Appendix: Observability](appendix-observability.md#appendix-observability-and-metrics); neither drives acquisition. Realized demand is served reactively per [ADR 037](037-regional-proxy-warming.md#adr-037-latency-driven-proxy-warming-for-regional-locality). |
There was a problem hiding this comment.
[P2] This resolves issue #1396's observability question inconsistently. The patch removes the FIND_VALUE observation path (run_prefetch/the popularity tracker) and adds no pure-observability replacement; the remaining cache metrics are aggregate, not per-hash. Yet this acceptance criterion says FIND_VALUE-query frequency and per-hash cache-miss frequency are emitted. Please either retain and wire the telemetry (and name the concrete metrics), or remove this claim so the ADR matches the node.
There was a problem hiding this comment.
Removed the claim. The node emits no per-hash cache-miss-frequency or FIND_VALUE-query-frequency metric — only aggregate counters — and appendix-observability has no such section. Rewrote acceptance-criterion #7 and the reactive-demand line to state that no such demand signal is collected, so the ADR matches the node.
altanoruc
left a comment
There was a problem hiding this comment.
PR Review: feat: remove speculative prefetch mechanism (#1396)
Great work! This is a clean, thorough removal of speculative prefetch (~2,900 net lines) across crates and ADRs.
Highlights & Code Verification:
- Clean Decoupling: The removal of , configuration structs, prefetch hooks, and prefetch metrics is complete and precise.
- Reactive Surface Intact: Cache-miss pull-through, ADR 037 regional proxy warming, , and origin authorization gates are properly preserved and cleanly re-homed into ADR 022.
- Formatting: passes cleanly with zero warnings.
🔍 Minor Finding / Cleanup:
In (line 259), under , the alert description still references prefetch:
- alert: DecdnOriginDirectoryWatcherStalled
expr: (decdn_origin_directory_watcher_last_tick_timestamp_seconds > 0) and (time() - decdn_origin_directory_watcher_last_tick_timestamp_seconds > 180)
for: 5m
labels:
severity: warning
annotations:
summary: "Origin-directory watcher not ticking on {{ $labels.instance }}"
description: |
The cached namespace → operator directory is no longer refreshed; the
prefetch authorized-origin gate reads that cache. Restart and check the
RPC provider.Suggested Fix: Update to .
LGTM overall! 🚀
altanoruc
left a comment
There was a problem hiding this comment.
PR Review: feat: remove speculative prefetch mechanism (#1396)
Great work! This is a clean, thorough removal of speculative prefetch (~2,900 net lines) across crates and ADRs.
Highlights & Code Verification:
- Clean Decoupling: The removal of
crates/node/src/prefetch/,[prefetch]configuration structs,FIND_VALUEprefetch hooks, and prefetch metrics is complete and precise. - Reactive Surface Intact: Cache-miss pull-through, ADR 037 regional proxy warming,
OriginDirectory, and origin authorization gates are properly preserved and cleanly re-homed into ADR 022. - Formatting:
cargo fmt --checkpasses cleanly.
🔍 Minor Finding / Cleanup:
In monitoring/prometheus-alerts.yml (line 259), under DecdnOriginDirectoryWatcherStalled, the alert description still references prefetch:
- alert: DecdnOriginDirectoryWatcherStalled
expr: (decdn_origin_directory_watcher_last_tick_timestamp_seconds > 0) and (time() - decdn_origin_directory_watcher_last_tick_timestamp_seconds > 180)
for: 5m
labels:
severity: warning
annotations:
summary: "Origin-directory watcher not ticking on {{ $labels.instance }}"
description: |
The cached namespace → operator directory is no longer refreshed; the
prefetch authorized-origin gate reads that cache. Restart and check the
RPC provider.Suggested Fix: Update prefetch authorized-origin gate to pull-through authorized-origin gate.
LGTM overall! 🚀
Delete speculative prefetch entirely: nodes no longer pre-acquire blobs they don't hold off the DHT FIND_VALUE query-frequency signal. Content propagation relies solely on the reactive, paid cache-miss pull-through path (plus explicit operator pinning). Cache-miss pull-through and ADR 037 proxy warming — both reactive — are unchanged. Rust: - Delete crates/node/src/prefetch/ (PrefetchEngine, popularity tracker, decision engine, acquirer, acquired-set). - Drop the [prefetch] config block: PrefetchConfig, ResolvedPrefetch, the DEFAULT_PREFETCH_* constants, and resolver/validation. - Remove the decdn_prefetch_* metric family and the prefetch-ledger-only decdn_node_pull_delta_overflow_total, plus their setters. - Remove the FIND_VALUE->prefetch feed (DhtHandler), the AcquisitionObserver trait + serve-path crediting (node_origin/voucher), and all runtime wiring (engine construction, provision_acquirer, prefetch_shutdown token, armed_origin_gates helper). - Drop the [prefetch] CLI config template + example, and dead tests. Kept (shared surface): cache-miss pull-through, ADR 037 proxy warming, the pull_through_require_authorized_origin gate, OriginDirectory, and the FIND_VALUE fallback. The gate's OriginAssignment / namespace-0 / fail-closed semantics are re-homed from the deleted prefetch section into a new self-contained ADR 022 "Origin authorization for cache warming". ADRs: delete ADR 022's prefetch sections and rewrite Popularity Signals to reactive-only; remove appendix-observability Prefetch Metrics; clean single refs in ADR 001/017/037/architecture. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Fold the origin-authorization detail so nothing is stated twice: - ADR 022 § FIND_VALUE Flow is the single home for origin-directory resolution (getOrigins / namespaceId==0 default-open / nodeIdOf-active) and now also the directory's event-subscription currency + fail-closed behavior. - ADR 037 § Seed-leech caps is the single home for the gate policy (pull_through_require_authorized_origin: initiation-only, NotFound, ContentBlacklist boundary, ADR 019 compliance posture). Collapse ADR 022's "Origin authorization for cache warming" subsection to its unique content (permissionless cache role + unclaimed-content pinning) with a one-line pointer to the gate; repoint ADR 037's gate references to ADR 022 § FIND_VALUE Flow instead of the removed subsection. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…label Address PR #1399 review feedback that survives the #1395 rebase: - config validate summary, `--origin-assignment-address` help, and the ResolvedBlockchain doc now state that an unset origin directory disables both the pull-through gate AND the FIND_VALUE last-resort fallback (Copilot: the directory backs both consumers, not only the gate). - prometheus DecdnOriginDirectoryWatcherStalled alert: "prefetch authorized-origin gate" -> "pull-through authorized-origin gate". Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
5c135e1 to
ebc8526
Compare
|
Pushed a rebase + review fixes (
The |
Coverage reportTotal: 81.14% (was 81.27%, ▼ 0.14%) — 54305/66929 lines
History
|
…ADR cites Follow-up to the prefetch-removal review (PR #1399): - adr/022: document the fail-closed-on-RPC-loss / empty-directory behavior in the FIND_VALUE Flow section, so ADR 037's delegation points at text that actually exists (it was left homeless when the Scope-and-limits subsection was deleted). - Repoint two doc-comments (config/types.rs, handlers/client/mod.rs) from the deleted "ADR 022 Scope and limits" section to FIND_VALUE Flow, matching the dispatch.rs fix already in this branch. - CHANGELOG: add a BREAKING config entry -- a leftover [prefetch] section now fails at startup/reload under deny_unknown_fields. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Closes #1396.
Deletes speculative prefetch entirely — nodes no longer pre-acquire blobs they don't hold off the DHT
FIND_VALUEquery-frequency signal. Content propagation now relies solely on the reactive, paid cache-miss pull-through path (plus explicit operator pinning). Cache-miss pull-through and ADR 037 proxy warming — both reactive — are unchanged.No tombstones: there are zero remaining references to prefetch anywhere (
grep -ri prefetchis empty), and no "we no longer prefetch" notes.Breaking change:
[prefetch]config sections are now rejectedFileConfiguses#[serde(deny_unknown_fields)], so removing theprefetchfield means any existing config that still carries a[prefetch]section fails at startup with an "unknown fieldprefetch" error rather than being ignored. #1396 left accept-and-warn vs. hard rejection open; this PR ships hard rejection — operators upgrading must delete the[prefetch]block from their config. This is deliberate: a silently-ignored block would let stale prefetch tuning look effective when the feature is gone.Removed
Rust (~2,900 net lines, 26 files):
crates/node/src/prefetch/module (PrefetchEngine, popularity tracker, decision engine, acquirer, acquired-set).[prefetch]config:PrefetchConfig,ResolvedPrefetch,DEFAULT_PREFETCH_*, resolver + validation.decdn_prefetch_*metric family and the prefetch-ledger-onlydecdn_node_pull_delta_overflow_total, plus setters.FIND_VALUE→prefetch feed (DhtHandler), theAcquisitionObservertrait + serve-path crediting (node_origin/voucher), and all runtime wiring (engine construction,provision_acquirer,prefetch_shutdowntoken, thearmed_origin_gateshelper).[prefetch]CLI config template + example config, and 3 dead tests.ADRs: deleted ADR 022's prefetch sections and rewrote §Popularity Signals to reactive-only; removed appendix-observability §Prefetch Metrics; cleaned single refs in ADR 001/017/037/architecture.
Kept (shared surface)
Cache-miss pull-through, ADR 037 proxy warming, the
pull_through_require_authorized_origingate,OriginDirectory, and theFIND_VALUEfallback all survive. The gate'sOriginAssignment/ namespace-0 / fail-closed semantics — previously documented inside the deleted prefetch section — are de-duplicated to one canonical source: ADR 022 §FIND_VALUE Flow (the origin-discovery fallback), which ADR 037 §Seed-leech caps and the code now reference instead of re-describing.Rebased on
main(#1395)This branch was rebased onto current
mainto resolve the conflict with #1395 (namespace-as-origin-addressing, drop … default-open allow-list). All surviving ADR text uses #1395's model —namespaceId == 0has no authorized origins (no default-open allow-list, no on-chain hash→namespace lookup); the rebase applies only the prefetch removal on top of those semantics.grep -r default-open adr/is empty.Verification
cargo clippy --workspace --all-targets— 0 warnings;cargo fmt --checkcleancargo nextest: 798 (common + cli), 900 (node) — all passgrep -i prefetch(excl._history): 0 hits; no dangling ADR anchor links;default-opengone fromadr/Not run:
anvil-e2e-gated tests (need a live anvil); nothing in that path referenced prefetch.🤖 Generated with Claude Code
Summary by CodeRabbit