Repository navigation
Description
Why now
We're at the natural decision point for the prefetch surface. The decision + metering layer of DHT speculative prefetch has landed behind prefetch.enabled = false (#650 / PR #819: PopularityTracker, PrefetchPolicy, config, metrics). #820 is the open follow-up that would wire the actual acquisition (FindValue → probe → pull-through), plus the live OriginAssignment event subscription for the origin gate and the ledger feedback loop. #821 is a third spawned surface (no opt-out symmetry on the reactive path) that only exists because of prefetch's gate.
Before we spend the #820 effort, this issue evaluates whether the FIND_VALUE-driven speculative acquisition path earns its keep against the mechanisms that have shipped or landed since ADR 022 was written, and asks for an explicit keep/defer/drop decision.
Scope: this is only about the speculative-acquisition decision — "pre-pull hash H because FIND_VALUE traffic for H crossed a threshold." It is not about the FIND_VALUE popularity oracle itself (a fine observability signal), STORE-on-commit, the DHT, reactive pull-through, or pinning. Those stay regardless.
What prefetch is (ADR 022 § Prefetch Decision)
A node sitting close to hash H in Kademlia keyspace receives every FindValue(H) query the network routes, whether or not it holds H (a non-suppressible popularity oracle). When the query count crosses prefetch.find_value_threshold (default 5 / 300s), the node MAY speculatively pull H and publish a STORE, converting its routing position into paid-delivery opportunities. Ships off by default (prefetch.enabled = false), gated by require_authorized_origin, a budget_usdc_per_hour circuit-breaker, and a served/acquired demand-quality auto-throttle.
The mechanisms it overlaps with
| Mechanism | Status | What it does |
|---|---|---|
| Origin cache-miss pull-through | shipped (crates/cache/src/engine.rs) |
On a real paid miss, pull from configured origin, BLAKE3-verify, cache, STORE-on-commit. |
| Node-to-node window-paced pull-through | landing (ADR 037 § Node serving; integration test #746, commit 101f043) |
On a real paid miss for an unheld blob, pull from a holder while serving, bounded by pull_ahead_bytes + seed-leech caps. Warms the cache as a paid side effect. |
| Latency-driven proxy warming | shipped (ADR 037 / #723) | Bootstraps the first regional copy by routing a real request through a nearby non-holder, ranked by measured RTT. |
| Operator pinning | shipped (engine.rs, set_pinned/SIGHUP) |
Deterministic, operator-chosen protection of specific hashes — the explicit "I want this content cached here" lever. |
Does prefetch increase locality? No — and ADR 037 says so
This is the load-bearing finding. Prefetch does not improve locality, because keyspace position and geography are independent coordinate systems. ADR 037 § Context spells it out:
FIND_VALUE query frequency accrues at the K nodes closest to
Hin keyspace, which are geographically uniform-random. The node that observes "His in demand" is, with high probability, not near the clients generating the demand.
ADR 037 was written specifically to solve the regional cold-start trap that prefetch cannot, and it does so reactively (RTT-routed, on real paid demand, with bounded loss). In doing so it explicitly hollowed out prefetch's remit — ADR 037 § Cross-ADR Impact:
It supersedes the local cache-miss prefetch trigger — realized local demand is served reactively here, not by speculative prefetch — and narrows the FIND_VALUE-frequency prefetch to keyspace-position monetization.
So after ADR 037, the entire residual justification for prefetch is: a keyspace-positioned node pre-acquiring globally-hot content to monetize its routing position and add a replica. Not locality. Not local demand. Just global-popularity replication at a geographically-random node.
Steelman: KEEP it
- Global-popularity replication that reactive paths can't front-run. Reactive warming only ever makes a copy where a real request already routed. A keyspace-positioned node sees globally-distributed demand and can pre-position a copy that becomes FIND_VALUE-discoverable for the whole network before the first request reaches it — raising replica count and availability for hot content, and absorbing load spikes on a single origin holder before they become slow/failed requests.
- The demand signal is free and honest-by-construction. The node already receives the FIND_VALUE traffic; the oracle "cannot be suppressed" by gossip and reflects real client demand. Not acting on a signal you already have is leaving an incentive on the table.
- Rewards running DHT routing nodes. Without prefetch, being near a hot hash in keyspace earns nothing — you just route queries for free. Prefetch turns that positional luck into revenue, which is a deliberate incentive-design property.
- The expensive part is already built and the threat model is closed. PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 landed the decision engine, config, metrics, and the
with_prefetchseam. ADR 022's recommended defaults close both the demand-only and demand-supply Sybil attacks. It's opt-in, off by default. The marginal cost of finishing (DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820) is the acquisition wiring, not the analysis. - Cheap to retain even unimplemented. Keeping the ADR analysis + the off-by-default decision layer costs little and preserves optionality if operational data later shows hot-content under-replication.
Steelman: DROP it (i.e. close #820, keep the oracle as observability only)
- Zero locality value. The benefit operators would most expect — content near clients — is explicitly not delivered (keyspace ≠ geography). ADR 037 owns locality and disengages cleanly once a copy exists. Prefetch's marquee selling point is already covered better, by a different mechanism.
- It's the only path that spends ahead of any paying customer. Every other path (origin pull-through, node-to-node window-paced pull-through, proxy warming) pays USDC only against a real in-flight paid request, bounded by
pull_ahead_bytes. Prefetch acquires on speculation — it pays for bytes no customer has requested, defended only by a budget circuit-breaker + origin gate + demand-quality throttle. That is a strictly worse, unbounded-loss-shaped profile, and it's unique to this one feature. - It generates a disproportionate attack/complexity surface. FIND_VALUE is cheap (no payment, only a QUIC NodeId), so prefetch drags in the entire demand-only / demand-supply Sybil analysis, the
require_authorized_origingate, a liveOriginAssignmentevent subscription with fail-closed semantics, a spend budget, a demand-quality auto-throttle, 7 config knobs, and 7 observability metrics. Norequire_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 is a fourth surface (operators wanting opt-out symmetry on the reactive path) spawned by the existence of the gate. Drop the speculative-acquisition decision and most of that evaporates. - Replication already happens on real demand. Globally-hot content generates real paid requests across the network; origin + node-to-node pull-through already create replicas where demand actually lands (which is where they're useful), with STORE-on-commit making each discoverable. Prefetch adds a replica at a keyspace-random node that is, by construction, far from all of the demand.
- Pinning covers the deterministic intent without the speculation. An operator who knows certain content is strategic/hot pins it — explicit, deterministic, no spend-on-acquisition, no manufactured-demand exposure. The "I want to cache popular content here" intent has a safe lever already.
- Off-by-default + acquisition-unbuilt + hollowed-out remit is a strong negative signal. It ships disabled, the acquisition half isn't built, and ADR 037 already carved away its biggest use case. If no operator turns it on, DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820 builds a speculative-spend engine and a fail-closed RPC subscription that sit dead — pure carrying cost in the design corpus and the dependency graph.
Recommendation
Lean: defer #820 / demote prefetch to "oracle-only," and put a decision in ADR 022. Concretely:
- Keep the FIND_VALUE
PopularityTrackeras an observability signal (decdn_prefetch_*popularity metrics) — it's honest and free. - Keep STORE-on-commit and the reactive warming + pinning paths — they already deliver locality and demand-driven replication with bounded, customer-anchored loss.
- Do not build the speculative acquisition path (DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820) in the initial network. The only thing it adds over the reactive paths is global-popularity replication at a geographically-random node, bought with the system's only spend-ahead-of-customer surface and its heaviest Sybil/gate complexity — a poor trade when no current data shows hot content is under-replicated.
- If we later observe real hot-content under-replication or single-origin overload that reactive paths don't absorb, revisit with that data — the decision layer from PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 keeps that option cheap.
This is a recommendation, not a foregone conclusion — the strongest KEEP argument (the expensive analysis/decision layer is already built and closed) is real. The question is whether global-popularity replication at a keyspace-random node is worth the only speculative-spend path in the protocol.
Decision requested
- Build it — proceed with DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820 as specified (finish acquisition + origin subscription + ledger feedback).
- Defer it — keep DHT: prefetch and popularity signals (ACs 7-8 of #320, ADR 022 §Popularity Signals) #650/PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819's decision layer dormant, do not build DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820 now, leave
prefetch.enabledoff and revisit with operational data. (recommended) - Drop it — demote the FIND_VALUE signal to observability-only, retire the speculative-acquisition decision from ADR 022 (and reassess DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820/No
require_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821), document the reactive-warming + pinning coverage as the replacement.
References
- ADR 022 § Popularity Signals / § Prefetch Decision —
adr/022-content-discovery.md - ADR 037 (locality is reactive, prefetch narrowed to keyspace monetization) —
adr/037-regional-proxy-warming.md - Prefetch metrics —
adr/appendix-observability.md§ Prefetch Metrics - Pinning / eviction —
crates/cache/src/engine.rs,adr/appendix-blob-cache-eviction.md - Related issues: DHT: prefetch and popularity signals (ACs 7-8 of #320, ADR 022 §Popularity Signals) #650 (oracle + decision), DHT prefetch: live FindValue→probe→pull-through acquisition + OriginAssignment subscription (AC 7 of #650) #820 (acquisition wiring — the work this decision gates), No
require_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 (reactive-path opt-out, gate-spawned), Regional locality: latency-driven proxy warming bootstraps the first regional cache copy #723 (ADR 037 proxy warming, shipped), tests: no integration test for cdn/client/v1 node-to-node paid pull-through covering cache miss, upstream payment channel creation, and simultaneous client streaming #746 (node-to-node pull-through, landed)
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon Jun 5, 2026
🎯 Triage report
This is a well-scoped architectural decision issue requesting an explicit keep/defer/drop call on FIND_VALUE-driven speculative prefetch acquisition (ADR 022). The decision layer has already shipped behind
prefetch.enabled = false(PR #819); this issue gates whether to build the acquisition wiring in #820. The author presents a balanced steelman analysis and leans toward deferral, on the grounds that ADR 037's reactive proxy warming has taken over prefetch's primary locality use case, leaving only global-popularity replication at a geographically-random keyspace node — bought at the cost of the protocol's only spend-ahead-of-customer surface and its heaviest Sybil/gate complexity.📊 Assessment
adr-review,economics,missing-decision,architecture)highcould reflect that this is blocking #820 active work, but urgency is self-described as a "natural decision point" rather than critical🔗 Similar issues
require_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 (related — a surface spawned by the prefetch gate itself; the "no opt-out symmetry on reactive path" issue that disappears if prefetch is dropped)💡 Notes and suggestions
Key framing for the decision:
The KEEP steelman's strongest point is that the expensive part (analysis engine, config, metrics, threat-model closure) is already sunk cost in PR #819 — the marginal effort is only the acquisition wiring in #820. The DROP/DEFER steelman's strongest point is that
prefetch.enabled = false+ unbuilt acquisition + ADR 037 having carved away the locality use case is a three-signal negative indicator: the feature's primary justification dissolved before it shipped.Decision implications by path:
OriginAssignmentevent subscription with fail-closed semantics, spend-budget circuit-breaker, demand-quality auto-throttle, plus resolving Norequire_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821. Only justified if the team explicitly values keyspace-position monetization and global-popularity replication as a protocol incentive.decdn_prefetch_*metrics) keeps running, generating operational data. Decision stays reopenable cheaply once there is evidence of hot-content under-replication. Norequire_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 remains open but non-urgent.require_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821; record the rationale in ADR 022. Demote FIND_VALUE frequency to observability-only. Reduces design-corpus carrying cost; thePopularityTracker/PrefetchPolicycode in PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 can be scoped down or retained as dead-but-harmless observability infrastructure.Suggested sub-tasks once a decision is made:
adr/022-content-discovery.md) under a new## Decision (post-ADR 037)section, cross-referencing ADR 037 §Cross-ADR Impactrequire_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821's status accordinglyPrefetchPolicy/PrefetchConfigtypes from PR feat(node): add DHT prefetch popularity signal + decision engine (#650) #819 should be removed from the codebase or retained as observability-only scaffoldingadr/appendix-observability.md§Prefetch Metrics to reflect the post-decision scopeNote: The issue already carries all appropriate labels. No additional label changes are needed.
Add this agentic workflows to your repo
To install this agentic workflow, run
alpergundogdu commentedon Jun 15, 2026
Decision: KEEP — off by default, dormant, operator-opt-in
Full memo:
adr/_decisions/822-find-value-prefetch.md.The premise has gone stale
This issue asks whether to spend the #820 effort "before we spend the #820 effort." That effort is already merged —
1d92267(PR #899) wired the liveFindValue → probe → pull-throughacquisition, theOriginAssignmentsubscription (ChainOriginDirectory), and the ledger feedback loop; #900/#909 added test coverage. So the question is no longer "should we build it" but "should we keep what's built," and that inverts the cost ledger:prefetch.enabled = false.Why keep on the merits (not just sunk cost)
Speculative prefetch is not redundant with the shipped mechanisms. Origin pull-through, ADR 037 proxy warming, and pinning all warm a node only when it receives a real paid request (or a manual pin). Prefetch is the only mechanism that warms a node close to
Hin Kademlia keyspace that never gets a paid request forH— the keyspace-positioned node's non-suppressible view of global demand. The ADRs already designed these as complements (ADR 022 §Popularity Signals; ADR 037 Cross-ADR note: "narrows the FIND_VALUE-frequency prefetch to keyspace-position monetization"). Without prefetch, the FIND_VALUE oracle is pure observability — the node sees demand it can never act on.The fair counter-arguments — speculative value, real Sybil surface, ~nil benefit at the current "tens of nodes" testnet scale — argue against enabling by default (which we also reject), not against keeping an off-by-default, gated, tested capability.
Conditions on KEEP
Dispositions
require_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 (norequire_authorized_originopt-out on the reactive path): keep open, decouple from this issue. It's a legitimate operator ask on its own merits (kept content-agnostic — an operator-local refusal knob, not an on-chain content gate). Whether to build the symmetric gate now is a separate call.Independent finding (separate from this decision)
ChainOriginDirectory(#651) is currently wired only to prefetch; the node-origin FIND_VALUE fallback gets an empty directory (deliberate "initial network" deferral,runtime/mod.rs:1349-1353), while ADR 022 §Origin discovery mandates the on-chain origin set as the FIND_VALUE last-resort fallback independent of prefetch. Filed separately as a follow-up.Closing as decided: KEEP.