Repository navigation
Conversation
…n and Priority (#446) ADR 003 §Admission and Priority named only the two signals available to an admission policy; the worked design lived solely in issue #446. Fold that recommended design — a two-lane scheduler, its properties, a per-client concurrent-stream cap, and operator variations — into the section so it lives in a canonical design artifact. The design is adapted to existing protocol surface: the overload rejection maps to ADR 005's real `StreamError::Overloaded`, and the below-floor case reuses the existing `amount_delta / bytes_delta >= rate_per_mb` verification rather than introducing a new error code. Closes #446. Co-Authored-By: Claude Opus 4.7 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request expands the 'Admission and Priority' section of the payments ADR, introducing a recommended two-lane scheduler that uses committed voucher rates and node-stake as admission signals. The review feedback highlights significant concerns regarding protocol consistency and security: specifically, the pseudocode relies on voucher data not present in the StreamRequest wire format, the proposed rejection response could trigger slashing for honest nodes under congestion, and the hint mechanism for rejected requests may conflict with existing security models regarding rate manipulation.
| requester = address recovered from the voucher signature or channel.client | ||
| committed_rate = voucher.amount_delta / voucher.bytes_delta // bytes_delta > 0 |
There was a problem hiding this comment.
The pseudocode assumes that a voucher is available at the moment an incoming StreamRequest is processed. However, according to the wire protocol defined in ADR 005, the StreamRequest does not contain a voucher. This inconsistency violates the requirement for internal consistency across protocol documentation regarding field lists and admission logic. Because the node does not have access to the voucher's amount_delta or bytes_delta at admission time, it cannot use the committed_rate as a priority key for the initial admission decision as described here.
References
- Ensure protocol documentation is internally consistent by verifying that function descriptions, field lists, and edge-case logic are aligned across all sections of the document.
There was a problem hiding this comment.
Verified — correct. StreamRequest (ADR 005:140) carries no voucher; the first Voucher arrives after StreamResponse (ADR 005:332). Detailed analysis with citations and redesign direction in #446 (comment) — PR is being closed pending redesign there.
|
|
||
| if queue.is_full(): | ||
| if committed_rate <= queue.lowest_committed_rate(): | ||
| reject: StreamResponse { ok: false, error: Overloaded } // hint: lowest admitted rate in lane |
There was a problem hiding this comment.
Rejecting a StreamRequest with ok: false is a slashable offense if the node recently signed a has_blob: true probe for that requester. Since the operator's signed response remains the dispositive evidence for the SlashJudge, the node will be slashed regardless of the congestion state. To avoid this, the documentation should clarify that slashes requiring operator signatures cannot be unilaterally triggered by external adversaries and should recommend non-slashable rejection mechanisms, such as timing out the request or closing the QUIC stream without sending a signed StreamResponse.
References
- In protocol documentation, clarify that slashes requiring operator signatures cannot be unilaterally triggered by external adversaries, as the operator's signed response remains the dispositive evidence.
There was a problem hiding this comment.
Verified — correct. ADR 005 §EvictedSinceProbe semantics is explicit that ok: false after a has_blob: true probe is phantom-announcement slash evidence regardless of error code (Overloaded included). The protocol's actual congestion control lives at probe time via max_probe_holds (ADR 005 §Probe-triggered eviction hold / §Hold budget). Detailed analysis in #446 (comment) — PR is being closed pending redesign there.
| - **Admission-time-only.** Priority is fixed at admission; later `stakeOf` changes do not re-rank in-flight streams. | ||
| - **Non-preemptive.** An admitted stream runs to completion (or its protocol-level timeout); a late higher-rate stream does not bump it. | ||
| - **No waiting queue.** A `StreamRequest` is admitted or rejected — no pending state. Permanent starvation is impossible by construction; the worst case is repeated rejection, observable client-side and recoverable. | ||
| - **Reject-with-hint.** Rejections carry an actionable next step — the lane's current admission-floor rate, or the advertised `rate_per_mb`. |
There was a problem hiding this comment.
The "Reject-with-hint" property suggests repurposing the rate_per_mb field in an ok: false response. However, if the hint rate is higher than the rate previously quoted in a ProbeResponse, the node becomes liable for a "rate manipulation" slash. This mechanism creates a conflict in the protocol's security framing. Documentation must maintain a clear distinction between immediate on-chain verification (slash evidence) and post-hoc or informational evidence (like hints) to avoid weakening the protocol's security model.
References
- Maintain a clear distinction between immediate on-chain verification (e.g., slash evidence) and post-hoc or off-chain-rooted evidence to avoid weakening the security framing of the protocol.
There was a problem hiding this comment.
Verified — correct. A StreamResponse carries a signed rate_per_mb whether ok is true or false; a higher hint than the prior probe is rate-manipulation slash evidence (ADR 003 §Rate bait-and-switch). Any hint must travel in unsigned channels. Detailed analysis in #446 (comment) — PR is being closed pending redesign there.
Summary
Closes #446.
ADR 003 §Admission and Priority previously named only the two signals an admission policy can use (committed voucher rate, registered node-stake) without a worked design. The full recommended design lived solely in issue #446 — an ephemeral artifact, where CLAUDE.md states ADRs are canonical.
This folds that recommended design into the existing section (no new appendix file — honors the issue's "filed in lieu of an appendix" note):
stakeOfas binary lane eligibility).Protocol-consistency adjustment
Issue #446's pseudocode referenced an
ErrorCode::RateBelowFloorthat does not exist in ADR 005'sStreamErrorenum. The folded-in design instead:StreamError::Overloaded(ADR 005), andamount_delta / bytes_delta >= rate_per_mbverification — the advertisedrate_per_mbis itself the hint, so no new error code is introduced.Scope
Documentation only — single file,
adr/003-payments.md, §Admission and Priority. No code, protocol, or contract surface change. No overlap with any open PR.Verification
make check-refs(bare refs, anchors, section numbers) — passed.pre-commit run --files adr/003-payments.md(markdownlint, adr reference hygiene) — passed.🤖 Generated with Claude Code