Skip to content

Remove speculative client-less background warm (unpaid-egress → paid-ingress deposit-drain surface) #1610

Closed

Description

@alpergundogdu

Problem

The node has a detached background cache-fill (#859, #1254): on a serve-miss where the foreground pull misses its deadline or can't open, the node sends the requesting client a refusal and then tokio::spawns a warm that re-pulls the blob from offset 0 — either from a peer (paid, USDC) or from the operator's own backend (unpaid, backend egress).

Both variants ingest with no client waiting on the bytes and nobody paying for the result. They are speculative bets on a future request.

The paid variant is an economic attack surface — unpaid egress forces paid ingress:

  1. A client requests a rare/large blob the node lacks.
  2. Node misses; foreground pull times out / can't open; node returns a refusal (no revenue).
  3. Node then pays an upstream peer from offset 0 to warm that blob.
  4. Cheaply repeatable. The requester never pays; the node keeps spending USDC on blobs nobody ends up wanting → payment-channel deposit drain.

Re-pulling from zero makes each attempt re-pay the full blob. The unpaid (own-backend) variant can't drain USDC but has the same shape: a flood of forced foreground timeouts drives repeated backend egress (S3/R2 egress is not free) for blobs whose client already gave up.

This is not a scale-deferral concern — the economics are wrong at any node count. The core principle: a node should never initiate a from-zero pull off its own back; it should only ingest while a live client is waiting on (and paying for) the bytes.

Decision

Remove both background-warm variants — paid (node→node) and unpaid (own-backend). Keep every foreground, client-waiting fill.

Remove

  • maybe_spawn_background_fill (crates/node/src/handlers/client/fill.rs:18) + its 3 call sites: window.rs:195, window.rs:204, fill.rs:486.
  • spawn_local_warm + on_local_populate_timeout (fill.rs).
  • The BackgroundFill subsystem in handlers/client/mod.rs (BackgroundFill, arm_background_fill, the inflight-dedup guard, warm_budget_mb, MAX_BACKGROUND_FILL_MB = 2048, ClientHandlerDeps::background_fill) and its BackgroundFill::new wiring in runtime/mod.rs.
  • The node_pull_through_background_spawned / _shed metrics (metrics.rs) and the background-fill notes in selection.rs / node_origin/mod.rs.
  • The associated background-warm config knob(s), per pre-launch policy (delete the shape, no deprecation shim).

Keep (client-waiting, unchanged)

  • The serve-miss tee (window.rs:181, open_progressive_pull) — client streaming while the store ingests.
  • Foreground buffered populate / populate_local bounded by the pull-through deadline (fill.rs:174, fill.rs:229).

Resulting invariant

A node only ingests while a live client is waiting on the bytes. It never initiates a from-zero paid pull speculatively. cache-admit never occurs without a consumer sink alongside it.

Non-impact

  • Advertising is independent. The node announces its own origin content from a HEAD/stat metadata index (rescan_origins builds origin_held), not from warmed bytes — so dropping the warm does not change what the node advertises or serves. Un-cached assigned blobs are still pulled on the next real request (foreground, client paying).
  • No change to serve/export, DHT routing, or the namespace/origin-role model.

Relationship to the ingest refactor

Recorded in specs/2026-08-05-unify-blob-source-ingest-design.md. Removing this collapses the client-less {cache}-only sink combination out of the source/sink model entirely, so the refactored PeerSource never has to support a paid pull with no consumer sink. It also removes a consumer of MAX_BACKGROUND_FILL_MB (sized against max_blob_size_mb), simplifying the max_blob_size_mb removal in the ingest-unification work.

Severity

Bounded today by warm-slot count + per-hash dedup, so it is rate-limited rather than unbounded — but it is a genuine fund-loss / cost-amplification surface that triggers automatically and silently. Worth closing before launch.

Activity

  1. added
    kind:feature
    rust
    on Aug 5, 2026
  2. added
    design:economics
    prio:high
    kind:security
    on Aug 5, 2026
  3. self-assigned this
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:economicskind:featurekind:securityprio:highrust

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions