Skip to content

docs(adr): adopt shared payment pool over pairwise channels - #1650

Merged
alpergundogdu merged 16 commits into
mainfrom
claude/practical-lamport-45bbfb
Aug 11, 2026
Merged

alpergundogdu merged 16 commits into
mainfrom
claude/practical-lamport-45bbfb

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replaces the pairwise payment model — one funded escrow per (payer, node) pair, each with its own on-chain open and locked deposit — with a shared payment pool. ADR-only change (design docs; no contract/code implementation). Pre-launch, so the old shape is deleted rather than shimmed.

One funded pool backs off-chain vouchers from many independent capped signers to many nodes.

  • Capability (off-chain, owner-signed): { signer, spending_cap, pool_id, expiry } — node-agnostic.
  • Voucher (signer-signed): { pool_id, signer, provider, cumulative, bytes_delivered } — node-addressed. provider is mandatory because pool_id no longer encodes the payee. No nonce (cumulative amount is the sole ordering/replay guard) and no token field (single-currency contract; the EIP-712 domain separator already binds the one deployment).
  • Contract enforces: per-signer cap via authorized[pool][signer] = {cap, expiry, spent}; a two-dimensional sharded register watermark[pool][signer][provider]; register-the-capability-once (owner sig verified on first redemption, vouchers-only afterward); and pay min(delta, remaining) so the pool never goes negative. Served bytes are forwarded to FeeRouter paid-proportional (bytesPaid = mulDiv(bytesDelta, paid, delta)), so served-bytes accounting never outruns paid USDC in a drained pool.
  • Regular close only with the existing ~2-day window (now a redemption grace window), finalized per (signer, provider) lane; reclaim returns deposit minus total redeemed. Cooperative close dropped.
  • Revocation is expiry-based plus a node-side stop-serving signal. No redemption-gating epoch.
  • A pool never expires. maxChannelDuration / expiresAt / reclaimExpired are retired: a pool stays open until the owner closes it, and a node's redemption deadline is each signer's capability expiry plus the grace window.

Boundary kept crisp: the contract enforces caps, the sharded register, min(delta, remaining), regular close, and expiry-of-capabilities. The credit window (per-node unredeemed-exposure cap, D ≥ Q_b · c) is node policy, not contract.

Naming: the contract is PaymentPool (poolId, poolNonce, openPool/closePool/redeem/reclaim, Pool* events). Nothing in the ADR set reads as "channel" except intentional "the old per-channel pin" contrasts and generic QUIC/transport uses.

Chain-agnostic: the pool makes opens rare and off the client hot path, so fast/cheap opens are no longer required. No L1-vs-L2 decision is made here.

Files revised

  • Core: adr/003-payments.md (payment model rewritten to the pool; pairwise design deleted), adr/016-contract-interactions.md (PaymentPool surface, class diagram, call/fund tables, events, read API), adr/024-account-abstraction.md (AA/session keys operate on signature validation; many concurrent signers on one pool is an accounting-layer property — the sharded register), adr/appendix-l2-deployment.md (opens rare → chain choice is a cost/neutrality decision; Arbitrum One selection unchanged), adr/architecture.md.
  • Wire: adr/005-protocol.md — voucher format gains signer/provider; VoucherRejectReason adds WrongPool/CapExceeded, drops CooperativeCloseSigned, the obsolete Expired, and (with the token field gone) StaleNonce/WrongToken; per-lane concurrent-stream and watermark-bundle wording.
  • Downstream sweep (done in this PR): 009, 011, 012, 017, 018, 026, 036, 037, 038, 039 (its multi-source payment section switched from one-escrow-per-source to one pool with per-(signer, provider) lanes), glossary.md, both README.mds, and the appendices (fraud-detection retitled Permissionless Settlement Analysis, operator-key-rotation, observability, bundles, poc-production-seams, operator-upgrade-path).

Verified (as requested)

  • ADR 036 (served-bytes voting weight) — unaffected. Accounting keys off FeeRouter.routeSettlement, which still fires on every redemption; forwarding paid-proportional bytes keeps per-byte revenue and vote weight derived from real, floor-priced USDC even when a pool is drained.
  • ADR 002 / ADR 011 — content-scope isolation is OUT of scope. The per-signer spending cap is the isolation the pool provides; no content-scoped gating is introduced.

Notes

  • Observability metric identifiers keep their shipped-code spellings (decdn_channel*, ChannelOpenFailureReason). These mirror real Rust code in crates/node / crates/incentive / crates/client-pull and are gated by metrics.rs::adr_registry_names_are_exported; only their descriptions use the pool model. Renaming the metrics/enum needs a companion code change, out of scope for this ADR-only PR.
  • With openPool no longer naming a provider, PaymentPool no longer calls CapacityBond.isActive() (node-active gating moves to off-chain node selection); the CapacityBond constructor dependency is now vestigial — a small follow-up.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced shared payment pools with multiple capped signers and provider-specific payment lanes.
    • Added redemption, batch redemption, closure, fund reclaim, partial payouts, and grace-period recovery.
    • Added capability-based authorization with spending limits and expiry.
    • Added smart-account and gasless pool-opening support.
  • Protocol Updates

    • Updated stream requests, vouchers, recovery, and rejection handling for pool-based payments.
    • Added provider and capability validation.
  • Documentation

    • Updated architecture, governance, onboarding, privacy, deployment, observability, and operational guidance.

Copilot AI lite review requested due to automatic review settings August 10, 2026 15:55
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@alpergundogdu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: a5182f51-1ddb-4473-be31-1510218498f4

📥 Commits

Reviewing files that changed from the base of the PR and between f33f26d and 4a70719.

📒 Files selected for processing (8)
  • adr/003-payments.md
  • adr/005-protocol.md
  • adr/013-schema-evolution.md
  • adr/016-contract-interactions.md
  • adr/017-privacy.md
  • adr/038-bao-verified-range-streaming.md
  • adr/appendix-bundles.md
  • adr/glossary.md

Walkthrough

The ADRs replace provider-specific payment channels with shared payment pools. The model adds delegated signer capabilities, provider-addressed voucher lanes, per-redemption FeeRouter settlement, grace-period reclaim, updated protocol rejection handling, and aligned architecture and deployment guidance.

Changes

Payment pool protocol redesign

Layer / File(s) Summary
Pool lifecycle and redemption model
adr/003-payments.md
Defines shared pools, capped signers, provider lanes, redemption, reclaim, solvency bounds, replay protection, and FeeRouter routing.
Voucher and signer authorization
adr/003-payments.md, adr/005-protocol.md, adr/012-client.md, adr/024-account-abstraction.md, adr/013-schema-evolution.md, adr/014-on-chain-verification.md
Updates voucher payloads, signer capabilities, lane watermarks, rejection reasons, retry handling, session binding, wire fields, and account-abstraction roles.
Contract interaction and routing updates
adr/016-contract-interactions.md
Documents pool opening, redemption, reclaim, recovery views, FeeRouter routing, fund flows, roles, events, deployment, and reentrancy coverage.
Protocol, client, and ecosystem alignment
adr/009-governance.md, adr/011-content-takedown.md, adr/017-privacy.md, adr/018-liquidity-strategy.md, adr/019-node-onboarding.md, adr/026-tokenomics.md, adr/036-served-bytes-voting-weight.md, adr/037-regional-proxy-warming.md, adr/038-bao-verified-range-streaming.md, adr/039-multi-source-parallel-fetch.md, adr/architecture.md, adr/appendix-*, adr/README.md, adr/_build/part-3-payments.md, adr/glossary.md, README.md
Aligns governance, privacy, liquidity, onboarding, tokenomics, streaming, deployment, monitoring, key rotation, architecture, glossary, and project documentation with payment pools and redemption.

Estimated code review effort: 4 (Complex) | ~45 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

Pull request overview

This PR updates the deCDN ADR set to replace the pairwise (client, provider) payment-channel model with a shared on-chain payment pool backing off-chain vouchers, keeping the change strictly in design documentation (no code/contracts).

Changes:

  • Rewrites ADR 003 to specify the shared pool + capability-authorized signers + per-(signer, provider) lanes, and updates associated threat model/operational assumptions.
  • Updates contract-surface documentation (ADR 016) to reflect the new PaymentChannel pool API (openChannel, redeem, closeChannel, reclaim) and related flow diagrams/tables.
  • Reconciles protocol/account-abstraction docs (ADR 005, ADR 024, architecture overview, L2 appendix) to match the new voucher fields (signer, provider) and new close/reclaim semantics.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
