Skip to content

docs(adr): correct region-scope enforcement drift in ADRs 011/014/016/030/031 - #1446

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/gracious-nobel-3d5817
Jul 27, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/gracious-nobel-3d5817

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Why

ADR 014 § Blacklist violation item 7 claimed node region "is not stored on-chain in CapacityBond" and that consequently "all blacklist violations are treated as globally scoped".

Both statements are false against merged code. SlashJudge._regionalLiveBefore resolves global ∪ current-region ∪ ripening-prev-region on-chain via RegionScopeLib and ICapacityBondRegionView, reading regionHint / regionPrev / regionLastChanged off CapacityBond.

This is compliance-relevant documentation — it describes what the enforcement layer can and cannot do — so the correction runs through every ADR that repeated the assumption or the API names behind it. Docs only; no contract or Rust changes.

ADR 014 — the primary fix

  • Item 7 rewritten as the actual three-leg scope predicate: the on-chain region state and the narrow view it is read through, the ripening window anchored to the served responseTs rather than challenge-submission time (and why — the flip-then-stall evasion), and the BlacklistAfterResponse vs HashNotBlacklisted revert split.
  • Item 6 was a one-liner that read as global-only. Now states the entry-liveness predicate explicitly: suspension lifts the serving restriction so it is not slashable; emergency lapse is evaluated at block.timestamp; the anchor is effectiveAt, not addedAt.
  • Integration bullets carried the same assumption. "No new fields in NodeInfo for PoC" → the actual region-scope read surface. "SlashJudge calls ContentBlacklist.isBlacklisted(hash) and getEntry(hash)" → neither function exists; it calls getHashEntry(region, blobHash) once per scope leg.
  • Gas row claimed one blacklist lookup. Now up to three entry reads plus a region-scope read; regionScopeData measured at ~15k via forge test --gas-report, so the row moves to ~75k–95k, noting the global leg short-circuits.
  • The one thing that genuinely is not enforced is kept: pre-positioned region misdeclaration leaves an operator out of scope for its true jurisdiction's entries, backstopped off-protocol per ADR 030.

ADR 011 — region representation and the view surface

  • region is bytes32 at every layer, not bytes2 with a string boundary and a _toBytes2 canonicalization step. A declarable region is a self-attested string of up to 16 bytes, so a two-byte key could not represent most of the space it must cover — narrowing it would silently put regions out of reach of takedown coverage.
  • View surface corrected to isHashBlacklisted / isHashBlacklistedInRegion / getHashEntry, and isHashBlacklistedForOperator documented — the serve-time counterpart of the slash gate, which the node polling fallback and the pre-cache check should be using rather than the global-only view.
  • Dropped the claim that a challenge filed during interim relief reverts with a distinct BlacklistEntrySuspended error. No such error exists; suspension folds into the liveness predicate and surfaces as HashNotBlacklisted, so the revert does not distinguish a suspended entry from a never-blacklisted one.

ADR 016 / 030 / 031

  • 016 repeated the same stale claim ("Region stays off-chain for now"). Region is on-chain; what stays off-chain is discovery ranking, not scope enforcement. Also fixes the stale getEntry() call in the cross-contract call graph.
  • 030 / 031 cited ADR 011's bytes2 gas note, which no longer exists. Retargeted, and the appeal record gets its own slot for the full-word region key (ADR 031's own as-built caveat already recorded bytes32).

Verification

  • make -C adr check-refs — bare-reference, anchor, and section-numbering guards pass
  • pre-commit run --files <the five ADRs> — all applicable hooks pass
  • Every claim cross-checked against merged contracts/src/{SlashJudge,ContentBlacklist,CapacityBond,RegionScopeLib}.sol

Not in this PR

ADR 011's appeal entry points still use the short names (fastTrackAppeal, rejectAppeal, …) where merged code and ADR 031 use the *BlacklistAppeal forms, and its BlacklistEntry struct is broader than the merged HashEntry (which has no blake3Hash / reason / suspendedAtUs). Both are separate drift axes from region scope; flagging rather than folding in.

🤖 Generated with Claude Code

…/030/031

