Skip to content

refactor(contracts,node)!: drop ContentBlacklist coupling from OriginAssignment (#2032) - #2035

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/upbeat-spence-cc973c
Sep 15, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/upbeat-spence-cc973c

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

What

Full cut of the ContentBlacklist coupling in OriginAssignment, from the governance-hardening spec-discipline pass. The seat set is a routing hint (namespaces are routing-only, ADR 002; the authorized-origin serve gate was removed in #1525), so blacklist filtering moves to the consumer that acts on it, and the on-chain guard — which never re-ran after seating and which every consumer had to re-filter past anyway — is deleted.

Closes #2032.

Why (spec-discipline verdict: simplify)

  • The addOrigin operator-mapping blacklist check was fully redundant with the isActive check on the line above it: ContentBlacklist.addOperator ejects from CapacityBond, so an operator-blacklisted address already reads isActive == false.
  • The origin-mapping check was opportunistic, not enforcement — it never re-ran after seating, and ADR 011 already required consumers to re-filter getOrigins regardless of stale state. No on-chain contract reads getOrigins/isAuthorizedOrigin as an authorization gate.
  • The one gap it uniquely closed — an origin-blacklisted-but-still-bonded operator lingering in getOrigins, which node routing filtered only by isActive, not blacklist — is closed the trustless way: the node already holds the blacklist deny-set in memory (synced for the delivery gate), so the routing filter now applies it too.

Changes

Contracts (OriginAssignment)

  • Removed contentBlacklist pointer, setContentBlacklist, ContentBlacklistUpdated, the addOrigin blacklist branch, _isBlacklisted, and the ContentBlacklistNotSet / OperatorBlacklisted / OperatorNotBlacklisted errors.
  • Deleted IContentBlacklistOriginView (sole user). SlashJudge's IContentBlacklistHashView is unrelated and untouched.
  • pruneBlacklistedOrigin → pruneInactiveOrigin, permissionless, keyed on !CapacityBond.isActive (reverts OperatorStillActive) — reaches every exit from the active set, including operator-level blacklist. Event BlacklistedOriginPruned → InactiveOriginPruned (same topic shape).
  • Dropped the contentBlacklist_ constructor arg → erases the deployment-window bootstrap and the post-deploy setContentBlacklist step.
  • Updated BaseProtocolDeploy, DeployProtocol.t.sol, OriginAssignment.t.sol.

Node (Rust)

  • ChainOriginDirectory now drops any getOrigins operator on its live ContentDenylist (the origin ∪ operator union already synced by the blacklist watcher), applied at resolve time so a governance blacklist takes effect without waiting out the getOrigins cache TTL. New unit test covers it.

ADRs / CHANGELOG

  • ADR 011 (§ Origin Assignment Authority, § Interaction with ContentBlacklist, edge cases, cross-contract integration) and ADR 016 (contract inventory, deploy order step 12, post-deploy init renumbered 1–6, interaction tables) rewritten to the new shape. CHANGELOG entry added.

This also moots the parked setContentBlacklist set-once question — nothing left to set.

Verification

  • Solidity: forge fmt --check, FOUNDRY_PROFILE=ci forge build --sizes --deny-warnings, forge test (844 passed), .gas-snapshot regenerated, aderyn (no new high — the OriginAssignment hits are the pre-existing EnumerableSet over-report class, unchanged by this diff), slither (0 OriginAssignment findings).
  • Rust: cargo build, cargo fmt --check, cargo clippy --workspace --all-targets --all-features, RUSTDOCFLAGS=-D warnings cargo doc … --document-private-items, cargo nextest run -p decdn-node -p decdn-incentive (1403 passed incl. the new filter test), anvil-e2e compile gate, crate-edges check.

🤖 Generated with Claude Code

…Assignment (#2032)

The OriginAssignment seat set is a routing hint, so blacklist filtering
belongs at the consumer that acts on it, not on-chain. The seat-time
blacklist guard never re-ran after seating and every consumer had to
re-filter `getOrigins` regardless — so it failed the trustless axiom and
the redundant-signal gate (the operator-mapping half was fully redundant
with the `isActive` check beside it).

Contracts (OriginAssignment):
- Remove the `contentBlacklist` pointer, `setContentBlacklist`,
  `ContentBlacklistUpdated`, the `addOrigin` blacklist guard, and the
  `ContentBlacklistNotSet` / `OperatorBlacklisted` / `OperatorNotBlacklisted`
  errors. Delete `IContentBlacklistOriginView` (sole user).
- Replace `pruneBlacklistedOrigin` with permissionless `pruneInactiveOrigin`
  keyed on `!CapacityBond.isActive` (reverts `OperatorStillActive`); it
  reaches every exit from the active set, including operator-level
  blacklist (which ejects from CapacityBond). Rename event
  `BlacklistedOriginPruned` -> `InactiveOriginPruned`.
- Drop the `contentBlacklist_` constructor arg, erasing the deployment-window
  bootstrap and the post-deploy `setContentBlacklist` wiring step.

Node: the chain-backed origin directory now drops any `getOrigins` operator
on its live blacklist deny-set (the origin u operator union already synced
for the delivery gate), applied at resolve time so a governance blacklist
takes effect without waiting out the getOrigins cache TTL.

ADRs 011 and 016 rewritten to match (post-deploy init renumbers 1-6);
CHANGELOG entry added.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu alpergundogdu added this to the Governance hardening milestone Sep 15, 2026
Copilot AI lite review requested due to automatic review settings September 15, 2026 11:51
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.69% (2549/2842 lines)
▼ -0.06pp vs base (89.75% → 89.69%)
Run: 34966012280

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

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.

🟢 Approval recommended

The contract surface simplification and the node-side enforcement shift are consistently applied across code/tests/docs, with only a minor documentation wording fix suggested.

Pull request overview

This PR removes the on-chain ContentBlacklist coupling from OriginAssignment and moves blacklist filtering to the routing consumer (node), aligning OriginAssignment with its “routing hint” role and reducing governance/deployment surface area.

Changes:

  • Contracts: delete OriginAssignment’s contentBlacklist pointer/setter and blacklist-based seating/pruning; replace pruneBlacklistedOrigin with pruneInactiveOrigin keyed on CapacityBond.isActive == false.
  • Node: apply the live ContentDenylist filter when resolving getOrigins results, so routing avoids blacklisted operators without waiting for cache TTL expiry.
  • Docs/tests: update Foundry tests, deployment script, ADRs, and changelog to match the new contract and routing behavior.
File summaries
File Description
crates/node/src/runtime/mod.rs Wires the live ContentDenylist into ChainOriginDirectory construction.
crates/node/src/dht/chain_origin_directory.rs Filters getOrigins operators through ContentDenylist at resolve time and adds a unit test proving it’s live (not cached).
crates/node/src/content_deny.rs Updates module docs to remove OriginAssignment-specific coupling language.
crates/node/src/blacklist_watcher.rs Updates docs to reflect that the deny-set now feeds both delivery gating and origin-routing filtering.
crates/incentive/src/origin_assignment.rs Updates ABI docs/event naming to InactiveOriginPruned.
contracts/src/OriginAssignment.sol Removes ContentBlacklist integration, renames prune path to pruneInactiveOrigin, and updates errors/events/docs accordingly.
contracts/src/interfaces/IContentBlacklistOriginView.sol Deletes the interface (no longer used).
contracts/src/ContentBlacklist.sol Updates docs that referenced the removed interface / prior coupling assumptions.
contracts/script/BaseProtocolDeploy.s.sol Removes the post-deploy setContentBlacklist wiring step and updates deploy invariants/docs.
contracts/test/OriginAssignment.t.sol Updates tests for removed blacklist coupling and new prune semantics/event.
contracts/test/DeployProtocol.t.sol Removes the assertion about originAssignment.contentBlacklist() binding.
contracts/.gas-snapshot Refreshes gas snapshot after contract/test changes.
CHANGELOG.md Documents the breaking contract surface changes and the new node-side routing filter.
adr/016-contract-interactions.md Updates contract inventory/deploy order/post-deploy initialization steps and call graph to the new shape.
adr/011-content-takedown.md Updates the OriginAssignment↔ContentBlacklist interaction model to “consumer self-filters”; documents pruneInactiveOrigin.
Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

… review)

setSlashJudge is GOVERNANCE_ROLE, not deployer-only — it stays callable by
governance via the Timelock after handoff. The reason it runs in
_wireCrossContractRoles is to skip the Timelock delay while the deployer
still holds the role, not exclusivity. Reword the phase-4 comment.

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

Copy link
Copy Markdown

Coverage report

Total: 82.92% (was 82.79%, ▲ +0.13%) — 79781/96209 lines

File Coverage Lines Δ
crates/node/src/blacklist_watcher.rs 74.28% 924/1244 ● 0.00%
crates/node/src/content_deny.rs 96.74% 89/92 ● 0.00%
crates/node/src/dht/chain_origin_directory.rs 89.35% 302/338 ▲ +1.15%
crates/node/src/runtime/mod.rs 47.72% 1170/2452 ▼ 0.02%
History
Commit Total Δ vs base
4e773ed (HEAD) 82.92% ▲ +0.13%

@alpergundogdu
alpergundogdu merged commit 672e372 into main Sep 15, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/upbeat-spence-cc973c branch September 15, 2026 12:08
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.

Remove ContentBlacklist coupling from OriginAssignment (push filter to routing consumer)

2 participants