Repository navigation
feat(node): honor blacklist suspend/resume promptly via HashSuspensionUpdated - #1330
Conversation
…nUpdated #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]>
|
Warning Review limit reached
Next review available in: 41 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: Free Run ID: 📒 Files selected for processing (2)
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces support for the HashSuspensionUpdated event in the blacklist watcher. This event is emitted when a blacklist entry's suspension status is toggled (suspend/resume). The watcher now processes this event immediately: on a resume edge, it triggers an immediate scope re-check to prevent serving slashable content, while on a suspend edge, it retains the entry in memory for future re-scoping without performing an immediate check. Unit tests have been added to verify both behaviors. No review comments were provided, so there is no additional feedback to address.
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 reduces compliance risk in the node’s blacklist watcher by consuming the new HashSuspensionUpdated event, allowing the watcher to react promptly when an appeal-driven resume re-arms enforcement (without waiting for the next periodic re-scope).
Changes:
- Added
HashSuspensionUpdatedto the RustContentBlacklistABI bindings so event signatures match the Solidity contract. - Updated the node blacklist watcher to subscribe to and handle
HashSuspensionUpdated, re-checking scope immediately on resume while avoiding RPC on suspend. - Added tests covering both suspend and resume edges using a mocked provider to prove whether a re-check was attempted.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/node/src/blacklist_watcher.rs |
Subscribe to and handle HashSuspensionUpdated; re-check scope immediately on resume; add suspend/resume tests. |
crates/incentive/src/content_blacklist.rs |
Extend the alloy::sol! ABI surface with HashSuspensionUpdated matching the contract event signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let hash = Hash::from_bytes(event.hash.0); | ||
| state.add_entry(event.region, hash); | ||
| if event.suspended { |
Coverage reportTotal: 81.64% (was 81.63%, ▲ +0.02%) — 50457/61802 lines
History
|
Refs #1300. Consumes the
HashSuspensionUpdatedevent that #1326 added toContentBlacklist.The gap
The watcher already honored suspension, but only indirectly: suspended entries stay in
known, and the batched re-scope asks the contract'sisHashBlacklistedForOperatorview, which accounts forsuspended.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 batched re-scope — up to a full rescan cadence. Serving a re-enforced hash is slashable (SlashJudge.submitBlacklistChallenge), so that window is real exposure.Change
crates/incentive/src/content_blacklist.rs— mirror theHashSuspensionUpdateddeclaration so the binding'sSIGNATURE_HASHmatches the contract.crates/node/src/blacklist_watcher.rs— subscribe to the third topic, dispatch it, addon_suspension_log:suspended == false) → re-check scope immediately, exactly ason_blacklisted_logdoes for a fresh entrysuspended == true) → retain inknown, no re-checkSuspension only ever narrows what is enforced, and local eviction is deliberately sticky and one-way, so the suspend edge has nothing to undo and should not spend an RPC. Both edges keep the entry in
known.The periodic re-scope is still required
It is not made redundant: it remains the only thing that catches a region/ripening transition (
CapacityBond.updateRegion), which emits no event at all. The two are complementary — the event gives a prompt path for the appeal half, the re-scope stays the backstop.Tests
Both edges, against the mocked provider (no queued response, so any real RPC fails):
resume_rechecks_immediatelyRecheck::Failed— proof it attempted the re-checksuspend_retains_entry_without_recheckRecheck::NoAction— proof it spent no RPCBoth also assert the entry stays in
knownfor re-scoping.Verification
cargo fmt --check,cargo clippy -p decdn-node -p decdn-incentive --all-targets(clean),cargo nextest run -p decdn-node -p decdn-incentive— 1118 passed, 0 failed.Out of scope
Does not touch
cursor_start()'sFullReplayor its COMPLIANCE PIN — the delta-sync half of #1181 is a separate change.🤖 Generated with Claude Code