Skip to content

docs(adr-003): fold node admission & queueing guidance into §Admission and Priority - #672

Closed
yigitdot wants to merge 1 commit into
mainfrom
docs/446-admission-queueing-guidance
Closed

yigitdot wants to merge 1 commit into
mainfrom
docs/446-admission-queueing-guidance

Conversation

@yigitdot

Copy link
Copy Markdown
Contributor

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):

  • Recommended policy: two-lane scheduler — pseudocode keyed on the two signals (committed rate as per-stream priority key, stakeOf as binary lane eligibility).
  • Properties — per-stream, admission-time-only, non-preemptive, no waiting queue, reject-with-hint, address resolution.
  • Per-client concurrent-stream cap — anti-monopolization recommendation.
  • Operator variations — five alternative policies operators may implement instead.

Protocol-consistency adjustment

Issue #446's pseudocode referenced an ErrorCode::RateBelowFloor that does not exist in ADR 005's StreamError enum. The folded-in design instead:

  • maps the overload rejection to the real StreamError::Overloaded (ADR 005), and
  • treats a below-floor request as already rejected by the existing amount_delta / bytes_delta >= rate_per_mb verification — the advertised rate_per_mb is 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.
  • All new cross-links and intra-doc anchors confirmed to resolve.

🤖 Generated with Claude Code

…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]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread adr/003-payments.md
Comment on lines +744 to +745
requester = address recovered from the voucher signature or channel.client
committed_rate = voucher.amount_delta / voucher.bytes_delta // bytes_delta > 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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
  1. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread adr/003-payments.md

if queue.is_full():
if committed_rate <= queue.lowest_committed_rate():
reject: StreamResponse { ok: false, error: Overloaded } // hint: lowest admitted rate in lane

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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
  1. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread adr/003-payments.md
- **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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implementation guidance: node admission and queueing policy

1 participant