Skip to content

docs(contracts): reconcile ADR-031 mechanical drift to as-built ContentBlacklist (#1014) - #1024

Merged
alpergundogdu merged 2 commits into
mainfrom
docs/1014-adr031-reconcile
Jun 30, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
docs/1014-adr031-reconcile

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

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}, RejectionWindow 3-strike ring, the FilerInRejectionCooldown gate in openBlacklistAppeal, _recordRejection from rejectBlacklistAppeal, and the bounded setRejectionCooldownWindow (GOVERNANCE_ROLE) setter.
  • All 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.

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:

  • Timestamps μs → seconds. openedAtUs/*UntilUs/nowUs/* 1_000_000 → openedAt/*UntilAt/block.timestamp, matching the contract's uint64(block.timestamp) time fields.
  • Function names → as-built Blacklist infix. fastTrackBlacklistAppeal, rejectBlacklistAppeal, ratifyBlacklistAppealRemoval, reverseBlacklistAppeal, cleanupExpiredBlacklistAppeal. (SlashAppeal's own fastTrackAppeal/rejectAppeal references are untouched — different contract.)
  • Remove orphaned unFastTrackAppeal. No spun-off issue implements it, and the issue names "no unFastTrackAppeal" as drift. Dropped: the UnFastTracked state, alreadyUnFastTracked field (+ _pad1 13→14 bytes), the event row, the state-machine transitions, and the one-shot note.

Out of scope (kept as target, owned by sibling PRs)

Checks

  • pre-commit run — markdownlint, ADR reference hygiene, ADR book-list-in-sync all pass.

Refs #688.

Summary by CodeRabbit

  • Documentation
    • Updated the blacklist appeal process to reflect the latest lifecycle and timing rules.
    • Clarified appeal handling outcomes, expiry behavior, and edge-case rejection conditions.
    • Revised event and state-transition descriptions to match the current appeal flow and timestamp handling.

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]>
Copilot AI review requested due to automatic review settings June 30, 2026 13:07
@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 43c1419e-60fd-45d4-96e1-a8e6930d8b82

📥 Commits

Reviewing files that changed from the base of the PR and between 36825ee and 380b351.

📒 Files selected for processing (1)
  • adr/031-content-blacklist-appeals-contract.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • adr/031-content-blacklist-appeals-contract.md

Walkthrough

ADR-031 is reconciled to the as-built ContentBlacklist contract. Function names gain a Blacklist prefix, timestamp fields shift from microsecond to second resolution, the un-fast-track stage is removed, revert conditions are expanded, and the state machine, event table, and integration sections are updated.

Changes

ADR-031 Reconciliation

Layer / File(s) Summary
Data model: struct layout and auxiliary mappings
adr/031-content-blacklist-appeals-contract.md
BlacklistAppeal struct drops microsecond timestamp fields and the un-fast-track one-shot flag, replacing them with second-resolution openedAt, fastTrackedAt, and reviewWindowEndsAt fields. AppealStatus terminal state descriptions are updated. Auxiliary mappings lastRatifiedSuccessUs, cooldownUntilUs, and perjuryDenylistUntilUs are renamed to *At variants.
Function signatures and revert tables
adr/031-content-blacklist-appeals-contract.md
Entry points are renamed with a Blacklist prefix. openBlacklistAppeal revert table gains conditions for perjury denylist, rejection cooldown, empty evidence hash, bond transfer failure, and activation timing. cleanupExpiredBlacklistAppeal replaces cleanupExpiredAppeal with updated openedAt + STANDING_LOOKBACK_SECONDS clawback logic and bond refund/burn outcomes.
Events, state machine, and integration notes
adr/031-content-blacklist-appeals-contract.md
BlacklistAppealUnFastTracked is removed from the event topic table. State machine diagram removes the UnFastTracked transition. Integration section replaces entry.suspendedAtUs with entry.suspendedAt and adjusts regionActiveReliefCount decrement points. ADR-014 cross-reference is updated to entry.suspendedAt.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 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 is concise and accurately describes the ADR-031 reconciliation work in this docs-only PR.
Linked Issues check ✅ Passed The docs-only changes align with #1014 by reconciling ADR-031 drift and documenting the shipped rejection-cooldown behavior.
Out of Scope Changes check ✅ Passed The PR stays within ADR-031 reconciliation and rejection-cooldown verification, with no unrelated code or spec changes.
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 docs/1014-adr031-reconcile

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Ensure ADR documentation accurately reflects implementation and internal references.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Ensure ADR documentation accurately reflects implementation and internal references.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

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 win

Use suspendedAt here, not effectiveAt.

This paragraph still references entry.effectiveAt, but the rest of the ADR has already renamed the field to entry.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

📥 Commits

Reviewing files that changed from the base of the PR and between 44afd1c and 36825ee.

📒 Files selected for processing (1)
  • adr/031-content-blacklist-appeals-contract.md

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

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 / UnFastTracked state 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 None sentinel and bytes2 region 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 (see contracts/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.

Comment on lines 10 to 13
> 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +196 to 199
| (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)) |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Review feedback addressed (pushed in 380b351)

Fixed

Verified and skipped (with reasons)

  • @coderabbitai — entry.effectiveAt → entry.suspendedAt (lines 180-184): These are distinct fields, not a rename. Per ADR-011: effectiveAt = addedAt + compliance window (the compliance-effective date), whereas suspendedAt is the fast-track suspension timestamp. ADR-011 § Authority and flow uses exactly this wording — "Reversal clears suspended, preserves the original effectiveAt… resetting was rejected to avoid shielding pre-suspension non-compliance." The PR's suspendedAtUs→suspendedAt rename did not touch effectiveAt, and it shouldn't — they mean different things. No change.
  • @gemini-code-assist — appeal.blake3Hash → appeal.hash (lines 178, 201): The ADR-031 target struct field is blake3Hash (bytes32 blake3Hash; // disputed hash), and every reference (open event, revert table, indexer convention, internal calls) uses it consistently. hash is the as-built contract's field name, not this ADR's. Per the target-spec framing, the names are intentionally distinct. No change.

@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 for the clarification — agreed, my earlier comment was off here.

effectiveAt and suspendedAt serve different purposes in adr/011-content-takedown.md, so the suspendedAtUs → suspendedAt rename in adr/031-content-blacklist-appeals-contract.md should not have touched effectiveAt. The target-spec explanation also makes the blake3Hash naming choice in ADR-031 clear.

(ᵔᴥᵔ)


✏️ Learnings added
Learnt from: alpergundogdu
URL: https://github.com/decdn/decdn/pull/1024

Timestamp: 2026-06-30T13:24:57.310Z
Learning: In `adr/011-content-takedown.md`, `effectiveAt` and `suspendedAt` are distinct timestamps with different semantics: `effectiveAt` is the compliance-effective date (`addedAt + compliance window`), while `suspendedAt` is the fast-track suspension timestamp. Reversal clears suspension but preserves the original `effectiveAt`.

Learnt from: alpergundogdu
URL: https://github.com/decdn/decdn/pull/1024

Timestamp: 2026-06-30T13:24:57.310Z
Learning: `adr/031-content-blacklist-appeals-contract.md` is intentionally maintained as a forward target specification rather than a 1:1 as-built ABI reference. Differences from the deployed contract, such as target-spec names like `blake3Hash` instead of the as-built `hash`, can be intentional and should not be auto-normalized during review.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@alpergundogdu
alpergundogdu merged commit 7ee668a into main Jun 30, 2026
22 checks passed
@alpergundogdu
alpergundogdu deleted the docs/1014-adr031-reconcile branch June 30, 2026 13:28
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.

docs(contracts): close rejection-cooldown item and reconcile ADR-031 to as-built ContentBlacklist (#688)

2 participants