Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a design for separating node discovery from content discovery to address scaling issues with Bloom filters in gossip messages. It replaces the CacheAnnounce mechanism with NodeAnnounce for node metadata and utilizes a probe fan-out strategy for on-demand content discovery. Feedback on the design highlights that the proposed data structures for tracking local demand and network popularity are insufficient for implementing time-windowed thresholds, suggesting the use of timestamp lists instead to accurately trigger prefetching.
There was a problem hiding this comment.
Pull request overview
Adds a new design spec that proposes separating node discovery (gossip) from content discovery (on-demand probe fan-out) to address the Bloom filter/hash list scaling concerns raised in #25.
Changes:
- Introduces a
NodeAnnouncegossip message carrying only node-level metadata (plus popularity hints). - Defines cache-miss resolution via
cdn/probe/v1fan-out with a short-lived probe-result cache. - Describes dual-signal prefetching (local demand + network popularity) and outlines intended ADR impact.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the network and content discovery architecture across several ADRs, transitioning from a gossip-based content discovery model to an on-demand probe fan-out mechanism. Key changes include the introduction of the NodeAnnounce structure for lightweight node metadata, the replacement of the global routing table with a peer table, and the implementation of a short-lived probe cache. Prefetching logic has also been updated to utilize local demand and network popularity signals. Feedback was provided to elevate a note regarding a potential race condition between the probe cache TTL and the slashing window to a formal requirement or warning to ensure it is not overlooked during implementation.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
48805b9 to
6ce4fcf
Compare
Replaces CacheAnnounce gossip with probe-based content discovery, resolving issue #25 (Bloom filter parameter problems) by eliminating Bloom filters and hash list broadcasts entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix local demand tracking: use VecDeque<u64> timestamps instead of (count, last_seen) to support sliding window threshold - Fix network popularity tracking: store per-peer announcement timestamps - Clarify routing table removal vs probe cache distinction - Fix architecture.md path reference to adr/architecture.md - Reword privacy trade-off: popularity is a new gossiped signal, content availability is now probe-discoverable only - Note probe cache TTL overlap with slashing evidence window Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Plan covers updates to ADR 001, 005, 008, and architecture.md to replace CacheAnnounce with NodeAnnounce and probe fan-out content discovery. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove Bloom filters, hash lists, and gossip-derived routing tables. Add NodeAnnounce gossip, probe fan-out content discovery, probe cache, and dual-signal prefetching. Reframe DHT future work for scaling probe fan-out. Resolves #25. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Gossip now carries node metadata (NodeAnnounce) instead of content inventories. Content discovery handled via cdn/probe/v1 fan-out.
Replace CacheAnnounce with NodeAnnounce in system diagram and ADR summaries. Update cache miss flow to probe fan-out model. Update prefetching to dual-signal model. Update future work section.
Update routing table → peer table in ADR 003, 004, 005. Update CacheAnnounce → NodeAnnounce in ADR 003 gossip flooding. Update cache miss flowchart in architecture.md to probe fan-out. Update ADR 005 probe section to reference peer probing not routing table. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Design specs and implementation plans are working artifacts, not permanent repo content. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix stale "content availability broadcast via gossip" in ADR 003 - Fix "announced content" and "deprioritized in routing" in ADR 003 - Fix "content routing announces" in ADR 004 auto-ejection - Clarify "routing table" references in ADR 001 consequences - Clarify probe cache TTL = slashing window overlap in ADR 001 - Fix "observe probe traffic" in architecture.md future work - Update ADR 000 gossip description to NodeAnnounce - Add NodeAnnounce struct cross-reference in ADR 005 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Rename NodeAnnounce timestamp → timestamp_us for protocol consistency - Specify signature covers all fields via postcard serialization - Add gossip validation rules (signature + registry check) to ADR 001 - Store full signed ProbeResponse in probe cache for slashing evidence - Cross-reference ADR 001 validation from ADR 004 auto-ejection Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ecture Clarify that the app server (key delivery, subscription auth) is a traditional web service operated by content providers, not part of the CDN protocol or crate structure. Add External Components section to architecture.md, update network diagram to show provider infrastructure, and detail the app server's API surface and scaling model in ADR 006. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
6ce4fcf to
567a089
Compare
Remove Bloom filter spec from ADR 001 — PR #44 proposes a broader discovery redesign that may eliminate Bloom filters entirely. Leaving #25 for that PR to resolve. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Commit to 15s probe cache TTL (half the 30s slashing window) - Add NodeAnnounce replay prevention (timestamp freshness ±60s + monotonic check) - Increase probe timeout from 200ms to 500ms for inter-continental coverage - Add registry freshness check before paid pulls (new step 5) - Add probe rate limits (10 outbound fan-outs/s, 20 inbound/peer/s) - Try next cached provider before falling back to full fan-out Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
LGTM, merge directly or into PR 85 @thiras |
Integrates the NodeAnnounce/probe fan-out redesign from PR #44 into the batch ADR fix branch, consolidating both PRs into one. Key changes from PR #44: - Replace CacheAnnounce with lightweight NodeAnnounce (~700 bytes) - On-demand probe fan-out for content discovery (no routing tables) - 15s probe cache TTL (half the 30s slashing evidence window) - 500ms probe timeout for inter-continental coverage - Gossip validation: signature, registry, timestamp freshness, monotonic - Registry check before paid pulls (content discovery step 5) - Probe rate limits: 10 outbound fan-outs/s, 20 inbound/peer/s - Cascading cached provider fallback before full fan-out - Prefetching via local demand + network popularity signals - App server as external component (WebSocket/SSE, not cdn/keys/v1) Conflict resolution preserved PR #85's additions: - Node Selection Algorithm with reputation weighting - Registry Unavailability with retry/fallback - Redirect loop prevention, StreamError enum, retry semantics - Challenge bond, channel expiry, NodeId-to-Ethereum binding - ADRs 007, 009, 010, 011 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Consolidated into PR #85 (fix/adr-wave-1-critical-foundations). All changes from this PR — the NodeAnnounce/probe fan-out redesign, Alper's review feedback (probe cache TTL, replay prevention, probe timeout, registry check, rate limits, cached provider fallback), and the app server externalization — have been merged into PR #85 with conflicts resolved. Stale CacheAnnounce and cdn/keys/v1 references in PR #85's ADRs (007, 009, 010, 011) have been updated to reflect the new design. |
…85) * docs: add design spec for separated node/content discovery Replaces CacheAnnounce gossip with probe-based content discovery, resolving issue #25 (Bloom filter parameter problems) by eliminating Bloom filters and hash list broadcasts entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address review feedback on discovery design spec - Fix local demand tracking: use VecDeque<u64> timestamps instead of (count, last_seen) to support sliding window threshold - Fix network popularity tracking: store per-peer announcement timestamps - Clarify routing table removal vs probe cache distinction - Fix architecture.md path reference to adr/architecture.md - Reword privacy trade-off: popularity is a new gossiped signal, content availability is now probe-discoverable only - Note probe cache TTL overlap with slashing evidence window Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: add implementation plan for separated discovery ADR updates Plan covers updates to ADR 001, 005, 008, and architecture.md to replace CacheAnnounce with NodeAnnounce and probe fan-out content discovery. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs(adr-001): replace CacheAnnounce with NodeAnnounce and probe fan-out Remove Bloom filters, hash lists, and gossip-derived routing tables. Add NodeAnnounce gossip, probe fan-out content discovery, probe cache, and dual-signal prefetching. Reframe DHT future work for scaling probe fan-out. Resolves #25. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * docs(adr-005): update gossip section from CacheAnnounce to NodeAnnounce Gossip now carries node metadata (NodeAnnounce) instead of content inventories. Content discovery handled via cdn/probe/v1 fan-out. * docs(adr-008): make LoadHint cross-reference to ADR 001 concrete * docs(architecture): update for separated node/content discovery Replace CacheAnnounce with NodeAnnounce in system diagram and ADR summaries. Update cache miss flow to probe fan-out model. Update prefetching to dual-signal model. Update future work section. * docs: fix remaining stale references from CacheAnnounce migration Update routing table → peer table in ADR 003, 004, 005. Update CacheAnnounce → NodeAnnounce in ADR 003 gossip flooding. Update cache miss flowchart in architecture.md to probe fan-out. Update ADR 005 probe section to reference peer probing not routing table. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * chore: remove superpowers working artifacts Design specs and implementation plans are working artifacts, not permanent repo content. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix review findings across ADRs - Fix stale "content availability broadcast via gossip" in ADR 003 - Fix "announced content" and "deprioritized in routing" in ADR 003 - Fix "content routing announces" in ADR 004 auto-ejection - Clarify "routing table" references in ADR 001 consequences - Clarify probe cache TTL = slashing window overlap in ADR 001 - Fix "observe probe traffic" in architecture.md future work - Update ADR 000 gossip description to NodeAnnounce - Add NodeAnnounce struct cross-reference in ADR 005 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address second-round review feedback - Rename NodeAnnounce timestamp → timestamp_us for protocol consistency - Specify signature covers all fields via postcard serialization - Add gossip validation rules (signature + registry check) to ADR 001 - Store full signed ProbeResponse in probe cache for slashing evidence - Cross-reference ADR 001 validation from ADR 004 auto-ejection Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: document app server as external component in ADR 006 and architecture Clarify that the app server (key delivery, subscription auth) is a traditional web service operated by content providers, not part of the CDN protocol or crate structure. Add External Components section to architecture.md, update network diagram to show provider infrastructure, and detail the app server's API surface and scaling model in ADR 006. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: add NodeId-to-Ethereum binding spec and PoC challenge bond (#57, #58) - ADR 003: Add full NodeId-to-Ethereum binding section with EIP-712 typed data, on-chain registration via StakingRegistry.bindNodeId(), and ephemeral off-chain binding for clients - ADR 004: Add 100 TOKEN challenge bond for PoC (was N/A), preventing zero-cost griefing via fabricated slash claims - ADR 005: Reference challenge bond requirement in probe slashing section Closes #57, closes #58 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix ADR 003 payment channel gaps (#73, #72, #67, #66, #61) - Reject probe-requires-channel option (bootstrap catch-22) - Clarify clock skew immunity in rate manipulation detection - Define channel expiry (maxChannelDuration: 90 days) and reclaimExpired - Specify nonce as on-chain per-client monotonic counter with pre-computation - Add Concurrent Streams subsection with rules, example, and isolation advice Closes #73, closes #72, closes #67, closes #66, closes #61 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix network and reputation issues (#71, #70, #25, #6, #77, #63, #62) ADR 001: - Add registry unavailability fallback with retry and cached peer list - Document region hint limitations and PoC latency-based detection - Specify Bloom filter parameters (1% FPR, k=10, 14.4 bits/item) - Define unified node selection algorithm: rate × rtt × (1/reputation²) ADR 008: - Add 1-hour recency validation for gossip reputation reports - Fix bootstrap division-by-zero with max(1, ...) guard - Switch reporter weight from channel count to settled USDC value Closes #71, closes #70, closes #25, closes #6, closes #77, closes #63, closes #62 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix ADR 005 protocol gaps (#75, #69, #29, #24) - Document dual-connection overhead and production optimization path - Add redirect loop prevention (max 3 hops, cycle detection) - Add Error Handling section with StreamError enum, retry semantics, timeouts - Define postcard schema evolution strategy (trailing Option<T> for non-breaking, new ALPN for breaking) - Update challenge bond references to reflect PoC implementation Closes #75, closes #69, closes #29, closes #24 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix encryption and governance issues (#76, #68, #26, #16, #78, #65) ADR 006: - Reduce offline lease TTL from 30 to 7 days with mandatory daily check-in - Add key rotation notification via iroh-gossip EpochRotated message - Use iroh QUIC stream for PoC epoch key delivery (not WebSocket/SSE) - Add key hierarchy: per-content epoch keys derived from server_secret ADR 009: - Define pause sunset as immutable constructor deadline with upgrade-only extension - Tighten safety bounds: slash 5-50%, dispute window 12h-72h, rate floor >= 1 ADR 003 (consistency): - Update dispute window safety bounds to match ADR 009 (12h-72h) Closes #76, closes #68, closes #26, closes #16, closes #78, closes #65 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix multi-token, takedown, and tokenomics issues (#59, #84, #80, #81, #64, #60, #74) ADR 010: - Resolve slashing denomination: always in TOKEN stake, no cross-token conversion - Fix backward-compat contradiction: payment_token requires cdn/client/v2 - Clarify SafeERC20 rationale (USDT non-returning transfer pattern) ADR 011: - Add blacklist version sync recovery (delta, full re-sync, cache scan fallback) - Document self-reported region limitation with production mitigation path ADR 004: - Restrict PoC mint() to onlyOwner, document production removal - Define PoC slash counter reset: 30 days without incidents Closes #59, closes #84, closes #80, closes #81, closes #64, closes #60, closes #74 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: cross-ADR analysis and architecture sync (#17, #11, #45, #15) ADR 007: - Add Fee Accountability section: PoC trust-based, production escrow with heartbeats ADR 004: - Add production bootstrap modeling table (100/500/1000 nodes) - Document reflexive TOKEN price dependency risk architecture.md: - Add Gossip Bandwidth Budget section (~6 KB/s per node at PoC scale) - Add Privacy Surface section consolidating all privacy tradeoffs - Sync overview sections: unified selection score, 4 ALPNs, value-weighted reputation, tightened safety bounds, NodeId binding, challenge bonds Closes #17, closes #11, closes #45, closes #15 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: remove blocked issues #24, #11, #45 from batch fix Revert changes for blocked issues: - #24: Remove Schema Evolution Strategy section from ADR 005 - #11: Remove Gossip Bandwidth Budget section from architecture.md - #45: Remove Privacy Surface section from architecture.md Update #84 cross-reference to not depend on removed #24 section. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: fix cross-ADR consistency issues found in PR review - Fix slash 100% exceeding governance max 50%: production third offense now 50% (cumulative slashing triggers auto-ejection) - Fix rate floor: ADR 003 safety bounds now >= 1 base unit (was 0), matching ADR 009 - Fix channel expiry: ADR 010 references updated from 30 to 90 days - Fix dispute window: "24-hour" hardcoded references now say "default 24h, governable 12h-72h" - Update ADR 005 and architecture.md to reference unified selection score - Fix "Three ALPN" heading to "Four ALPN" (watchtower was added) - Disambiguate cdn/keys/v1 ALPN from cdn/keys/rotation/v1 gossip topic Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address remaining PR review findings - ADR 005: Update mermaid diagram to reference unified selection score - ADR 003: Add ChannelExpiredReclaimed event for reclaimExpired - ADR 003: Add reclaimExpired to channel close lifecycle documentation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address Copilot and Gemini review comments - ADR 003: Reject bindNodeId if nodeId already bound to different address - ADR 003: Clarify nonce read-then-increment ordering for channelId - ADR 004: Fix challenge bond rationale (testnet token has no economic cost) - ADR 008: Add future-timestamp rejection + clock sync dependency note - ADR 001: Clamp reputation to min 0.1 in selection score (avoid div-by-zero) - ADR 001: Correct Bloom filter FPR from 1% to 0.1% (matches k=10, m=14.4) - ADR 009: Add Min deposit row to governance parameters table Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address second round of review comments - ADR 003: Remove duplicate reclaimExpired lifecycle entry - ADR 005: Add error? field to StreamResponse wire format diagram - ADR 006: Fix key hierarchy opening sentence (limits client-key compromise blast radius, not server_secret compromise) - architecture.md: Link to ADR 001 for selection score instead of inlining formula without clamp Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: integrate cdn/keys/v1 protocol detail from PR #47 Moves the detailed cdn/keys/v1 spec from PR #47 into this batch fix: - ADR 006: Full protocol messages (KeySessionOpen, EpochKeyUpdate, EnvelopeRequest/Response), app server as iroh Endpoint, dual-stream pattern, authentication model, concurrent session limiting - ADR 005: cdn/keys/v1 in ALPN table (five protocols), stream limits (10: 1 epoch + 9 envelopes), connection lifetime exception - architecture.md: cdn/keys/v1 in ALPN table, updated ADR 006 summary - CLAUDE.md: cdn/keys/v1 and cdn/watchtower/v1 in ALPN table Supersedes #47 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: revert Bloom filter parameter changes (#25) Remove Bloom filter spec from ADR 001 — PR #44 proposes a broader discovery redesign that may eliminate Bloom filters entirely. Leaving #25 for that PR to resolve. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: remove premature backward-compat complexity from ADR 010 ADR 010 is a draft for a post-PoC feature with no deployed v1 to be backward-compatible with. Simplify: - Revert cdn/client/v1→v2 versioning back to just cdn/client/v1 - Replace 3-phase migration plan with simple contract replacement - Remove "old nodes"/"legacy"/"backward-compatible" framing Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * docs: address Alper's review feedback on probe and gossip design - Commit to 15s probe cache TTL (half the 30s slashing window) - Add NodeAnnounce replay prevention (timestamp freshness ±60s + monotonic check) - Increase probe timeout from 200ms to 500ms for inter-continental coverage - Add registry freshness check before paid pulls (new step 5) - Add probe rate limits (10 outbound fan-outs/s, 20 inbound/peer/s) - Try next cached provider before falling back to full fan-out Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Summary
CacheAnnounce, Bloom filters, and hash list broadcasts entirely — replaces with lightweightNodeAnnouncegossip (~700 bytes) + on-demandcdn/probe/v1fan-outadr/architecture.md, and fixes stale references in ADR 003, 004Test plan
CacheAnnounce/routing tablereferences — should be zero🤖 Generated with Claude Code