ADR 014 § Blacklist violation item 7 claimed node region "is not stored
on-chain in CapacityBond" and that "all blacklist violations are treated
as globally scoped". Both are false against merged code: SlashJudge
resolves global ∪ current-region ∪ ripening-prev-region on-chain via
RegionScopeLib and ICapacityBondRegionView, reading regionHint /
regionPrev / regionLastChanged off CapacityBond.

This is compliance-relevant documentation — it describes what the
enforcement layer can and cannot do — so the correction runs through
every ADR that repeated the assumption or the API names behind it.

ADR 014:
- Rewrite item 7 as the actual three-leg scope predicate, including the
  ripening window anchored to the served responseTs (not challenge time)
  and the BlacklistAfterResponse / HashNotBlacklisted revert split.
- Expand item 6 into the explicit entry-liveness predicate (suspension,
  emergency lapse at block.timestamp, effectiveAt rather than addedAt).
- Replace the "no new NodeInfo fields" bullet with the region-scope read
  surface, and the non-existent isBlacklisted/getEntry calls with
  getHashEntry per scope leg.
- Update the blacklist-challenge gas row for the added scope reads
  (regionScopeData measured at ~15k).
- Keep the one thing that genuinely is not enforced: pre-positioned
  region misdeclaration.

ADR 011:
- region is bytes32 at every layer, not bytes2 with a string boundary.
  A declarable region is up to 16 bytes, so a two-byte key could not
  represent most of the space it must cover.
- Correct the view surface to isHashBlacklisted /
  isHashBlacklistedInRegion / getHashEntry, and document
  isHashBlacklistedForOperator — the serve-time counterpart of the slash
  gate, which node polling and the pre-cache check should be using.
- Drop the claim that a challenge during interim relief reverts with a
  distinct BlacklistEntrySuspended error; suspension folds into the
  liveness predicate and surfaces as HashNotBlacklisted.

ADR 016: region is on-chain — what stays off-chain is discovery ranking,
not scope enforcement; fix the stale getEntry call in the call graph.

ADR 030 / ADR 031: retarget the dangling bytes2 citations, and give the
appeal record its own slot for the full-word region key.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 16:16
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@alpergundogdu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 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: 74c1d672-c08b-4b30-86f0-cfb618d39c6b

📥 Commits

Reviewing files that changed from the base of the PR and between 730336e and 53e0676.

📒 Files selected for processing (4)
  • adr/011-content-takedown.md
  • adr/014-on-chain-verification.md
  • adr/016-contract-interactions.md
  • adr/030-node-region-self-attestation.md

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

Updates multiple ADRs to correct documentation drift around on-chain region-scope enforcement for blacklist challenges and serve-time blacklist views, aligning the written spec with the merged Solidity implementation (regional scope legs, CapacityBond region state, and updated ContentBlacklist view surface).

Changes:

  • Re-specifies blacklist-challenge scope/liveness logic (global + current-region + ripening-prev-region) and related revert semantics in ADR 014.
  • Corrects region representation to bytes32 end-to-end (including appeal surfaces and event indexing rationale) across ADRs 011/031 and updates downstream references in ADRs 016/030.
  • Updates cross-contract call-graph documentation to reflect getHashEntry(region, hash) and region-scope reads via the narrow regionScopeData view.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
adr/031-content-blacklist-appeals-contract.md Updates appeal record + events to use bytes32 region keys and adjusts indexing rationale.
adr/030-node-region-self-attestation.md Updates region-scope discussion to reference bytes32 packed keys and scope-check boundary conversion.
adr/016-contract-interactions.md Corrects “region off-chain” claim and updates blacklist challenge external-call inventory.
adr/014-on-chain-verification.md Rewrites blacklist-violation verification steps to match on-chain regional scope + enforceability timing.
adr/011-content-takedown.md Updates IContentBlacklist spec block to bytes32 regions and expands/renames hash blacklist view surface.

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

Comment thread adr/011-content-takedown.md Resolved
Comment thread adr/014-on-chain-verification.md Resolved
Comment thread adr/030-node-region-self-attestation.md Resolved
…-3d5817

# Conflicts:
#	adr/011-content-takedown.md
#	adr/016-contract-interactions.md
@alpergundogdu
alpergundogdu merged commit 85b1d58 into main Jul 27, 2026
24 checks passed
@alpergundogdu
alpergundogdu deleted the claude/gracious-nobel-3d5817 branch July 27, 2026 17:07
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.

2 participants