Repository navigation
refactor: remove the residual authorized-origin content-authorization gate - #1525
Conversation
… gate The `pull_through_require_authorized_origin` gate refused to initiate a backend pull/warm for a request whose `namespaceId` had no on-chain authorized origin. But ADR 002 is explicit that the request namespace is a **routing hint, not a trust anchor** — so using it as a serve-authorization decision was residual: a husk left after the per-hash on-chain claim layer was removed. ADR 037 already documented that the gate was namespace-scoped, not operator-scoped (#1368), and authorized nothing per-content (it admitted a serve for any hash in any namespace that had *any* registered origin, even one assigned to a different operator). Remove the gate and everything specific to it: `pull_origin_gate` / `pull_origin_gate_blocks`, `OriginDirectory::has_origin` (its only consumer), `ServeRejectReason::UnauthorizedOrigin` and its wire mapping + metric, the `cache.pull_through_require_authorized_origin` config across all three layers, the `launch_authorized_origin` e2e fixture, and the three `g_node_08_*` tests that existed only to exercise the gate. KEEP the origin directory and `lookup_origins`: that is the legitimate node→node *routing* mechanism (find which upstream origins to pull from for a namespace), which ADR 002/022 sanction. Namespace stays routing-only. Safe by construction: the gate was opt-in and default-off, and the real protections are untouched — `pull_authorized` (channel ownership, the actual unpaid-egress guard), the seed-leech caps, `ContentBlacklist`, and BLAKE3 verification. ADRs 037/022/019/011 updated to match. 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 (22)
💤 Files with no reviewable changes (13)
WalkthroughThe pull-through authorized-origin configuration and enforcement path are removed. Origin discovery now supplies routing candidates directly, runtime and client wiring are simplified, related metrics and tests are updated, and ADRs describe routing-only origin assignments and blacklist-based handling. ChangesAuthorized-origin pull gating removal
Estimated code review effort: 3 (Moderate) | ~25 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 |
Coverage reportTotal: 80.16% (was 80.15%, ▲ +0.01%) — 53874/67205 lines
History
|
…review)
Two accuracy fixes from PR review:
- ADR 037 said the probe `has_blob` answer is "unsigned"; it is signed
(EIP-712 `slash_sig` over `{hash, has_blob, rate_per_mb, timestamp_us}`).
The real point is that `ProbeResponse` carries no policy/role field, so a
client cannot tell an origin-only node from a relay edge — reworded to say
exactly that.
- ADR 002 described the origin-only decline in namespace terms, risking the
implication that `namespaceId` drives the serve/decline decision. The gate
is backend-authoritative (`origin_probe_presence(hash)`) and never consults
`namespaceId`, which stays a routing hint (#1525). Reworded to backend
presence and stated the non-consultation explicitly.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
) (#2055) * docs(adr): record proxy-warming vs origin-only policy composition (#1990) Two deliberate policies interact in a way neither ADR documented: the client's cold-blob / warming fallback (ADR 037) targets RTT-nearest non-holders, and an origin-configured node defaults to origin-only (`relay_foreign_namespaces = false`, #1759) and declines a foreign miss. The fallback can therefore route a warming attempt to a node that categorically declines it. Run through spec discipline, the two policies compose correctly rather than conflict: proxy warming is a relay-edge mechanism by construction, and an origin-only node declining a warming pull is the origin-only policy holding, not a warming failure. The decline collapses to `NotFound`, the client fails over over the shared pool at the cost of one round-trip, and pays nothing. Document the composition: - ADR 037 gains a "Warming is a relay-edge mechanism" section and a Cross-ADR Impact bullet for ADR 002. - ADR 002 § Retrieval by namespace gains the canonical statement of the `relay_foreign_namespaces` role-derived policy (previously code-only, referenced obliquely by ADR 041 as "a separate policy"). No mechanism is added. The two options that would (a self-attested probe flag to pre-filter origin-only nodes, and reversing the #1759 default) stay out — both add surface to force an optimization that is correctly not firing. The interaction is already observable: the serving node counts declines in `decdn_serve_stream_rejected_foreign_declined_total` (exists since #1766) and the client logs its warming lead and each failover; the client is an ephemeral CLI with no scrape endpoint, so a client-side counter would be dead instrumentation. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(adr): fix probe-signing and namespace-vs-backend wording (#1990 review) Two accuracy fixes from PR review: - ADR 037 said the probe `has_blob` answer is "unsigned"; it is signed (EIP-712 `slash_sig` over `{hash, has_blob, rate_per_mb, timestamp_us}`). The real point is that `ProbeResponse` carries no policy/role field, so a client cannot tell an origin-only node from a relay edge — reworded to say exactly that. - ADR 002 described the origin-only decline in namespace terms, risking the implication that `namespaceId` drives the serve/decline decision. The gate is backend-authoritative (`origin_probe_presence(hash)`) and never consults `namespaceId`, which stays a routing hint (#1525). Reworded to backend presence and stated the non-consultation explicitly. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Summary
Removes the
pull_through_require_authorized_origingate. It refused to initiate a backend pull/warm for a request whosenamespaceIdhad no on-chain authorized origin — treating the request namespace as a serve-authorization trust anchor. But ADR 002 § Hash-to-namespace association is explicit that the namespace is a routing hint, not a trust anchor. So the gate was residual: a husk left after the per-hash on-chain claim layer was removed.The gate never authorized anything per-content. As ADR 037 §87 itself documented, it was namespace-scoped, not operator-scoped (#1368): it admitted a serve for any hash in any namespace with any registered origin — "even one the DAO assigned to a different operator." An operator couldn't express "don't serve a namespace I'm not assigned to" through it at all.
What's removed
pull_origin_gate/pull_origin_gate_blocks(the serve-path check)OriginDirectory::has_origin(its only consumer)ServeRejectReason::UnauthorizedOrigin+ its wire mapping + theserve_stream_rejected_unauthorized_originmetriccache.pull_through_require_authorized_originconfig — raw, resolved, and reload layers + literalslaunch_authorized_origine2e fixture and the threeg_node_08_*tests (they existed only to exercise the gate)What's kept
The origin directory and
lookup_originsstay — that's the legitimate node→node routing mechanism (node_origin.rsuses it to find which upstream origins to pull from for a namespace), which ADR 002/022 sanction. Namespace stays routing-only.Why it's safe
The gate was opt-in and default-off, so removal is behavior-neutral for anyone not opted in (effectively everyone on testnet). The real protections are untouched:
pull_authorized— channel-ownership, the actual guard against unpaid upstream egressContentBlacklist— removes unwanted content once heldVerification
cargo build,cargo clippy --workspace --all-targets,cargo fmt --check,cargo nextest run(2655/2655), and bothcargo test --no-run -p decdn-{e2e,node} --features anvil-e2egates all green. Pre-commit markdownlint + ADR reference-hygiene pass on the ADR edits.Net: 22 files, +23 / −1245.
🤖 Generated with Claude Code
Summary by CodeRabbit
Behavior Changes
Configuration
Documentation