Repository navigation
refactor(contracts,node)!: drop ContentBlacklist coupling from OriginAssignment (#2032) - #2035
Conversation
…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]>
Contracts coverageLine coverage: 89.69% (2549/2842 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
🟢 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’scontentBlacklistpointer/setter and blacklist-based seating/pruning; replacepruneBlacklistedOriginwithpruneInactiveOriginkeyed onCapacityBond.isActive == false. - Node: apply the live
ContentDenylistfilter when resolvinggetOriginsresults, 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]>
Coverage reportTotal: 82.92% (was 82.79%, ▲ +0.13%) — 79781/96209 lines
History
|
What
Full cut of the
ContentBlacklistcoupling inOriginAssignment, 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)
addOriginoperator-mapping blacklist check was fully redundant with theisActivecheck on the line above it:ContentBlacklist.addOperatorejects fromCapacityBond, so an operator-blacklisted address already readsisActive == false.getOriginsregardless of stale state. No on-chain contract readsgetOrigins/isAuthorizedOriginas an authorization gate.getOrigins, which node routing filtered only byisActive, 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)contentBlacklistpointer,setContentBlacklist,ContentBlacklistUpdated, theaddOriginblacklist branch,_isBlacklisted, and theContentBlacklistNotSet/OperatorBlacklisted/OperatorNotBlacklistederrors.IContentBlacklistOriginView(sole user).SlashJudge'sIContentBlacklistHashViewis unrelated and untouched.pruneBlacklistedOrigin→pruneInactiveOrigin, permissionless, keyed on!CapacityBond.isActive(revertsOperatorStillActive) — reaches every exit from the active set, including operator-level blacklist. EventBlacklistedOriginPruned→InactiveOriginPruned(same topic shape).contentBlacklist_constructor arg → erases the deployment-window bootstrap and the post-deploysetContentBlackliststep.BaseProtocolDeploy,DeployProtocol.t.sol,OriginAssignment.t.sol.Node (Rust)
ChainOriginDirectorynow drops anygetOriginsoperator on its liveContentDenylist(the origin ∪ operator union already synced by the blacklist watcher), applied at resolve time so a governance blacklist takes effect without waiting out thegetOriginscache TTL. New unit test covers it.ADRs / CHANGELOG
This also moots the parked
setContentBlacklistset-once question — nothing left to set.Verification
forge fmt --check,FOUNDRY_PROFILE=ci forge build --sizes --deny-warnings,forge test(844 passed),.gas-snapshotregenerated, aderyn (no new high — the OriginAssignment hits are the pre-existingEnumerableSetover-report class, unchanged by this diff), slither (0 OriginAssignment findings).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