Repository navigation
docs(adr): close #453 risks 1, 5, 6 — payout ordering, paired invariant, capability (4) - #522
Conversation
…nt, capability (4) Resolves three deferred decisions tracked in the #453 ADR 026/028 execution-risk register: - **Risk 1.** ADR 026 §5 pins cross-category payout ordering: pending claims are paid epoch-FIFO across all payout categories, with deterministic (IncidentReason enum, recipient) tiebreakers within an epoch. No category priority; multisig authorization order does not affect queue position. ADR 028 §5 and the §6 future-split bullet are updated to reference the canonical ordering; the corresponding Forward-references bullet is removed. - **Risk 5.** The `MAX_EVIDENCE_AGE_US < unbondingPeriod` invariant in ADR 014 § Interaction with unbonding period is promoted from SHOULD-level to a MUST-level paired-setter pattern enforced on both `SlashJudge.setMaxEvidenceAge` and `StakingRegistry.setUnbondingPeriod`. A new ADR 014 Governable Parameters with Safety Bounds subsection mirrors the ADR 009 §5 / ADR 026 §11 pattern. ADR 009's rationale list adds a paired-invariant bullet pointing to ADR 014 for the revert conditions. - **Risk 6.** ADR 009 capability (4) "SafetyReserve fast-track authorization" is editorially expanded to enumerate `fastTrackAppeal(appealId)` and `rejectAppeal(appealId)` as appeal-flow sub-modes. ADR 028 §6 prose and the corresponding Forward-references bullet are trimmed to reflect the resolution. Risk 2 (ADR 030 SafetyReserve appeal-surface contract-implementation) becomes a follow-up issue. Risk 3 stays tracked at decdn/finance#3. Risk 4 (wash-trading appendix) lands in a separate PR. Refs #453 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates several Architecture Decision Records (ADRs) to formalize protocol invariants and governance procedures. Key changes include defining a cross-parameter invariant between evidence age and unbonding periods, expanding emergency multisig capabilities to include specific slashing appeal actions, and establishing an epoch-FIFO queue for pending SafetyReserve payouts. Review feedback suggests standardizing governable parameters to use seconds instead of microseconds for consistency and addressing a circular deployment dependency in the proposed invariant enforcement. Additionally, a contradiction was identified in the payout ordering logic where the use of a fixed enum for tiebreaking conflicts with the claim of having no cross-category priority.
There was a problem hiding this comment.
Pull request overview
This PR updates the ADR documentation to close three deferred execution-risk decisions from #453, primarily by making payout ordering deterministic across categories, formalizing a cross-parameter safety invariant, and expanding multisig capability (4) to explicitly cover appeal-flow actions.
Changes:
- Specify cross-category pending-claim payout ordering as epoch-FIFO with deterministic tie-breakers (ADR 026) and reference it from ADR 028.
- Promote
MAX_EVIDENCE_AGE_US < unbondingPeriodto a MUST-level, paired-setter, contract-enforced invariant (ADR 014 + ADR 009 rationale). - Expand ADR 009 multisig capability (4) to enumerate
fastTrackAppeal/rejectAppealas sub-modes; trim corresponding ADR 028 forward references.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| adr/028-slashing-appeals.md | References the newly pinned cross-category queue ordering and removes now-resolved forward references. |
| adr/026-gauge-boost-tokenomics.md | Adds a canonical “Cross-category payout ordering” section defining deterministic epoch-FIFO semantics for pending claims. |
| adr/014-on-chain-verification.md | Strengthens and details the MAX_EVIDENCE_AGE_US < unbondingPeriod invariant with paired setter revert conditions and documents it in a new parameter table. |
| adr/009-governance.md | Adds an explicit safety-bound rationale bullet for the evidence-age/unbonding invariant and enumerates appeal sub-modes under multisig capability (4). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…, permissionless disbursement Four review fixes on the Risk-1 amendment: 1. **Within-epoch tiebreaker.** Switched from `(IncidentReason enum, recipient address)` to a monotonic `claimId` (assigned at authorization). The IncidentReason-based tiebreaker, while deterministic, looked like a payout-category priority claim — Gemini flagged the tension with the "no payout category has cross-category priority" wording. `claimId` is protocol-monotonic and category-agnostic, removing the priority-looking ordering entirely. 2. **Epoch pinning.** `accrualEpoch` is now explicitly the FeeRouter 1-week epoch from ADR 026 §2 Epoch mechanics. Copilot flagged that "epoch" was undefined — SafetyReserve does not maintain a separate clock; reusing the FeeRouter epoch keeps `accrualEpoch` derivable from any block timestamp without an additional canonical clock. 3. **Forward-reference for the contract spec.** Reworded "the exact storage shape lives in the SafetyReserve contract-implementation ADR" → "pinned in a future SafetyReserve contract-implementation ADR (tracked at #524)". Copilot noted that the prior phrasing implied a concrete document that doesn't yet exist; the new wording matches the actual issue state. 4. **Permissionless disbursement of queued claims.** Copilot pointed out a substantive tension: if each pending-claim payment "requires a subsequent SafetyReserve.payout() authorization", the multisig could still effectively re-order claims by selectively re-authorizing, defeating the Risk-1 ordering guarantee. Resolved by making disbursement permissionless head-of-queue once solvency permits. The four Spending-controls gates are checked at the *original* authorization (gate 4 post-incident-reporting writes atomically per disbursement); no second-stage authorization step exists, which is what makes the queue-ordering guarantee meaningful. This mirrors the permissionless-detection pattern in appendix-fraud-detection.md. ADR 028 §5 SafetyReserve-insolvency paragraph updated to match. Two further Gemini comments (microsecond unit on MAX_EVIDENCE_AGE_US; circular deployment dependency between SlashJudge and StakingRegistry setters) are addressed in the PR thread — the parameter naming is canonical from ADR 014 to align with wire-level `timestamp_us` fields, and the deployment-ordering concern is an implementation detail handled by standard two-phase init patterns at deploy time, not an ADR-level constraint. Refs #453, PR #522 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…chor swap, gate-4 wording
Three small polish items surfaced by the comprehensive review:
1. ADR 014 § Governable Parameters table — switch Default/Min/Max columns from right-aligned to default-aligned. Right-alignment renders "(fixed)" / "(per ADR 009 ...)" awkwardly next to numeric values like "5 days" / "60 s". Matches the alignment used in ADR 009 § Other protocol parameters.
2. ADR 009 § Max evidence age + Unbonding period bullet — link target swapped from `#evidence-staleness` to `#slashed-event-and-slashid-allocation`. The latter is the canonical offense-enumeration anchor and the natural landing point when the bullet says "the three on-chain offenses." `#evidence-staleness` was the staleness check anchor, not the offense list.
3. ADR 028 § SafetyReserve insolvency at ratification paragraph — wording was compressed ("the four ... gates were checked at the original `ratifyAppeal` authorization"). ADR 026 §5 packages the four-gate story more carefully: gates 1–3 (attested bundle, authorization, 48-hour appeal window) check at original authorization; gate 4 (post-incident reporting) writes atomically per disbursement. Mirroring that wording here for cross-ADR symmetry.
Refs #453, PR #522
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
left a comment
There was a problem hiding this comment.
Substantive risk-closure work LGTM — the claimId swap and permissionless disbursePending() upgrade in 7ca7437 are real improvements over the original phrasing, and the bot-review responses are well-reasoned. Two small editorial nits on the new cross-category section inline.
Out-of-scope but worth tracking for a future pass: ADR 026 §5 Spending controls gate 4 (line 298) reads "Post-incident reporting published to a public registry maintained by SafetyReserve" while ADR 009 § SafetyReserve Payout Authorization gate 4 uses the more precise "On payout settlement, SafetyReserve writes an immutable record…". Aligning ADR 026 §5's gate-4 wording with ADR 009's would also obviate inline #1 below.
| - **No multisig-as-orderer hazard.** Authorization order (the sequence in which `SafetyReserve.payout()` is called or the multisig fast-tracks an appeal) determines `claimId` only in the rare same-epoch tie, and even then only deterministically; once authorized, queue position is fixed. | ||
| - **Forward-compatible with new payout categories.** Future incident-response contracts integrating via the stable `payout(bundleHash, recipient, amount)` interface inherit the same queue semantics without amending this ADR. | ||
|
|
||
| **Disbursement of queued claims is permissionless.** Once the original `payout()` authorization completes — the four [Spending controls](#spending-controls) gates are checked at authorization, with gate 4 (post-incident reporting) writing atomically per disbursement — the claim is in the queue and any caller may invoke a `disbursePending()` head-of-queue path when reserve solvency permits. No second-stage authorization is required, which is what makes the queue-ordering guarantee meaningful: the multisig cannot selectively re-authorize favored queued claims because no re-authorization step exists. This mirrors the permissionless-detection pattern in [Appendix: Fraud Detection](appendix-fraud-detection.md). The exact storage shape and the `disbursePending` entry-point signature are pinned in a future SafetyReserve contract-implementation ADR (tracked at [#524](https://github.com/decdn/decdn/issues/524)); this section pins only the ordering semantics and the permissionless-disbursement property. |
There was a problem hiding this comment.
Minor wording tension: "the four Spending controls gates are checked at authorization, with gate 4 (post-incident reporting) writing atomically per disbursement" reads as mildly self-contradictory — gate 4 either is checked at authorization or is a per-disbursement write, not both.
The ADR 028 §5 phrasing you used in the same commit (7ca7437) is cleaner and could be mirrored here:
Gates 1–3 of the four [ADR 026 §5 Spending controls] (attested bundle, authorization, 48-hour appeal window) were checked … ; gate 4 (post-incident reporting) writes atomically on each disbursement.
Suggest splitting the sentence the same way: gates 1–3 checked at authorization, gate 4 as the per-disbursement write.
There was a problem hiding this comment.
Fixed in ed6cb08 by adopting your suggested split (gates 1–3 checked at authorization; gate 4 writes atomically on each disbursement), and also pulled the root fix forward: ADR 026 §5 gate 4 now canonicalizes on ADR 009's "On payout settlement, SafetyReserve writes an immutable record …" wording, which is the upstream reason the line-315 sentence read as self-contradictory.
|
|
||
| #### Interface stability | ||
|
|
||
| The `payout(bundleHash, recipient, amount)` signature is contract-stable: future incident-response tooling, insurance products, and SLA-style contracts integrate via this entry point without contract changes. Evidence formats live off-chain and are referenced by hash on-chain; the contract enforces the four payout gates uniformly regardless of caller identity (subject to `AccessControl` role grants per [ADR 016 §5](016-contract-interactions.md#5-access-control-matrix)). |
There was a problem hiding this comment.
The "subject to AccessControl role grants per [ADR 016 §5]" qualifier here is still accurate for payout() itself, but it doesn't acknowledge the new permissionless disbursePending() entry point introduced just above. A reader landing on this paragraph could read it as a blanket statement about all SafetyReserve entry points and be confused by the apparent contradiction.
A short carve-out — e.g., "payout() is subject to AccessControl; disbursePending() is permissionless by design (see above)" — would close the gap without bloat.
There was a problem hiding this comment.
Fixed in ed6cb08 with the carve-out you suggested: payout() is the AccessControl-gated authorization path; disbursePending() is permissionless by design (with a back-link to Cross-category payout ordering), and a note that it inherits its evidence-and-gates guarantees from the original payout() authorization that placed the claim on the queue.
…Control carve-out
Three coherent fixes on ADR 026 §5 from Alper's review:
- Align ADR 026 §5 gate 4 definition (line 298) with ADR 009 §
SafetyReserve Payout Authorization gate 4: "On payout settlement,
SafetyReserve writes an immutable record …". The looser earlier
wording ("published to a public registry") was the root of the
self-contradiction Alper flagged below; canonicalizing on ADR 009's
phrasing dissolves it at the source.
- Split the permissionless-disbursement sentence (line 315) so gates
1–3 (checked at authorization) and gate 4 (per-disbursement write)
are no longer conflated. Mirrors the cleaner phrasing already used
in ADR 028 §5 line 114, same commit 7ca7437.
- Add an AccessControl carve-out to ADR 026 §5 Interface stability
(line 319) distinguishing `payout()` (AccessControl-gated) from
`disbursePending()` (permissionless by design), so the blanket
"subject to AccessControl role grants" sentence is no longer
readable as covering the new permissionless entry point.
Editorial-only; no semantic change. Substantive risk-closure work
from 38416e2/7ca7437 is unaffected.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Thanks for the review (and the out-of-scope flag on the gate-4 wording). I pulled it in — it was strictly upstream of inline #1, so bundling it kept the editorial pass to a single commit (ed6cb08). ADR 026 §5 gate 4 now mirrors ADR 009's "On payout settlement, SafetyReserve writes an immutable record …" wording verbatim in spirit. Two inline nits also fixed in the same commit. |
Summary
Resolves three deferred decisions tracked in #453 (ADR 026/028 execution-risk register):
Risk 1 — Cross-category payout ordering. ADR 026 §5 now pins epoch-FIFO across all payout categories with deterministic
(IncidentReason enum, recipient address)tiebreakers within an epoch. Chosen over (a) explicit category ranking (no governance mandate for inter-constituency priority) and (b) FIFO-by-authorization (the exact hazard ADR 026/028 execution-risk register: deferred decisions before contract bytecode locks #453 flags: makes the multisig the de-facto orderer). Epoch-FIFO is deterministic, removes the multisig-as-orderer concern, and scales to future incident-response contracts integrated via the stablepayout(bundleHash, recipient, amount)interface. ADR 028 §5 cross-references the canonical ordering; the resolved Forward-references bullet is removed.Risk 5 —
MAX_EVIDENCE_AGE_US < unbondingPeriodinvariant. Promoted from SHOULD-level to a MUST-level paired-setter pattern enforced on bothSlashJudge.setMaxEvidenceAgeandStakingRegistry.setUnbondingPeriod. Matches the ADR 026 §11 FeeRouter sum-to-100% pattern and the ADR 009 § Other protocol parametersOriginAssignmentcross-parameter examples. New ADR 014 Governable Parameters subsection documents the paired invariant; ADR 009's rationale list adds a corresponding bullet pointing at ADR 014 for revert conditions.Risk 6 — ADR 009 capability (4) editorial expansion. Capability (4) "SafetyReserve fast-track authorization" now enumerates
fastTrackAppeal(appealId)andrejectAppeal(appealId)as appeal-flow sub-modes per ADR 028 §6. An auditor reading ADR 009 alone can now find the appeal flow. ADR 028 §6 prose and the resolved Forward-references bullet are trimmed.Risk 2 (ADR 030: SafetyReserve appeal-surface contract-implementation) is being opened as a follow-up issue. Risk 3 (SafetyReserve sizing) stays tracked at
decdn/finance#3. Risk 4 (wash-trading economics appendix) lands in a separate PR.Test plan
This is docs-only; no code changes. Verification:
pre-commit run --files <changed adr/*.md>passes (markdownlint, EOF, trailing whitespace, etc.)#cross-category-payout-ordering,#interaction-with-unbonding-period,#governable-parameters-with-safety-bounds,#11-governable-parameters-with-safety-bounds,#6-contract-surface,#safetyreserve-payout-authorization,#evidence-stalenessSafetyReserve/SlashJudgeimplementation workRefs #453
🤖 Generated with Claude Code