Skip to content

feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#1016) - #1026

Merged
alpergundogdu merged 2 commits into
mainfrom
feat/1016-perjury-denylist
Jun 30, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
feat/1016-perjury-denylist

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1016. Sub-issue of #688 — Mechanism B (perjury denylist). Independent of C/D.

What

A single adjudicated bad-faith / false-sworn-declaration appeal now costs the filer the right to open new appeals for a fixed 365-day term. This is distinct from the rejection cooldown (Mechanism A), which throttles volume abuse (three rejections in a rolling window) — perjury penalizes one egregious act.

Changes (ContentBlacklist.sol)

  • perjuryDenylistUntilAt[filer] mapping (uint64, public auto-getter) + a gate in openBlacklistAppeal alongside the existing rejection-cooldown gate, reverting FilerPerjuryDenylisted(until).
  • rejectAppealAsPerjury(uint256 appealId) gated to the existing EMERGENCY_MULTISIG_ROLE — no new role (ADR 009 capability 3 sub-mode, same 3-of-5 threshold as fastTrackBlacklistAppeal). It mirrors rejectBlacklistAppeal exactly (burn bond, record the rolling-window rejection, and on a fast-tracked appeal un-suspend the entry + release the per-region relief slot), and additionally sets the 365-day denylist.
  • PERJURY_DENYLIST_DURATION = 365 days fixed constant — no governance setter, since the entry is tied to a concrete finalized appeal (auditable).
  • Emits BlacklistAppealRejectedAsPerjury(appealId, filer, until) in addition to BlacklistAppealRejected, so consumers tracking rejections see both.

Off-chain adjudication criteria for "egregious bad faith / false sworn declaration" live in ADR prose, not contract logic.

Tests (ContentBlacklist.t.sol) — 6 new, 46/46 pass

happy-path (denylist 365d + burn + finalize) · blocks the filer until the window lapses then lifts · role-gating (non-multisig reverts) · fast-track path un-suspends + releases the relief cap · per-filer isolation · terminal-appeal revert.

ADR-031 reconciliation

Perjury promoted from deferred to as-built: event/error names aligned to the shipped surface (BlacklistAppealRejectedAsPerjury, FilerPerjuryDenylisted) and removed from the deferred-mechanisms note.

