Repository navigation
feat(contracts): carry the post-change version on ContentBlacklist hash events - #1326
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThe ADR revises ContentBlacklist governance, appeal, event, and polling semantics. The contract and Rust ABI emit versioned hash events, tests validate event payloads, and gas snapshots are updated. ChangesBlacklist Event Versioning
Estimated code review effort: 2 (Simple) | ~10 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Contracts coverageLine coverage: 88.96% (2499/2809 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
Code Review
This pull request updates the content takedown architecture (ADR 011) and its implementation in ContentBlacklist.sol to include the post-change blacklist version in the HashBlacklisted, HashRemoved, and HashSuspensionUpdated events, enabling delta consumers to reliably order events and detect gaps. Additionally, the scope of appeals has been expanded to cover global entries, and several interface functions and events have been renamed or updated to align with these design changes. Unit tests have been added and updated to verify the new event payloads and version tracking. There are no review comments, and I have no feedback to provide.
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.
Pull request overview
This PR updates the ContentBlacklist contract’s hash-related events to carry the post-change blacklist version, and adds a dedicated event for appeal-driven suspend/resume so every _blacklistVersion increment has a corresponding log entry. This supports delta consumers that poll getBlacklistVersion() to decide whether to fetch, and then use logs to determine what changed.
Changes:
- Extend
HashBlacklistedandHashRemovedto include the post-changeversion, and emit that value from the add/remove helpers. - Add
HashSuspensionUpdatedemitted from_setEntrySuspended, ensuring appeal-driven suspend/resume version bumps are never “silent”. - Add/adjust Foundry tests to assert the version-bearing events, and update ADR 011 polling documentation accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| contracts/src/ContentBlacklist.sol | Adds version to hash add/remove events and introduces HashSuspensionUpdated emitted from the suspend/resume choke point. |
| contracts/test/ContentBlacklist.t.sol | Adds tests asserting version-bearing removal and suspension events; updates existing event expectations for new signatures. |
| adr/011-content-takedown.md | Documents the polling/log strategy and updates the described events (but has interface-type inconsistencies noted in review comments). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Regional governance path — REGIONAL_BODY_ROLE, callable only by a | ||
| // registered regional body. Both revert on the global sentinel, so a | ||
| // regional body can never reach a global entry. | ||
| function addHashRegional(string calldata region, bytes32 blake3Hash, string calldata reason) external; | ||
| function removeHashRegional(string calldata region, bytes32 blake3Hash) external; |
| // Per-entry appeal flow (see § Blacklist Entry Appeals). Regional entries are | ||
| // the primary case; global entries are filable by naming GLOBAL_REGION. | ||
| // openBlacklistAppeal reverts on the UNSET region sentinel (bytes32(0)) and on | ||
| // entries past their filing window. The filer declares one standing path: |
…sh events A delta consumer polls `getBlacklistVersion()` to decide whether to fetch, then reads event logs to learn what changed. That only works if every advance of the counter has a matching log and each log says which revision it belongs to — otherwise the version can move with no event behind it, and a node silently under-enforces a resumed hash. Under-enforcement is precisely the compliance failure the poll cycle exists to prevent. Three changes: - `HashBlacklisted` and `HashRemoved` now carry the post-change `version`. - New `HashSuspensionUpdated`, emitted from the `_setEntrySuspended` choke point. This was the gap: an appeal-driven suspend/resume flips whether a live entry is enforced and bumps `_blacklistVersion`, but added or removed nothing — so it advanced the counter with no log at all. - ADR 011 § Polling documents the mechanism, including why `version` is NOT indexed: EVM topic filters match by set membership, not range, so indexing buys no range query. The node keys `eth_getLogs` on a block range from its last-seen checkpoint and uses `version` to order deltas and prove there is no gap. Origin blacklisting stays deliberately outside this: `OriginBlacklistUpdated` carries no version and is enforced via `OriginAssignment` cross-reference at selection time, not the hash version poll. Also in ADR 011: operator standing under appeal path 2 does not require a region match on a **global** entry — a global entry binds every region, so any in-scope operator has standing. Verified: `forge fmt --check`, `FOUNDRY_PROFILE=ci forge build --sizes --deny warnings`, `forge test` (753 passed), `aderyn` (0 high), `slither` (exit 0). ContentBlacklist is 14,920 bytes, well under the EIP-170 limit. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
586f8a1 to
0d68cb6
Compare
Coverage reportTotal: 81.63% (was 81.63%, ● 0.00%) — 50381/61722 lines No coverage data for changed Rust files. History
|
…nUpdated (#1330) #1326 added `HashSuspensionUpdated` to `ContentBlacklist` so that every `_blacklistVersion` bump has a matching log. The node did not consume it. The watcher already *honored* suspension, but only indirectly: suspended entries stay in `known` and the batched re-scope asks the contract's `isHashBlacklistedForOperator` view, which accounts for `suspended`. The gap was latency on the **resume** edge — an appeal reversal/lapse re-arms enforcement while emitting no `HashBlacklisted`, so the hash stayed servable until the next re-scope pass (up to a full rescan cadence). Serving a re-enforced hash is slashable, so that window is real exposure. - `crates/incentive/src/content_blacklist.rs`: mirror the `HashSuspensionUpdated` declaration so the binding's `SIGNATURE_HASH` matches the contract. - `crates/node/src/blacklist_watcher.rs`: subscribe to the third topic, dispatch it, and add `on_suspension_log`: - resume (`suspended == false`) -> re-check scope immediately, exactly as `on_blacklisted_log` does for a fresh entry; - suspend (`suspended == true`) -> retain in `known`, no re-check. Suspension only ever narrows what is enforced, and local eviction is deliberately sticky and one-way, so there is nothing to undo. Both edges keep the entry in `known` so the periodic re-scope still watches it. The periodic re-scope remains the backstop and is NOT redundant: it is still the only thing that catches a region/ripening transition (`CapacityBond.updateRegion`), which emits no event at all. Tests cover both edges against the mocked provider: the resume path surfaces `Recheck::Failed` (proving it attempted the re-check), the suspend path returns `Recheck::NoAction` (proving it spent no RPC), and both assert the entry stays in `known`. Refs #1300. Does not touch the full-replay cursor or its COMPLIANCE PIN — the delta-sync half of #1181 is separate. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
A delta consumer polls
getBlacklistVersion()to decide whether to fetch, then reads event logs to learn what changed. That split only works if two things hold: every advance of the counter has a matching log, and each log says which revision it belongs to.Neither held.
HashBlacklistedandHashRemovedcarried no version, and the appeal-driven suspend/resume path bumped_blacklistVersionwhile emitting nothing at all — it flips whether a live entry is enforced (_isLive) without adding or removing anything, so it fell between the two existing events. A node fetching deltas could see the counter move with no event behind it and silently under-enforce a resumed hash, which is the compliance failure the poll cycle exists to prevent.Changes
HashBlacklisted/HashRemovednow carry the post-changeversion— thegetBlacklistVersion()value after the change, so a consumer can order events and confirm no gap.HashSuspensionUpdated, emitted from the_setEntrySuspendedchoke point. That choke point already existed to keep the counter bumps in one place; the event now sits with it, so every bump has exactly one matching log.Why
versionis not indexedEVM topic filters match by set membership, not range, so indexing
versionbuys no "give me versions 5–12" query — it would only let you ask for an exact set of versions you already knew. The node instead keyseth_getLogson a block range from its last-seen checkpoint and usesversionto order the deltas and prove it has seen every revision. The counter answers whether to fetch; the events answer what changed.Scope
Origin blacklisting stays deliberately outside this mechanism.
OriginBlacklistUpdatedcarries no version and is enforced viaOriginAssignmentcross-reference at selection time with lazy permissionless cleanup, not the hash version poll.Also included, in ADR 011 only: operator standing under appeal path 2 does not require a region match on a global entry — a global entry binds every region, so any in-scope operator has standing without one.
Verification
forge fmt --check— cleanFOUNDRY_PROFILE=ci forge build --sizes --deny warnings— cleanforge test— 753 passed, 0 failedaderyn— 0 high;slither --config-file slither.config.json— exit 0ContentBlacklistis 14,920 bytes, well clear of the EIP-170 limitNew tests:
test_HashRemoved_carriesVersion, andtest_HashSuspensionUpdated_onSuspendAndResume— which asserts on both edges (fast-track suspends, reversal resumes), since the resume side is the one whose absence caused silent under-enforcement.🤖 Generated with Claude Code
Summary by CodeRabbit