Repository navigation
Description
Background
ADR 027 introduces a DeliveryReceipt primitive paired 1:1 with each voucher, plus an MMR aggregator on FeeRouter, plus a submitReceiptFraudChallenge entry point on SlashJudge, plus an OffenseType.ReceiptFraud enum value, plus a 7-day challenge window, plus identity-diversity rules, plus cold-start exceptions, plus reputation gating — all to defend the gauge bucket against wash-trading per ADR 026 §Risks.
The wash-trading attack is real (gauge boost is core to the tokenomics, see ADR 026 §3), so the defense itself needs to stay. But the receipt primitive is largely redundant with the existing Voucher.
The redundancy
| Required signal for diversity gating | ADR 027 source | Already available without receipts |
|---|---|---|
| Identity of paying party | receipt.clientPubKey (signed) |
channel.client (set at openChannel, stored in contract) |
| Bytes attributable to that party | receipt.bytesClaimed (signed) |
voucher.bytesDelivered (signed by same key) |
| Operator identity | receipt.operatorAddress (signed) |
channel.provider (stored at openChannel) |
| Epoch attribution | receipt.epochId (signed) |
settlement block timestamp, or add one epochId field to Voucher |
The DeliveryReceipt typedef commits to the same field set the Voucher already commits to, signed by the same key.
Proposed simplification
Compute distinct-client diversity directly from settled-voucher state inside FeeRouter:
mapping(address operator => mapping(uint64 epoch => uint256)) public distinctClientCount;
mapping(address operator => mapping(uint64 epoch => mapping(address client => bool))) seen;
mapping(address operator => mapping(uint64 epoch => uint256)) public bytesPerEpoch;
// Inside settleChannel:
uint64 ep = epochOf(voucher);
address c = channel.client;
address op = channel.provider;
if (!seen[op][ep][c]) {
seen[op][ep][c] = true;
distinctClientCount[op][ep] += 1;
}
bytesPerEpoch[op][ep] += voucher.bytesDelivered;At gauge claim time:
require(distinctClientCount[operator][epoch] >= MIN_DISTINCT_CLIENTS_PER_EPOCH);
uint256 bytes_i = bytesPerEpoch[operator][epoch];Per-settlement gas: ~+25k (2 SLOADs + 1–2 SSTOREs).
What this removes
DeliveryReceiptEIP-712 typedef- Per-voucher requester-side extra signature
FeeRouterMMR aggregator (peaks+leafCountper(operator, epoch))commitEpochReceiptRoot+commitEpochSummarykeeper jobsOffenseType.ReceiptFraudfrom ADR 014 enumsubmitReceiptFraudChallengeentry point fromSlashJudge- Bond economics for receipt-fraud challenges
- 7-day challenge window state machine
- Privacy regression on challenge (per-receipt
clientPubKeyexposure) - Funding-source diversity heuristic (kept as off-chain advisory if useful, but no longer load-bearing)
ADR 027 collapses from ~423 lines to ~80–120 lines.
What this keeps
MIN_DISTINCT_CLIENTS_PER_EPOCHthreshold (default 5, governable)- Funded-channel minimum + funding age gates
- Per-operator cooldown (a client identity counts at most once per
IDENTITY_COOLDOWN) - Reputation-gated stricter thresholds (§6) — applied to thresholds, not to a new primitive
- Cold-start exception (
gaugeBootstrapEpochs) enableGauge()launch prerequisite
Trade-offs
- Epoch attribution at settlement, not delivery. For 90-day long-lived channels, bytes are credited to the settlement epoch rather than the delivery epoch. Mitigations: short voucher cadence (already exists), encourage epoch-boundary settlement, or extend
VoucherwithepochIdfor per-voucher attribution at settlement. - No "operator commits per-epoch summary" point. Gauge accrual is tied to settlement; long-channel operators face delayed gauge claim. Acceptable cost given the surface removed.
- Funding-source diversity loses its dedicated home. Still doable off-chain, just not bonded under a formal fraud-challenge surface. The ADR §3 already calls it advisory and not cryptographically enforced.
Why this is safe
The on-chain diversity count is computed directly by FeeRouter from settled-voucher state — the operator never asserts a "summary" that could be a lie. There's nothing to challenge because there's nothing to forge: vouchers are already signed by channel.client (bound at openChannel), and the contract enforces uniqueness via the seen map.
Cascading changes
- ADR 014: drop
OffenseType.ReceiptFraud, dropsubmitReceiptFraudChallengefrom ABI - ADR 016: drop
submitReceiptFraudChallengefrom contract diagram + function table; addFeeRouterper-settlement bookkeeping - ADR 026 §Risks: update wash-trading defense cross-ref to point at
FeeRouterdiversity counting - ADR 008 §3 (if it references receipt-fraud) — verify and update
appendix-fraud-detection.md: drop receipt-fraud challenger flow
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
alpergundogdu commentedon May 8, 2026
Adding to scope: per-operator gauge-share cap, 5% default, governable.
Defense-in-depth alongside the diversity gate. Even if a sophisticated attacker bypasses the funding-source diversity heuristic and funds N Sybils through mixers, the gauge upside is bounded at 5% of the total bucket per operator regardless of claimed bytes. This caps the wash-trading payoff to a known maximum and shifts the attack ROI calculation decisively toward unprofitable.
Implementation: a single multiplicative cap inside ADR 026 §3 gauge formula. Trivial gas, ~2 lines of Solidity. Governable via ADR 009 safety bounds, e.g.
[1%, 25%].Will land in the same PR as the diversity-counting simplification.
alpergundogdu commentedon May 8, 2026
Scope expanded mid-PR after the wash-trading economic analysis (now in
internal/ideas/wash-trading-economics.md) showed that the diversity gate is redundant with the per-operator gauge-share cap.Walked through the math:
So PR #488 was retargeted from "simplify ADR 027" to "delete ADR 027 entirely":
CLAUDE.mdbytesPerEpochstorage map lives canonically in ADR 016 (FeeRouter)Voucher.epochIdfield lives canonically in ADR 003enableGauge()lives canonically in ADR 026 §2MIN_DISTINCT_CLIENTS_PER_EPOCH,MIN_CHANNEL_FUNDING_USDC,MIN_CLIENT_AGE,IDENTITY_COOLDOWNdistinctClientCount,_seenClientStablePaymentChannel.lifetimeDepositOf()view removed (had no consumer outside the diversity gate)summaryWindow/challengeWindowgovernable parameters from ADR 026 §11 droppedNet diff: 14 files, +46 / −311 (~−265 lines). Closing this issue when PR #488 merges.
🤖 Generated with Claude Code
docs(adr): drop ADR 027 — wash-trading defense is the per-operator ga…