Skip to content

feat(contracts): enforce Publisher and TokenHolder standing at appeal filing (audit I-3) (#1017) - #1050

Merged
alpergundogdu merged 7 commits into
mainfrom
feat/1017-standing-enforcement
Jul 8, 2026
Merged

alpergundogdu merged 7 commits into
mainfrom
feat/1017-standing-enforcement

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1017. Sub-issue of #688 — Mechanism C1 (audit I-3).

What

openBlacklistAppeal previously only verified Operator standing; Publisher and TokenHolder were enum-range-checked only — any address could forge them (audit I-3). This enforces standing at filing for all three paths.

Design

  • Publisher — requires publisherRegistry.ownerOf(namespaceId) == msg.sender AND publisherRegistry.hasClaimed(namespaceId, hash). A new namespaceId filing arg carries the claiming namespace (a hash→namespace reverse lookup is ambiguous — many namespaces can claim one hash — so it's passed explicitly). Ignored on non-Publisher paths.
  • Operator — current-region match (unchanged; ADR 011 § Standing path 2, via ADR 030).
  • TokenHolder — the escrowed appeal bond IS the standing. No separate balance threshold. Standing only grants the right to file: an Open appeal has zero interim relief and every consequential transition (fastTrackBlacklistAppeal) is EMERGENCY_MULTISIG_ROLE-gated. Spam is already bounded by the bond + hasActiveAppeal + the filerRejections cooldown + the perjury denylist, so a balance gate protects nothing that isn't already protected.

Change from the earlier revision of this PR

The earlier version gated TokenHolder on a governable TOKEN balance threshold (appealFilerTokenThreshold, default 1,000e18, tightening-only). That's been removed in favor of bond-is-standing. Because the bond is escrowed by the appeal it can't be flash-loaned, so the synthetic-standing clawback (#1018) that was meant to defend the threshold is dropped, not deferred — there is nothing to fake by construction.

⚠️ @maintainer: please close #1018 — it is no longer needed (nothing to clawback once standing is the escrowed bond). I can't close it from here.

The safety argument holds only while standing-alone grants no automatic outcome. A code comment on the TokenHolder branch (and the contract header) flags: if any future change lets standing auto-fast-track or gain relief without a trusted role, a credential gate must be reinstated.

Changes

ContentBlacklist.sol

  • New namespaceId filing arg; Publisher owner+claim check; TokenHolder path posts the bond with no extra credential.
  • Removed all appealFilerTokenThreshold machinery (state var, DEFAULT/FLOOR/CEILING constants, setAppealFilerTokenThreshold, bounds helper, AppealFilerTokenThresholdUpdated event, AppealFilerTokenThresholdNotIncreasing error, constructor init).
  • PublisherRegistry bound as a constructor immutable (security-critical standing gate, can't be left unset/re-pointed).

Wiring

  • New minimal IPublisherRegistryStanding interface (ownerOf + hasClaimed); PublisherRegistry gains a public hasClaimed getter.
  • BaseProtocolDeploy reordered so PublisherRegistry (needs only admin) builds before ContentBlacklist; constructor arg + post-deploy binding check added.
  • Construction sites updated: ContentBlacklist.t.sol, CapacityBondRegionE2E.t.sol.

ADR 031 — TokenHolder standing = the escrowed bond; clawback dropped-not-deferred. Excised the clawback from the target spec (cleanup admissibility condition (c), the LapseReason/StandingClawback enum value, the state diagram, the STANDING_LOOKBACK checkpoint) and renumbered global-override (d)→(c). Publisher path prose kept.

Notes on the issue's assumptions

  • InterfaceFreeze is NOT touched — it explicitly does not pin ContentBlacklist (only PaymentChannel/SlashJudge/OriginAssignment), so the new signature doesn't break it.
  • namespaceId is ignored (not required-zero) on non-Publisher paths — simpler, no special-case revert.
  • ADR 011 canonically still describes the synthetic-standing clawback; reconciling that at its source is a separate follow-up (out of scope for feat(contracts): enforce Publisher and TokenHolder standing at appeal filing (audit I-3) (#688) #1017).

Tests (57/57 ContentBlacklist, 689 full suite)

Publisher: owner-of-claiming-namespace succeeds; non-owner / owner-but-hash-not-claimed / wrong-namespaceId revert. TokenHolder: a bond-only filer gets standing and the bond is escrowed (test_tokenHolderStanding_bondIsStanding_succeedsAndEscrows). Operator path regression retained. The prior threshold-setter and at/below-threshold tests were deleted.

Checks

CI-profile forge build --sizes --deny warnings clean (ContentBlacklist 13,716 < EIP-170, down from 14,170); full forge test (689 pass); forge fmt/solhint/markdownlint/ADR hygiene green; aderyn 0 High; slither exit 0 (no medium+); gas snapshot regenerated.

Refs #688.

… filing (#688)

ADR 031 § 216 Mechanism C1 (audit I-3). `openBlacklistAppeal` previously only
verified Operator standing; Publisher and TokenHolder were enum-range-checked
only, so any address could forge them. Enforce all three at filing.

- New `namespaceId` filing arg on `openBlacklistAppeal`. Publisher path now
  requires `publisherRegistry.ownerOf(namespaceId) == msg.sender` AND
  `publisherRegistry.hasClaimed(namespaceId, hash)` (a hash->namespace reverse
  lookup is ambiguous, so the namespace is passed explicitly). `namespaceId` is
  ignored on the other paths.
- TokenHolder path now requires `token.balanceOf(filer) >= appealFilerTokenThreshold`,
  a governable bounded param: default 1,000e18, bounds [1,000e18, 1,000,000e18],
  tightening-only (floor == launch default). Low at launch per the operator-
  barrier preference; the bond + the deferred §216(c) clawback are the primary
  Sybil deterrents.
- `PublisherRegistry` bound as a constructor immutable (security-critical, can't
  be left unset/re-pointed). New minimal `IPublisherRegistryStanding` interface
  (ownerOf + hasClaimed); `PublisherRegistry` gains a public `hasClaimed` getter.
  Deploy reordered so the registry (needs only `admin`) builds first.

Wiring updated: BaseProtocolDeploy + the ContentBlacklist / CapacityBondRegionE2E
construction sites. InterfaceFreeze is NOT touched — it does not pin
ContentBlacklist (only PaymentChannel/SlashJudge/OriginAssignment).

Tests: Publisher owner+claimed succeeds; non-owner / owner-but-unclaimed /
wrong-namespaceId revert; TokenHolder at/below threshold; threshold setter
bounds (tightening-only floor), role-gating; Operator path regression. 62/62
ContentBlacklist, 685 full suite. ADR-031 standing section reconciled.

Prerequisite for #1018 (synthetic-standing clawback). Closes #1017. Refs #688.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 30, 2026 15:58
@coderabbitai

coderabbitai Bot commented Jun 30, 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

Enforces Publisher and TokenHolder standing at openBlacklistAppeal filing. ContentBlacklist adds a publisher registry binding, a governable token threshold, and a namespaceId argument. Deployment, tests, ADR-031, and gas snapshots are updated to match.

Changes

Publisher & TokenHolder Standing Enforcement

Layer / File(s) Summary
IPublisherRegistryStanding interface & hasClaimed getter
contracts/src/interfaces/IPublisherRegistryStanding.sol, contracts/src/PublisherRegistry.sol
New standing-read interface exposes ownerOf and hasClaimed; PublisherRegistry adds hasClaimed(namespaceId, blake3Hash).
ContentBlacklist standing enforcement
contracts/src/ContentBlacklist.sol
Adds the immutable publisher registry binding, governable token threshold state, constructor update, namespaceId parameter, standing validation branches, threshold setter, and bounds helper.
Deploy script wiring
contracts/script/BaseProtocolDeploy.s.sol
Reorders deployment so PublisherRegistry is created before ContentBlacklist, passes it into the constructor, and asserts the binding is wired.
Test setup and call-site updates
contracts/test/ContentBlacklist.t.sol, contracts/test/CapacityBondRegionE2E.t.sol
Updates test wiring to inject PublisherRegistry and appends the new namespaceId argument to openBlacklistAppeal calls.
ADR-031 spec update
adr/031-content-blacklist-appeals-contract.md
Updates the ADR to describe the standing checks, constructor requirements, namespaceId parameter, threshold source, and revert behavior.
Gas snapshot updates
contracts/.gas-snapshot
Refreshes recorded gas figures across the affected test suites.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

  • decdn/decdn#1026: Both PRs modify contracts/src/ContentBlacklist.sol’s openBlacklistAppeal flow, making the changes directly overlapping at that entrypoint.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The gas snapshot update includes many unrelated benchmarks and tests outside the standing-enforcement scope. Limit snapshot churn to affected ContentBlacklist/registry/deploy tests and revert unrelated PaymentChannel, Faucet, Token, and other benchmark changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the required filing-time standing checks, threshold, registry binding, and supporting deploy/test/docs updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enforcing appeal-filing standing for Publisher and TokenHolder paths.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1017-standing-enforcement

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 91.48% (2331/2548 lines)
▼ -0.04pp vs base (91.52% → 91.48%)
Run: 28943608865

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@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 standing enforcement at filing for all three paths (Operator, Publisher, and TokenHolder) in ContentBlacklist as specified in ADR 031 and addressing audit finding I-3. It introduces the IPublisherRegistryStanding interface, integrates PublisherRegistry into ContentBlacklist as an immutable constructor dependency, and updates the openBlacklistAppeal function to accept a namespaceId for the Publisher standing check. Additionally, it adds a governable appealFilerTokenThreshold for TokenHolder standing checks, along with corresponding setters, events, and comprehensive unit tests. There are no review comments, so I have no feedback to provide.

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.

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

This PR tightens ContentBlacklist.openBlacklistAppeal standing enforcement to address audit finding I-3 by requiring real Publisher and TokenHolder standing at appeal filing (not just enum-range validation), and updates deploy wiring/tests/documentation accordingly.

Changes:

  • Extended openBlacklistAppeal with a namespaceId argument and enforced Publisher standing via publisherRegistry.ownerOf(namespaceId) + publisherRegistry.hasClaimed(namespaceId, hash).
  • Enforced TokenHolder standing via a governable appealFilerTokenThreshold (default 1000e18; bounded).
  • Added PublisherRegistry.hasClaimed view getter and introduced a minimal IPublisherRegistryStanding interface; updated deploy script + tests + ADR and regenerated gas snapshots.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
contracts/src/ContentBlacklist.sol Adds publisher-registry immutable binding, token-holder threshold gating, new namespaceId arg, and standing checks at filing.
contracts/src/interfaces/IPublisherRegistryStanding.sol Defines minimal read-only interface needed for Publisher standing checks.
contracts/src/PublisherRegistry.sol Exposes hasClaimed(namespaceId, hash) for standing verification.
contracts/script/BaseProtocolDeploy.s.sol Reorders deployment so PublisherRegistry is deployed before ContentBlacklist and wired immutably.
contracts/test/ContentBlacklist.t.sol Updates constructor usage + appeal calls with namespaceId, and adds new standing enforcement tests.
contracts/test/CapacityBondRegionE2E.t.sol Updates ContentBlacklist construction to include publisher registry binding.
adr/031-content-blacklist-appeals-contract.md Updates ADR narrative + signature/revert-table notes to reflect standing enforcement and new arg.
contracts/.gas-snapshot Updates gas baselines after contract/test changes.

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

Comment thread contracts/src/ContentBlacklist.sol Resolved
Comment thread contracts/test/ContentBlacklist.t.sol Resolved

@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 (2)
contracts/script/BaseProtocolDeploy.s.sol (1)

277-289: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the new registry binding in the deploy invariants.

publisherRegistry_ is now a security-critical standing gate, but phase 7 never re-reads it. A future constructor-arg mix-up would still let the script finish with ContentBlacklist pointing at the wrong registry.

Suggested follow-up
         address boundBlacklist = d.originAssignment.contentBlacklist();
         if (boundBlacklist != address(d.blacklist)) {
             revert BindingNotWired(address(d.originAssignment), address(d.blacklist), boundBlacklist);
         }
+        address boundPublisherRegistry = address(d.blacklist.publisherRegistry());
+        if (boundPublisherRegistry != address(d.registry)) {
+            revert BindingNotWired(address(d.blacklist), address(d.registry), boundPublisherRegistry);
+        }
         address boundPool = d.slashAppeal.challengerIncentivePool();
         if (boundPool != cfg.challengerIncentivePool) {
             revert BindingNotWired(address(d.slashAppeal), cfg.challengerIncentivePool, boundPool);
         }
🤖 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 `@contracts/script/BaseProtocolDeploy.s.sol` around lines 277 - 289, The deploy
script currently creates PublisherRegistry and passes it into ContentBlacklist,
but the phase 7 deploy invariants do not verify that binding. Add an assertion
in the deploy invariant checks around the ContentBlacklist deployment to confirm
the blacklist’s publisherRegistry_ is the freshly deployed registry (using the
existing d.registry and d.blacklist symbols), so a constructor-argument mix-up
is caught immediately after deployment.
contracts/test/ContentBlacklist.t.sol (1)

1108-1142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing decrease-after-increase regression.

These cases cover floor/ceiling bounds, but not the required tightening-only behavior. As written, the current setter can raise to 5000e18 and then drop back to 1000e18 while still satisfying every new test here.

Suggested test
+    function test_setAppealFilerTokenThreshold_cannotDecreaseAfterIncrease() public {
+        vm.startPrank(admin);
+        blacklist.setAppealFilerTokenThreshold(5000e18);
+        vm.expectRevert();
+        blacklist.setAppealFilerTokenThreshold(1000e18);
+        vm.stopPrank();
+    }
🤖 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 `@contracts/test/ContentBlacklist.t.sol` around lines 1108 - 1142, The new
tests for setAppealFilerTokenThreshold only cover bounds and access control, but
miss the tightening-only regression where the value can be increased and then
lowered back to the default. Add a test in ContentBlacklist.t.sol alongside
test_setAppealFilerTokenThreshold_updatesValue that first calls
ContentBlacklist.setAppealFilerTokenThreshold to raise the threshold and then
asserts a subsequent attempt to set it back to 1000e18 reverts with
ContentBlacklist.ParamOutOfBounds, using vm.prank(admin) for both calls.
🤖 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 `@contracts/src/ContentBlacklist.sol`:
- Around line 741-750: The `setAppealFilerTokenThreshold` setter in
`ContentBlacklist` is only enforcing floor/ceiling bounds, so governance can
still lower `appealFilerTokenThreshold` after raising it. Update this method to
make the change tightening-only by rejecting any `newThreshold` that is below
the current `appealFilerTokenThreshold`, while still keeping the existing
`_enforceAppealFilerTokenThresholdBounds` check. Preserve the existing
`AppealFilerTokenThresholdUpdated` event flow and use the current storage
variable in the comparison so the gate can only stay the same or increase.

---

Nitpick comments:
In `@contracts/script/BaseProtocolDeploy.s.sol`:
- Around line 277-289: The deploy script currently creates PublisherRegistry and
passes it into ContentBlacklist, but the phase 7 deploy invariants do not verify
that binding. Add an assertion in the deploy invariant checks around the
ContentBlacklist deployment to confirm the blacklist’s publisherRegistry_ is the
freshly deployed registry (using the existing d.registry and d.blacklist
symbols), so a constructor-argument mix-up is caught immediately after
deployment.

In `@contracts/test/ContentBlacklist.t.sol`:
- Around line 1108-1142: The new tests for setAppealFilerTokenThreshold only
cover bounds and access control, but miss the tightening-only regression where
the value can be increased and then lowered back to the default. Add a test in
ContentBlacklist.t.sol alongside test_setAppealFilerTokenThreshold_updatesValue
that first calls ContentBlacklist.setAppealFilerTokenThreshold to raise the
threshold and then asserts a subsequent attempt to set it back to 1000e18
reverts with ContentBlacklist.ParamOutOfBounds, using vm.prank(admin) for both
calls.
🪄 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: cb2520a2-e3b1-4f69-a231-67758b986186

📥 Commits

Reviewing files that changed from the base of the PR and between 8f51f4b and 38a6f41.

📒 Files selected for processing (8)
  • adr/031-content-blacklist-appeals-contract.md
  • contracts/.gas-snapshot
  • contracts/script/BaseProtocolDeploy.s.sol
  • contracts/src/ContentBlacklist.sol
  • contracts/src/PublisherRegistry.sol
  • contracts/src/interfaces/IPublisherRegistryStanding.sol
  • contracts/test/CapacityBondRegionE2E.t.sol
  • contracts/test/ContentBlacklist.t.sol

Comment thread contracts/src/ContentBlacklist.sol Resolved
alpergundogdu and others added 2 commits June 30, 2026 17:05
… FP (#1017)

The new TokenHolder standing check `token.balanceOf(filer)` is an external
call whose result gates a state-affecting revert, which aderyn flags as
reentrancy-state-change (1 high) like the existing region-scope read. The
function is nonReentrant, so it's a false positive. Cache the balance on its
own line preceded by `// aderyn-ignore-next-line(reentrancy-state-change)`,
mirroring the ownerOf/hasClaimed/regionScopeData guards.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…1017 review)

Address PR #1050 review:
- setAppealFilerTokenThreshold is now monotonic non-decreasing — reverts
  AppealFilerTokenThresholdNotIncreasing on any value below the current
  threshold, not just below the static floor. The bounds check stays, so a
  below-floor value still reverts ParamOutOfBounds first (gemini, coderabbit
  Major: governance could previously raise to 5000 then drop back to 1000).
- Add the decrease-after-increase regression test (coderabbit).
- Assert the ContentBlacklist->PublisherRegistry immutable binding in the
  phase-7 deploy invariants, so a constructor-arg mix-up on a security-critical
  standing gate is caught at deploy (coderabbit).
- Fix a stale test comment that referenced `filer` instead of `poorHolder`
  (copilot).

686 tests pass; gas snapshot refreshed.

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

Copy link
Copy Markdown
Contributor Author

Review + CI fixes (c55fa1d, and aderyn in 5aa14b4)

CI aderyn (1 high) — fixed in 5aa14b4: the new token.balanceOf(filer) TokenHolder check is an external call whose result gates a revert, flagged reentrancy-state-change like the existing region-scope read (false positive under nonReentrant). Guarded with the same aderyn-ignore-next-line directive, cached on its own line. aderyn now passes.

Major (gemini + @coderabbitai) — tightening-only: setAppealFilerTokenThreshold is now monotonic non-decreasing (reverts AppealFilerTokenThresholdNotIncreasing below the current value), matching the signed-off 'governance can only raise' intent. Replied + resolved.

@coderabbitai nitpicks (both addressed):

  • Deploy-invariant assertion — phase-7 invariants now verify d.blacklist.publisherRegistry() == d.registry, so a constructor-arg mix-up on the security-critical standing binding is caught at deploy.
  • Decrease-after-increase regression — added test_setAppealFilerTokenThreshold_cannotDecreaseAfterIncrease (raise to 5000e18, then a drop to 1000e18 reverts).

@copilot nit: fixed the stale filer→poorHolder test comment.

686 tests pass; gas snapshot refreshed; fmt/solhint/markdownlint/ADR hygiene green.

🤖 Addressed by Claude Code

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@alpergundogdu Thanks for the thorough follow-up — this addresses my comments.

The monotonic “governance can only raise” change for setAppealFilerTokenThreshold, plus the new regression test and the deploy invariant asserting blacklist.publisherRegistry() == registry, all look like the right fixes for the concerns raised. Good catch as well on the aderyn false positive handling.

🐇✅


✏️ Learnings added
Learnt from: alpergundogdu
URL: https://github.com/decdn/decdn/pull/1050

Timestamp: 2026-06-30T16:11:40.902Z
Learning: In this repository's Solidity `ContentBlacklist` implementation, `setAppealFilerTokenThreshold` is intended to be tightening-only via a monotonic non-decreasing update rule, reverting with `AppealFilerTokenThresholdNotIncreasing` if governance attempts to lower the current threshold.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

…forcement

# Conflicts:
#	adr/031-content-blacklist-appeals-contract.md
alpergundogdu and others added 2 commits July 7, 2026 17:07
…forcement

# Conflicts:
#	contracts/.gas-snapshot
…threshold + clawback

Replace the governable TOKEN balance threshold for StandingPath.TokenHolder
with a no-special-case design: the escrowed appeal bond IS the standing.
Standing only grants the right to file; an Open appeal has zero interim
relief and every consequential transition is EMERGENCY_MULTISIG_ROLE-gated,
so spam is already bounded by the bond + hasActiveAppeal + filerRejections
cooldown + perjury denylist. A balance gate protects nothing not already
protected, and because the bond is escrowed it can't be flash-loaned — so
the synthetic-standing clawback (issue #1018) is dropped, not deferred:
there is nothing to fake.

ContentBlacklist.sol: remove appealFilerTokenThreshold state var, the
DEFAULT/FLOOR/CEILING constants, setAppealFilerTokenThreshold,
_enforceAppealFilerTokenThresholdBounds, the AppealFilerTokenThresholdUpdated
event, the AppealFilerTokenThresholdNotIncreasing error, and the constructor
init. The TokenHolder branch is now a documented no-op (bond-is-standing).

Tests: drop the 5 threshold-setter tests and the 2 at/below-threshold tests;
add test_tokenHolderStanding_bondIsStanding_succeedsAndEscrows proving a
bond-only filer gets standing and the bond is escrowed.

ADR 031: TokenHolder standing = the escrowed bond, no appealFilerTokenThreshold,
clawback dropped-not-deferred; excise the clawback from the target spec
(cleanup condition (c), LapseReason enum, state diagram, STANDING_LOOKBACK
checkpoint) and renumber global-override (d)->(c). Publisher path unchanged.

Regenerate .gas-snapshot.

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

Copy link
Copy Markdown
Contributor Author

Review — standing enforcement at appeal filing (#1017)

Reviewed the full diff (contracts + ADR 031 + deploy wiring + tests) at high effort. The core change is correct and well-tested: the enum-branch refactor maps cleanly (Publisher=0 first, TokenHolder=2 second, trailing else if (region != GLOBAL_REGION) falls through to Operator=1 only), the range check, the constructor zero-address guard, the IPublisherRegistryStanding signatures (they match PublisherRegistry.ownerOf/hasClaimed), the deploy reorder (registry created before both ContentBlacklist and OriginAssignment consumers), and the new post-deploy binding check are all sound. No hard on-chain logic bug found, and there are no dangling references to the removed appealFilerTokenThreshold machinery. All four new ContentBlacklist(...) sites and every openBlacklistAppeal(...) call site were updated to the new arity.

What's left is doc drift the PR introduced or should have swept, plus one design point worth confirming.

1. docs/runbook.md:242 — stale openBlacklistAppeal arity (not in diff)

The operator runbook still documents the 4-arg form:

openBlacklistAppeal(hash, region, evidenceBundleHash, standingPath)

This PR added the required uint256 namespaceId 5th arg. An operator following the runbook to hand-encode an appeal will build a call that fails to encode against the deployed ABI.
Fix: update the runbook signature to include namespaceId (and a one-liner that it's the claiming namespace for the Publisher path, ignored otherwise).

2. ContentBlacklist.sol:30 and :536 — § 216(c) now mis-points, and #1018 is dangling

This same PR renumbered ADR 031's admissibility conditions (d)→(c), so § 216(c) is now the global-override refund case (adr/031-…md:211), not the clawback — the clawback was removed as a lettered condition entirely (:213 "intentionally absent"). Both new comments point a reader at § 216(c) "for the clawback," where they'll find GlobalOverride instead. The header also still says "formerly #1018", but the PR deliberately scrubbed #1018 from ADR 031 (:18) as no-longer-relevant.
Fix: drop the § 216(c) sub-letter (say "the synthetic-standing clawback, ADR 031 § 216, is omitted…") and drop the #1018 reference, matching the ADR you just edited.

3. adr/011-content-takedown.md still specifies the removed clawback as canonical (not in diff)

ADR 031 §8/§16 call ADR 011 the "canonical decision authority," yet ADR 011 still carries a full "Synthetic-standing clawback" subsection (balance checks at T and T+24h, STANDING_LOOKBACK_SECONDS, APPEAL_FILER_TOKEN_THRESHOLD, burn-on-lapse) at ~:201, plus filing guidance at :193 steering filers away from a clawback that no longer exists. ADR 031 §8 also still lists "synthetic-standing clawback" among the ADR 011 semantics it defers to. The PR body acknowledges ADR 011 reconciliation as an out-of-scope follow-up — flagging so it's tracked, since right now the doc chain's "canonical" source contradicts the shipped code. [your call] whether to fold a one-paragraph ADR 011 amendment into this PR or spin a follow-up issue.

4. Confirm intended: the Publisher standing gate is forgeable

ownerOf(namespaceId) == msg.sender && hasClaimed(namespaceId, hash) is described (header + branch comment) as proving the filer is the content's publisher, but PublisherRegistry.claimContent is permissionless self-assertion: anyone can createNamespace() then claimContent(ns, H) for a hash they never authored, and then pass the Publisher gate. There's no on-chain escalation here — the TokenHolder path already grants standing to any bond-poster, and standing alone grants no automatic outcome — so this isn't a security regression. But the comment reads as a meaningful authorship gate when it's really just "declared a namespace that self-claimed the hash." Suggest softening the comment to say what it actually proves, so a future reader doesn't lean on it as authorship. (Same bounded-impact note applies to the pre-existing Operator + GLOBAL_REGION path, which does no operator check at all — not introduced here.)


Nothing above blocks merge on correctness. #1 and #2 are quick, mechanical, and worth doing before merge since they're in the surface this PR is specifically about.

… stale comments (#1017)

Follow-up to review feedback on the standing-enforcement change.

- ADR 011 (canonical takedown ADR): drop the removed synthetic-standing
  clawback + TOKEN-balance standing threshold. Rewrite path 3 (TokenHolder)
  to bond-is-standing, correct path 1 (Publisher) to pass namespaceId
  explicitly (the contract does not derive it from the hash), remove the
  clawback lapse condition and renumber (d)->(c), fix the Sybil paragraph,
  and add namespaceId to the interface + sequence-diagram signatures.
- docs/runbook.md: update openBlacklistAppeal to the 5-arg signature and
  replace the now-false "recorded but not verified" caveat with the
  as-shipped per-path standing behavior.
- ContentBlacklist.sol: drop the stale "s 216(c), formerly #1018" comment
  pointers (after this PR's own (d)->(c) renumbering, 216(c) is the global-
  override case), and clarify that the Publisher gate proves namespace
  control, not authorship.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu merged commit fa61a0d into main Jul 8, 2026
22 checks passed
@alpergundogdu
alpergundogdu deleted the feat/1017-standing-enforcement branch July 8, 2026 13:59
alpergundogdu added a commit that referenced this pull request Jul 8, 2026
Re-resolves the regenerated .gas-snapshot after main advanced.
Full suite green: 701 passed, 0 failed, 6 skipped.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants