Repository navigation
Description
Sub-issue of #688. Mechanism C2 — synthetic-standing clawback (audit I-3, continued). Complexity L. HIGHEST RISK — money-burning + flash-loan threat model. Mandatory careful human review. Depends on C1 (#1017). Do last.
Problem
Even with C1 enforcing balanceOf >= APPEAL_FILER_TOKEN_THRESHOLD at filing, a TokenHolder filer can acquire (or flash-borrow) tokens, pass the standing gate, file an appeal, then immediately divest — "synthetic standing." The standing check at filing alone is gameable. The bond should be forfeited when an adverse outcome reveals the filer never held genuine standing.
Decisions (resolved)
- Magnitude: burn 100% of the escrowed bond on an adverse outcome where standing turns out synthetic. No extra collateral, no "multiplier" (the issue's multiplier would require a brand-new collateral-deposit surface — explicitly rejected as scope creep). The bond is already the filer's at-risk capital and the existing
token.burn(bondBurned)machinery is reused. - Flash-loan defense — block-gate only, no time lookback:
Token.solintentionally has no ERC20Votes / getPastVotes, sobalanceOf-at-time is the only available tool (confirms ADR-031's simpler path).- Snapshot the open block number on TokenHolder appeals.
- At adverse finality:
if (block.number > openBlock && token.balanceOf(filer) < appealFilerTokenThreshold) burn the bond instead of refunding. - The strict
block.number > openBlockgate defeats same-transaction / same-block flash-loan filing. NoSTANDING_LOOKBACK_SECONDSconstant (block-gate only).
Solution / scope (ContentBlacklist.sol)
- Add
uint64 openBlock(or reuse a free struct slot) to the appeal record, set inopenBlacklistAppealfor TokenHolder-path appeals (uint64(block.number)). - In the adverse finalizers (
rejectBlacklistAppeal,reverseBlacklistAppeal, and the perjury path from feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#688) #1016 if landed) add the clawback branch:- Only when
standingPath == TokenHolder. if (block.number > a.openBlock && token.balanceOf(a.filer) < appealFilerTokenThreshold) → burn full bond; else refund as today.- Emit a distinct
SyntheticStandingClawback(appealId, filer, bond)event.
- Only when
- Note: code already anticipates this (comment near the standing check references
status == Open && standingPath == TokenHolder). Align with that. - Confirm interaction with the existing bond-burn paths so a bond is never both refunded and burned (single decision point per finalizer).
Test plan (test/ContentBlacklist.t.sol)
- File as TokenHolder with balance >= threshold, divest below threshold, adverse outcome → bond burned (not refunded).
- File as TokenHolder, keep balance >= threshold, adverse outcome → bond refunded (no clawback).
- Block-gate: a finalize in the SAME block as open does not clawback (guard correctness).
- Favorable outcome → bond refunded regardless of balance.
- Non-TokenHolder paths never clawback.
- Re-entrancy / double-spend: bond is burned XOR refunded, never both.
CI / risk notes
--deny warnings: keep finalizers state-mutating; mind W5740.- This burns user funds on an adversarial-balance condition — the threat model (flash loans, partial divestment across blocks, griefing via forced adverse finality) must be reviewed by a human before merge. Spell out the threat model in the PR description.
ADR reconciliation
Document the clawback condition, the block-gate (and the explicit choice of no time lookback), and the balanceOf-only constraint imposed by Token having no ERC20Votes.
Agent-suitable: implementation yes, but flagged for MANDATORY human security review before merge. Land AFTER C1; never simultaneously with D (#1015) — shared finalizer accounting.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
docs(contracts): mark ADR-031 as target spec vs as-built (PR review)
docs(contracts): reconcile ADR-031 mechanical drift to as-built Conte…
feat(contracts): enforce Publisher and TokenHolder standing at appeal…
refactor(contracts): TokenHolder standing is the escrowed bond, drop …
docs(contracts): reconcile ADR 011 + runbook to bond-is-standing; fix…
feat(contracts): enforce Publisher and TokenHolder standing at appeal…