Repository navigation
fix(cli): send the ADR 005 client identity binding on decdn fetch (#1115) - #1124
Conversation
) A direct `decdn fetch` never sent an ADR 005 client identity binding, so the node's `pull_authorized` gate always failed for client fetches: a cache miss for a blob present only in the node's configured `cache.origin` was refused as `NotFound`, and the origin was never read. The "operator hand-curates an fs/http/s3 origin, clients fetch on demand" flow was non-functional. The client now signs an ephemeral `BindNodeId(nodeId, nonce=0)` attestation over its OWN iroh NodeId with the buyer key, under the `CapacityBond` domain, and attaches it to every `cdn/client/v1` request's `ext`. The serving node recovers the buyer address, confirms it owns the named channel, and reactively populates from its origin. - client-pull: add `sign_client_binding` + `ChannelContext::with_client_binding` and a `client_binding: Option<ClientBinding>` field; `fetch_inner` and `open_progressive_pull` attach the binding when present (absent => byte-for-byte the pre-#1115 wire, so unbound node->node pulls are unchanged pending #1117). - cli/fetch: sign + attach the binding when `capacity_bond_address` is set; warn and fall back to prior behavior when it is not. - tests: loopback proof that a bound fetch of an origin-only blob populates from the fs origin and serves, with an unbound control that is refused. The reusable helpers are shaped for #1117 (node->node chained binding). Local origin / node->node flag decoupling remains #1116. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The serve-path note and the e2e pre-warm comment still said `stream_fetch` sends no ownership binding. After #1115 the direct-client `decdn fetch` does; the remaining gap is the node→node requester (`node_origin`, #1117). The e2e `ClientFixture` sends none by choice (`client_binding: None`). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 35 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)
WalkthroughChangesThe pull client now carries optional ADR 005 client bindings, signs them for configured capacity-bond chains, and conditionally encodes them in buffered and progressive requests. Tests cover bound and unbound origin pull-through, while existing contexts and documentation are updated for the new field. Client identity binding
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as CLI fetch
participant Pull as client-pull
participant Node as serve_stream
participant Origin as filesystem origin
CLI->>Pull: provide signed ClientBinding in ChannelContext
Pull->>Node: send StreamRequest with binding extension
Node->>Origin: request blob on cache miss
Origin-->>Node: return blob
Node-->>Pull: deliver verified blob
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 |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
There was a problem hiding this comment.
Code Review
This pull request implements the ADR 005 client identity binding for the direct-client fetch command, allowing clients to prove channel ownership to serving nodes. This is achieved by signing the client's own Iroh NodeId with the buyer key using EIP-712. The signed binding is attached to stream requests, enabling reactive origin pull-through on cache misses. Unbound requests are safely refused. The changes also include comprehensive integration tests verifying this behavior. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage reportTotal: 80.36% (was 80.34%, ▲ +0.02%) — 44900/55876 lines
History
|
…ssertions) Applies the review feedback on the #1115 client-binding change: - fetch: drop the always-on `capacity_bond_address` unset warning (it fired on every successful cached fetch too, a false positive that trains users to ignore it). Instead, when an UNBOUND request is refused with NotFound, attach an actionable hint at the point of failure via `annotate_unbound_cache_miss`, reconnecting the opaque `delivery refused: NotFound` to its cause. Unit-tested (unbound+NotFound → hint; bound → untouched; non-NotFound → untouched). - tests: wire `CacheMetrics` into `empty_cache_with_fs_origin` and assert `origin_fetches == 1` on the bound path and `== 0` on the unbound path — the negative control now proves the gate short-circuits BEFORE any origin egress (the anti-griefing guarantee), not just that it refused. - client-pull: add a `client_binding_ext` unit test locking the shared bound/unbound → ext mapping both request sites depend on. - docs: steer `with_client_binding` callers to `sign_client_binding`; soften the `sign_client_binding` #1117 "reusable" claim to "once wired, not yet a caller"; tighten the e2e pre-warm comment ("reactive pull-through is not attached by default" vs the narrower "node-to-node"). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…pulate + node→node chained binding (#1116, #1117) (#1128) * feat(node): complete reactive origin pull-through — decouple local populate + node→node chained binding (#1116, #1117) Follow-through on #1124. Two gaps remained after the direct-client fetch learned to send the ADR 005 client identity binding: #1116 — reactive local-origin populate was gated behind cache.node_to_node_pull_through_enabled, so a cache-only operator (flag off) got a silent NotFound for content in its own fs/http/s3 origin, and with the flag on a whole-blob request preferred the paid peer window path over the node's own local origin. - CacheEngine::populate_local: like populate but skips the Peer origin (via a local_only flag threaded through the shared pull_through chain walk); a peer-only chain is a fast NoOrigin. - ClientHandler gains local_populate + attach_local_populate + try_local_populate; the serve-miss path tries a local-origin fill FIRST (gated on the same pull_authorized proof of channel ownership) before any node→node path. - Runtime arms attach_local_populate whenever [cache.origin] is configured, independent of the node→node flag. No new config knob. #1117 — node_origin omitted the binding, so multi-hop node→node chained warming stopped at the first hop that already held the blob. - NodeOriginDeps gains bind_domain; the runtime threads in the same CapacityBond bind domain the serving side verifies against. - Both node_origin requester paths attach a binding signed over the node's own iroh NodeId with the channel buyer key, reusing #1124's sign_client_binding / with_client_binding. Both paths stay gated on pull_authorized, so no change frees egress. Tests: engine populate_local (skips peer / peer-only NoOrigin); loopback cache-only-operator serve + local-preferred-over-window; two-hop chained reactive pull proving the binding propagates across a node→node hop. Closes #1116. Closes #1117. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(node): address review — local-populate deadline + timeout race check (#1116) - Arm attach_local_populate with the per-attempt node_pull_timeout_sec, not outer_pull_deadline (which budgets MAX_PROVIDER_ATTEMPTS × for the sequential node→node fan-out); a single local origin-chain walk shouldn't block ~3× longer before falling through to the node→node paths. - try_local_populate now does a post-deadline cache.has race check (extracted to on_local_populate_timeout) and meters the timeout, so a concurrent fill that lands at the deadline is served — not reported as CacheMiss with node→node OFF — and operators get a timeout signal. No background warm is spawned (local-only). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(node): address PR review — displaced doc/attr, timeout metering, docs, test (#1116, #1117) Multi-agent review of PR #1128: - node_origin.rs: bind_upstream_ctx was inserted between pull_from_candidate's doc comment + #[allow(cognitive_complexity, too_many_lines)] and the function, so both bound to the wrong item (bind_upstream_ctx got pull_from_candidate's rustdoc; pull_from_candidate lost its doc and lint allow). Move bind_upstream_ctx above so the doc/attr sit on pull_from_candidate again. - client.rs on_local_populate_timeout: a store-lookup error at the deadline was metered as node_pull_through_error AND then also as node_pull_through_timeout with a misleading "timed out" log. Return after the error meter so a store fault isn't double-counted / mislabeled as a timeout. - metrics.rs: document that node_pull_through_{errors,timeouts} now cover BOTH reactive tiers (node→node #831 and local-origin populate #1116), so they aren't read as node→node-only health signals. - runtime/mod.rs: correct the deadline comment — outer_pull_deadline adds a fixed PULL_THROUGH_OUTER_SLACK on top of MAX_PROVIDER_ATTEMPTS×, so the overshoot is >3× (more at small budgets), not ~3×. - test: add local_populate_miss_is_clean_cache_miss — a blob absent from the local origin terminates as a clean delivery refusal after the origin is consulted once (node→node off), guarding the local-first miss path. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Closes #1115.
Problem
A direct
decdn fetchnever sent an ADR 005 client identity binding, so the node'spull_authorizedgate always failed for client fetches. A cache miss for a blob present only in the node's configuredcache.origin(fs/http/s3) was refused asNotFoundand the origin was never read — the "operator hand-curates an origin, clients fetch on demand" flow was non-functional.The node side was already fully wired to verify and require the binding (
handlers/client.rspull_authorized/verify_binding); only the client failed to send one — both request-building sites inclient-pullhard-coded the requestexttoNone.Change
The client now signs an ephemeral
BindNodeId(nodeId, nonce = 0)attestation over its own iroh NodeId with the buyer key, under theCapacityBondEIP-712 domain, and attaches it to everycdn/client/v1request'sext. The serving node recovers the buyer address, confirms it owns the named channel, and reactively populates from its origin.sign_client_bindinghelper +ChannelContext::with_client_bindingand aclient_binding: Option<ClientBinding>field;fetch_innerandopen_progressive_pullattach the binding when present. Absent ⇒ byte-for-byte the pre-fetch: stream_fetch omits the ADR 005 client identity binding, so reactive origin pull-through never fires for a direct client fetch #1115 wire, so unbound node→node pulls are unchanged.capacity_bond_addressis set; warn and fall back to prior behavior (already-cached content only) when it is not.stream_fetchsends no binding.Scope / follow-ups
The reusable helpers are shaped for #1117 (node→node chained binding — the
node_originrequester still omits it). Decoupling local-origin populate fromnode_to_node_pull_through_enabled(the whole-blob window path shadowing the fs read) remains #1116.Verification
cargo build,cargo clippy --all-targets -- -D warnings,cargo fmt --checkclean.bound_client_fetch_triggers_reactive_origin_pull_through,unbound_client_fetch_is_refused_on_origin_only_blob) alongside the existing binding tests.decdn-client-pull+decdn-incentivesuites: 250/250 passed.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes