Repository navigation
docs(contracts): reconcile ADR-031 mechanical drift to as-built ContentBlacklist (#1014) - #1024
Conversation
Close the rejection-cooldown item of #688 (already implemented + tested on main; verified, no gap) and fix the genuinely-wrong mechanical facts in ADR-031 so it matches what shipped, while keeping the perjury / standing / synthetic-clawback / per-filer-cap prose as the forward target that #1015-#1018 will implement: - Timestamps: microsecond fields/framing (openedAtUs, *UntilUs, nowUs, * 1_000_000) -> second-resolution (openedAt, *UntilAt, block.timestamp), matching the as-built contract's uint64(block.timestamp) usage. - Function names: add the as-built "Blacklist" infix (fastTrackBlacklistAppeal, rejectBlacklistAppeal, ratifyBlacklistAppealRemoval, reverseBlacklistAppeal, cleanupExpiredBlacklistAppeal). SlashAppeal's own fastTrackAppeal / rejectAppeal references are left untouched. - Remove the orphaned unFastTrackAppeal surface (UnFastTracked state, alreadyUnFastTracked field, event row, state-machine transitions, one-shot note) — no spun-off issue implements it, and the issue lists "no unFastTrackAppeal" as drift to reconcile. Refs #1014, #688. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughADR-031 is reconciled to the as-built ChangesADR-031 Reconciliation
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 |
There was a problem hiding this comment.
Code Review
This pull request updates the ADR for the content blacklist appeals contract by renaming several functions to include 'Blacklist' (e.g., fastTrackBlacklistAppeal, rejectBlacklistAppeal) and removing the un-fast-track appeal flow entirely. Additionally, it transitions all timestamp fields from microsecond resolution to second-resolution using block.timestamp. The feedback highlights documentation inconsistencies where appeal.blake3Hash is referenced instead of appeal.hash to align with the defined BlacklistAppeal struct.
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.
| `ratifyBlacklistAppealRemoval`: | ||
|
|
||
| - `status = Ratified`; `regionActiveReliefCount[appeal.region]--`. | ||
| - Internal call `_removeHashRegional(appeal.blake3Hash, appeal.region)` — same body as the public `removeHashRegional` but bypassing the `GOVERNANCE_ROLE` check (caller is already `onlyGovernor` per the modifier on this entry point). This emits the standard `HashRemoved(blake3Hash, version, region)` event from `ContentBlacklist`. |
There was a problem hiding this comment.
The internal call reference uses appeal.blake3Hash, but the BlacklistAppeal struct defined in this ADR uses hash as the field name. To maintain consistency with the struct definition, this should be updated to appeal.hash.
References
- Ensure ADR documentation accurately reflects implementation and internal references.
There was a problem hiding this comment.
The ADR-031 struct field is blake3Hash (see the BlacklistAppeal definition: bytes32 blake3Hash; // disputed hash), and every reference here — the open event, the revert table, the indexer convention, and this internal call — uses blake3Hash consistently. The hash name is the as-built contract's field, not this ADR's. Per the target-spec framing (this ADR pins the intended surface, not the deployed ABI), the names are intentionally distinct, so no change here.
| | (a) multisig silent past `BLACKLIST_MULTISIG_REVIEW_WINDOW` | `status == Open && block.timestamp ≥ reviewWindowEndsAt` | refund | | ||
| | (b) governance silent past `BLACKLIST_RATIFICATION_WINDOW` | `status == FastTracked && block.timestamp ≥ reviewWindowEndsAt` | refund | | ||
| | (c) synthetic-standing clawback fired | `status == Open && standingPath == TokenHolder && block.timestamp ≥ openedAt + STANDING_LOOKBACK_SECONDS && TOKEN.balanceOf(filer) < APPEAL_FILER_TOKEN_THRESHOLD` | **burn** (100%) | | ||
| | (d) global override fired | `status ∈ {Open, FastTracked} && _entryExists(appeal.blake3Hash, appeal.region) == false` | refund (per [ADR 011 § Global Override](011-content-takedown.md#global-override)) | |
There was a problem hiding this comment.
The global override condition uses appeal.blake3Hash, but the BlacklistAppeal struct defined in this ADR uses hash as the field name. To maintain consistency with the struct definition, this should be updated to appeal.hash.
References
- Ensure ADR documentation accurately reflects implementation and internal references.
There was a problem hiding this comment.
Same as the line-178 thread: the ADR-031 target struct uses blake3Hash, and appeal.blake3Hash here is consistent with it. hash is the as-built field name. No change.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
adr/031-content-blacklist-appeals-contract.md (1)
180-184: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winUse
suspendedAthere, noteffectiveAt.This paragraph still references
entry.effectiveAt, but the rest of the ADR has already renamed the field toentry.suspendedAt. Leaving the old name here reintroduces the drift this PR is trying to remove.♻️ Suggested fix
- - `status = Reversed`; `regionActiveReliefCount[appeal.region]--`; `entry.suspended = false`. `entry.effectiveAt` is **preserved** per [ADR 011 § Authority and flow](011-content-takedown.md#authority-and-flow) to avoid retroactively shielding pre-suspension non-compliance. + - `status = Reversed`; `regionActiveReliefCount[appeal.region]--`; `entry.suspended = false`. `entry.suspendedAt` is **preserved** per [ADR 011 § Authority and flow](011-content-takedown.md#authority-and-flow) to avoid retroactively shielding pre-suspension non-compliance.🤖 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 `@adr/031-content-blacklist-appeals-contract.md` around lines 180 - 184, Update the `reverseBlacklistAppeal` ADR paragraph to use `entry.suspendedAt` instead of `entry.effectiveAt`, since the contract has already renamed that field throughout the document. Keep the rest of the flow the same, but make the preservation note reference the `suspendedAt` symbol consistently so the `reverseBlacklistAppeal` and `entry` terminology stays aligned across the ADR.
🤖 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.
Outside diff comments:
In `@adr/031-content-blacklist-appeals-contract.md`:
- Around line 180-184: Update the `reverseBlacklistAppeal` ADR paragraph to use
`entry.suspendedAt` instead of `entry.effectiveAt`, since the contract has
already renamed that field throughout the document. Keep the rest of the flow
the same, but make the preservation note reference the `suspendedAt` symbol
consistently so the `reverseBlacklistAppeal` and `entry` terminology stays
aligned across the ADR.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 455ded8c-54fd-4919-b74c-243d58adc7dd
📒 Files selected for processing (1)
adr/031-content-blacklist-appeals-contract.md
There was a problem hiding this comment.
Pull request overview
Updates ADR-031’s documented ContentBlacklist appeal surface to reduce mechanical drift vs the shipped Solidity contract, focusing on timestamp units, function naming, and the appeal state-machine.
Changes:
- Renames several documented entry points to the as-built
*BlacklistAppeal*names and updates related narrative/state-diagram references. - Converts documented time fields and comparisons from microseconds to seconds (
block.timestamp-based naming). - Removes the orphaned
unFastTrackAppeal/UnFastTrackedstate from the ADR state machine and struct layout.
Comments suppressed due to low confidence (1)
adr/031-content-blacklist-appeals-contract.md:25
- This section describes a mapping-backed appeal registry with a
Nonesentinel andbytes2region packing, but the as-built contract uses a different, already-shipped layout:struct BlacklistAppeal { bytes32 hash; bytes32 region; ... }stored in an array (BlacklistAppeal[] internal _appeals;) with appeal IDs starting at 0 (seecontracts/src/ContentBlacklist.sol:144-168,:439-452). If the goal is to reconcile ADR-031 to “as-built ContentBlacklist”, readers will likely assume this storage/ID model is what’s deployed.
Either update the storage-layout pseudocode to match the as-built contract, or explicitly label this whole block as a “target layout” and add a brief “as-built summary” right here.
### Storage layout
Two enums and one struct describe an appeal; auxiliary mappings carry the per-filer and per-region caps from [ADR 011 § Bond and frequency caps](011-content-takedown.md#bond-and-frequency-caps).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| > The full ABI (per-appeal storage layout, exact event topics, gas-optimized struct packing) is deferred to a future contract-implementation ADR — same approach as [ADR 028 § Contract surface](028-slashing-appeals.md#contract-surface). | ||
|
|
||
| This ADR is that contract-implementation ADR. It pins the per-appeal storage layout, canonical event topic ordering, gas-packed struct layout, and surface-level integration with the rest of `ContentBlacklist` (suspension flag manipulation, internal `_removeHashRegional` call, `cleanupExpiredAppeal` admissibility checks), giving the implementation in `contracts/` a single canonical reference. | ||
| This ADR is that contract-implementation ADR. It pins the per-appeal storage layout, canonical event topic ordering, gas-packed struct layout, and surface-level integration with the rest of `ContentBlacklist` (suspension flag manipulation, internal `_removeHashRegional` call, `cleanupExpiredBlacklistAppeal` admissibility checks), giving the implementation in `contracts/` a single canonical reference. | ||
|
|
There was a problem hiding this comment.
Good call — fixed in 380b351. Added an explicit "Target spec, not a 1:1 as-built ABI reference" note that enumerates the live divergences (_appeals array vs appeals mapping/appealCounter, bytes32 vs bytes2/string region, computed windows vs stored reviewWindowEndsAt, lapse-path bond burn, deferred standing/perjury/clawback/per-filer machinery) and points at #688 / #1015–#1018. This PR deliberately keeps the spec as the forward target rather than down-rewriting it to the current subset.
|
|
||
| ### Gas-optimization notes | ||
|
|
||
| - **`region` as `bytes2`.** Per [ADR 011 § Contract: ContentBlacklist](011-content-takedown.md#contract-contentblacklist), the canonical region storage representation is `bytes2`. The `openBlacklistAppeal` external entry takes `string calldata region` for ADR-conformant interface stability but canonicalizes internally to `bytes2` for storage. Helpers (`_toBytes2(string)`) revert on length ≠ 2 or non-ASCII-alpha characters per ISO 3166-1 alpha-2. |
There was a problem hiding this comment.
Covered by the new target-spec note in 380b351, which calls out the bytes2/string region as a target-vs-as-built (bytes32) divergence. The bytes2 encoding is the intended design, so the block stays as the destination spec rather than being rewritten to the deployed signature.
| | (a) multisig silent past `BLACKLIST_MULTISIG_REVIEW_WINDOW` | `status == Open && block.timestamp ≥ reviewWindowEndsAt` | refund | | ||
| | (b) governance silent past `BLACKLIST_RATIFICATION_WINDOW` | `status == FastTracked && block.timestamp ≥ reviewWindowEndsAt` | refund | | ||
| | (c) synthetic-standing clawback fired | `status == Open && standingPath == TokenHolder && block.timestamp ≥ openedAt + STANDING_LOOKBACK_SECONDS && TOKEN.balanceOf(filer) < APPEAL_FILER_TOKEN_THRESHOLD` | **burn** (100%) | | ||
| | (d) global override fired | `status ∈ {Open, FastTracked} && _entryExists(appeal.blake3Hash, appeal.region) == false` | refund (per [ADR 011 § Global Override](011-content-takedown.md#global-override)) | |
There was a problem hiding this comment.
Covered by the new target-spec note in 380b351, which flags the computed-window vs stored-reviewWindowEndsAt and the lapse-path bond-burn divergences explicitly. The refund-on-(a)/(b) semantics are the intended target; the as-built subset currently burns on lapse, and that's now documented as a known divergence pending #688/#1015–#1018.
Address Copilot review on #1024: the storage-layout and signature blocks read like a deployed-ABI guarantee, but the as-built ContentBlacklist ships a deliberate subset. Add an explicit "target spec, not a 1:1 as-built ABI reference" note enumerating the live divergences (_appeals array vs appeals mapping/appealCounter, bytes32 vs bytes2/string region, computed windows vs stored reviewWindowEndsAt, lapse-path bond burn, deferred standing/perjury/ clawback/per-filer machinery) and pointing at #688/#1015-#1018. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Review feedback addressed (pushed in 380b351)Fixed
Verified and skipped (with reasons)
|
|
Tip For best results, initiate chat on the files or code changes.
(ᵔᴥᵔ) ✏️ Learnings added
|
Closes #1014. Sub-issue of #688 (Mechanism A — rejection cooldown + ADR-031 reconciliation). Docs only — no contract or test changes.
Rejection cooldown: verified complete, no code
The "rejection cooldown" mechanism #688 lists as deferred is already fully implemented and tested on
main. Verified:rejectionCooldownWindow+REJECTION_COOLDOWN_WINDOW_{DEFAULT,FLOOR,CEILING},RejectionWindow3-strike ring, theFilerInRejectionCooldowngate inopenBlacklistAppeal,_recordRejectionfromrejectBlacklistAppeal, and the boundedsetRejectionCooldownWindow(GOVERNANCE_ROLE) setter.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.Coverage is complete; no test gap found, so no test added (per the issue's "add a test only if a gap is found").
ADR-031 reconciliation strategy
ADR-031 is the full target spec; the shipped contract is a deliberate subset, and #1015–#1018 will implement most of the gap. By decision, this PR keeps the perjury / standing-enforcement / synthetic-clawback / per-filer-cap prose as the forward target and only corrects the genuinely-wrong mechanical facts, so each later PR promotes its own mechanism without thrash:
openedAtUs/*UntilUs/nowUs/* 1_000_000→openedAt/*UntilAt/block.timestamp, matching the contract'suint64(block.timestamp)time fields.Blacklistinfix.fastTrackBlacklistAppeal,rejectBlacklistAppeal,ratifyBlacklistAppealRemoval,reverseBlacklistAppeal,cleanupExpiredBlacklistAppeal. (SlashAppeal's ownfastTrackAppeal/rejectAppealreferences are untouched — different contract.)unFastTrackAppeal. No spun-off issue implements it, and the issue names "no unFastTrackAppeal" as drift. Dropped: theUnFastTrackedstate,alreadyUnFastTrackedfield (+_pad113→14 bytes), the event row, the state-machine transitions, and the one-shot note.Out of scope (kept as target, owned by sibling PRs)
bytes2region,appealsmapping +appealCounter,Nonesentinel) — design target, not corrected here.Checks
pre-commit run— markdownlint, ADR reference hygiene, ADR book-list-in-sync all pass.Refs #688.
Summary by CodeRabbit