Skip to content

ContentBlacklist: reconcile getBlacklistVersion() vs ADR 011 on origin blacklisting #1296

Closed

Description

@thiras

Summary

ContentBlacklist.getBlacklistVersion() (added in #1291) bumps on hash add/remove and appeal suspend/resume, but not on setOriginBlacklist. PR #1291 also added test_getBlacklistVersion_unaffectedByNonEntryOperations, which asserts origin blacklisting does not move the counter — locking that choice in. This contradicts ADR 011 as currently written, so the spec and the implementation need to be reconciled one way or the other. Flagged during the #1291 review.

The inconsistency

ADR 011 (adr/011-content-takedown.md) says origins are part of the version mechanism:

  • § Interface (lines 111–112): OriginBlacklisted(address indexed operatorAddress, uint256 indexed version, string reason) and OriginRemoved(..., uint256 indexed version) — both carry an indexed version.
  • § Blacklist version (line 143): "incremented on every add/remove operation across all paths."
  • § Polling (line 509): "Delta fetching relies on contract event logs: HashBlacklisted and OriginBlacklisted events include an indexed version field, enabling efficient eth_getLogs queries filtered by version range." A node only fetches deltas when the version advances — so if origin changes don't bump it, an origin blacklist/removal is invisible to the poll.

The implementation already diverges from that:

  • ContentBlacklist.sol:445 setOriginBlacklist does not touch _blacklistVersion.
  • It emits OriginBlacklistUpdated(address indexed origin, bool blacklisted) (ContentBlacklist.sol:292) — a single toggle event with no version field, not the ADR's OriginBlacklisted/OriginRemoved pair. So the origin event model had already drifted from ADR 011 before feat(contracts): add ContentBlacklist.getBlacklistVersion() monotonic counter #1291.
  • contracts/test/ContentBlacklist.t.sol:179 (test_getBlacklistVersion_unaffectedByNonEntryOperations, origin case at :188) now asserts the no-bump behavior.

Why it's not a live bug today (but still needs resolving)

Origin blacklist enforcement does not currently ride the node's blacklist version-poll:

  • crates/node/src/blacklist_watcher.rs has zero references to origins — it only tracks hash entries.
  • Per ADR 011 lines 490/497, origin enforcement flows through OriginAssignment: off-chain consumers cross-reference ContentBlacklist.isOriginBlacklisted(operator) at selection time, and stale entries are cleaned up lazily/permissionlessly via OriginAssignment.pruneBlacklistedAssignment.

So nothing breaks right now. But the ADR-described version-delta path (the node half deferred by #1181) would silently skip origins if it were built to the current § Polling text, and the spec/impl/test currently disagree.

Decision needed (pick one, then align the other artifacts)

Option A — code is right, ADR is stale (looks most likely). Origins are enforced via OriginAssignment cross-reference, not the hash version-poll. If so:

  • Correct ADR 011 § Polling (line 509) to stop listing OriginBlacklisted among the version-range-fetched events.
  • Correct the § Interface events (lines 111–112) to match the shipped OriginBlacklistUpdated(origin, bool) with no version field, and tighten § Blacklist version (line 143) "across all paths" to mean hash entries + suspend/resume only.
  • Keep the test; maybe rename its intent comment to state the exclusion is deliberate per the corrected ADR.

Option B — ADR is right, code is incomplete. Origins belong in the version mechanism. If so:

  • Bump _blacklistVersion in setOriginBlacklist.
  • Emit versioned OriginBlacklisted/OriginRemoved events (ABI change; ripples into the Rust decoder).
  • Flip the origin assertion in test_getBlacklistVersion_unaffectedByNonEntryOperations.

Either way, the goal is that adr/011-content-takedown.md, ContentBlacklist.sol, and the test tell the same story. ADR is the source of truth (per CLAUDE.md), so if Option A is chosen the ADR must be edited to reflect reality rather than left contradicting the code.

References

Activity

  1. added
    area:contracts
    design:adr
    design:consistency
    design:missing-decision
    prio:medium
    on Jul 18, 2026
  2. thiras commented on Jul 20, 2026

    @thiras
    ContributorAuthor

    Resolved by #1326 (4a527b1), which took Option A — code is right, ADR was stale.

    Verified on main:

    • setOriginBlacklist (ContentBlacklist.sol:464) still does not touch _blacklistVersion; it emits OriginBlacklistUpdated(origin, blacklisted) with no version. The counter bumps only in _addHash, _removeHashRegional, and _setEntrySuspended.
    • ADR 011 § Interface now declares the shipped OriginBlacklistUpdated(address indexed operatorAddress, bool blacklisted) in place of the never-implemented versioned OriginBlacklisted/OriginRemoved pair.
    • ADR 011 § Polling now states origin blacklisting is deliberately outside the version poll and flows through OriginAssignment cross-reference, so a delta-fetcher built to that text no longer skips origins.
    • test_getBlacklistVersion_unaffectedByNonEntryOperations keeps its origin no-bump assertion, now matching the corrected ADR rather than contradicting it.

    ADR, contract, and test tell the same story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:contractsdesign:adrdesign:consistencydesign:missing-decisionprio:medium

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions