Skip to content

ADR 030: SafetyReserve appeal-surface contract-implementation #524

Closed

Description

@thiras

Context

Tracking the resolution of #453 Risk 2 as a standalone ADR PR.

ADR 028 §6 specifies five new entry points on SafetyReserve. ADR 026 §5 carries an interface stub with three of the appeal-flow event signatures. The storage layout, the per-appeal escrow accounting from ADR 028 §2, and the full six event signatures (including SlashAppealLapsed, which is named in ADR 028 Forward references but absent from the ADR 026 interface stub) live nowhere canonical. #452 cannot start the appeal-flow contract work without this ADR.

Scope

New file: adr/030-safety-reserve-appeals-contract.md. Suggested section outline:

  1. Storage layout. Appeal struct (slashId, appellant, evidenceBundleHash, bond, status enum, openedEpoch, escrowAmount); appeals[appealId] mapping; monotonic appealCounter; per-operator lastAcceptedAppealEpoch[operator] for the ADR 028 §5 frequency cap; per-category pending-claim queue keyed by (accrualEpoch, IncidentReason, recipient) per the Risk-1 resolution amended into ADR 026 §5 Cross-category payout ordering (lands in PR docs(adr): close #453 risks 1, 5, 6 — payout ordering, paired invariant, capability (4) #522).

  2. Per-appeal escrow accounting (lifts ADR 028 §2). fastTrackAppeal → per-appeal escrow; ratifyAppeal → release to recipient; reverseAppeal → return to general balance; rejectAppeal → bond per §2 split; lapseAppeal (internal, time-triggered) → return escrow + refund bond. Invariant: sum(escrowAmount over open + fast-tracked appeals) ≤ generalBalance at all times.

  3. Solidity event signatures (all six, pinned) — resolves the inconsistency where SlashAppealLapsed is named in ADR 028 Forward references but absent from ADR 026's interface stub:

    ```solidity
    event SlashAppealOpened(uint256 indexed appealId, uint256 indexed slashId, address indexed appellant, bytes32 evidenceBundleHash, uint256 bond);
    event SlashAppealFastTracked(uint256 indexed appealId, uint256 escrowAmount);
    event SlashAppealRejected(uint256 indexed appealId, uint256 bondSlashed);
    event SlashAppealRatified(uint256 indexed appealId, address indexed recipient, uint256 restitutionAmount);
    event SlashAppealReversed(uint256 indexed appealId, uint256 escrowReturned);
    event SlashAppealLapsed(uint256 indexed appealId, uint256 escrowReturned, uint256 bondRefunded);
    ```

  4. State-transition diagram. Open → {FastTracked, Rejected, Lapsed}; FastTracked → {Ratified, Reversed}; Lapsed terminal. Frequency cap ("one accepted appeal per operator per 365 days") checked at ratifyAppeal against lastAcceptedAppealEpoch.

  5. Cross-category ordering hook. Defers to the amended ADR 026 §5 queue semantics; ADR 030 pins the storage shape only.

  6. Out of scope. Parameter values (#451 territory). Audit-pinned constants. Gas optimization. The four payout gates from ADR 026 §5 (already canonical there).

Numbering

Next canonical ADR is 030. Highest existing: 028. 029 is appendix-peer-table-eviction.md (reclassified, do not reuse). 030/031/032 were reclaimed previously when their proposals moved to the internal ideas repo. Re-verify by listing adr/ at issue-pickup time in case the counter has moved.

Acceptance

  • adr/030-safety-reserve-appeals-contract.md created
  • All six event signatures pinned (including SlashAppealLapsed)
  • adr/026-gauge-boost-tokenomics.md §5 interface stub updated to add SlashAppealLapsed (consistent with ADR 030)
  • adr/028-slashing-appeals.md Forward references bullet "future contract-implementation ADR will pin…" replaced with a back-reference to ADR 030
  • adr/architecture.md updated: ADR 030 in Chapter 5 reading order + Architectural Decisions list
  • decdn/CLAUDE.md next-ADR counter bumped from 030 → 031

Related

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

design:adr

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions