Skip to content

test(e2e): cover the operator deny-list and the origin restart path - #1499

Merged
alpergundogdu merged 1 commit into
mainfrom
test/enumeration-baseline-e2e
Jul 29, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
test/enumeration-baseline-e2e

Conversation

@thiras

@thiras thiras commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Why

Two gaps in the address-level blacklist journey, both in the half of the deny-set with the weakest primitives — and both about to be rewritten by the enumeration work in #1497. Pinning the behaviour before the rewrite rather than after.

The operator list was untested

addOperator writes isOperatorBlacklisted and emits OperatorBlacklisted. It never touches _isOriginBlacklisted or OriginBlacklistUpdated. So a node that projects only the origin event passes the existing journey and still serves an operator governance has blacklisted — and this is the primary governance route, since it also ejects the operator from CapacityBond. OriginAssignment unions the two lists; a node must too.

The new leg asserts the separation directly rather than implying it:

chain.set_operator_blacklist(funder, true).await?;
assert!(chain.is_operator_blacklisted(funder).await?);
assert!(!chain.is_origin_blacklisted(funder).await?,
    "addOperator must NOT set the origin mapping — that separation is the point");

The restart path was untested

The origin half sits outside the getBlacklistVersion() mechanism, so there is no counter a consumer could use to notice it missed an update. The deny-set therefore has to survive a process restart on its own. A regression here surfaces as an empty deny-set, which is indistinguishable from "nothing is blacklisted" while the node serves content it is obliged to refuse — and reports nothing wrong.

The new leg blacklists, confirms the refusal, restarts the daemon, and requires the refusal again.

Notes for review

Both assert the typed refusal, not a formatted string — via a shared poll_until_refused helper that downcasts to UpstreamRefused and requires StreamError::OriginBlacklisted. A channel/connect/payment regression that also fails the fetch cannot green these.

Both have teeth by construction. If the node ignored OperatorBlacklisted, or came up with an empty deny-set after restart, the fetch would keep succeeding and the poll would time out rather than pass. There is no vacuous-pass path.

set_operator_blacklist is deliberately not a wrapper over set_origin_blacklist — the entire point is that the two lists are independent, so the fixture keeps them independent too.

Correction to an earlier assumption

Scoping this work, I recorded that there was no e2e coverage of the slash watcher's rebuild-on-restart. That was wrong: slash_appeal.rs:127-147 already asserts exactly that ("a fresh process must re-surface the slash by rebuilding its in-memory store from the SlashJudge floor scan"). No new test was needed there, and the slash-watcher migration is already guarded.

Testing

Verified against a live anvil chain — 3 tests pass in 221s:

PASS [ 72.665s] operator_blacklist_refuses_delivery_to_the_blacklisted_funder
PASS [ 52.419s] origin_blacklist_refuses_delivery_to_the_blacklisted_funder
PASS [ 95.891s] origin_deny_set_survives_a_restart

Plus cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check.

Pure test addition — no runtime code changes, so it can merge independently of #1497 and #1498.

🤖 Generated with Claude Code

Two gaps in the address-level blacklist journey, both in the half of the deny-set
with the weakest primitives — and both about to be rewritten by the enumeration
work, so they are worth pinning before rather than after.

**The operator list was untested.** `addOperator` writes `isOperatorBlacklisted`
and emits `OperatorBlacklisted`; it never touches `_isOriginBlacklisted` or
`OriginBlacklistUpdated`. A node projecting only the origin event passes the
existing journey and still serves an operator governance has blacklisted — and
this is the *primary* governance route, since it also ejects from `CapacityBond`.
The new leg asserts the separation directly: `addOperator` must land on-chain
while `isOriginBlacklisted` stays false, and the node must still refuse.

**The restart path was untested.** The origin half has no version counter to
detect a missed update against, so the deny-set must survive a process restart.
A regression comes up as an EMPTY deny-set, which is indistinguishable from
"nothing is blacklisted" while the node serves what it is obliged to refuse —
and reports nothing wrong. The new leg blacklists, confirms the refusal,
restarts, and requires the refusal again.

Both assert the TYPED refusal (`StreamError::OriginBlacklisted`) via the shared
`poll_until_refused` helper, so a channel/connect/payment regression that also
fails the fetch cannot green them. Both have teeth by construction: if the node
ignored `OperatorBlacklisted`, or came up with an empty deny-set, the fetch would
keep succeeding and the poll would time out rather than pass.

Adds `set_operator_blacklist` / `is_operator_blacklisted` to `ChainFixture` and
binds `isOperatorBlacklisted` — deliberately not a wrapper over
`set_origin_blacklist`, since the whole point is that the two lists are
independent.

Verified against a live anvil chain: 3 tests pass in 221s.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 01:55
@coderabbitai

coderabbitai Bot commented Jul 29, 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: 26 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: bb21c7d2-3d53-4229-acb3-5f2868772c27

📥 Commits

Reviewing files that changed from the base of the PR and between f4a1572 and bafaf60.

📒 Files selected for processing (3)
  • crates/e2e/src/bindings.rs
  • crates/e2e/src/chain.rs
  • crates/e2e/tests/origin_blacklist_compliance.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.

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

Adds missing end-to-end coverage around the address-level origin/operator deny lists and verifies the origin deny-set remains enforced across a daemon restart, strengthening the node’s compliance guarantees and protecting against regressions ahead of the planned blacklist enumeration rewrite.

Changes:

  • Added new e2e legs to assert (1) operator blacklist enforcement and (2) origin deny-set persistence across node restart.
  • Introduced a shared poll_until_refused helper to assert typed refusals (UpstreamRefused → StreamError) rather than string matching.
  • Extended the e2e chain fixture + alloy::sol! bindings to drive and confirm the operator blacklist path (addOperator / isOperatorBlacklisted).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/e2e/tests/origin_blacklist_compliance.rs Adds operator-blacklist and restart-survival e2e coverage plus a typed-refusal polling helper.
crates/e2e/src/chain.rs Adds fixture helpers to set/read the operator blacklist via governed ContentBlacklist calls.
crates/e2e/src/bindings.rs Extends the ContentBlacklistOrigin binding with isOperatorBlacklisted for on-chain confirmation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to +99
/// Poll until a fetch by `client` is refused specifically for `expected`.
///
/// Asserts on the TYPED refusal rather than a formatted string: a
/// channel/connect/payment regression that also fails the fetch must not green
/// the check. Before the watcher catches up the fetch may still succeed — that
/// is "not yet projected", so retry.
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 80.75% (was 80.79%, ▼ 0.05%) — 54698/67741 lines

File Coverage Lines Δ
crates/e2e/src/chain.rs 1.62% 21/1293 ▼ 0.05%
History
Commit Total Δ vs base
bafaf60 (HEAD) 80.75% ▼ 0.05%

@alpergundogdu
alpergundogdu merged commit 5bdb59b into main Jul 29, 2026
26 checks passed
@alpergundogdu
alpergundogdu deleted the test/enumeration-baseline-e2e branch July 29, 2026 11:17
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.

3 participants