adr/003-payments.md Replaces pairwise channels with shared payment pool + capability/voucher model and lane-based redemption/close semantics.
adr/016-contract-interactions.md Updates the documented smart-contract surface and interaction tables/flows for pool-backed redeem and reclaim lifecycle.
adr/005-protocol.md Updates wire/protocol semantics for voucher fields and new reject reasons aligned to the pool model.
adr/024-account-abstraction.md Reframes AA/session-key discussion around capability-authorized signers and separates signature validation from accounting/lane mechanics.
adr/appendix-l2-deployment.md Adjusts L2-selection rationale for “opens are rare/off hot path” under the pool model.
adr/architecture.md Updates the living architecture overview’s payments chapter description to the shared pool design.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread adr/appendix-l2-deployment.md Resolved
Comment thread adr/003-payments.md Resolved
Comment thread adr/003-payments.md Resolved
Comment thread adr/016-contract-interactions.md Resolved
Comment thread adr/005-protocol.md Resolved
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Update (2nd commit): downstream reconciliation done. The whole adr/ folder is now free of pairwise-channel prose. Additional files revised:

  • 009-governance.md — the 48h–72h window is described as the redemption grace window.
  • 012-client.md — owner/signer roles, capability delegation (cap + expiry), key-compromise response via expiry revocation + close/reclaim.
  • 017-privacy.md — P-02/P-22 keyed on pool owner + redemption events; channel_id = keccak256(owner, channelNonce); redeem not settle/dispute.
  • 018-liquidity-strategy.md — FeeRouter fed by redeem.
  • appendix-operator-key-rotation.md — rotation waits on redeeming provider lanes (no dispute window); capability expiry gives native revocation.
  • appendix-fraud-detection.md — retitled to Permissionless Settlement Analysis: under the pool there is no stale-close/disputeChannel vector, so it reframes around off-chain settlement-flow analysis + the node's own in-process redemption monitor. Inbound links updated in architecture, 009, 016, 005, 003. (The frozen _history/033 link is intentionally left; the anchor gate does not scan _history.)

Remaining open item: PaymentChannel no longer calls CapacityBond.isActive() (open names no provider) — the CapacityBond constructor dependency is now vestigial; left in place to avoid deployment-order ripple.

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.88% (was 80.88%, ● 0.00%) — 60163/74382 lines

No Rust files changed in this PR.

History
Commit Total Δ vs base
62eec97 80.90% ▲ +0.02%
d0a596d 80.88% ● 0.00%
14a2e45 80.88% ● 0.00%
553ed38 80.89% ▲ +0.01%
f33f26d 80.88% ● 0.00%
755a85e 80.88% ● 0.00%
613bd1d 80.89% ▲ +0.01%
26f4e8a 80.89% ● 0.00%
2f97db9 (HEAD) 80.88% ● 0.00%

alpergundogdu and others added 16 commits August 11, 2026 12:18
Replace the one-(client,provider)-channel-per-pair payment model with a
shared pool: one funded deposit backs off-chain vouchers from many capped
signers to many nodes.

- adr/003: rewrite the payment model as a pool. Owner-signed capabilities
  ({signer, spending_cap, channel_id, expiry}, node-agnostic) plus
  signer-signed node-addressed vouchers ({channel_id, signer, provider,
  cumulative, bytes_delivered, nonce, token}). Contract enforces per-signer
  caps via authorized[channel][signer], a two-dimensional sharded register
  watermark[channel][signer][provider], register-the-capability-once, and
  pay min(delta, remaining) as the solvency backstop. Regular close only
  with the ~2-day grace window, finalized per (signer, provider) lane;
  reclaim returns deposit minus total redeemed. Drop cooperative close.
  Revocation is expiry + node-side stop-serving, no redemption-gating epoch.
  Credit window (per-node unredeemed exposure, D >= Q_b x c) is node policy,
  not contract.
- adr/016: PaymentChannel surface updated to the pool (openChannel(deposit),
  redeem, closeChannel, reclaim; sharded register; events; call/fund tables).
- adr/024: account abstraction operates on signature validation (who may
  sign); many concurrent independent signers on one pool is an
  accounting-layer property (the sharded register), not a signature scheme.
- adr/appendix-l2-deployment: opens are now rare and off the fetch path, so
  chain choice is a cost/neutrality decision; chain-agnostic, Arbitrum One
  selection unchanged.