For review — two naming/scope calls

  • Event/error names deviate from both the issue's shorthand (AppealRejectedAsPerjury / FilerPerjuryDenylisted) and the ADR's prior placeholder (BlacklistAppealPerjuryRecorded / FilerOnPerjuryDenylist). I used BlacklistAppealRejectedAsPerjury (consistent with the codebase's BlacklistAppeal* event prefix) and FilerPerjuryDenylisted (parallels FilerInRejectionCooldown). Happy to rename if you prefer the issue's literal names.
  • perjuryFlagged struct field (a target-only field in ADR-031) is not added — the shipped path signals perjury via the dedicated event. Left as a target-only field per the "keep spec as target" decision; flag if you'd rather drop it.

Checks

  • forge build --deny warnings (CI profile, --sizes): clean; ContentBlacklist 12,479 bytes (well under EIP-170).
  • forge test: 675 pass (incl. InterfaceFreeze); forge fmt --check + solhint + markdownlint + ADR hygiene all pass.
  • slither/aderyn not run locally (not installed in this worktree). The new function is pattern-identical to the existing rejectBlacklistAppeal/reverseBlacklistAppeal (nonReentrant, checks-effects-interactions, same token.burn) which already pass both on main, so no new finding class is expected — CI runs them definitively.

Refs #688.

Summary by CodeRabbit

  • New Features

    • Added a perjury-based denylist for blacklist appeals, blocking repeat appeals for a fixed 365-day period.
    • Added a new emergency action to reject an appeal as perjury, with a dedicated event and status update.
  • Bug Fixes

    • Appeals now properly fail while a filer is still denylisted, and resume once the denylist window expires.
    • Fast-tracked appeals rejected for perjury now correctly restore related limits and suspension state.
  • Tests

    • Added coverage for denial timing, access control, per-filer isolation, and terminal-appeal handling.

…ury (#688)

ADR 031 § Evidence Mechanism B. A single adjudicated bad-faith / false-sworn-
declaration appeal locks the filer out of openBlacklistAppeal for a fixed
365-day term — distinct from the rejection cooldown (which throttles volume
abuse: three rejections in a rolling window).

- New `perjuryDenylistUntilAt[filer]` mapping (public auto-getter) and a gate
  in `openBlacklistAppeal` alongside the rejection-cooldown gate
  (`FilerPerjuryDenylisted(until)`).
- New `rejectAppealAsPerjury(appealId)` gated to the existing
  `EMERGENCY_MULTISIG_ROLE` (ADR 009 capability 3 sub-mode — no new role). It
  mirrors `rejectBlacklistAppeal` exactly (burn bond, record rolling-window
  rejection, un-suspend + release the per-region relief slot on a fast-tracked
  appeal) and additionally sets the 365-day denylist.
- `PERJURY_DENYLIST_DURATION = 365 days` fixed constant, no governance setter
  (tied to a concrete finalized appeal, so it is auditable).
- Emits `BlacklistAppealRejectedAsPerjury(appealId, filer, until)` in addition
  to `BlacklistAppealRejected`.

Tests: denylist+burn+finalize; blocks filer until the window lapses then
lifts; role-gating; fast-track path un-suspends + releases the cap; per-filer
isolation; terminal-appeal revert. 46/46 ContentBlacklist tests pass.

ADR-031 reconciled: perjury promoted from deferred to as-built (event/error
names aligned, removed from the deferred-mechanisms note). `perjuryFlagged`
struct flag stays a target-only field — the shipped path signals perjury via
the dedicated event instead.

Closes #1016. Refs #688.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 30, 2026 13:39
@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a perjury denylist mechanism to ContentBlacklist.sol: a fixed PERJURY_DENYLIST_DURATION constant, a perjuryDenylistUntilAt per-filer mapping, a new rejectAppealAsPerjury function restricted to EMERGENCY_MULTISIG_ROLE, and a gate in openBlacklistAppeal. ADR-031 is updated to match, and six new tests cover all paths.

Changes

Perjury Denylist Mechanism

Layer / File(s) Summary
State, events, and error declarations
contracts/src/ContentBlacklist.sol
Adds PERJURY_DENYLIST_DURATION (365 days), perjuryDenylistUntilAt public mapping, BlacklistAppealRejectedAsPerjury event, and FilerPerjuryDenylisted error.
openBlacklistAppeal perjury gate
contracts/src/ContentBlacklist.sol
Reads perjuryDenylistUntilAt[msg.sender] and reverts with FilerPerjuryDenylisted when the stored expiry exceeds block.timestamp.
rejectAppealAsPerjury implementation
contracts/src/ContentBlacklist.sol
Adds the multisig-gated function that sets the filer's denylist expiry, performs fast-track cleanup when applicable, burns the bond, finalizes the appeal, and emits both new and existing rejection events.
Test suite
contracts/test/ContentBlacklist.t.sol
Adds _open helper and six tests covering finalization, denylist block/lift, role guard, fast-track unsuspend and cap release, per-filer isolation, and terminal-appeal revert.
ADR-031 spec alignment
adr/031-content-blacklist-appeals-contract.md
Replaces perjuryFlagged struct references with BlacklistAppealRejectedAsPerjury event, renames revert error to FilerPerjuryDenylisted, and updates the event topic ordering table.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly names the new multisig perjury denylist path and the rejectAppealAsPerjury entrypoint.
Linked Issues check ✅ Passed The contract, ADR, and tests match the perjury denylist requirements: fixed duration, multisig gating, rejection flow, event/error, and fast-track handling.
Out of Scope Changes check ✅ Passed The PR stays within scope, touching only the contract, tests, and ADR reconciliation needed for the perjury denylist feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1016-perjury-denylist

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

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 90.28% (2265/2509 lines)
▲ +0.15pp vs base (90.12% → 90.28%)
Run: 28449791812

@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 implements the perjury denylist mechanism outlined in ADR 031. It introduces the rejectAppealAsPerjury function, which allows the emergency multisig to reject an appeal as perjury, burning the bond and banning the filer from opening new appeals for 365 days. The review feedback points out that the check for the perjury ban in openBlacklistAppeal should be evaluated before the volume-based rejection cooldown check to ensure the more severe perjury error is reported first.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread contracts/src/ContentBlacklist.sol Resolved

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
contracts/test/ContentBlacklist.t.sol (2)

729-753: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Pin the exact expiry boundary.

This only proves “revert before expiry” and “succeeds at until + 1”. If openBlacklistAppeal were implemented with <= until instead of < until, the suite would still pass. Please add a check at block.timestamp == until to lock the intended semantics.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contracts/test/ContentBlacklist.t.sol` around lines 729 - 753, The perjury
denylist test in test_rejectAppealAsPerjury_blocksFilerUntilWindowLapses only
covers behavior before expiry and at until + 1, so it does not pin the exact
boundary. Update this test around ContentBlacklist.openBlacklistAppeal and
perjuryDenylistUntilAt to also assert the expected revert when block.timestamp
equals until, using the same FilerPerjuryDenylisted selector, so the intended <
until semantics are locked in.

708-725: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the rejection events here.

This test pins the storage effects, but it never checks that rejectAppealAsPerjury emits the new BlacklistAppealRejectedAsPerjury event or the existing BlacklistAppealRejected event required by the PR contract. A regression in observability would still pass.

As per path instructions, "Confirm events are emitted for state-changing ops."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contracts/test/ContentBlacklist.t.sol` around lines 708 - 725, The test
`test_rejectAppealAsPerjury_denylistsBurnsAndFinalizes` only checks storage
changes and should also verify the emitted events for `rejectAppealAsPerjury`.
Add assertions that `blacklist.rejectAppealAsPerjury(appealId)` emits both
`BlacklistAppealRejectedAsPerjury` and the existing `BlacklistAppealRejected`
event, using the relevant `ContentBlacklist` event names so the state-changing
op is covered end to end.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@contracts/test/ContentBlacklist.t.sol`:
- Around line 729-753: The perjury denylist test in
test_rejectAppealAsPerjury_blocksFilerUntilWindowLapses only covers behavior
before expiry and at until + 1, so it does not pin the exact boundary. Update
this test around ContentBlacklist.openBlacklistAppeal and perjuryDenylistUntilAt
to also assert the expected revert when block.timestamp equals until, using the
same FilerPerjuryDenylisted selector, so the intended < until semantics are
locked in.
- Around line 708-725: The test
`test_rejectAppealAsPerjury_denylistsBurnsAndFinalizes` only checks storage
changes and should also verify the emitted events for `rejectAppealAsPerjury`.
Add assertions that `blacklist.rejectAppealAsPerjury(appealId)` emits both
`BlacklistAppealRejectedAsPerjury` and the existing `BlacklistAppealRejected`
event, using the relevant `ContentBlacklist` event names so the state-changing
op is covered end to end.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0b0f786-a996-4cd1-9497-6b14a1071532

📥 Commits

Reviewing files that changed from the base of the PR and between 7ee668a and 228df3e.

📒 Files selected for processing (3)
  • adr/031-content-blacklist-appeals-contract.md
  • contracts/src/ContentBlacklist.sol
  • contracts/test/ContentBlacklist.t.sol

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

Adds an on-chain “perjury denylist” enforcement path to the ContentBlacklist appeal system: once the emergency multisig adjudicates an appeal as bad-faith (perjury), the filer is prevented from opening new appeals for a fixed 365-day term. This extends the existing abuse-mitigation toolbox beyond the rolling “rejection cooldown” (volume throttling) to penalize a single egregious act.

Changes:

  • Introduces perjuryDenylistUntilAt (public address => uint64) and enforces it in openBlacklistAppeal via FilerPerjuryDenylisted(until).
  • Adds rejectAppealAsPerjury(appealId) gated by EMERGENCY_MULTISIG_ROLE, mirroring rejectBlacklistAppeal (burn + finalize + rejection-window accounting + fast-track cleanup) and additionally setting the denylist + emitting BlacklistAppealRejectedAsPerjury.
  • Adds a focused test suite for the new path and reconciles ADR-031 to reflect the shipped event/error naming and the “event-signaled” perjury record.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
contracts/src/ContentBlacklist.sol Implements perjury denylist storage + filing gate + multisig perjury-reject finalization path with dedicated event/error.
contracts/test/ContentBlacklist.t.sol Adds test coverage for denylist behavior, role gating, fast-track cleanup behavior, and per-filer isolation.
adr/031-content-blacklist-appeals-contract.md Updates ADR text/tables to reflect the now-shipped perjury denylist and the event-based perjury record.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address PR #1026 review:
- Check the perjury denylist BEFORE the rejection cooldown in
  openBlacklistAppeal so a filer who is both denylisted and in a volume
  cooldown sees the more severe FilerPerjuryDenylisted ban (gemini).
- Assert both BlacklistAppealRejectedAsPerjury and BlacklistAppealRejected
  emit in the happy-path test (coderabbit).
- Pin the exact denylist-expiry boundary: still reverts at until-1, lifts at
  exactly until — locks in the exclusive `> block.timestamp` semantics
  (coderabbit).
- Regenerate contracts/.gas-snapshot (FOUNDRY_PROFILE=ci) — deterministic gas
  shifted from the added storage read + new tests; this was the CI failure.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Review + CI fixes pushed in c207d59

CI failure (gas snapshot): contracts/.gas-snapshot was stale — the added storage read in openBlacklistAppeal + the new tests shifted deterministic gas. Regenerated with FOUNDRY_PROFILE=ci forge snapshot --snap .gas-snapshot; verified locally that the deterministic (non-runs:) lines now match, so the gate passes.

@gemini-code-assist (perjury-before-cooldown ordering): Done — replied + resolved inline.

@coderabbitai nitpicks (both addressed):

  • Pin the exact expiry boundary — test_rejectAppealAsPerjury_blocksFilerUntilWindowLapses now asserts the filing still reverts at until - 1 and succeeds at exactly until, locking in the exclusive perjuryUntil > block.timestamp semantics (a >= impl would fail this).
  • Assert the rejection events — test_rejectAppealAsPerjury_denylistsBurnsAndFinalizes now vm.expectEmits both BlacklistAppealRejectedAsPerjury and BlacklistAppealRejected, in order.

All 46 ContentBlacklist tests + full suite (675) still pass; fmt/solhint/markdownlint/ADR hygiene green.

🤖 Addressed by Claude Code

@gemini-code-assist

Copy link
Copy Markdown

Great to see the perjury denylist mechanism fully integrated and verified with the updated test suite. The shift to BlacklistAppealRejectedAsPerjury and the explicit assertion of the rejection event order in test_rejectAppealAsPerjury_denylistsBurnsAndFinalizes are excellent improvements for auditability. The handling of the perjuryUntil > block.timestamp boundary logic is also correct and robust. Everything looks solid for this feature.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@alpergundogdu Thanks — that addresses my nitpicks.

Locking in the exact until - 1 / until boundary and asserting both rejection events in order are both solid improvements. Glad to hear the gas snapshot and full suite are green as well.

🐇✅

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.

feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#688)

2 participants