Repository navigation
Description
Tracking issue for node-side admission and queueing policy — i.e. how a node decides which incoming StreamRequests to accept under congestion, and in what order.
This is out of protocol scope (ADR 003 §Admission and Priority names the two signals nodes have available; the wire format carries no priority bits and the contract surface has no priority-aware entrypoints). Different operators (small home node, CDN-scale, enterprise SLA tier) will tune it differently. The notes below are one workable design for implementors to reference; alternative implementations are acceptable.
Filed in lieu of an appendix — small enough to live as an issue.
Recommended design
A two-lane scheduler keyed on the two protocol-available signals: committed voucher rate (per-stream priority key) and StakingRegistry.stakeOf (binary lane eligibility).
on incoming StreamRequest:
requester = recover_address_from_voucher_or_binding()
if voucher.bytes_delta == 0:
reject(ErrorCode::RateBelowFloor, hint: rate_per_mb_floor)
committed_rate = voucher.amount_delta / voucher.bytes_delta
if committed_rate < rate_per_mb_floor:
reject(ErrorCode::RateBelowFloor, hint: rate_per_mb_floor)
lane = if StakingRegistry.stakeOf(requester) >= MIN_STAKE { Priority } else { Regular }
queue = admission_queue[lane]
if queue.is_full():
if committed_rate <= queue.lowest_committed_rate():
reject(ErrorCode::Overloaded, hint: queue.lowest_committed_rate() + epsilon)
else:
// Admit; do NOT preempt already-admitted streams.
admit(StreamRequest)
else:
admit(StreamRequest)
Drain order: Priority lane first, Regular lane only when Priority is empty. Within a lane, sort admitted streams by committed_rate descending.
Properties
- Per-stream. Each
StreamRequestis admitted independently against its own committed rate. No per-session, per-connection, or per-client priority state. - Admission-time-only. Priority is fixed at admission. Subsequent changes to
stakeOfor other inputs do not re-rank in-flight streams. - Non-preemptive. Once admitted, a stream runs to completion (or its protocol-level timeout). A late-arriving higher-rate stream does not bump an admitted stream.
- No waiting queue. A
StreamRequestis either admitted or rejected — no pending state. "Starvation forever" is impossible by construction; the worst case is repeated rejection, which is observable client-side and recoverable (retry elsewhere or commit at a higher rate). - Reject-with-hint. Rejections carry an actionable next step (rate floor or current admission floor in the relevant lane).
- Address resolution. Lane eligibility uses the address recovered from the voucher signature or
channel.client. The optional ephemeral binding inStreamRequest(ADR 005) is for voucher attribution, not a priority requirement.
Per-client concurrent-stream cap (recommended)
Independent of the lane mechanism, nodes SHOULD apply a per-client concurrent-stream cap (e.g., 10 streams per Ethereum address simultaneously) to prevent a single wealthy client from monopolizing all admission slots. Node-policy parameter; tune to traffic profile. Orthogonal to the per-ALPN concurrent-stream limit (ADR 005).
Variations operators may implement
- Voucher-rate alone (no priority lane). Simplest.
- Different lane eligibility — reputation-based, region-based, or a private allow-list for an enterprise SLA tier.
- Rate-window aging — bump effective priority of a stream waiting at the floor rate. Smooths starvation in heavy-load steady state at the cost of complexity.
- FCFS at the rate floor with reject-otherwise. Suitable for small home nodes without congestion.
- Weighted-fair queueing across clients — when per-client fairness is more important than revenue maximization.
References
- ADR 003 — payment channels, voucher format,
rate_per_mbfloor semantics, §Admission and Priority listing the signals - ADR 005 —
StreamRequest/StreamResponse/ voucher wire format, per-ALPN concurrent-stream limits - ADR 026 §7 —
MIN_STAKE = 50,000 TOKEN, 7-day unstake delay - ADR gap: client priority staking edge-case semantics #402 — original ADR-gap discussion that produced the signals decision
Activity
docs(adr): drop admission-policy appendix; keep signal note in ADR 003
docs(adr): remove client priority staking surface (#402) (#445)
yigitdot commentedon May 23, 2026
PR #672 (which proposed folding the design above into ADR 003 §Admission and Priority) drew a protocol-layer review from
gemini-code-assist. Verifying each comment against ADRs 003, 005, and 014, all three are substantively correct. The design has three issues that I think need addressing before any ADR fold-in.1. No voucher at admission
StreamRequest(ADR 005 §cdn/client/v1, l. 140) carrieshash,channel_id,byte_offset,timestamp_us,voucher_interval_mb, and optionalethereum_address/binding_signature. It does not carry a voucher. The firstVoucherarrives mid-Streaming, afterStreamResponse{ok:true}; ADR 005 (l. 332) explicitly forbids voucher-before-response.So the recommended-policy pseudocode line
committed_rate = voucher.amount_delta / voucher.bytes_deltais uncomputable at admission time. The committed per-MB rate is a mid-stream signal, not an admission key.2.
StreamResponse{ok:false}after a positive probe is slashable regardless of error codeADR 005 §
EvictedSinceProbesemantics is explicit:The same holds for
OverloadedandBlobTooLarge(ADR 005 §BlobTooLarge→ Probe interaction). The on-chain verifier sees onlyok: false; theerrorfield is unsigned. The recommended-policy pseudocode linereject: StreamResponse { ok: false, error: Overloaded }is therefore slashable in the normal probe-then-request flow.The protocol's actual congestion mechanism lives at probe time: under load, a node responds
has_blob: false(ADR 005 §Probe-triggered eviction hold + §Hold budget). Themax_probe_holdsbudget IS the capacity gate. Bare timeout / non-response is reputation-only and not slashable (ADR 003 §Phantom blob announcement).3. Rate hints in signed
rate_per_mbare slash evidenceA
StreamResponsecarries a signedrate_per_mbwhetherokis true or false (ADR 005slash_sigparagraph; ADR 014). ADR 003 §Rate bait-and-switch:StreamResponse.rate_per_mb > ProbeResponse.rate_per_mbwithin 30s is on-chain slash evidence. The "Reject-with-hint" property — "the lane's current admission-floor rate" — if placed in that signed field and exceeding the probed rate, is self-incriminating. Any hint must travel in unsigned channels.Suggested redesign direction
Without proposing final wording, the three points above push the design toward:
has_blob: true. The capacity gate is themax_probe_holdshold budget. Stake-lane eligibility can apply to probe-acceptance decisions for requesters whose stake the node can determine — practically, this is node-to-node cache-miss probes (the requester is a registered operator). For end-client probes the eligibility signal needs to be reputation, region, an allow-list, or similar (cf. the existing "Variations" list).Streaming, the rate can influence bandwidth allocation among admitted streams. ADR 003's pre-existing "nodes MAY use the committed rate as a per-stream priority key" reads correctly under this framing — ordering admitted streams, not gating admission.StreamResponse{ok:false}rejection is safe only when no signedhas_blob: trueprobe to that requester for that hash exists within 30s. After a positive probe the node is committed; the only safe non-delivery options are timeout / bare stream close (reputation cost, no slash).StreamResponsefields. Either drop the hint or convey it out-of-band.The per-client concurrent-stream cap and the operator-variations list are orthogonal and unaffected.
PR #672 is being closed; happy to help once a corrected design lands here.
yigitdot commentedon Jun 1, 2026
Corrected recommended design
This supersedes the Recommended design in the issue body. That version keyed admission on committed voucher rate and rejected with
StreamResponse{ok:false}— both protocol-incorrect for the reasons in the comment above (and why #672 was closed). The corrected design moves congestion control to probe time and demotes committed rate to a mid-stream signal.1. The capacity gate is at probe time
Under load, the lever is whether to sign
has_blob: true. Respondinghas_blob: falseis costless; themax_probe_holdshold budget (ADR 005 §Hold budget) IS the capacity gate. Bare timeout / non-response is reputation-only, not slashable (ADR 003 §Phantom blob announcement).A
StreamResponse{ok:false}after a positive probe within 30s is phantom-announcement slash evidence regardless of the (unsigned) error code —Overloaded,EvictedSinceProbe,BlobTooLargeare all slashable in the normal probe-then-request flow. Sook:falseis never a congestion mechanism. After a positive probe the node is committed; the only safe non-delivery is timeout / bare stream close (reputation cost, no slash).2. Lane eligibility — at probe time
Stake (
CapacityBond.bondOf/StakingRegistry) is determinable only when the requester is itself a registered operator — practically, node-to-node cache-miss probes (where the requester's NodeId↔address binding is on-chain). For those, a node MAY reserve probe-acceptance headroom forbondOf >= bond_required(declared_capacity)requesters.For end-client probes there is no stake signal (clients aren't registered). Lane eligibility there must come from reputation, region, or an allow-list (cf. the Variations list).
3. Committed voucher rate — a mid-stream scheduling signal, not an admission key
No voucher exists at probe/admission time. Once the first
Voucherarrives inStreaming, the node MAY order/bandwidth-allocate already-admitted, in-flight streams by committed rate (amount_delta / bytes_delta) descending. This is the framing under which ADR 003's pre-existing "nodes MAY use the committed rate as a per-stream priority key" reads correctly — ordering admitted streams, not gating admission.4. Rejection hints must not ride signed
StreamResponsefieldsStreamResponse.rate_per_mbis signed.StreamResponse.rate_per_mb > ProbeResponse.rate_per_mbwithin 30s is rate-bait-and-switch slash evidence (ADR 003 §Rate bait-and-switch). Any "current admission-floor" hint, if placed there and exceeding the probed rate, is self-incriminating. Convey hints out-of-band, or drop them. (Therate_per_mbfloor itself remains conveyable as before; it is the higher-than-probed hint that is unsafe.)Unchanged from the original design
Doc status
bondOfrow) corrected to this framing in docs(adr-003): correct §Admission and Priority to probe-time congestion control (#446) #756 — the section keeps signal-note form and points back here for the worked design.yigitdot commentedon Jun 1, 2026
Follow-up implementation issue: #757 (probe-time stake-lane eligibility in the probe handler). ADR correction: #756.
docs(adr-003): correct §Admission and Priority to probe-time congesti…
docs(adr-003): correct §Admission and Priority to probe-time congesti…
docs(adr-003): correct §Admission and Priority to probe-time congesti…