Repository navigation
feat(contracts): add per-(filer,region) concurrent fast-track cap alongside region ceiling (#1015) - #1045
Conversation
ADR 031 Mechanism D. The interim-relief concurrent cap was keyed on region alone, so a single adversarial filer could saturate a region's fast-track relief slots. Add a per-(filer, region) sub-cap alongside the existing per-region ceiling — both coexist (region ceiling kept as a second backstop). - Rename `BODY_CONCURRENT_APPEAL_CAP` -> `REGION_CONCURRENT_RELIEF_CAP` (the "body" name was misleading; enforcement is per region). Add `FILER_CONCURRENT_RELIEF_CAP = 2`, strictly below the region ceiling (3) so one filer can never monopolize a region. Both fixed constants, no setter. - New `filerRegionActiveRelief[region][filer]` mapping (public getter) + `FilerReliefCapHit(filer, cap)` error. - `fastTrackBlacklistAppeal` checks + increments both counters; all FIVE fast-track exit paths decrement both with the same `!= 0` guard — including `rejectAppealAsPerjury` (the exit path added by #1016). Tests: per-filer cap blocks while the region has headroom; two filers fill the region ceiling (per-filer doesn't block, region does); every exit path (reject / perjury / ratify / reverse / cleanup) decrements the per-filer counter and frees the filer to fast-track again. 52/52 ContentBlacklist, 681 full suite. Gas snapshot regenerated. ADR-031 reconciled: two-tier cap documented, revert table + decrement points updated, per-filer-cap removed from the deferred-machinery note. Also dropped the now-stale "perjury denylist is deferred" line from the contract header (implemented in #1016). Closes #1015. Refs #688. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 6 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe PR upgrades the interim-relief fast-track concurrency model in ChangesTwo-tier interim-relief concurrency cap
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contracts coverageLine coverage: 90.87% (2289/2519 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
Pull request overview
This PR strengthens ContentBlacklist’s fast-track (interim-relief) anti-spam controls by adding a per-(filer, region) concurrent fast-track cap that complements (and does not replace) the existing per-region ceiling, preventing a single filer from monopolizing a region’s relief slots.
Changes:
- Rename the region-scoped ceiling constant to
REGION_CONCURRENT_RELIEF_CAPand document the two-tier model in the contract header. - Add
FILER_CONCURRENT_RELIEF_CAP, afilerRegionActiveRelief[region][filer]counter, and enforce it infastTrackBlacklistAppealwith symmetric decrementing across all fast-track exit paths. - Update/extend Foundry tests to cover: (1) region-cap filling now requiring two filers, (2) per-filer cap reverts while region has headroom, and (3) all exit paths correctly decrement the per-filer counter; regenerate gas snapshot and reconcile ADR-031 §90.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
contracts/src/ContentBlacklist.sol |
Implements the two-tier concurrent fast-track cap (per-region + per-filer-per-region) and updates accounting on all fast-track exit paths. |
contracts/test/ContentBlacklist.t.sol |
Updates the regional-cap test to use two filers and adds targeted tests ensuring the per-filer cap and all decrement paths behave correctly. |
contracts/.gas-snapshot |
Updates gas baselines reflecting the additional storage checks/writes and new tests. |
adr/031-content-blacklist-appeals-contract.md |
Updates ADR-031 §90 to describe the two-tier cap and its increment/decrement points. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request implements a two-tier concurrent fast-track cap for interim relief in the ContentBlacklist contract, as specified in ADR 031. It introduces a global per-region ceiling of 3 active slots and a per-filer, per-region sub-cap of 2 active slots to prevent a single filer from monopolizing a region's relief slots. The implementation updates ContentBlacklist.sol to track, enforce, and release both caps across all fast-track entry and exit paths, supported by comprehensive unit tests. The review feedback identifies a valuable gas optimization opportunity in fastTrackBlacklistAppeal and related exit functions to cache frequently accessed storage variables like a.region, a.filer, and a.hash into local memory to avoid redundant SLOAD operations.
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.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@contracts/src/ContentBlacklist.sol`:
- Around line 507-524: The appeal lifecycle transitions are missing deadline
checks, allowing stale appeals to be fast-tracked or resolved after their
allowed windows. Update fastTrackBlacklistAppeal, ratifyBlacklistAppealRemoval,
and reverseBlacklistAppeal to enforce APPEAL_REVIEW_WINDOW from openedAt and
APPEAL_RATIFICATION_WINDOW from fastTrackedAt before changing status or
blacklist/bond outcomes, and route expired cases into the existing timeout/lapse
handling instead of permitting the transition. Make sure the checks are applied
consistently at the start of these functions using the existing appeal state
fields and error paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: dcd99b5e-f6c0-449f-812d-c44dc75d75be
📒 Files selected for processing (4)
adr/031-content-blacklist-appeals-contract.mdcontracts/.gas-snapshotcontracts/src/ContentBlacklist.solcontracts/test/ContentBlacklist.t.sol
…review) Cache a.region and a.filer in locals to avoid redundant warm SLOADs in fastTrackBlacklistAppeal, which this PR reworked to read both fields ~6x across the two cap checks and increments (gemini). Scoped to this function; a.hash is read once so it stays inline. Gas snapshot refreshed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Closes #1015. Sub-issue of #688 — Mechanism D. Independent of B/C; coordinated with #1016 (now merged) since they share fast-track exit-path accounting.
What
The interim-relief concurrent cap was keyed on region alone (
BODY_CONCURRENT_APPEAL_CAP = 3), so a single adversarial filer could saturate a region's fast-track relief slots. This adds a per-(filer, region)sub-cap alongside the existing per-region ceiling — both coexist (the region ceiling stays as a second backstop, per the resolved decision).Changes (
ContentBlacklist.sol)BODY_CONCURRENT_APPEAL_CAP→REGION_CONCURRENT_RELIEF_CAP(the "body" name was misleading — enforcement is per region, not per requesting body). Updated the header docstring +RegionalCapHitdoc.FILER_CONCURRENT_RELIEF_CAP = 2(see note below), thefilerRegionActiveRelief[region][filer]mapping (public getter), and theFilerReliefCapHit(filer, cap)error.regionActiveReliefCountexactly:fastTrackBlacklistAppealchecks + increments both counters; all five fast-track exit paths decrement both with the same!= 0guard. The fifth path isrejectAppealAsPerjury(added by feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#688) #1016) — this is the shared-accounting overlap the issues warned about, now handled since feat(contracts): add multisig perjury denylist via rejectAppealAsPerjury (#688) #1016 landed first.Cap value — flagged for your review
FILER_CONCURRENT_RELIEF_CAP = 2withREGION_CONCURRENT_RELIEF_CAP = 3. Rationale: it must be strictly below the region ceiling so one filer can't fully monopolize a region (2 of 3 → one slot always reachable by others), and it's the value that makes the issue's "two different filers each fast-track up to the region ceiling" test coherent (2 + 1 = 3). If you'd prefer the stricter1(one concurrent relief per filer per region), it's a one-line change — say the word.Tests (
ContentBlacklist.t.sol)test_regionalCap_countsFastTrackedNotOpento use two filers to fill the region ceiling (one filer alone now tops out at the sub-cap; the 4th fast-track hitsRegionalCapHitwhile the filer is still under its sub-cap).FilerReliefCapHit, region count unchanged).InterfaceFreeze).ADR-031 reconciliation
Two-tier model documented in §90 (mapping, revert table, fast-track state transition, decrement points); per-filer-cap removed from the deferred-machinery note. Also dropped the now-stale "perjury denylist is deferred" line from the contract header (implemented in #1016 — that comment was missed there).
Out of scope / flagged
BODY_CONCURRENT_APPEAL_CAPname (lines 260/271/303) — it's the upstream semantic spec and the issue scopes the doc work to ADR-031 §90, so I left it. Happy to reconcile ADR-011 separately if you want.Checks
CI-profile
forge build --deny warnings(clean), fullforge test(681), gas snapshot regenerated + verified against the CI deterministic check,forge fmt/solhint/markdownlint/ADR hygiene all green. (slither/aderyn run in CI — accounting mirrors existing passing patterns.)Refs #688.
Summary by CodeRabbit
New Features
Bug Fixes