Skip to content

Simplify the stream open to five rules (follow-up to #2912) #2913

Open

Description

@alpergundogdu

Summary

#2912 retires cdn/probe/v1 and rate-manipulation slashing. Keep that. The open it adds carries too many states, windows and special cases. This issue tracks the cuts that bring the stream open down to five rules. Design discussion: #2912 review and follow-up comment.

None of this touches the contracts. Every step is node, client and wire only. The steps are mostly deletions.

The five rules

  1. A StreamRequest is a free, signed quote. Before the first voucher, a node does a store lookup and at most one memoised {H}.sizeproof read. For a requester that is not an active staker, it also does a DHT lookup and sends unpaid opens to upstream nodes. It holds no pin, checks no pool and reads no chain. There is no pull_through flag. A node runs its network miss path only for a requester that is not an active staker. This stops proxy chains and the partial-holder pull loop. Serving from a node's own origin backend is not a miss path.
  2. The first voucher starts everything: admission, the pin and any fill.
  3. The client decides each answer as it arrives. If the answer is verified and consistent, quotes at or under the lane's rate limit, comes from an operator the fetch does not already use, covers useful blocks, and a lane is free, the client uses it as a lane and pays at once. Otherwise the client cancels it at once. There is no upfront planning. The ADR 039 tail-stealing moves work to the faster lanes.
  4. An unpaid stream dies within seconds. The first voucher has its own deadline of about 2 s. The proof wait during a stream stays at 10 s and keeps watching transport progress (client: a leg that faults mid-pull is logged nowhere and its range waits for a busy lane (serial tail) #2230). A node closes a connection that has never received a voucher a few seconds after its last unpaid stream ends.
  5. Origins publish {H}, {H}.obao4 and {H}.sizeproof. All three are required. decdn origin import writes all three. A missing or broken object is an ordinary origin fault: a StreamError before any ChunkData.

Steps

Do the steps in this order. Each step is one PR, and each leaves the protocol working.

  • 1. Make the outboard required at origins (rule 5). (feat!: origins publish all three objects; delete the whole-blob origin fallback #2922) Delete origin_outboard_published and its memo, origin_probe_presence (the data-object HEAD, the Content-Length read and the Content-Encoding case), origin_range_serviceable, the "no outboard" memo and its degrade path, and the fallback that pulls the whole blob from the origin and imports it. ADR 037 § Origin-tier pull-through loses "Fallback is always correct". First, check whether commit_buffered_bytes and default_buffered_max_bytes also serve the buffered whole-blob pull from another node (ADR 037, near line 126). If they do, that path stays.
  • 2. Remove the pin before payment and add the short first-voucher deadline (rules 2 and 4). Delete the unadmitted pin, MAX_UNADMITTED_PINS, the logic that drops the pin on a miss and takes it again on a fill, MAX_UNADMITTED_STREAMS_PER_CONNECTION, the client's matching limit, and the "8 of 10 for discovery" split. The node takes the pin at admission. Give the first voucher its own deadline, separate from VOUCHER_READ_TIMEOUT. Close a connection that has never received a voucher soon after its last unpaid stream ends.
  • 3. Answer whatever pool the request names (rule 1). Delete the pool Declined refusal, declines_pool, the "retry once on a listed contract" rule, and "a node that refuses the pool is a serve target with unknown coverage". The node answers the blob status for any requested pool and lists payment_pools. The pool check moves to admission. The client uses the winner's stream as its first lane only when that stream named the chosen contract.
  • 4. Remove pull_through and add the staker rule (rule 1). Delete StreamRequestExt.pull_through, the second admission timing, and the cold tail (append_cold_tail, OpenSet.cold). The staker rule also replaces refuses_whole_blob. A proxy that does not hold the blob answers with its upstream's verified size proof and fills only after the first voucher. A proxy can keep its upstream discovery stream open and use it as its paid upstream lane.
  • 5. Decide each answer on arrival (rule 3). Delete the DIRECT_PATH_GRACE wait before an answer counts (record RTT into the peer store after the lane runs), OpenRound::Settle, cold_grace, SETTLE_AFTER_HOLDER, the OpenRound enum, the path that cancels late holders and opens a new lane to each, and the upfront ranking (RTT bands, then quote, then coverage). Ranking decides only who keeps a lane when the lanes are full. The node's pull path follows the same rule, and its ADR 001 score decides only that choice.

ADR end state

The discovery section of ADR 005 has four parts: the answer, coverage, the rule on who gets a miss path, and the payer's price protection. The Deferred admission, Open-stream pin, Pull-through and Discovery on several contracts subsections go away. ADR 022, 037, 039 and 040 change to match.

Open question

When the lanes are full, should a cheaper late holder replace the most expensive running lane? Without that, nodes win by answering fast, not by being cheap.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions