Repository navigation
Description
Summary
A direct decdn fetch can never trigger reactive origin pull-through, because the client (stream_fetch) does not send the ADR 005 client identity binding. The node's pull-authorization gate (pull_authorized) therefore always fails for client fetches, and a cache miss for a blob that exists only in the node's configured cache.origin (fs/http/s3) is refused as NotFound — the origin is never read.
This is already flagged as a follow-up in the serve-path source (see the "stream_fetch does not yet [send a binding]" comment), so this issue is to track finishing it.
Evidence (file/line)
crates/node/src/handlers/client.rs:563—pull_authorized()returnsfalseunlessverified_clientisSomeand the request's channel is owned by that verified address.crates/node/src/handlers/client.rs:940-972—verified_clientis derived only fromext.binding(ADR 005 §Client identity binding). No binding ⇒verified_client == None.crates/node/src/handlers/client.rs:1017-1029— the cache-miss pull-through gate, with the explicit note: "Multi-hop node→node pulls therefore require the downstream requester to send a binding;stream_fetchdoes not yet, so chained pull-through is a follow-up."crates/node/src/handlers/client.rs:1044-1121— serve-miss flow: the range pull (1044), node→node window path (1073), and buffered populate (1107) are all gated onpull_authorized. With it false, the branch falls straight toServeRejectReason::CacheMiss→ wireNotFound.crates/cli/src/commands/fetch.rs→decdn_client_pull::stream_fetch_tracked— the client pull path; it does not construct/sign/send anext.binding.crates/cache/src/engine.rs:1432populate()→pull_through()→origin.fetch()(decdn_cache_origin_fetches_total) — confirms the engine would read the configured fs/http/s3 origin (fs first in the chain) ifpopulatewere ever invoked.
Reproduction
- Node config:
[cache.origin] kind = "fs",path = /var/lib/decdn/origin, andcache.node_to_node_pull_through_enabled = true. - Place a blob at
{path}/{hex[0..2]}/{hex}(BLAKE3 hex). - Open a funded
PaymentChanneland rundecdn fetch --node-id <id> --hash <hex> --provider-address <node-eth> --addr <ip:4433> -o out. - Observed:
Error: delivery refused: Some(NotFound). Node metrics:decdn_cache_origin_fetches_total = 0,decdn_node_pull_through_background_spawned_total = 0,decdn_serve_stream_rejected_cache_miss_totalincrements. The local fs origin is never read.
(Confirmed end-to-end: stubbing pull_authorized to true and skipping the window branch makes the exact same fetch succeed and pull from the fs origin.)
Proposed fix
- Client: in
decdn_client_pull/crates/cli/src/commands/fetch.rs, sign and send the ADR 005 ephemeral client identity binding (EPHEMERAL_BINDING_NONCE, the client bind domain) with the buyer key, so the node can verify the request owns the named channel andpull_authorizedpasses legitimately. - Related (same area): for whole-blob (offset-0) requests, when
pull_through_origin(the node→nodeNodeOrigin) is attached vianode_to_node_pull_through_enabled, the serve path (client.rs:1073) prefers the node→node window path over the node's own localcache.origin. An origin operator serving its own fs/http/s3 content reactively will therefore never reach the buffered local-origin populate. Consider consulting local configured origins before/independently of the node→node path, or decoupling the local-origin populate fromnode_to_node_pull_through_enabled.
Impact
Nodes cannot reactively serve content that exists only in their configured cache.origin to a paying client via decdn fetch; content must be pre-warmed into cache (e.g., ADR 022 publish → prefetch). The "operator hand-curates an fs/http/s3 origin, clients fetch on demand" flow is currently non-functional without this.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
review: address PR #1124 findings (actionable refusal, origin-fetch a…
fix(cli): send the ADR 005 client identity binding on decdn fetch (#1115