- adr/architecture: living overview payment description updated.
- adr/005: reconcile the voucher wire format (adds signer/provider),
  VoucherRejectReason enum (WrongProvider, CapExceeded; drop
  CooperativeCloseSigned), and the watermark-bundle self-heal to the pool.

Payment model is chain-agnostic (no L1 vs L2 decision here).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sweep the rest of the adr/ folder for pairwise-channel prose left after the
pool rewrite, so the ADR set is internally consistent.

- appendix-fraud-detection: retitled to "Permissionless Settlement Analysis".
  Under the pool there is no stale-close/disputeChannel vector (redemption is
  provider-only and final; close only starts the grace window). Reframed
  around off-chain settlement-flow analysis (self-routing/wash-trading) plus
  the node's own in-process redemption monitor as self-protection. Inbound
  links updated in architecture, 009, 016, 005, 003.
- appendix-operator-key-rotation: rotation waits on redeeming provider lanes
  (no dispute window); old keystore retained while outbound pools' signer
  vouchers remain unredeemed; capability expiry gives native revocation.
- 012-client: owner/signer roles, capability delegation (cap + expiry),
  key-compromise response via expiry revocation + close/reclaim.
- 017-privacy: P-02/P-22 keyed on pool owner + redemption events;
  channel_id = keccak256(owner, channelNonce); redeem, not settle/dispute.
- 018-liquidity-strategy: FeeRouter fed by redeem, not settleChannel.
- 009-governance: 48h-72h is the redemption grace window.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- 003/016: redeem forwards a paid-proportional byte count
  bytesPaid = mulDiv(bytesDelta, paid, delta), so served bytes never
  outrun the USDC actually paid when a pool is partially drained; event
  and FeeRouter-integration prose updated to match.
- 003: align the FeeRouter hand-off to the safeTransfer push pattern
  (matches ADR 016), replacing the stale approve-then-route wording in
  the reentrancy note and redeem effects.
- 005: signer is the requester's verified Ethereum address (ephemeral
  binding when present, else on-chain registration), not "the bound
  client key" — covers node-to-node pulls that omit the binding.
- appendix-l2-deployment: "payment channels" -> "the payment pool".

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Grep-driven sweep of stale "payment channel" prose the pool rewrite missed:
glossary Channel/Voucher entries rewritten as Pool/Capability/Voucher;
ADR 039 payment section (was one channel per source, now one pool with
per-(signer,provider) lanes, deposit-fragmentation negative removed);
017 privacy P-02/P-07/P-22 keyed on pool+redemption; observability metric
descriptions and the obsolete disputes metric; 011 blacklist gate on pool
owner; 026 revenue "per redemption"; 005 concurrent-streams per-lane; and
per-lane/per-pool wording across 003, 009, 012, 014, 018, 019, 024, 036,
and the appendices.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Per follow-up: nothing should read as "channel", and a pool has no reason
to expire.

Rename (whole ADR set + READMEs):
- Contract PaymentChannel → PaymentPool; channelId → poolId, channelNonce →
  poolNonce (ownerChannelNonce → ownerPoolNonce), channel_id → pool_id.
- Events ChannelOpened/Redeemed/CloseInitiated/Reclaimed/ToppedUp →
  Pool*; functions openChannel → openPool, closeChannel → closePool.
- ChannelStateStore → PoolStateStore, ChannelError → PoolError,
  WrongChannel → WrongPool, ChannelOpenFailureReason → PoolOpenFailureReason;
  metrics decdn_channel*/decdn_channels* → decdn_pool*/decdn_pools*.
- EIP-712 domain name "PaymentChannel" → "PaymentPool"; #paymentchannel and
  the channel-named section headings/anchors updated with their inbound links.
- Remaining pairwise "payment channel" prose → pool/lane throughout.

Retire pool expiry entirely:
- Drop maxChannelDuration, Pool.expiresAt, reclaimExpired, ChannelExpiredReclaimed,
  and the Max-pool-duration safety bound. A pool never expires; owner funds are
  recovered only via closePool → grace window → reclaim, and a node's redemption
  deadline is each signer's capability expiry plus the grace window.
- Drop the obsolete VoucherRejectReason::Expired (capability expiry is covered by
  CapExceeded); update the constructor, events, and dependents (016, 024, 012,
  005, appendix-l2, appendix-operator-key-rotation, 009).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The rename pass renamed metric identifiers in appendix-observability, but
those mirror shipped Rust code (crates/node, crates/incentive, crates/client-pull)
and are gated by metrics.rs::adr_registry_names_are_exported, which asserts every
`live` registry row resolves to an exported series. Restore the code spellings
(decdn_channels_open, decdn_channel_deposit_usdc,
decdn_buyer_channel_store_skipped_undecodable_records_total, the
decdn_channel_open_failures_* family, and the ChannelOpenFailureReason enum);
only their descriptions use the pool model. Note added that renaming these needs
a companion code change. `planned` rows (not gated) keep pool names.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Two fixes to redeem semantics on a drained pool:

- The lane watermark now tracks cumulative *paid* amount, not the voucher's
  claimed cumulative. redeem pays min(desired, capRoom, remaining) where
  desired = cumulative − paid, and advances the watermark by `paid` only. A
  drained pool pays partially and the same voucher can be re-presented after a
  top-up to collect the rest — a node no longer forfeits an over-committed
  voucher to a transient drain. When nothing is payable, redeem reverts
  NothingToRedeem (writes no state) instead of saving-and-failing. Redemption
  is now purely cumulative: the on-chain nonce gate is dropped (nonce stays an
  off-chain ordering/VoucherAck field), and replay is automatic (a paid voucher
  pays 0). Per-signer cap is enforced on paid USDC (spent += paid).
- Add redeemMany(entries[]): applies redeem per entry and SKIPS (does not
  revert) any that would pay 0 — drained pool, stale/paid voucher, expired
  capability, cap reached — so one empty lane never sinks the batch; reverts
  only on a bad signature or wrong payee.

Reconciles 003 (register struct, redeem steps, events, nonce convention,
replay, reject table, credit-window), 016 (redeem row, redeemMany, class
diagram), 005 (reject-reason framing: ordering guards are off-chain-only now).
Also fixes two rename misses: ownerChannelNonce→ownerPoolNonce, ChannelId→PoolId.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Make the reconciliation explicit: a node reads *paid* from the authoritative
on-chain lane watermark (watermark[poolId][signer][provider].amount, echoed as
newPaidCumulative in PoolRedeemed) rather than assuming its voucher cleared —
which a drained-pool partial pay would violate. *Owed* is the highest accepted
voucher cumulative it already persists per lane. unredeemed = owed − paid drives
the credit window and the retry loop; it can pre-check getPool / getAuthorization
to skip a doomed redeem, and both sides survive a restart (paid re-read from
chain, owed from the persisted store).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
A node follows the paid side by subscribing to PoolRedeemed filtered on its own
(indexed) provider address and applying each event's newPaidCumulative — its own
redeem/redeemMany txs included — so the event stream is the single write path for
paid and a partial pay is recorded exactly. It follows PoolToppedUp to re-drive
dry lanes, and reconciles on startup by enumerating from a pinned block then
tailing live (matching the other chain watchers). eth_call getPool/getAuthorization
is only an optional pre-flight to skip a doomed redeem, never for tracking state.
Also fix the PoolRedeemed indexed-fields note (poolId/signer/provider, not "redeem").

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Solvency model change per updated proposal:

- Replace the dynamic per-node redemption credit window (c = balance/Q,
  Q-estimation, earned-window-as-security, D >= Q_b·c) with a refundable
  minimum-remaining-deposit M. Nodes stop serving when the pool's on-chain
  remaining balance <= M; the reserved M covers all in-flight vouchers (tail =
  zero), unused M refunds to the owner at close, and it also removes node-vs-node
  racing (with M >= in-flight there is nothing to race for). M is NODE POLICY,
  not a contract field — the contract is unchanged (still pays min(desired,
  remaining)). Sizing M = k·ρ·B·Δ (per-lane M = N·t, threshold t = ρ·V·Δ); t is
  a gas knob (trust-graduated), M is the security parameter.
- Residuals stated honestly: fan-out (zero tail up to N = M/t; wider reopens it,
  bounded by rate-anomaly clamping) and self-dealing (bounded by M, taxed by the
  FeeRouter cut; escrow un-yankable).
- No full provisioning, no onboarding-cost mitigation (both dropped per request).
- Pool expiry stays retired; note made explicit that the money layer carries no
  max-duration and only capabilities carry a short-TTL expiry.
- appendix-l2: detection delay Δ is chain-dependent and scales M (fast finality
  => small M), kept chain-agnostic. 016/024/architecture need no change (M is
  node policy). Reconciled 039's two solvency references.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Make the cold-start win explicit: because the security bound is the reserved
floor M (not a per-relationship earned window), a node serves a brand-new pool
at full link speed from the first byte — trust affects only redemption cadence
(t, gas), never delivery rate. The only limit on an unproven pool is fan-out
width (the rate-anomaly-clamped residual), not per-stream speed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The fan-out residual hand-waved "implied aggregate bandwidth" without saying how
a node that only sees its own lane could know it. Add the mechanism: redemptions
are public (PoolRedeemed indexed by poolId), so every node sums all lanes'
redemptions to observe the pool's aggregate draw rate (d(totalRedeemed)/dt / price)
and remaining balance, and refuses to keep serving when the aggregate exceeds the
B that M reserves for. All nodes clamp on the same public signal without knowing
fan-out N. Honest victims redeem (revealing the draw); the only hidable draw is
self-service (not a free-ride). Residual gap is the redemption lag (<= t per lane)
plus detection delay, bounded because overshooting M requires physically pulling
B·Delta of real bytes at egress cost, independent of fan-out width.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Rate-anomaly clamping (nodes observing the pool's public aggregate redemption
rate and refusing past B) is too much machinery for a small, self-limiting
residual. Remove it. The fan-out residual is now stated honestly and accepted:
each node's exposure to a fresh pool is only its small redemption threshold t,
enlarging the aggregate tail forces the attacker to fan across proportionally
many nodes while physically pulling real bytes (egress cost), and self-dealing is
taxed by the FeeRouter cut. M sized for the expected fan-out closes it in the
common case (honest clients are sticky); it is not driven to zero and need not be.
M remains the sole solvency mechanism; node policy is just M + t.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The node's continued delivery is already the implicit acknowledgement of a
voucher, and with cumulative settlement a lost voucher just pauses delivery and
is resent — so the explicit VoucherAck wire message is redundant. Remove it:

- 013: drop the VoucherAck ClientMessage variant (renumber StreamEnd/Ping/Pong)
  and the two prose mentions.
- 005: remove it from both cdn/client/v1 sequence diagrams; reframe the
  credit-window flow (no per-interval ack round-trip — continued delivery is the
  implicit ack, a rejected voucher stops delivery and is resent); connection
  lifetime no longer waits on an ack; StaleNonce retry no longer references it.
- 038: drop it from the envelope lists.
- 003: durability now keys on "before delivering further bytes" (not "before
  VoucherAck"); persist-fail stops delivery; nonce reframed as an off-chain
  per-lane sequence — with VoucherAck gone its dropped-ack rationale is gone, and
  it is now redundant with the cumulative (retained only as bookkeeping).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ng guard

The voucher nonce is redundant with the cumulative amount. On-chain
redemption was already purely cumulative (redeem pays cumulative - paid),
and off-chain a node can order and replay-check by amount alone: it expects
each voucher to advance the lane by last_amount + rate_per_mb * new_chunks.

Drop the nonce field from the voucher object, VOUCHER_TYPEHASH, the digest,
and redeem/redeemMany signatures. Remove the StaleNonce reject reason and
the WatermarkBundle nonce field; AmountRegression becomes the sole off-chain
ordering/replay guard and absorbs the crash-reconnect self-heal path.
Replace the Voucher Nonce Convention section with a Voucher ordering note.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…t redundant

The PaymentPool settles in one token fixed at deployment (immutable
constructor argument), so a voucher can only ever pay in that token.
Cross-token replay does not arise, and the EIP-712 domain separator
already binds each voucher to the one contract deployment.

Remove token from the voucher object, VOUCHER_TYPEHASH, the digest, the
redeem-side signed payload, the WatermarkBundle authentication tuple, and
the wire format. Drop the WrongToken reject reason (enum, off-chain
rejection table, retry table) and decrement the mirror counts.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu force-pushed the claude/practical-lamport-45bbfb branch from 27e704c to 4a70719 Compare August 11, 2026 11:18
@alpergundogdu
alpergundogdu merged commit 6e94e3e into main Aug 11, 2026
4 checks passed
yigitdot added a commit that referenced this pull request Aug 11, 2026
One conflict, in adr/appendix-operator-key-rotation.md steps 7-10 of the
EOA -> EOA migration. #1650 rewrote the payment model from pairwise channels
to a shared pool and swept this file's vocabulary; this branch had rewritten
step 8 in review round 4.

Resolved per-line rather than per-hunk, since the two sides touched disjoint
steps:
- step 7  -> main (rewritten for pools; this branch never edited it)
- step 8  -> ours (the 'from the old address' fix that dropped an
             over-constraining 'before deregister', plus the three-step
             archive-restore procedure — main left step 8 untouched)
- steps 9, 10 -> main (channels -> pools)

Deliberately NOT swept: the channel vocabulary in this branch's Rust doc
comments. #1650 is ADR-only (no crates/, no contracts/) — PaymentChannel.sol
still exists and PaymentPool.sol does not — so those comments describe what
the code actually does today. Rewriting them to pool vocabulary would make
them false, which is the failure mode the earlier review rounds were about.
The metric names decdn_channels_open and decdn_channel_deposit_usdc are
likewise unchanged, matching main's own choice to keep them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@thiras
thiras deleted the claude/practical-lamport-45bbfb branch August 11, 2026 15:21
thiras added a commit that referenced this pull request Aug 11, 2026
Two stacked ADR decisions that keep per-MB metering while removing the
machinery built to make a signed per-interval voucher fast.

The fsync-before-VoucherAck rule in ADR 003 put a ~3.18 ms durable commit on
the acknowledgement path. That forced the credit window to cover
`RTT + commit_interval`, which forced group-commit batching, which forced
voucher-interval negotiation and the concurrent-stream lane-arbitration rules.
Both decisions dismantle that tower from the base.

1. Persistence is best-effort; the chain is the floor.
   Accept on verification and persist asynchronously, flushing on a value bound
   so the post-crash replay surface is at most one credit window — the credit a
   node already extends by serving. An unknown lane seeds its floor from
   `watermark[poolId][signer][provider]` with one eth_call; the lane floor is
   `max(local, chain)`. Seeding is lazy and per-lane, so a pool naming no
   provider never needs to be node-enumerable. A persist failure becomes a
   metric, not a wire rejection.

2. The voucher becomes a chain-epoch anchor; preimages meter the chunks.
   PayWord on each lane: one signed Voucher opens an epoch (default 1024 x
   64 KiB) carrying chainRoot/chainLength/chunkBytes/chunkPrice, and each chunk
   is paid by a bare 32-byte Preimage — one keccak, no signature, no ack, no
   round trip, nothing to persist. `redeem` walks at most MAX_CHAIN_LENGTH
   (1024) hashes and the contract stores no chain state, so the pool, per-signer
   cap, sharded register, min(delta, remaining) and FeeRouter routing are
   untouched. The meter gets 64x finer rather than coarser, and the withholding
   bound tightens with it.

Wire (pre-launch cut, no shim): VoucherAck removed and Preimage takes its slot;
voucher_interval_mb replaced by node-advertised chunk_bytes; WatermarkBundle and
the VoucherRejected bundle field removed, since a signer derives its own chain
index; VoucherRejectReason drops StaleNonce/AmountRegression/BytesRegression/
RetryLater and adds BadChainParams/StaleEpoch/BadPreimage/ChainExhausted.

ADR 003 Concurrent Streams rules 1 and 3 are deleted rather than deferred —
they were specified but never implemented, and a lane-wide chunk size makes
them unnecessary.

Corrects two downstream claims the chain invalidates: ADR 024 and ADR 012 both
motivated session keys with "a 100 MB download needs 100 signatures", which is
now about two. The session-key case is rewritten to rest on unattended
operation (nodes sign slash_sig per response; payer signatures scale with lanes
and have nobody to confirm them), which the chain does not weaken.

Stacked on #1650. Docs only — implementation follows as separate issues.

Verified: make -C adr check-refs (1685 anchors resolve), check-book-list,
adr-ref-hygiene + adr-book-list + trailing-whitespace + end-of-file-fixer
pre-commit hooks, and `cargo nextest run -p decdn-node -E 'test(/metric/)'`
(39 passed) for the appendix-observability registry check. markdownlint fails
only on .github/workflows/issue-triage.md, identical before this branch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants