Skip to content

feat(node): honor blacklist suspend/resume promptly via HashSuspensionUpdated - #1330

Merged
thiras merged 1 commit into
mainfrom
feat/node-honor-blacklist-suspension
Jul 20, 2026
Merged

thiras merged 1 commit into
mainfrom
feat/node-honor-blacklist-suspension

Conversation

@thiras

@thiras thiras commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Refs #1300. Consumes the HashSuspensionUpdated event that #1326 added to ContentBlacklist.

The gap

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

Test Asserts
resume_rechecks_immediately returns Recheck::Failed — proof it attempted the re-check
suspend_retains_entry_without_recheck returns Recheck::NoAction — proof it spent no RPC

Both also assert the entry stays in known for 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()'s FullReplay or its COMPLIANCE PIN — the delta-sync half of #1181 is a separate change.

🤖 Generated with Claude Code

…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]>
Copilot AI review requested due to automatic review settings July 20, 2026 15:22
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thiras, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 321e11f4-ff66-4261-8282-2786cf0797eb

📥 Commits

Reviewing files that changed from the base of the PR and between 4996e44 and f64993c.

📒 Files selected for processing (2)
  • crates/incentive/src/content_blacklist.rs
  • crates/node/src/blacklist_watcher.rs

Note

🎁 Summarized by CodeRabbit Free

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

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

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 HashSuspensionUpdated to the Rust ContentBlacklist ABI 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.

Comment on lines +526 to +528
let hash = Hash::from_bytes(event.hash.0);
state.add_entry(event.region, hash);
if event.suspended {
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 81.64% (was 81.63%, ▲ +0.02%) — 50457/61802 lines

File Coverage Lines Δ
crates/node/src/blacklist_watcher.rs 82.64% 438/530 ▲ +1.97%
History
Commit Total Δ vs base
f64993c (HEAD) 81.64% ▲ +0.02%

@thiras
thiras merged commit 21d493a into main Jul 20, 2026
24 checks passed
@thiras
thiras deleted the feat/node-honor-blacklist-suspension branch July 20, 2026 15:33
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.

2 participants