Skip to content

feat(node): blacklist compliance loop + G-NODE-04 e2e (#1031) - #1087

Merged
alpergundogdu merged 8 commits into
mainfrom
feat/1031-blacklist-compliance-loop
Jul 10, 2026
Merged

alpergundogdu merged 8 commits into
mainfrom
feat/1031-blacklist-compliance-loop

Conversation

@yigitdot

@yigitdot yigitdot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1031.

Why

Issue #1031 is filed as an e2e test, but the node-side enforcement it asserts did not exist. ContentBlacklist + SlashJudge ship on-chain and the crates/e2e harness exists, yet nothing on the Rust side evicted, stopped announcing, or refused delivery for a blacklisted blob — handlers/client.rs explicitly deferred it as "ContentBlacklist's job (ADR 011/031)". This PR builds the missing node-side compliance loop and the G-NODE-04 acceptance test that exercises it end-to-end.

What changed

Production — node-side compliance loop

  • Config (blockchain.*): content_blacklist_address (opt-in; zero address rejected — codeless fails open), content_blacklist_from_block (replay start, mirrors origin_directory_from_block), content_blacklist_poll_interval_sec (periodic re-scope cadence, default 600s per ADR 011 §Polling; zero rejected — it would panic interval_at).
  • Binding: decdn-incentive::content_blacklist — isHashBlacklistedForOperator view + HashBlacklisted/HashRemoved events + governance writes.
  • Watcher (crates/node/src/blacklist_watcher.rs): event-sourced deny-set. HashBlacklisted logs are replayed from a checkpoint block (eth_getLogs, windowed) + a live subscription; every seen-but-not-yet-evicted hash is retained (incl. out-of-scope/suspended) and re-scoped each periodic pass, so a scope change that emits no event (operator updateRegion/ripening, appeal reversal/lapse clearing suspended) still leads to eviction. In-scope hashes are cache.evict()ed — sticky, works on absent hashes, so offline-blacklisted content is pre-blocked via the existing pull-admission is_evicted gate (no handler change). Resilience: reconcile runs regardless of the subscription (enforces even when the filter API is broken); every RPC read is timeout-bounded; the whole reconcile is interruptible by a CancellationToken (can't overrun the shutdown deadline); subscribe is shutdown-raced; stream-ends are throttled. O(blacklist), not O(held).

The single evict() lever cascades: durable takedown via evicted.log (survives restart), DHT-announce suppression, probe has_blob:false, and delivery refusal (EvictedSinceProbe, also blocks re-pull).

Test — G-NODE-04 (crates/e2e/tests/g_node_04_blacklist_compliance.rs)

  • Global compliance: blacklist H → evicted → paid delivery refused with EvictedSinceProbe → probe handler reports has_blob:false → durable across restart → full SlashJudge.submitBlacklistChallenge commit-reveal proving on-chain slashability.
  • Regional scope (GOV-05): US evicts / DE ignores a US-regional entry, gated on a global-sentinel ordering barrier.
  • Scope transition: a US-regional entry retained-but-not-evicted by a DE operator, then evicted after updateRegion("US") — a scope change with no ContentBlacklist event, caught only by the re-scope.

Fixtures: ContentBlacklist/SlashJudge/AccessControl/CapacityBond.updateRegion bindings, anvil-impersonated governance + update_region helpers, NodeFixture::{restart,launch_with_blobs}, ClientFixture::probe.

CI

Wired the previously-unrun decdn-e2e crate into the anvil-e2e job (settlement e2e first, warming forge); job timeout sized above the steps' per-test ceilings.

Reviewer notes

  • DHT announce-suppression is delegated to dht/publish.rs unit tests (its is_evicted gate); delivery, probe, and slashability are exercised end-to-end.
  • As-built SlashJudge enforces slashability from addedAt (no on-chain compliance-window grace — that window is the node's reaction budget, ADR 011 "target spec vs as-built"); "after the window" is modeled by stamping evidence after addedAt.
  • Follow-ups: appeal-driven un-eviction (sticky by design); explicit suspended-appeal-reactivation e2e (same re-scope path the scope-transition test covers); bounded-concurrency for the scan (unnecessary — O(blacklist)).

Verification

  • cargo clippy --workspace --all-targets --features anvil-e2e -- -D warnings, cargo fmt --check, cargo doc — clean.
  • Unit/integration: common (incl. config-rejection tests), incentive, node-lib, cli, sighup — pass.
  • e2e against real anvil+forge: global_blacklist_compliance (probe + slash), regional_blacklist_scope (sentinel barrier), regional_scope_transition (updateRegion re-scope), and smoke — all pass.

Review rounds

  • commit 2 (49f0b65): bot review — reconcile/subscribe race, periodic re-reconcile, per-call timeout.
  • commit 3 (d787c73): human review (alpergundogdu) — event-sourced replay closing the offline-then-served hole, reconcile independent of subscription, bounded+shutdown-raced subscribe, scope-error retry, zero-address rejection, CI timeout, test hardening (specific refusal reason, real daemon probe, regional ordering barrier).
  • commit 4 (8f5c9d5): coderabbit + human review (altanoruc) — CancellationToken making reconcile interruptible (shutdown-deadline safety), and retain + re-scope of the deny-set so region/appeal transitions that emit no event still evict (P1); + poll-interval config and the scope-transition test.
  • commit 5 (48af2df): coderabbit — reject content_blacklist_poll_interval_sec = 0 (would panic interval_at and kill the watcher): config rejection + unit test + defensive clamp in run.

🤖 Generated with Claude Code

The node had no content-hash blacklist awareness: ContentBlacklist and
SlashJudge shipped on-chain and the e2e harness existed, but nothing on
the Rust side evicted, stopped announcing, or refused delivery for a
blacklisted blob — the client handler explicitly deferred it as
"ContentBlacklist's job". This adds the missing node-side loop and the
G-NODE-04 acceptance test that exercises it end-to-end.

Production (Part A):
- Add optional `blockchain.content_blacklist_address` config (opt-in,
  modeled on origin_assignment_address).
- New `decdn-incentive::content_blacklist` binding (isHashBlacklistedForOperator
  view + HashBlacklisted/HashRemoved events + governance writes).
- New `blacklist_watcher` runtime task: reuses `watch_contract_events`,
  reconciles held hashes at boot and on each event, and calls
  `cache.evict()` for hashes blacklisted in scope for this operator
  (region logic delegated to the contract view). Eviction is the single
  lever and cascades to durable takedown (evicted.log), DHT-announce
  suppression, probe has_blob:false, and delivery refusal.

Test (Part B):
- `crates/e2e/tests/g_node_04_blacklist_compliance.rs`: global compliance
  (evict -> refuse delivery -> durable across restart -> full
  SlashJudge.submitBlacklistChallenge commit-reveal proving slashability)
  and regional scope (GOV-05: in-region node evicts, out-of-region keeps
  serving).
- Fixtures: ContentBlacklist/SlashJudge/AccessControl bindings,
  anvil-impersonated governance helpers, NodeFixture::restart().
- Wire the (previously unrun) decdn-e2e crate into the CI anvil-e2e job.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds opt-in blacklist configuration, a node-side compliance watcher, contract and e2e fixture support, global/regional compliance tests, and CI preparation for cross-layer journeys.

Changes

Content blacklist compliance

Layer / File(s) Summary
Config schema and resolution
crates/common/src/..., crates/cli/tests/config_validate.rs, crates/node/src/runtime/..., crates/node/tests/sighup_signal.rs
Adds blacklist address, replay-height, and polling configuration with validation, environment expansion, resolved-state wiring, and updated fixtures.
ContentBlacklist ABI bindings
crates/incentive/src/content_blacklist.rs, crates/incentive/src/lib.rs
Defines and exports the ContentBlacklist contract bindings.
Node blacklist watcher
crates/node/src/blacklist_watcher.rs, crates/node/src/lib.rs, crates/node/src/runtime/mod.rs
Adds replay, event subscription, periodic re-scoping, bounded RPC handling, eviction, cancellation, and runtime wiring.
E2E fixtures for governance, blacklist, and probe support
crates/e2e/src/{bindings,chain,node,client}.rs
Adds governance bindings and helpers, multi-blob node setup, daemon restart support, blacklist config rendering, and unpaid probing.
G-NODE-04 blacklist compliance e2e tests
crates/e2e/tests/g_node_04_blacklist_compliance.rs
Covers global and regional eviction, scope transitions, probe and delivery results, restart durability, and slash-challenge submission.
CI workflow updates for cross-layer e2e
.github/workflows/ci.yml
Raises the anvil-e2e timeout and builds decdn-node before cross-layer tests.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • decdn/decdn#1022: Adds the probe helper used by the e2e client fixture.
  • decdn/decdn#1053: Extends the e2e fixture surface used by these blacklist compliance flows.

Suggested reviewers: alpergundogdu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the blacklist watcher, restart durability, slashable evidence flow, and G-NODE-04 e2e coverage requested by #1031.
Out of Scope Changes check ✅ Passed The changed files stay focused on blacklist compliance, config, e2e coverage, and CI wiring with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: node blacklist compliance work plus the G-NODE-04 e2e test.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1031-blacklist-compliance-loop

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 implements the ContentBlacklist compliance watcher (ADR 011/031) to automatically evict blacklisted blobs from the local store, cascading to DHT-announce suppression and delivery refusal. It adds the necessary configuration options, contract ABI bindings, integration tests, and the background watcher task. The review feedback correctly identifies a critical race condition in the watcher's startup and reconnection logic where events could be missed between reconciliation and subscription establishment. To resolve this, the reviewer suggests subscribing first before running the reconciliation, which also simplifies the state tracking enum.

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.

Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 88.71% (2452/2764 lines)
▲ +0.00pp vs base (88.71% → 88.71%)
Run: 29098287481

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
crates/common/src/config/mod.rs (1)

3688-3689: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing dedicated coverage for the new content_blacklist_address resolution path.

Every fixture touched here just adds content_blacklist_address: None to compile; unlike slash_judge_address/other contract addresses, there's no test asserting resolve_blockchain accepts a valid checksummed content_blacklist_address, rejects a malformed one, or that empty-string collapses to None (mirroring resolve_blockchain_origin_directory_* / parse_contract_address_* patterns already in this file). A dedicated ${VAR} expansion test (sibling to expand_env_substitutes_slash_judge_address) is also absent.

Also applies to: 6931-6934, 7004-8710

🤖 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 `@crates/common/src/config/mod.rs` around lines 3688 - 3689, Add dedicated test
coverage for the new content_blacklist_address resolution path in the config
resolver, using the existing resolve_blockchain and parse_contract_address test
patterns as a guide. Create cases that verify a valid checksummed
content_blacklist_address is accepted, a malformed one is rejected, and an empty
string resolves to None, plus add a ${VAR} expansion test alongside
expand_env_substitutes_slash_judge_address. Use the existing slash_judge_address
and resolve_blockchain_origin_directory_* tests as the reference structure.
🤖 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.

Inline comments:
In `@crates/node/src/blacklist_watcher.rs`:
- Around line 262-308: The per-hash blacklist check in
is_blacklisted_for_operator and its caller evict_if_blacklisted currently treats
any RPC failure as “not blacklisted,” which can leave a blob served
indefinitely. Update the blacklist_watcher flow so transient failures are
retried with backoff or revisited by a periodic re-reconcile instead of being
dropped after one failed call. Keep the existing logging, but ensure
reconcile_all or the event-driven path schedules another attempt for hashes that
failed the isHashBlacklistedForOperator call.
- Around line 198-224: `reconcile_all` currently scans `cache.iter_hashes()`
sequentially and `evict_if_blacklisted` can hang indefinitely on
`isHashBlacklistedForOperator(...).call().await`. Update the blacklist watcher
reconcile path to use bounded concurrency when iterating held hashes, and wrap
each blacklist check in a per-call timeout so startup reconcile and replay
processing cannot stall the watcher. Keep the fix localized to `reconcile_all`
and `evict_if_blacklisted`, preserving the existing eviction and logging
behavior while making the scan latency bounded.

---

Nitpick comments:
In `@crates/common/src/config/mod.rs`:
- Around line 3688-3689: Add dedicated test coverage for the new
content_blacklist_address resolution path in the config resolver, using the
existing resolve_blockchain and parse_contract_address test patterns as a guide.
Create cases that verify a valid checksummed content_blacklist_address is
accepted, a malformed one is rejected, and an empty string resolves to None,
plus add a ${VAR} expansion test alongside
expand_env_substitutes_slash_judge_address. Use the existing slash_judge_address
and resolve_blockchain_origin_directory_* tests as the reference structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cd81e4a8-ae8b-4283-bfa0-a76390ac8e5d

📥 Commits

Reviewing files that changed from the base of the PR and between 73ec2db and 8da9dac.

📒 Files selected for processing (17)
  • .github/workflows/ci.yml
  • crates/cli/tests/config_validate.rs
  • crates/common/src/cli/run.rs
  • crates/common/src/config/mod.rs
  • crates/common/src/config/resolved.rs
  • crates/common/src/config/types.rs
  • crates/e2e/src/bindings.rs
  • crates/e2e/src/chain.rs
  • crates/e2e/src/node.rs
  • crates/e2e/tests/g_node_04_blacklist_compliance.rs
  • crates/incentive/src/content_blacklist.rs
  • crates/incentive/src/lib.rs
  • crates/node/src/blacklist_watcher.rs
  • crates/node/src/lib.rs
  • crates/node/src/runtime/mod.rs
  • crates/node/src/runtime/reload.rs
  • crates/node/tests/sighup_signal.rs

Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.32% (was 80.96%, ▼ 0.65%) — 43472/54126 lines

File Coverage Lines Δ
crates/common/src/config/mod.rs 97.01% 6589/6792 ▲ +0.02%
crates/common/src/config/resolved.rs 100.00% 48/48 ● 0.00%
crates/e2e/src/chain.rs 1.53% 11/720 ▼ 0.22%
crates/e2e/src/client.rs 0.00% 0/128 ● 0.00%
crates/e2e/src/node.rs 0.00% 0/199 ● 0.00%
crates/node/src/blacklist_watcher.rs 15.12% 57/377 new
crates/node/src/runtime/mod.rs 48.51% 946/1950 ▼ 0.70%
crates/node/src/runtime/reload.rs 95.27% 1470/1543 ▲ +0.02%
History
Commit Total Δ vs base
8da9dac 81.26% ▼ 0.45%
49f0b65 81.25% ▼ 0.46%
d787c73 81.01% ▼ 0.72%
8f5c9d5 80.98% ▼ 0.76%
48af2df 80.98% ▼ 0.75%
42f9609 81.01% ▼ 0.72%
687e308 80.32% ▼ 0.64%
2bf005f (HEAD) 80.32% ▼ 0.65%

 review)

Address bot review on the blacklist compliance watcher:

- Reconcile after the event filter is installed, not before. Establishing
  the subscription first (which buffers server-side) then reconciling
  closes the race where an event emitted between a reconcile and a later
  subscribe was lost — now covering startup, stream gaps, and repeated
  subscription failures uniformly. Collapses Cycle to {Shutdown,
  Resubscribe} and drops the Follow enum. Mirrors chain_origin_directory.
- Add a periodic re-reconcile (10 min, matching ADR 011 §Polling) so a
  hash whose scope check hit a transient RPC error is retried under a
  stable subscription instead of staying served until the next event/gap.
- Bound isHashBlacklistedForOperator with a 10s per-call timeout so a
  stalled provider (no RPC request timeout is configured) cannot hang a
  reconcile scan.

Bounded-concurrency for the scan is deliberately not added: sequential is
fine for a background backstop at the initial network scale, and the
per-call timeout already removes the unbounded-hang risk.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/common/src/config/mod.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
Comment thread crates/node/src/blacklist_watcher.rs Resolved
@alpergundogdu

Copy link
Copy Markdown
Contributor

Review summary

Reviewed at high effort (8 finder angles → adversarial verification). 10 inline comments posted. The eviction gate itself is well-placed (verified: CacheEngine chokepoint covers get/populate/range-pull/probe-hold, and DHT republish gates on it; the cache crate stays leaf). The top findings are all about coverage windows around that gate: content blacklisted while offline or not-yet-held escapes it, reconcile is gated on subscription health, and one transient scope-check error permanently drops a promised sticky pre-block — each a slashable-serving window under the no-grace SlashJudge semantics this PR's own e2e proves.

Lower-priority items verified but kept out of the inline set:

  • HashRemoved dead arm — subscribed and decoded solely for a debug log while the module doc says removal is intentionally unhandled; drop it from the filter or log via the catch-all.
  • Sticky-evict vs future resumption [design note, conceded in the module doc] — compliance reuses the permanent operator evict(), so "denied now, allowed later" (appeal wins, HashRemoved) can't be represented; the ADR 011 resumption follow-up will require changing eviction semantics that probe-hold/DHT/delivery now depend on, not just adding a handler arm.
  • blacklist_rpc_url Option mirror — derived via .map(|_| rpc_url.clone()) then matched as a two-Option tuple whose halves are correlated by construction; the sibling reputation_rpc_url pattern (unconditional clone + single if let) is simpler.
  • EIP-712 ProbeResponse duplicated 4× — the e2e's ProbeMsg struct + hand-written PROBE_TYPE string mirror the contract and decdn_incentive::probe_sig's canonical struct; exposing struct_hash()/abi_encode_response() from probe_sig would delete both copies (drift currently surfaces as an opaque on-chain revert).
  • Dead e2e surface — blacklist_added_at() (sole consumer of the getHashEntry binding), global_region() (duplicates region_key("GLOBAL") eight lines below), and the removeHashGlobal binding have no callers.
  • poll() helper — third private copy (smoke.rs, anvil_settlement) with Result<Option<T>> forcing ?-then-assert at every call site; promote to the fixture crate with bail-on-timeout semantics.
  • Region topic filter (with a caveat) — region is indexed, so filtering to [GLOBAL, own-region, ripening-prev-region] would skip out-of-scope events, but the prev-region term is required (ADR 030) and the filter must be reinstalled on region change.

🤖 Generated with Claude Code

 review)

Address alpergundogdu's review of the blacklist compliance loop.

Watcher redesign (crates/node/src/blacklist_watcher.rs) — the deny-set is now
sourced from `HashBlacklisted` logs replayed from a checkpoint block plus a live
subscription, instead of scanning currently-held blobs:
- Replay-from-checkpoint lets the watcher pre-block a hash blacklisted while the
  node was offline and not yet held: `evict` is sticky, so the pull-through
  admission `is_evicted` gate refuses a later origin fill. Closes the
  offline-then-served slash hole; also makes each pass O(blacklist) not O(held).
- Reconcile runs every cycle regardless of the subscription (eth_getLogs works
  even when the filter API is broken), so an eth_call/getLogs-only endpoint still
  enforces.
- The subscribe await is bounded by RPC_CALL_TIMEOUT and raced against shutdown
  so a hung eth_newFilter can't wedge the watcher or block graceful shutdown.
- Per-hash scope-check errors are queued and retried on the periodic tick, so a
  transient RPC error no longer permanently drops a sticky pre-block.
- Clean stream-ends are throttled (min-survival before resetting backoff) so a
  filter that expires on the first poll can't spin.

Config — add `blockchain.content_blacklist_from_block` (replay start, mirrors
`origin_directory_from_block`), and reject the zero address for
`content_blacklist_address` (a codeless address fails open: every scope call
errors → nothing evicted while the operator believes compliance is active).

CI — raise the anvil-e2e job timeout above the sum of the steps' in-test
ceilings so a hung test hits its per-test timeout's clear message first.

Tests — assert the refusal reason specifically (`EvictedSinceProbe`), drive a
real probe at the daemon asserting `has_blob:false` (the phantom-blob seam), and
gate the regional non-eviction on a global-sentinel ordering barrier so a
one-cycle-late scope bug can't pass. Adds `NodeFixture::launch_with_blobs` and
`ClientFixture::probe`.

Declined: bounded-concurrency for the scan — the replay makes it O(blacklist),
so it is unnecessary complexity at the current scale.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

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

Actionable comments posted: 1

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

Inline comments:
In `@crates/node/src/blacklist_watcher.rs`:
- Around line 263-275: `reconcile` currently ignores shutdown once it starts, so
long-running backlog processing in `replay` and `drain_pending` can overrun the
shutdown deadline. Update `reconcile` to stop early when shutdown is requested
by threading the shutdown signal through `replay` and `drain_pending`, or by
racing `reconcile` itself against shutdown; use the existing `reconcile`,
`replay`, and `drain_pending` functions as the entry points for the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6dfcf9a2-e3a9-465a-99e2-bcc46bf21dee

📥 Commits

Reviewing files that changed from the base of the PR and between 49f0b65 and d787c73.

📒 Files selected for processing (12)
  • .github/workflows/ci.yml
  • crates/cli/tests/config_validate.rs
  • crates/common/src/config/mod.rs
  • crates/common/src/config/resolved.rs
  • crates/common/src/config/types.rs
  • crates/e2e/src/client.rs
  • crates/e2e/src/node.rs
  • crates/e2e/tests/g_node_04_blacklist_compliance.rs
  • crates/node/src/blacklist_watcher.rs
  • crates/node/src/runtime/mod.rs
  • crates/node/src/runtime/reload.rs
  • crates/node/tests/sighup_signal.rs
✅ Files skipped from review due to trivial changes (2)
  • crates/cli/tests/config_validate.rs
  • crates/node/src/runtime/reload.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/node/tests/sighup_signal.rs
  • crates/common/src/config/types.rs
  • crates/common/src/config/resolved.rs
  • crates/node/src/runtime/mod.rs
  • crates/common/src/config/mod.rs

Comment thread crates/node/src/blacklist_watcher.rs Resolved

@altanoruc altanoruc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One P1 compliance gap needs to be addressed before merge.

Comment thread crates/node/src/blacklist_watcher.rs Resolved
…et (PR #1087 review)

Address the round-4 review of the blacklist compliance watcher.

Shutdown interruptibility (coderabbit) — a long reconcile (many 9k-block replay
windows / scope retries) could overrun the runtime's 15s SHUTDOWN_DEADLINE and
force an abort. Convert the watcher's shutdown from a oneshot to
`tokio_util::sync::CancellationToken` (the runtime's standard shutdown
primitive): `is_cancelled()` is checked between replay windows and rescan
hashes, and `cancelled()` feeds the loop/subscribe/sleep selects.

Retain + re-scope the deny-set (altanoruc, P1) — the round-3 watcher dropped a
hash on `Some(false)` (out-of-scope for the operator's region, or fast-track
suspended). Neither a region/ripening transition (`updateRegion`) nor an appeal
reversal/lapse re-emits `HashBlacklisted`, and the advanced checkpoint prevents
replay, so such a hash could become live + in scope and be served indefinitely.
Now every seen-but-not-yet-evicted hash is retained in a `known` set (incl.
out-of-scope/suspended) and re-scoped on every periodic pass; when it comes into
scope it is evicted. This supersedes the round-3 `pending` retry set.

Config — add `blockchain.content_blacklist_poll_interval_sec` (default 600s, ADR
011 §Polling cadence) governing the periodic replay + re-scope; scope
transitions emit no event, so this backstop is what catches them.

Test — add `regional_scope_transition`: a US-regional entry is retained (not
evicted) by a DE operator, then evicted after `updateRegion("US")` — a scope
change with no `ContentBlacklist` event, caught only by the re-scope. Adds
`CapacityBond.updateRegion` binding + `chain.update_region` helper; the e2e node
config uses a 2s poll interval.

The suspended-appeal-becoming-active case exercises the identical re-scope path
(scope flips true when `suspended` clears); left as a follow-up rather than
duplicating the mechanism with the heavy appeal-lifecycle choreography.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/e2e/tests/g_node_04_blacklist_compliance.rs (1)

280-290: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Negative assertion can pass vacuously — no positive proof the watcher observed the US entry.

Lines 286-290 sleep a fixed 8s, then assert H is still present. If the watcher hasn't yet replayed/processed the US-regional entry within that window, a genuine scope bug (evicting out-of-scope hashes) would still leave H present and green the test. This is the same shape flagged earlier for run_regional, which was hardened with a DE sentinel barrier; that barrier isn't present here.

Consider adding a positive signal that the DE watcher has processed the entry at/after the US-regional insertion before asserting non-eviction — e.g. blacklist a global sentinel blob that DE does evict, and wait for that eviction first, mirroring run_regional.

🤖 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 `@crates/e2e/tests/g_node_04_blacklist_compliance.rs` around lines 280 - 290,
The regional non-eviction assertion can pass before the DE watcher processes the
US entry. In the test flow around add_hash_regional and evict_was_present, add a
DE-visible global sentinel after inserting the US entry, then wait for the
sentinel’s eviction using the existing watcher/barrier pattern from run_regional
before asserting the US hash remains present; remove the fixed-sleep-only
synchronization.
🤖 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.

Inline comments:
In `@crates/node/src/blacklist_watcher.rs`:
- Around line 250-251: The blacklist poll interval can resolve to zero, causing
interval_at in the watcher initialization to panic. Reject or clamp zero values
during configuration resolution, or immediately before constructing the interval
in the blacklist watcher, ensuring the value passed to interval_at is always
positive while preserving the existing scheduling behavior.

---

Nitpick comments:
In `@crates/e2e/tests/g_node_04_blacklist_compliance.rs`:
- Around line 280-290: The regional non-eviction assertion can pass before the
DE watcher processes the US entry. In the test flow around add_hash_regional and
evict_was_present, add a DE-visible global sentinel after inserting the US
entry, then wait for the sentinel’s eviction using the existing watcher/barrier
pattern from run_regional before asserting the US hash remains present; remove
the fixed-sleep-only synchronization.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0fc54d8f-f937-458d-b441-4a74c53f5d5c

📥 Commits

Reviewing files that changed from the base of the PR and between d787c73 and 8f5c9d5.

📒 Files selected for processing (12)
  • crates/cli/tests/config_validate.rs
  • crates/common/src/config/mod.rs
  • crates/common/src/config/resolved.rs
  • crates/common/src/config/types.rs
  • crates/e2e/src/bindings.rs
  • crates/e2e/src/chain.rs
  • crates/e2e/src/node.rs
  • crates/e2e/tests/g_node_04_blacklist_compliance.rs
  • crates/node/src/blacklist_watcher.rs
  • crates/node/src/runtime/mod.rs
  • crates/node/src/runtime/reload.rs
  • crates/node/tests/sighup_signal.rs
✅ Files skipped from review due to trivial changes (2)
  • crates/node/tests/sighup_signal.rs
  • crates/node/src/runtime/reload.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/cli/tests/config_validate.rs
  • crates/common/src/config/resolved.rs
  • crates/e2e/src/bindings.rs
  • crates/e2e/src/node.rs
  • crates/common/src/config/mod.rs

Comment thread crates/node/src/blacklist_watcher.rs Resolved
`tokio::time::interval_at` panics on a zero period, so
`content_blacklist_poll_interval_sec = 0` would kill the watcher task and
silently stop blacklist reconciliation. Reject 0 at config resolution (0 is not
a "disable" sentinel — disabling the periodic re-scope would break the
retain/re-scope guarantee), mirroring the zero-slash-judge / zero-chain-id
checks, with a unit test. Also clamp defensively in `blacklist_watcher::run` so
the interval construction can never panic regardless of caller.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@yigitdot
yigitdot requested a review from alpergundogdu July 10, 2026 11:18
claude added 2 commits July 10, 2026 12:51
…dget

PR #1087 review fixes:

- blacklist_watcher: key `known` by (region, hash) — the contract's own
  `_hashEntries[region][hash]` key — so a HashRemoved for one region's
  entry no longer drops a surviving same-hash entry in another region
  (which left the node slashable after a later updateRegion into the
  surviving region, since region changes emit no blacklist event).
  Re-scoping dedupes the per-hash isHashBlacklistedForOperator eth_call
  across regional entries; eviction (sticky, region-independent) drops
  all entries for the hash. Warn on undecodable HashRemoved logs like
  HashBlacklisted, and add unit tests for the pure deny-set transitions.
- config: test the zero-address rejection of
  blockchain.content_blacklist_address (mirrors slash_judge_address).
- CI anvil-e2e: cap the cross-layer journeys at --test-threads 2 (each
  journey runs its own anvil + forge deploy + daemons; four at once
  oversubscribes the 4-core runner) and recompute the job budget
  honestly — settlement 13m + worst 2-thread journey schedule 30m plus
  compiles/deploys — raising timeout-minutes 30 -> 60.
- e2e Cargo.toml: unstale the "only test target is the smoke test"
  comments now that the G-NODE-04 journeys exist.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0184dDvFgy44w6deBQkugX7r
Union-merge of the slash-watcher feature (#1089/#1032) with the blacklist
compliance loop (#1031): both config surfaces (slash_judge_from_block /
slash_appeal_address alongside content_blacklist_*), both e2e binding sets
(SlashAppeal/Governor/Timelock alongside ContentBlacklist/AccessControl —
the blacklist challenge entry point moves to a SlashJudgeBlacklist binding
so main's production-SlashJudge re-export stands), both ChainFixture verb
sets (head_timestamp absorbs block_timestamp), and one reconciled
NodeFixture::restart (pub config_path).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0184dDvFgy44w6deBQkugX7r
The #1089 merge brought crates/e2e/tests/slash_appeal.rs into the
cross-layer journey step, and it shells out to the user CLI binary
`decdn` (package decdn-cli), which the anvil-e2e job never built — the
journey failed with "decdn binary not found". Build it alongside the
daemon, and recompute the job budget for the 5-test journey set:
settlement 13m + worst 2-thread schedule 43m (smoke 13m + three
G-NODE-04 10m on one thread vs slash_appeal 20m on the other) + compiles
and per-fixture forge deploys, raising timeout-minutes 60 -> 75.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0184dDvFgy44w6deBQkugX7r
@alpergundogdu
alpergundogdu merged commit 871751d into main Jul 10, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the feat/1031-blacklist-compliance-loop branch July 10, 2026 16:04
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.

e2e G-NODE-04: blacklist compliance loop (slashable — highest priority)

4 participants