Skip to content

ADR 022: Content discovery via cdn/dht/v1 (Kademlia) from PoC onward - #194

Merged
thiras merged 2 commits into
mainfrom
adr/022-content-discovery
Apr 8, 2026
Merged

thiras merged 2 commits into
mainfrom
adr/022-content-discovery

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

Closes part of #190 (Missing ADRs — Content Discovery at Scale).

Adds ADR 022 and updates four existing ADRs for cross-ADR consistency.

Decision

cdn/dht/v1 — a lightweight Kademlia subset over iroh QUIC — is the primary content discovery mechanism from PoC day one. Probe fan-out (cdn/probe/v1) is retained as:

  • Bootstrap fallback (while routing table < k entries)
  • Emergency fallback (if DHT returns no providers)

At PoC scale (30 nodes), FIND_VALUE resolves in 1–2 hops, overhead is negligible.

Why DHT from the start

  • Hash-prefix range hints rejected: economically irrational (nodes cache popular content, not hash ranges)
  • Gossip content announcements rejected: unbounded churn traffic proportional to demand × network size
  • Phased rollout dropped: no complexity threshold where fan-out is cheaper than a 1-hop DHT at 30 nodes

Popularity signals

  1. popular_hashes gossip — advisory, suppression is self-limiting (hiding popular content raises LoadHint, reduces selection score)
  2. DHT FIND_VALUE query frequency — non-suppressible honest oracle (routing traffic reaches keyspace-close nodes regardless of what nodes gossip)

Cross-ADR updates

  • ADR 001: Content discovery section rewritten; Future Work block resolved and struck; prefetch/Consequences/pref sections updated
  • ADR 005: Protocol gossip description updated to cdn/dht/v1
  • ADR 012: Client content discovery bullet updated
  • architecture.md: ADR 022 summary, cache miss flow, pull-through, prefetch, indexer, CRDT sections all updated

- Add adr/022-content-discovery.md: lightweight Kademlia subset over iroh QUIC
  as primary discovery mechanism from PoC day one. Probe fan-out retained as
  bootstrap fallback (routing table < k entries) and emergency fallback (DHT miss).
  Two popularity signals: popular_hashes gossip (advisory) and DHT FIND_VALUE
  query frequency (non-suppressible oracle). No discovery fees. Market dynamics
  section explains self-limiting suppression and honest-oracle properties.

- Update adr/001-network.md: rewrite Content Discovery section (DHT + Probe),
  remove three-strategy Future Work block (now resolved by ADR 022), update
  prefetch path, Consequences section, and cross-references throughout.

- Update adr/005-protocol.md: change content discovery description from probe
  fan-out to cdn/dht/v1 + cdn/probe/v1; update anchor reference.

- Update adr/012-client.md: client now uses DHT FIND_VALUE for discovery,
  falls back to broadcast probe during bootstrap.

- Update adr/architecture.md: ADR 022 summary updated to DHT-from-day-one,
  cache miss and pull-through descriptions updated, CRDT/indexer sections
  updated to reflect DHT as primary; multiple probe fan-out references replaced.

Co-authored-by: Copilot <[email protected]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces ADR 022, which establishes a Kademlia-based content DHT (cdn/dht/v1) as the primary content discovery mechanism, replacing the O(N) broadcast probe fan-out approach. The changes update the network, protocol, and client ADRs to reflect this O(log N) discovery model and define new popularity signals. Feedback identifies a missing 'Key Invariants' heading in the architecture document and an inconsistency in the summarized DHT rollout strategy compared to the authoritative specification.

Comment thread adr/architecture.md Resolved
Comment thread adr/architecture.md Resolved
…Is Not Decided Yet

- Restore accidentally-removed '## Key Invariants' heading above the
  invariant bullet list in architecture.md
- Replace stale phased-rollout description of ADR 022 with correct
  DHT-from-day-one summary

Co-authored-by: Copilot <[email protected]>
@thiras
thiras merged commit 41f9196 into main Apr 8, 2026
@thiras
thiras deleted the adr/022-content-discovery branch April 8, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants