Skip to content

docs(adr): resolve corruption at the wire — drop ADR 014 §2 + OffenseType.Corruption - #480

Merged
alpergundogdu merged 4 commits into
mainfrom
feat/adr-003-corruption-wire-level
May 8, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
feat/adr-003-corruption-wire-level

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

Replaces ADR 003's §Corrupted delivery forward-reference to ADR 014 §2's optimistic challenge-response (and the in-progress ADR 030 Merkle-bisection upgrade in #477) with the actual resolution: progressive BLAKE3 verification at the client + post-verification voucher signing means corruption is fully absorbed at the wire and never results in payment for corrupt bytes.

Why drop the on-chain slash path

For corruption slashing to add value over progressive BLAKE3 + voucher cadence, there has to be a scenario where:

  1. A node delivers bytes that don't BLAKE3 to X
  2. The client can't detect this in real time
  3. Therefore the client signs/banks payment for corrupt bytes
  4. Slashing recovers the loss

Step 2 doesn't hold. iroh-blobs surfaces bao-verified chunks at the leaf level — verification completes within microseconds of each chunk arrival, well before any voucher boundary. Vouchers are signed only after the corresponding chunks have been verified, so a corrupt window yields no voucher. Client monetary loss in the corruption case is zero.

The "node signs wrong merkle_root (R)" attack only manifests as observable harm if the node also ships matching wrong bytes — at which point it's the same as wire corruption, caught by BLAKE3 streaming. R itself is never observable to anyone in the corruption case.

What this PR changes

One paragraph in adr/003-payments.md §Corrupted delivery:

  • Removes link to ADR 014 §2 optimistic challenge-response
  • Removes mention of "interactive keccak256 Merkle proof for production" (ADR 030 / PR feat(adr): production BLAKE3 corruption verification (#387) #477)
  • Adds wire-level explanation with cross-reference to §Voucher withholding for the symmetric voucher_interval risk cap
  • Notes node-local acceptance policies as the right place for client-reputation handling (out of protocol scope)

Follow-up (separate PRs)

  • Remove ADR 014 §2 (optimistic corruption path)
  • Drop OffenseType.Corruption from the enum (no contract path slashes on it after §2 is gone)
  • Closing #477 and #387 as superseded by this resolution

Test plan

  • ADR 003 markdown renders cleanly
  • Internal anchor link to #voucher-withholding resolves
  • No remaining references to ADR 014 §2 corruption-slash path from ADR 003

🤖 Generated with Claude Code

…e-level resolution

Progressive BLAKE3 verification at the client (already mandatory in
cdn/client/v1) plus post-verification voucher signing means a client
never pays for corrupt bytes — detection drops the connection before
any voucher commits to the bad window. The on-chain slash path that
ADR 014 §2 specified, and that ADR 030 (PR #477) attempted to upgrade
to a Merkle-bisection scheme, is solving a non-problem: corruption is
caught at the wire and absorbed by the existing voucher cadence.

This commit removes the forward reference from §Corrupted delivery to
ADR 014 §2, replacing it with the wire-level explanation and a
parallel framing to §Voucher withholding for the bidirectional risk
cap. Follow-up: remove ADR 014 §2 itself and drop OffenseType.Corruption
from the enum.

Refs: PR #477 (closing), issue #387 (closing).

Co-Authored-By: Claude Opus 4.7 (1M context) <[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 updates ADR 003 to replace the on-chain slashing mechanism for content corruption with a wire-level progressive BLAKE3 verification strategy, where vouchers are withheld for corrupt data. A review comment identifies a stale reference to the old slashing mechanism in the 'Negative consequences' section that should be removed to maintain internal consistency.

Comment thread adr/003-payments.md Resolved
…nces

Per gemini-code-assist review on PR #480: the §Negative bullet referencing
"intermediate scheme for slash evidence" via ADR 014 is no longer
applicable now that corruption is resolved at the wire. Removing it to
keep ADR 003 internally consistent with the new §Corrupted delivery
resolution.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Addressed in 29a219e — removed the stale §Negative consequences bullet that referenced ADR 014's intermediate slash scheme. Thanks for catching it.

…eType.Corruption

Cascading follow-up to the wire-level corruption resolution in §Corrupted
delivery (this branch's first commit). Since corruption is fully absorbed
at the wire by progressive BLAKE3 verification + post-verification voucher
signing, there is no on-chain corruption-slash path to specify.

Removed:
- ADR 014 §2 (BLAKE3 Content Corruption — Optimistic Challenge-Response)
- OffenseType.Corruption from the enum
- submitCorruptionChallenge / counterChallenge / resolveChallenge from ISlashJudge
- DeliveryReceipt typedef
- The §3 → §2 / §4 → §3 renumbering of remaining sections
- Corruption gas-table row, maxActiveChallenges entry, evidenceHash preimage

All four remaining offenses (Phantom, RateManipulation, Blacklist,
ReceiptFraud) now resolve synchronously at submit time — no
counter-evidence window for any.

Cascading updates across ADRs:
- ADR 016: drop submitCorruptionChallenge from contract diagram + function table
- ADR 024: drop submitCorruptionChallenge AA digest row
- ADR 027: detach contentRoot from the (removed) ADR 014 §2 production path,
  inline the per-stream chunk-tree construction, mark as informational
- ADR 028: update offense-type counts and section-§2 cross-refs
- ADR 008: drop the now-false slashing-deterrent claim from the 40%
  correctness-weight footnote; replace with reputation + economic
  (no-payment-on-failed-delivery) framing
- ADR 011: repoint MAX_EVIDENCE_AGE_US references to §Evidence Staleness
- appendix-poc-production-seams: drop CorruptionChallenger trait,
  drop Corruption verification row, renumber affected seam sections
- appendix-operator-key-rotation: update §3 reference and drop
  corruption-challenge counter-evidence mention
- architecture.md: drop "optimistic challenge-response for corruption"
  from the ADR 014 description

Refs: PR #477 (closed), issue #387 (resolved-no-action).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alpergundogdu alpergundogdu changed the title docs(adr-003): resolve corruption at the wire, drop ADR 014 §2 reference docs(adr): resolve corruption at the wire — drop ADR 014 §2 + OffenseType.Corruption May 8, 2026
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 content corruption as an on-chain slashable offense, shifting the responsibility for verification to the client via progressive BLAKE3 checks at the wire level. Consequently, the optimistic challenge-response mechanism and the 24-hour counter-evidence window are removed from the SlashJudge contract, and several ADRs are updated to reflect this architectural shift. Feedback indicates that removing 'Corruption' from the OffenseType enum violates the documented append-only rule, which could break ordinal-based indexing in consumer contracts like SafetyReserve. Additionally, the documentation for the new submitReceiptFraudChallenge function is missing a required external call to FeeRouter.epochSummary().

/// and append-only — new offense types extend the enum at the end so existing
/// `slashId` allocations remain stable.
enum OffenseType { Corruption, Phantom, RateManipulation, Blacklist, ReceiptFraud }
enum OffenseType { Phantom, RateManipulation, Blacklist, ReceiptFraud }

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

Removing Corruption from the beginning of the OffenseType enum will shift the ordinals of all subsequent offense types. While this is a Draft/PoC, the text on line 224 explicitly states that the order is "contract-canonical and append-only" and that "existing entries MUST NOT be reordered" because consumer contracts (like SafetyReserve) index by ordinal. To maintain ordinal stability and adhere to the documented rule, consider keeping Corruption as a deprecated placeholder or explicitly noting that this is a breaking change for the PoC.

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.
  2. Require slashing contracts to emit unique, monotonic identifiers for all offense types to support precise appeal referencing.

Comment thread adr/016-contract-interactions.md Outdated
| `submitPhantomChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |
| `submitRateChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |
| `submitBlacklistChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `ContentBlacklist.getEntry()` (read), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |
| `submitReceiptFraudChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |

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 "External Calls" list for submitReceiptFraudChallenge() is missing the required call to FeeRouter.epochSummary(). Adjudicating receipt fraud requires retrieving the operator's committed aggregateRoot from the FeeRouter contract to verify the provided Merkle proofs. This dependency should also be reflected in the cross-contract call graph and diagram (lines 458-498).

Suggested change
| `submitReceiptFraudChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |
| `submitReceiptFraudChallenge()` | `IERC20.safeTransferFrom()` (TOKEN bond deposit), `FeeRouter.epochSummary()` (read), `StakingRegistry.slash()`, `IERC20.safeTransfer()` (slash reward + bond return on success) | `nonReentrant`, checks-effects-interactions |
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.
  2. When refactoring or removing protocol features, perform a comprehensive update of all related documentation, including ADR tables and diagrams, to eliminate stale references.

…aud row

Two follow-ups from gemini-code-assist review of 3ba8973:

1. ADR 014: drop the historical "earlier drafts" narrative from the Context
   section and the "append-only / MUST NOT be reordered / SafetyReserve
   indexes by ordinal" prose around the OffenseType enum. There's no
   contract deployed and no consumer indexing by ordinal — the apparatus
   wasn't load-bearing yet.

2. ADR 016: add `FeeRouter.epochSummary()` (read of the operator's
   `aggregateRoot` for the challenged `(operator, epochId)`) to the
   `submitReceiptFraudChallenge` external-calls list. This is the
   on-chain dependency for verifying receipt-fraud Merkle proofs.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Addressed in eb68ead:

  • OffenseType enum / append-only narrative: dropped the historical "earlier drafts" prose and the "MUST NOT be reordered / SafetyReserve indexes by ordinal" justification. There's no contract deployed and no consumer code indexing by ordinal yet — the apparatus wasn't load-bearing.
  • submitReceiptFraudChallenge external calls: added FeeRouter.epochSummary() per the suggested diff.
  • ADR 003 line 154 "BLAKE3 verification on EVM" bullet: that finding is stale — the bullet was already removed in 29a219e. grep against the current file confirms no match for the quoted text.

@alpergundogdu
alpergundogdu merged commit 70ec8cc into main May 8, 2026
10 checks passed
@alpergundogdu
alpergundogdu deleted the feat/adr-003-corruption-wire-level branch May 8, 2026 16:16
thiras added a commit that referenced this pull request May 10, 2026
…esolution removed the threat (#501)

Closes #494.

The `##### Challenge rate limit` subsection in ADR 014 and its row in ADR 009's
governable-parameters table are stale artifacts of the previous async dispute
design. After PR #480 dropped `OffenseType.Corruption` and §2's optimistic
challenge-response, all remaining offense types (Phantom, RateManipulation,
Blacklist) resolve synchronously at submit time — ADR 014 lines 147–150 and
§Bond Handling line 199 already concede this. Spurious challenges revert
without bond transfer (line 200) so there is nothing for a defender to monitor
or dispute off-chain; valid challenges deserve to slash. Operator-side appeals
live in ADR 028 against `SafetyReserve` with their own deterrents and don't
motivate a `SlashJudge`-side cap.

No contract code is affected — `crates/contracts/` is empty.

Co-authored-by: Claude Opus 4.7 (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.

1 participant