Skip to content

docs(adr): remove client priority staking surface (#402) - #445

Merged
alpergundogdu merged 3 commits into
mainfrom
claude/triage-blocking-issues-5atre
May 7, 2026
Merged

alpergundogdu merged 3 commits into
mainfrom
claude/triage-blocking-issues-5atre

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #402.

Summary

The original ADR 003 §Client Priority Staking specced a refundable TOKEN deposit (clientStake/clientUnstake/clientStakeOf) as a soft signal nodes could check to prioritize clients during congestion. Working through the four edge cases in #402 surfaced three structural weaknesses:

  1. Withdraw-anytime semantics meant the cost of priority was just the opportunity cost of holding TOKEN — sophisticated clients can cycle a single deposit across many nodes (weak Sybil-resistance signal).
  2. Misaligned with revenue. A node prioritizing a high-staker earned the same as serving a low-staker — the protocol asked nodes to bear the congestion-management cost without economic alignment.
  3. Marginal value, real surface cost. Three contract entrypoints, a storage map, two events, and the off-chain BindNodeId(nodeId, nonce=0) ephemeral-binding ceremony in StreamRequest whose only consumer was the clientStakeOf lookup.

This PR dissolves the mechanism. ADR 003's new §Admission and Priority section names the two protocol-available signals nodes can use for any admission policy (committed voucher rate, plus optional StakingRegistry.stakeOf reads for a staked-peer lane), but leaves the policy itself out of protocol scope — admission and queueing are node-side scheduling concerns, and different operators (small home node, CDN-scale, enterprise SLA tier) will tune them differently.

Detailed implementation guidance (two-lane scheduler pseudocode, non-preemptive admission with reject-and-rate-hint, per-client concurrent-stream cap, variations operators may implement) is filed as #446 rather than as a canonical appendix — small enough to live in an issue, and the issue tracker is the right consumer for operator-facing implementation suggestions.

Files changed

ADR 003 (adr/003-payments.md)

  • Removed §Client Priority Staking section
  • Removed clientStake/clientUnstake/clientStakeOf + clientStakes storage + ClientStaked/ClientUnstaked events from §StakingRegistry Modifications
  • Updated §Off-Chain (Ephemeral) Binding for Clients — the binding now serves voucher attribution only; the priority-staking framing is dropped, and the corresponding row in §Binding Requirements by Role is removed
  • Updated §NodeId-to-Ethereum Binding lead and §Slashing-Channel separation prose to drop "client priority staking" mentions
  • Added new §Admission and Priority section naming the two protocol-available signals (rate-floor semantics; stakeOf lookup) without prescribing scheduling policy

Other ADRs

  • adr/005-protocol.md: drop clientStakeOf from the §Client identity binding consumer list
  • adr/012-client.md: drop the priority-staking client-role bullet, drop clientStakeOf from the §Identity Lifecycle session step, drop the ephemeral-binding consequence about losing priority on disconnect
  • adr/014-on-chain-verification.md: drop clientStakeOf from the binding-cache consumer note
  • adr/016-contract-interactions.md: remove ClientStaker block from the TOKEN flow Mermaid diagram, drop "client priority stakes" from the funds-summary table, remove clientStake()/clientUnstake() rows from the StakingRegistry function table
  • adr/024-account-abstraction.md: drop the "Priority staking" wallet bullet from the Clients section

No new appendix. The earlier draft of this PR added adr/appendix-admission-policy.md plus listing entries in adr/architecture.md and adr/README.md; those were reverted in favour of #446 carrying the implementation guidance.

Wire / contract / schema impact

  • Wire format: unchanged. StreamRequest/StreamResponse ephemeral-binding fields stay (now described as "voucher attribution" only).
  • Contract surface: shrinks. clientStake/clientUnstake/clientStakeOf had no remaining consumer after the priority mechanism was demoted.
  • No schema ripple to ADR 001 NodeInfo, no serves flag, no ADR 012 bootstrap change, no ADR 022 origin-discovery change.

Test plan

  • markdownlint --dot clean on all touched files (verified locally)
  • No remaining clientStake/clientUnstake/clientStakeOf/ClientStaker/ClientStaked/ClientUnstaked/client priority references anywhere in adr/ (verified with grep)
  • All trailing newlines preserved
  • pre-commit run --all-files (binary not available locally — will run in CI)
  • Cross-ref check: [ADR 005](005-protocol.md#client-identity-binding) from ADR 003 §Off-Chain Binding resolves to the existing §Client identity binding section; [ADR 026 §7](026-gauge-boost-tokenomics.md#7-operator-economics-and-minimum-stake) from §Admission and Priority resolves

Notes

The serves flag / mesh-pollution concern raised earlier in design discussion is intentionally not in scope here. Clients who want priority-via-stake do so by registering as a node (existing path), and the question of whether getActiveNodes() should filter such addresses is orthogonal to this change. If we later want to filter, that's a separate ADR 001 schema change.

https://claude.ai/code/session_01V3AAY9Jnsmkqf3xg8c98Ui

#402)

Closes #402.

The original ADR 003 §Client Priority Staking specced a refundable TOKEN
deposit (`clientStake`/`clientUnstake`/`clientStakeOf`) as a soft signal
nodes could check to prioritize clients during congestion. Working through
the four edge cases in #402 surfaced three structural weaknesses:

1. Withdraw-anytime semantics meant the cost of priority was just the
   opportunity cost of holding TOKEN, so sophisticated clients could cycle
   a single deposit across many nodes — weak Sybil-resistance signal.
2. Misaligned with revenue: a node prioritizing a high-staker earned the
   same as serving a low-staker.
3. Marginal value, real surface cost — three contract entrypoints, a
   storage map, two events, and the off-chain `BindNodeId(nodeId, nonce=0)`
   ephemeral-binding ceremony in `StreamRequest` whose only consumer was
   the `clientStakeOf` lookup.

This commit dissolves the mechanism. Two signals already in the protocol
replace it as an operator-side implementation suggestion:

- Committed voucher rate as primary priority key. ADR 003 already verifies
  `amount_delta / bytes_delta >= rate_per_mb` (a floor, not equality), so
  clients can commit at higher rates and nodes can sort by committed rate
  with zero protocol changes. The premium goes to the node as USDC revenue,
  aligning incentive with prioritization.
- Optional staked-peer lane via `StakingRegistry.stakeOf` reads. Reuses the
  existing 50K TOKEN node-stake bookkeeping (real 7-day unstake commitment),
  no new contract surface.

Admission and queueing policy is operator-defined and lives in a new
appendix rather than as protocol-normative ADR text — different operators
will tune it differently (small home node vs CDN-scale vs enterprise SLA).

Net delta:
- Remove §Client Priority Staking from ADR 003.
- Remove `clientStake`/`clientUnstake`/`clientStakeOf` + `clientStakes`
  storage + `ClientStaked`/`ClientUnstaked` events from §StakingRegistry
  Modifications.
- Update ADR 003 §Off-Chain (Ephemeral) Binding — the binding now serves
  voucher attribution only; the priority-staking framing is dropped, and
  the row in §Binding Requirements by Role is removed.
- Update ADR 003 §NodeId-to-Ethereum Binding lead and §Slashing-Channel
  separation prose to drop "client priority staking" mentions.
- Update ADR 005, 012, 014: drop `clientStakeOf` from binding-cache
  consumer lists (voucher attribution only).
- Update ADR 012: drop the priority-staking client-role bullet and the
  ephemeral-binding consequence about losing priority on disconnect.
- Update ADR 016: remove ClientStaker block from the TOKEN flow Mermaid
  diagram, drop "client priority stakes" from the funds-summary table,
  remove `clientStake()`/`clientUnstake()` rows from the function table.
- Update ADR 024: drop the "Priority staking" wallet bullet from the
  Clients section.
- New: `adr/appendix-admission-policy.md` documenting voucher-rate-based
  ordering, optional staked-peer lane via `stakeOf`, non-preemptive
  admission with reject-and-rate-hint, per-client concurrent-stream cap
  recommendation, and the four-question dissolution table.
- Add new appendix to `adr/architecture.md` §Appendices and
  `adr/README.md` reading-order book build file list.

Wire format unchanged. No ripple to ADR 001/012/022 schemas. Contract
surface shrinks (the `client*` functions had no remaining consumer).

https://claude.ai/code/session_01V3AAY9Jnsmkqf3xg8c98Ui

@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 removes the on-chain client priority staking mechanism across several ADRs and introduces a new appendix defining a node-side admission and priority policy. The new policy utilizes committed voucher rates and registered node-stake as signals for handling congestion. Review feedback suggests removing historical narratives and iteration details from the documentation to maintain a clean record of the current design, and recommends adding a check for division-by-zero in the admission policy pseudo-code.

Comment thread adr/appendix-admission-policy.md Outdated
Comment on lines +7 to +11
[ADR 003](003-payments.md) specifies the per-MB voucher payment mechanism but does not say how a node decides which `StreamRequest` to admit when its concurrent-stream limit, bandwidth, or backend capacity is saturated. Earlier drafts of ADR 003 included a `clientStake` / `clientStakeOf` mechanism — a refundable TOKEN deposit a client could make to be prioritized during congestion. That mechanism was removed (see #402) for three structural weaknesses:

1. Withdraw-anytime semantics meant the cost of priority was just opportunity cost of holding TOKEN — sophisticated clients could cycle a single deposit across many nodes.
2. The signal was misaligned with revenue: a node prioritizing a high-staker earned the same as serving a low-staker.
3. It added contract surface (three entrypoints, a storage map, two events) and a wire-level binding ceremony for marginal value.

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

This section contains historical narrative regarding the removal of the clientStake mechanism. According to the general rules, canonical documentation (like ADRs and their appendices) should maintain a clean record of the current design. Historical context, iteration details, or information about dropped features should reside in issue discussions or merge commit messages rather than the documentation itself.

References
  1. Avoid including historical narratives, iteration details, or information about dropped features in canonical documentation (e.g., ADRs). Such context should reside in issue discussions or merge commit messages to maintain a clean record of the current design.

Comment thread adr/appendix-admission-policy.md Outdated
```
on incoming StreamRequest:
requester = recover_address_from_voucher_or_binding()
committed_rate = voucher.amount_delta / voucher.bytes_delta

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 pseudo-code calculation for committed_rate does not account for a potential division by zero if voucher.bytes_delta is zero. While this is an appendix, ensuring the logic is robust prevents implementation errors.

Suggested change
committed_rate = voucher.amount_delta / voucher.bytes_delta
committed_rate = if voucher.bytes_delta > 0 { voucher.amount_delta / voucher.bytes_delta } else { 0 }

Comment thread adr/appendix-admission-policy.md Outdated
- [ADR 003](003-payments.md) — payment channels, voucher format, `rate_per_mb` floor semantics
- [ADR 005](005-protocol.md) — `StreamRequest` / `StreamResponse` / voucher wire format, per-ALPN concurrent-stream limits
- [ADR 026 §7](026-gauge-boost-tokenomics.md#7-operator-economics-and-minimum-stake) — `MIN_STAKE = 50,000 TOKEN`, 7-day unstake delay
- Issue #402 — original ADR-gap discussion, closed as decided-against

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

This reference to Issue #402 includes historical narrative about the decision-making process ('closed as decided-against'). Per the general rules, such context should be omitted from canonical documentation to maintain a clean record of the current design. If this section is intended to document a rejected alternative, it should describe the design and the reasoning ('what and why') without invoking the iteration narrative.

References
  1. Avoid including historical narratives, iteration details, or information about dropped features in canonical documentation (e.g., ADRs). Such context should reside in issue discussions or merge commit messages to maintain a clean record of the current design.
  2. When documenting rejected alternatives in a canonical record, describe the rejected design unambiguously without invoking deleted or superseded files. The purpose of such a section is to explain 'what was rejected and why', not to maintain an iteration narrative.

claude added 2 commits May 7, 2026 08:51
- §Context: drop iteration narrative about removed clientStake mechanism;
  describe admission policy as a node-side scheduling concern in
  positive form.
- Pseudocode: guard against bytes_delta == 0 before computing
  committed_rate to avoid divide-by-zero in implementations.
- Drop §"How this resolves the prior #402 questions" — the useful
  semantic invariants (per-stream, admission-time-only, address
  resolution) are folded into §Properties; the rest was iteration
  narrative that belongs in the issue and commit messages, not the
  canonical appendix.
- §References: drop the #402 entry; the issue tracker is the wrong
  consumer for canonical cross-references.

Per CLAUDE.md / adr/README.md: ADRs and appendices read as the
canonical specification, not as an iteration log.

https://claude.ai/code/session_01V3AAY9Jnsmkqf3xg8c98Ui
Per discussion on PR #445: the appendix carries too little canonical
content to justify its own file. Detailed implementation guidance
(two-lane scheduler pseudocode, non-preemptive admission, per-client
cap, variations) lives in #446 instead — that's the right granularity
for operator-facing implementation suggestions.

ADR 003 §Admission and Priority retains a tight description of the
two protocol-available signals (committed voucher rate as floor-not-
equality, and StakingRegistry.stakeOf for optional lane eligibility)
since that information is genuinely about the protocol surface, not
about scheduling policy.

Reverts:
- Delete adr/appendix-admission-policy.md
- Revert architecture.md §Appendices entry
- Revert adr/README.md reading-order book build file list

https://claude.ai/code/session_01V3AAY9Jnsmkqf3xg8c98Ui
@alpergundogdu alpergundogdu changed the title docs(adr): demote client priority staking to admission-policy appendix (#402) docs(adr): remove client priority staking surface (#402) May 7, 2026
@alpergundogdu
alpergundogdu merged commit b944d52 into main May 7, 2026
10 checks passed
@alpergundogdu
alpergundogdu deleted the claude/triage-blocking-issues-5atre branch May 7, 2026 09:16
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.

ADR gap: client priority staking edge-case semantics

2 participants