Skip to content

feat(contracts): ADR-031 deferred ContentBlacklist appeal-integrity mechanisms — rejection cooldown, perjury denylist, standing clawback, per-body concurrent-appeal cap #688

Closed

Description

@thiras

Context

ContentBlacklist (PR #684) shipped the ADR 031 appeal lifecycle, but several integrity clauses were intentionally simplified / deferred for that revision (documented in the contract header, contracts/src/ContentBlacklist.sol:22-29). The security audit pass (#777) later surfaced the attack surface these deferrals leave open and scoped them out of the security PR because they need either a snapshot/balance-at-time primitive or an ADR update.

This issue is the single tracking item for all of that deferred ADR-031 appeal-integrity work. Consolidates #779 (security-audit framing, audit findings H-4 / I-3) — closed as a duplicate in favour of this issue.

The four mechanisms below are largely independent and can land incrementally; item 1 (rejection cooldown) is the most self-contained and the current top gap, since the bond is otherwise the only brake on raw appeal-spam.

Scope

1. Rejection cooldown — audit H-4

There is no rate limit on abusive/rejected filers — only the success-path frequency cap (lastRatifiedSuccessAt) throttles ratified filers. An attacker can spam openBlacklistAppeal across distinct live entries, bounded only by bond cost. ADR-031 specifies a rejection cooldown (e.g. N rejections / 90 days → lockout).

  • Add lastRejectionAt[filer] mapping; increment in rejectBlacklistAppeal; check in openBlacklistAppeal against a governable window. ~10 lines, ships independently.

2. Perjury denylist

Governance-maintained denylist of filers who submitted false appeals, checked in openBlacklistAppeal; populated on egregious-bad-faith rulings per ADR-031.

  • Add mapping(address => uint256) public perjuryDenylist (address => cooldownUntil); revert with a custom error (e.g. PerjuryDenylisted(filer, cooldownUntil)) while block.timestamp < perjuryDenylist[filer].
  • Governance-gated setter; cooldown (≈365 days) as a governable constant. Depends on off-chain adjudication criteria being defined.

3. Token-holder standing enforcement + synthetic-standing clawback — audit I-3

StandingPath is recorded but only enum-range validated — any address can file claiming any standing (Publisher / Operator / TokenHolder) without proving it, paying only the bond. ADR-031 §216 admissibility condition (c) requires a balance/standing check.

  • Decide the snapshot mechanism (ERC20Votes getPastVotes, or a simpler balance-at-file-time check) and update ADR-031 §216(c) with the chosen approach before implementation.
  • At StandingPath.TokenHolder filing, snapshot the filer's TOKEN balance; on adverse ruling claw back the bond + a multiplier if the snapshot was transiently inflated (flash-loan / transient deposit). Block-number gate to frustrate same-tx flash loans.

4. Per-(requesting_body, region) concurrent-appeal cap

The per-body cap currently enforces a single per-region hard ceiling (BODY_CONCURRENT_APPEAL_CAP = 3) rather than per-requesting-body identity, so one body can saturate a region's slots.

  • Track concurrent appeals per (requesting_body, region) pair (e.g. mapping(address => mapping(uint8 => uint256))); increment on filing, decrement on resolution; revert with a descriptive error at the per-pair cap.

Tests

One happy-path + one revert-path fixture per mechanism; cover the flash-loan snapshot edge case for the clawback.

Note on already-shipped mitigation

#777 mitigated the related M-1 (per-region cap now counts only fast-tracked appeals, so Open-filing spam can't saturate a region's interim-relief budget) — partial relief, but it does not substitute for item 1.

References

CI reminders (Solidity)

  • Run FOUNDRY_PROFILE=ci forge build --sizes --deny warnings before pushing — denylist/cooldown revert paths must emit before revert if the function is otherwise non-mutating, or solc emits W5740 / mutability warnings that are fatal under --deny warnings.
  • aderyn (fail-on: high) and slither (fail-on: medium) both run in CI; put // slither-disable-next-line directives immediately above the function declaration for unused-return.
  • forge fmt + solhint run as pre-commit hooks; resolve 120-char named-args revert disagreements with positional args.
  • Watch the CapacityBond/ContentBlacklist --sizes gate — added storage + branches can push bytecode toward the EIP-170 limit.

Activity

  1. added
    kind:security
    on May 28, 2026
  2. added
    kind:feature
    on May 28, 2026
  3. github-actions commented on May 28, 2026

    @github-actions

    🎯 Triage report

    This is a well-scoped follow-up to PR #684, tracking three ADR 031 clauses that were intentionally deferred in the initial ContentBlacklist implementation. Each deferral is documented in the contract header (contracts/src/ContentBlacklist.sol:22-29). The work is entirely within contracts/ and has clear, self-contained sub-tasks. The security + technical labels already applied are appropriate; added enhancement and prod-blocking since these are contract hardening items that need to ship before production.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature Implementing deferred spec clauses from ADR 031, not fixing a regression
    Labels enhancement, prod-blocking (added); security, technical (existing) Anti-abuse/anti-Sybil enforcement is required for production; not PoC-blocking
    Coding agent Suitable Requirements are fully specified; three independent sub-tasks; success criteria are test fixtures + passing CI

    🔗 Similar issues

    No duplicates found. PR #684 is the parent implementation this issue tracks follow-up work from.

    💡 Notes and suggestions

    Sub-task checklist

    • Perjury denylist — Add mapping(address => uint256) public perjuryDenylist to ContentBlacklist. In fileAppeal (or equivalent entry point), revert with a custom error (e.g., PerjuryDenylisted(address filer, uint256 cooldownUntil)) if block.timestamp < perjuryDenylist[msg.sender]. Populate via a governance-gated setter on egregious bad-faith rulings per ADR 031. The 365-day cooldown value should be a governable constant (or hard-coded as 365 days).
    • Synthetic-standing clawback — At StandingPath.TokenHolder filing, snapshot TOKEN.balanceOf(msg.sender) and store it alongside the appeal record. On adverse ruling, compare snapshot vs current balance; if snapshot was transiently inflated (possible heuristic: snapshot > current + threshold), claw back bond + multiplier. Consider block-number gating to frustrate same-tx flash loans.
    • Per-(requesting_body, region) cap — Replace or augment the region-only BODY_CONCURRENT_APPEAL_CAP mapping with a nested mapping(address => mapping(uint8 => uint256)) pendingAppealsPerBodyRegion. Increment on filing, decrement on resolution. Revert with a descriptive error if the per-pair cap is hit.
    • Test fixtures — One happy-path + one revert-path test per new mechanism; cover the flash-loan snapshot edge case for clawback.

    CI reminders

    • Run FOUNDRY_PROFILE=ci forge build --sizes --deny warnings before pushing — the perjury revert path must use emit before revert if the function is otherwise non-mutating, or solc may emit W5740/mutability warnings that fail CI under --deny warnings.
    • aderyn (fail-on: high) and slither (fail-on: medium) both run in CI; use // slither-disable-next-line directives above the function declaration (not the call site) for any unused-return findings.
    • forge fmt and solhint run as pre-commit hooks; 120-char line-length disagreements on named-args reverts are best resolved with positional args.

    Generated by Agentic Triage for issue #688 · ● 1.5M · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  4. changed the title [-]feat(contracts): ADR 031 deferred clauses — perjury denylist, synthetic-standing clawback, per-body concurrent-appeal cap[/-] [+]feat(contracts): ADR-031 deferred ContentBlacklist appeal-integrity mechanisms — rejection cooldown, perjury denylist, standing clawback, per-body concurrent-appeal cap[/+] on Jun 5, 2026
  5. thiras commented on Jun 5, 2026

    @thiras
    ContributorAuthor

    Consolidated #779 into this issue. #779 tracked the same deferred ADR-031 appeal-integrity work from the #777 security-audit angle (rejection cooldown = audit H-4, standing enforcement + synthetic-standing clawback = audit I-3, perjury denylist). Its scope is now folded into the four mechanisms above, the audit lineage (H-4 / I-3, #777) is captured, and priority is raised to high to match the audit severity. #779 closed as duplicate.

  6. alpergundogdu commented on Jun 29, 2026

    @alpergundogdu
    Contributor

    Decomposition + design decisions

    Broken into 5 sub-issues. Mechanism A (rejection cooldown) is already implemented and tested on main — only docs remain. Key design decisions resolved with the maintainer are recorded inline below.

    # Mechanism Decision summary Complexity Agent-suitable
    #1014 A rejection cooldown Already done; verify + close + reconcile ADR-031 to as-built docs only yes
    #1015 D concurrent cap "body" = filer → per-(filer,region) sub-cap, retain region ceiling too; fixed constant M yes
    #1016 B perjury denylist multisig rejectAppealAsPerjury on existing EMERGENCY_MULTISIG_ROLE; fixed 365d M yes
    #1017 C1 standing enforcement Publisher via new namespaceId filing arg (ownerOf + hasClaimed); TokenHolder via governable APPEAL_FILER_TOKEN_THRESHOLD M-L yes
    #1018 C2 synthetic-standing clawback 100% bond burn, block-gate only (no time lookback), balanceOf-only L yes, human-review-gated

    Implementation order

    1. docs(contracts): close rejection-cooldown item and reconcile ADR-031 to as-built ContentBlacklist (#688) #1014 (A close + ADR) → 2. feat(contracts): add per-(filer,region) concurrent fast-track cap alongside region ceiling (#688) #1015 (D) → 3. feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#688) #1016 (B) → 4. feat(contracts): enforce Publisher and TokenHolder standing at appeal filing (audit I-3) (#688) #1017 (C1, introduces PublisherRegistry wiring) → 5. feat(contracts): burn bond on synthetic-standing TokenHolder appeals (audit I-3) (#688) #1018 (C2, depends on C1, do last).

    B / C1 / D are mutually independent (parallelizable). Do not land #1015 (D) and #1018 (C2) simultaneously — they share the appeal-finalizer accounting sites.

    Cross-cutting notes

    • The as-built ContentBlacklist.sol diverges from the ADR-031 spec text (6-state vs 8-state machine, different struct layout, second- vs microsecond timestamps, no unFastTrackAppeal). Implement against the as-built contract, not the ADR struct layout. ADR-031 gets reconciled to as-built across these issues (one coherent edit).
    • rejectAppealAsPerjury reuses the existing emergency-multisig capability (ADR 009 capability 3) — no new role.
    • Token.sol has no ERC20Votes/getPastVotes, which constrains C2 to balanceOf-at-time (confirms the simpler clawback path).
  7. alpergundogdu commented on Jun 30, 2026

    @alpergundogdu
    Contributor

    Mechanism A (rejection cooldown): done. Verified already implemented and fully tested on main — rejectionCooldownWindow + bounds, the 3-strike RejectionWindow ring, the FilerInRejectionCooldown gate in openBlacklistAppeal, _recordRejection from rejectBlacklistAppeal, and the bounded setRejectionCooldownWindow setter; 9 tests at test/ContentBlacklist.t.sol:557-692 (lockout-after-three, two-don't-trip, lift-after-window, rolling-window reset, cross-filer isolation, governed-window, setter update/bounds/role-gating). No code gap found.

    ADR-031 mechanical reconciliation in #1024 (closes #1014). The perjury denylist / standing enforcement / synthetic clawback / per-filer cap remain the forward target in ADR-031, tracked by #1016 / #1017 / #1018 / #1015.

  8. added
    prio:medium
    and removed
    prio:high
    on Jul 9, 2026
  9. alpergundogdu commented on Jul 9, 2026

    @alpergundogdu
    Contributor

    Completed — all four deferred ADR-031 appeal-integrity mechanisms have landed, and ContentBlacklist.sol documents them as implemented:

    1. Rejection cooldown (filerRejections, setRejectionCooldownWindow) — feat(contracts): rejection cooldown for blacklist appeals (#688 item 1, H-4) #913 (item 1, audit H-4).
    2. Perjury denylist (rejectAppealAsPerjury, perjuryDenylistUntilAt) — feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#1016) #1026.
    3. Standing clawback — resolved as omitted by design: the escrowed appeal bond is the standing (cannot be flash-loaned), and standing is enforced at filing for all three paths — feat(contracts): enforce Publisher and TokenHolder standing at appeal filing (audit I-3) (#1017) #1050 (audit I-3). No clawback surface needed.
    4. Per-body concurrent-appeal cap — shipped as the two-tier REGION_CONCURRENT_RELIEF_CAP + FILER_CONCURRENT_RELIEF_CAP — feat(contracts): add per-(filer,region) concurrent fast-track cap alongside region ceiling (#1015) #1045.

    No contract work remains. Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featurekind:securityprio:medium

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions