Repository navigation
docs(adr): add ADR 030 — node region self-attestation - #565
Conversation
Closes #400 with a self-claim production posture: regions in NodeAnnounce and StakingRegistry are accepted at face value; the IP-geolocation oracle / third-party attestation path is considered and rejected. Misdeclaration is the operator's legal exposure under the declared jurisdiction and *expands* the operator's slashing surface under ADR 011 § Regional Scope (the operator opts into the declared region's blacklist while remaining legally reachable through their physical operations). The latency-vs.- claim reputation penalty from ADR 001 § Risks is the canonical soft mitigation; this ADR does not respecify it. The only gaming surface the soft loop does not close is appeals-standing flipping (ADR 011 § Standing path 2). ADR 030 § 3 closes it: adds a `regionLastChanged: uint64` field on the StakingRegistry operator record and a new operator-facing `updateRegion(string)` mutator alongside the existing `updateMultiaddrs`. Operator standing under path 2 requires `block.timestamp - regionLastChanged >= REGION_STABILITY_WINDOW` (default 7 days; governable [1d, 30d] per the ADR 009 safety-bound pattern). Sub-window filings are not auto-rejected — they remain admissible at multisig discretion, preserving heightened-scrutiny intake as the soft-norm fallback for legitimate post-relocation filers. Supersedes the "production mitigation: oracle/attestation" passages in ADRs 001, 011, and 019. Cross-refs updated in ADRs 001 (§ Risks), 008 (§ Regional coverage caveat), 011 (§ Standing + § Regional Scope), 019 (Phase 1 step 5 + Future Work), architecture.md (Chapter 5 Verification & Enforcement + numeric ADR index). CLAUDE.md next-ADR counter bumped 030 → 032 (031 already used by 031-content-blacklist-appeals-contract). Closes #400 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Cross-ADR consistency cleanup raised by the comprehensive review on the ADR 030 branch: - **Broken anchors fixed.** ADR 030 referenced `[ADR 019 § Step 5.2]` and `[ADR 019 § Re-registration]` — neither section exists. The real `updateMultiaddrs` precedent lives in [ADR 019 § NAT and Multiaddr Handling]; `firstRegisteredAt` is defined under [ADR 019 § Re-Onboarding after Deregistration or Auto-Ejection]. Cross-refs in § 3 (Decision — StakingRegistry interface delta) and § Consequences/Positive updated. - **`firstRegisteredAt` precedent overclaim corrected.** The Positive bullet had claimed `regionLastChanged` "mirrors the precedent." `firstRegisteredAt` is write-once-on-first-registration; `regionLastChanged` updates on every successful `updateRegion`. Bullet now: parallel storage shape with opposite mutability, called out explicitly. - **`updateMultiaddrs` "no governance gate" wording corrected.** `updateMultiaddrs` has a governable cooldown ([ADR 001 § Multiaddr Update Policy], default 0). Reframed as: operator-callable, no-bond; no analogous per-call cooldown specified for `updateRegion`; the 7-day `REGION_STABILITY_WINDOW` is the only timing gate. - **`[ADR 001 § Risks]` references corrected to `§ Consequences`.** ADR 001 has no `### Risks` section — the regional-attestation consequence lives in `## Consequences`. Five references updated (ADR 030 lines 16/28/72/98, architecture.md line 160, ADR 011 line 548). - **Self-referential anchor in ADR 011 § Regional Scope edit fixed.** Was `[§ Regional Scope](#regional-scope)` — a self-loop. Now `[§ Slashing](#slashing)` (the actual target of the "expands slashing surface" claim). - **Section order aligned with ADR 028 / 026 / 031 precedent.** Consequences now precedes Alternatives Considered. - **`Touches:` front-matter expanded.** Added ADRs 008 (regional-coverage caveat), 009 (governable-parameter bounds pattern), 026 (minimum-stake cost bullet) — all referenced in the body. - **Terminology mix-up fixed.** Context paragraph had conflated the StakingRegistry `regionHint` field with the `NodeAnnounce` `region` field. Reworded to name both surfaces explicitly. - **ADR 030 added to the book-PDF reading-order build list** at `adr/README.md:150` (Chapter 5 — Verification & Enforcement). - **Tightened ADR 028 § 5 alignment claim** (the 30d upper bound) and added a sentence on the 7d-stability-window-vs.-3d-filing-window-lower-bound interaction in the threshold-rationale paragraph. Refs #400 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds ADR 030 to formally decide that node regions remain self-attested in production (rejecting IP-geolocation/oracle attestation), and updates existing ADRs/docs to reflect the new posture and the new regionLastChanged / stability-window hardening for appeals standing.
Changes:
- Added ADR 030 — Node Region Self-Attestation (decision + rationale + contract-interface delta for
regionLastChangedandupdateRegion). - Updated cross-references across ADRs (001/008/011/019) and
adr/architecture.mdto supersede prior “future work: oracle/attestation” language. - Updated ADR build/book lists and the “next ADR number” note.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
CLAUDE.md |
Bumps next ADR number note to 032 and documents 030/031 as canonical. |
adr/README.md |
Adds ADR 030 to the reading-order (book) PDF build list. |
adr/architecture.md |
Adds ADR 030 to Chapter 5 reading order and numeric index. |
adr/030-node-region-self-attestation.md |
New ADR specifying self-attestation posture + regionLastChanged stability window + updateRegion interface. |
adr/019-node-onboarding.md |
Updates onboarding guidance and marks geolocation verification future work as resolved by ADR 030. |
adr/011-content-takedown.md |
Updates standing + regional-scope language to reference ADR 030 and the stability-window mitigation. |
adr/008-reputation.md |
Updates region-attestation caveat to reflect ADR 030 production posture. |
adr/001-network.md |
Updates consequences text to note oracle/attestation was considered and rejected (ADR 030). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces ADR 030, which establishes self-attestation as the production posture for node regions, explicitly rejecting the use of external oracles or attestation services. The changes include adding a regionLastChanged timestamp and an updateRegion function to the StakingRegistry, along with a 7-day stability window required for operators to gain standing in regional blacklist appeals. Feedback focuses on improving documentation navigability via GFM anchor links and ensuring consistency in data types and event definitions within the smart contract interfaces.
Acts on inline review comments from Copilot + Gemini Code Assist: - **Drop "known ISO code set" overclaim** in the gossip-layer-validation paragraph. `crates/gossip/src/validation.rs:127-130` is shape-only (length-2 ASCII uppercase). ADR 001 § Gossip validation describes the stricter check; tightening `validation.rs` to enforce it is orthogonal to this ADR and not a precondition for the self-attestation posture. - **Clarify migration semantics** for `regionLastChanged`. No storage migration required — Solidity zero-initializes the field for pre-upgrade records, and the standing-eligibility check reads it with a read-time fallback to `firstRegisteredAt`: `effective = regionLastChanged != 0 ? regionLastChanged : firstRegisteredAt`. Previous "defaults to firstRegisteredAt" wording was ambiguous between migration sweep and read-time fallback. - **`regionLastChanged: uint256`** (was `uint64`) to match `firstRegisteredAt`, `registeredAt`, and `lastMultiaddrUpdate` in ADR 001 § Data Structure. - **`RegionUpdated` event signature corrected.** Index `nodeId` to match every other `StakingRegistry` event in ADR 001; drop the redundant `timestamp` parameter (block timestamp is implicit in the event log header). - **Note ADR 011 § Contract: ContentBlacklist's `bytes2` recommendation** for the region field, and explain why ADR 030 retains `string` here (consistency with the existing `StakingRegistry.NodeInfo.regionHint` shape per ADR 001 § Data Structure; `bytes2` migration is a separate `StakingRegistry` storage-shape change orthogonal to this ADR). - **Rename §3 heading** from "Appeals-standing hardening: regionLastChanged + 7-day window" to "Appeals-standing hardening" so the GFM slug is predictable and short. Update cross-references in ADR 011:197 and ADR 019:259 to use the `#3-appeals-standing-hardening` anchor. Refs #400 #565 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two findings from the post-fce0fc2 internal review pass:
- **ADR 030 §3 strict-rule fenced block now uses the read-time fallback.**
Bullet 1 of §3 introduced
`effective = regionLastChanged != 0 ? regionLastChanged : firstRegisteredAt`
to avoid a storage migration, but the canonical fenced rule still read
`block.timestamp - operator.regionLastChanged >= REGION_STABILITY_WINDOW`,
which a contract-impl reader could copy verbatim and silently skip the
fallback for legacy records. The fenced block is now self-contained:
effective = operator.regionLastChanged != 0 ? operator.regionLastChanged : operator.firstRegisteredAt
block.timestamp - effective >= REGION_STABILITY_WINDOW
Runtime semantics unchanged (legacy records with `regionLastChanged == 0`
already trivially passed `block.timestamp - 0`), but the spec is now
unambiguous to a code-generation reader.
- **Stale "(ADR 030)" cross-references in ADR 031 corrected.** ADR 031
was written when "ADR 030" was the informal placeholder for the
SafetyReserve slash-appeal contract-implementation ADR (the blacklist-
side analogue of which is ADR 031). With #400 now claiming the 030
slot for Node Region Self-Attestation, ADR 031's three "(ADR 030)"
pointers (lines 14, 291, 314) became factually wrong on merge.
Reworded to refer to #524 alone (the GitHub issue tracking the
SafetyReserve slash-appeal contract ADR), with parenthetical pointers
to ADR 030's new occupant for cross-reference. The natural claimant
of the next-free 032 slot is now #524.
Refs #400 #565
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Security & compliance review (design-level)Reviewed ADR 030 for security/compliance gaps only. The oracle-rejection rationale and the appeals-standing hardening are solid, and the oracle-language supersession across ADRs 001/008/011/019 is complete with all cross-ref anchors resolving. Six gaps below, each with a simple fix. Three need a maintainer decision — flagged [maintainer call]. 1. §4 "misdeclaration expands slashing surface" is backwards for the main evasion case§4's only worked example declares into a stricter region (US-physical → EU). The real evasion is declaring out of the takedown's region: per ADR 011 § Slashing — "a node is only slashable for serving a hash it was in-scope to remove ... a node that declared region Fix: Rewrite §4 to state plainly that for region-scoped entries served by an in-region operator, misdeclaration reduces protocol slash exposure, with off-protocol legal action + the latency penalty as the only backstops. Reconcile with Negative bullet 1. Doc-only, no behavior change. 2.
|
Maintainer decisions on the three [maintainer call] itemsResolving the three open calls from the review above. #1, #3, #4 stand as previously described — clean doc/impl fixes, no decision needed. #2 — Adopted: reuse
|
Resolves the six findings from the PR #565 security/compliance review: - #1 §4: replace the inverted "misdeclaration expands slashing surface" argument with the honest reactive-vs-pre-positioned decomposition; reconcile Negative bullet 1 and the same claim mirrored in ADR 011 § Regional Scope. - #2: gate blacklist scope/slash eligibility on the stability window, not just appeals standing. Add `regionPrev`, make `updateRegion` revert within `REGION_STABILITY_WINDOW` (cooldown = window), and amend the ADR 011 § Regional Scope / § Slashing predicate so the previous region's entries and slash exposure persist until a change ripens — closing the reactive blacklist-evasion flip. - #3: migration fallback `max(firstRegisteredAt, regionGateActivatedAt)` instead of bare `firstRegisteredAt`; add migration-cohort Risks bullet. - #4: §2 states the residual control is consciously accepted unparameterized; log the `validation.rs` vs ADR 001 spec divergence as a Forward reference. - #5: raise `REGION_STABILITY_WINDOW` floor [1d,30d] -> [3d,30d] (default 7d unchanged) across §3, threshold rationale, Risks, and ADR 011 § Standing. - #6: this PR keeps ADR 030 (no change here; #566 renumber requested separately). §3 renamed "Appeals-standing hardening" -> "Region-stability window"; anchor references updated in ADR 011, ADR 019, architecture.md. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
All six review findings addressed —
|
Follow-up to the security/compliance review fixes. The cooldown = window rule, combined with regionLastChanged being stamped at registerNode, locked a freshly registered operator out of correcting a mis-entered region for a full window. Fix uses regionLastChanged itself as the "has changed region yet" discriminator rather than overloading regionPrev emptiness (which is only a clean sentinel if registration forbids an empty region): - registerNode no longer stamps regionLastChanged (stays 0 until the first updateRegion); the effective fallback already covers fresh nodes for appeals-standing / blacklist-scope. - Cooldown reverts iff regionLastChanged != 0 AND block.timestamp - regionLastChanged < REGION_STABILITY_WINDOW, so the first change is exempt and every subsequent change is gated. Safe: reactive evasion is foreclosed by the scope predicate (prev region keeps applying via regionPrev for the window) regardless of the cooldown; the cooldown only blocks a second flip, still gated once regionLastChanged != 0. Migration-cohort Risks bullet updated to note the first post-activation change is cooldown-exempt but still does not ripen / grant standing until the window passes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Follow-up —
|
PR #565 (also open) independently assigns ADR 030 to 030-node-region-self-attestation.md. To prevent a file collision and conflicting CLAUDE.md canonical claims on merge, move this PR's ADR to the free slot 032. - git mv 030-safety-reserve-appeals-contract.md -> 032-... - Update self-references, title, and ADRs-Affected in the renamed file - Repoint cross-refs in 026, 028, 031, architecture.md, README.md (section anchors unchanged) - architecture.md: move the per-ADR numeric-index entry after 031; Chapter 5 thematic order (028 -> 032 -> 031) and README reading-order build kept in lockstep - CLAUDE.md: next ADR number 032 -> 033; provenance note records 032 canonical, 030 assigned by in-flight PR #565 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
#566) * docs(adr): add ADR 030 — SafetyReserve appeal-surface contract surface (#524) Pins the contract-implementation surface deferred by ADR 028 §6: per-appeal storage layout, the per-appeal escrow accounting from §2, all six canonical Solidity event signatures (resolving the `SlashAppealLapsed` gap between ADR 028 Forward references and ADR 026 §5's stub), the state machine, and the integration with ADR 026 §5's cross-category pending-claim queue. Adds a sixth permissionless entry point `cleanupExpiredAppeal` for the two lapse cases (multisig timeout, ratification timeout), mirroring ADR 031's pattern. ADR 028 §6's enumerated five entry points expands to six; editorial follow-through in this commit. Closes #453 Risk 2. Unblocks #452 (slashing/appeals contract implementation). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): address PR #566 review — escrow lien model, incidentId, formula cleanup Responds to Copilot and Gemini review on PR #566: - §2 escrow model clarified: per-appeal escrow is a lien on general balance, not a separate USDC sub-account. `totalEscrowLien` aggregate added to storage; solvency invariant rewritten as `totalEscrowLien + Σ pendingClaim ≤ generalBalance`. Resolves the ratifyAppeal→payout double-debit ambiguity raised by Copilot (#3244100352). - §3 / §5 / ADR 026 §5 stub: `SlashAppealRatified` now emits `incidentId` (indexed) so off-chain consumers join directly against `SafetyReserve.Paid.id` without `evidenceBundleHash`/`recipient` joins. Per Gemini (#3244098475 / #3244098480). - §4 reviewWindowEndsUs lifecycle: pinned to one formula `nowUs + SafetyReserve.appealWindow() + RATIFICATION_WINDOW`, referencing the governable parameter rather than hardcoding "48h". Resolves Copilot (#3244100324) and the appealWindow part of Gemini (#3244098488). - Negative consequence about ADR 028's "five entry points" prose rewritten to describe the actual ABI-widening cost (Copilot #3244100374). - Risk note about "coarse-grained epochs" replaced with a mixed-time-units risk that matches the post-fix storage (microsecond timestamps for cap; epoch index for queue alignment) — Copilot #3244100280. - §1 storage description: `escrowAmount` comment updated to reflect the lien semantics; struct count clarified in Negative consequence. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): align ADR 030 enum/table comments with lien model; add UDVTs + invariant tests (PR #566 review) Addresses /pr-review-toolkit:review-pr findings on PR #566. Critical fixes (lien-vs-sub-account drift flagged by three reviewers): - §1 AppealStatus enum lines 26-30: enum value comments updated from "moved from general balance" / "returned to general balance" to lien-released language, matching §2's "Escrow is a lien, not a sub-account" framing. - §4 cleanupExpiredAppeal admissibility table (b): "return escrowAmount to general balance" → "release lien on escrowAmount (funds remain in general balance)" — funds never moved under the lien model. §2 additions: - Checks-Effects-Interactions ordering pinned at ratifyAppeal / reverseAppeal / cleanupExpiredAppeal so the re-entrant-appellant case is unambiguous: status update + lien decrement + bond transfer (effects) BEFORE the payout() / bond-split (interactions). §1 type-design upgrades (per type-design-analyzer): - Introduce `type EpochIndex is uint64;` and `type MicroTimestamp is uint64;` user-defined value types. Solidity refuses implicit conversion between them, so the storage layer cannot silently mix epoch indices with microsecond timestamps. Zero gas cost. ADR 031 retains raw uint64 — a future editorial pass may retrofit cross-ADR. §Risks expansion: - Named Foundry invariant tests (invariant_lienEqualsSumOfFastTracked, invariant_fastTrackedImpliesEscrow, invariant_terminalIsSticky, invariant_bondAccounting) become a MUST for #452's implementation. - "Mixed time units" risk rewritten as the residual hazard surface that UDVTs do not cover (unwrap casts, raw-uint64 setters, unit-ambiguous literals) with concrete enforcement obligations. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): fix ADR 030 §4 cross-ref + add 030/031 to reading-order build (PR #566 review) ADR 028 Forward references pointed cleanupExpiredAppeal's two lapse cases at ADR 030 §6 (Multisig capability scope) with a dangling "below"; the lapse-case admissibility table lives in ADR 030 §4 (State machine), which the §6 contract-block inline comment already cites correctly. Repoint to §4 and drop the dangling phrase. architecture.md Chapter 5 gained ADR 030/031 but README.md's reading-order pandoc command was not updated in lockstep, per the architecture.md maintenance note. Add both files after 028-slashing-appeals.md, matching Chapter 5 order. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): renumber ADR 030 -> 032 to avoid collision with PR #565 PR #565 (also open) independently assigns ADR 030 to 030-node-region-self-attestation.md. To prevent a file collision and conflicting CLAUDE.md canonical claims on merge, move this PR's ADR to the free slot 032. - git mv 030-safety-reserve-appeals-contract.md -> 032-... - Update self-references, title, and ADRs-Affected in the renamed file - Repoint cross-refs in 026, 028, 031, architecture.md, README.md (section anchors unchanged) - architecture.md: move the per-ADR numeric-index entry after 031; Chapter 5 thematic order (028 -> 032 -> 031) and README reading-order build kept in lockstep - CLAUDE.md: next ADR number 032 -> 033; provenance note records 032 canonical, 030 assigned by in-flight PR #565 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Alper Gundogdu <[email protected]>
Summary
prod-blocking/missing-decision).regionLastChanged: uint64field onStakingRegistry+ newupdateRegion(string)mutator. Operator standing under path 2 requiresblock.timestamp - regionLastChanged >= REGION_STABILITY_WINDOW(default 7 days; governable[1d, 30d]). Sub-window filings remain admissible at multisig discretion only.203fa34) and review-driven cross-ref cleanups (27a41e8) addressing anchor corrections, section-order alignment with ADR 028/026/031, terminology disambiguation, and theupdateMultiaddrs/firstRegisteredAtprecedent claims.Test plan
decdn/CLAUDE.mdreads 032 (031 already taken by031-content-blacklist-appeals-contract.md).pre-commit run --all-filesis green locally — pass on both commits in CI.Closes #400in the first commit body.🤖 Generated with Claude Code