Repository navigation
feat(contracts): enforce ADR-009 pause sunset via SunsettingPausable (#976) - #1027
Conversation
…976) ADR 009 § Emergency Multisig specifies that the protocol-wide pause — the most centralization-sensitive emergency power — sunsets hard at a deploy-time deadline, while the narrow unlawful-content-removal powers stay permanent. The decision was recorded in #977; this enforces it at the contract layer (the remaining contract piece tracked by #976). Add a shared `SunsettingPausable` base (extends OZ `Pausable`) that fixes `pauseDeadline = block.timestamp + 365 days` as an immutable at each contract's own construction and reverts `PauseExpired` from `pause()` once the deadline passes — for every caller, governance included (no role carve-out; progressive immutability). Post-sunset recourse is a governed redeploy with a fresh deadline. Wire all six pausable contracts (BuybackBurner, CapacityBond, FeeRouter, PaymentChannel, SlashAppeal, SlashJudge) to inherit it and guard their `pause()`. The permanent blacklist powers need no change: they live on the non-pausable `ContentBlacklist`, so the two paths already hold independent lifetimes by construction rather than by splitting a shared deadline. Update ADR 009's contract-layer note from "follow-up" to present-tense enforcement, and make the role-agnostic sunset explicit (no governance carve-out). The perpetual-narrow-compliance-vs-managerial-control boundary remains a pre-deployment counsel gate, filed in internal/Legal. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
WalkthroughA new ChangesSunsetting Pause Mechanism
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Pauser
participant Contract as "Migrated Contract (e.g. FeeRouter)"
participant SunsettingPausable
Pauser->>Contract: pause()
Contract->>SunsettingPausable: _requirePauseWindowOpen()
alt before pauseDeadline
SunsettingPausable-->>Contract: window open
Contract->>Contract: _pause()
Contract-->>Pauser: paused
else after pauseDeadline
SunsettingPausable-->>Contract: revert PauseExpired
Contract-->>Pauser: revert PauseExpired
end
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contracts coverageLine coverage: 91.47% (2347/2566 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
Pull request overview
Adds a contract-level enforcement of ADR-009’s “emergency pause sunset” by introducing a shared SunsettingPausable base and wiring it into all pausable contracts, with accompanying unit tests and ADR updates to reflect the new enforcement.
Changes:
- Introduce
SunsettingPausable(extends OZPausable) with an immutablepauseDeadlineand a_requirePauseWindowOpen()guard that reverts withPauseExpired()after expiry. - Migrate the six pausable contracts to inherit
SunsettingPausableand gate theirpause()entrypoints with_requirePauseWindowOpen(). - Add a dedicated
SunsettingPausabletest harness suite plus “reverts after sunset” tests across each affected contract suite, and update ADR-009 to document the enforced behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/src/SunsettingPausable.sol | New base contract implementing an immutable pause deadline and a guard that reverts after sunset. |
| contracts/src/BuybackBurner.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/src/CapacityBond.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/src/FeeRouter.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/src/PaymentChannel.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/src/SlashAppeal.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/src/SlashJudge.sol | Swap inheritance from Pausable to SunsettingPausable; add sunset guard to pause(). |
| contracts/test/SunsettingPausable.t.sol | New isolated unit tests for the base contract semantics (deadline arithmetic + role-agnostic sunset). |
| contracts/test/BuybackBurner.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| contracts/test/CapacityBond.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| contracts/test/FeeRouter.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| contracts/test/PaymentChannel.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| contracts/test/SlashAppeal.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| contracts/test/SlashJudge.t.sol | Add test asserting pause() reverts with PauseExpired after sunset. |
| adr/009-governance.md | Update ADR-009 to reflect contract-layer enforcement and the no-carve-out pause expiration behavior. |
💡 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 implements a sunsetting mechanism for the protocol's pause capability as specified in ADR 009. It introduces the SunsettingPausable base contract, which enforces a hard deadline of 365 days from deployment after which the pause function permanently reverts. Various system contracts (such as BuybackBurner, CapacityBond, and FeeRouter) have been updated to inherit from this new base contract, along with comprehensive test coverage. The reviewer's feedback suggests clarifying the ADR documentation by using 'constructionTimestamp' instead of 'deployTimestamp' and specifying durations primarily in seconds to adhere to technical specification guidelines.
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.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
contracts/src/SunsettingPausable.sol (1)
19-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider exposing the sunset guard as a modifier to prevent future omission.
The guard is correct, but every subclass must remember to call
_requirePauseWindowOpen()manually at the top ofpause(). Since this is a security-relevant control, awhenPauseWindowOpenmodifier on the base would make the guard harder to forget in any future pausable contract and keep the call site declarative alongside the existing role modifier.♻️ Optional modifier on the base
error PauseExpired(); constructor() { pauseDeadline = block.timestamp + PAUSE_SUNSET_PERIOD; } + /// `@dev` Reverts `PauseExpired` once the sunset has passed. Apply to each + /// `pause()` entrypoint so the guard cannot be silently omitted. + modifier whenPauseWindowOpen() { + _requirePauseWindowOpen(); + _; + } + /// `@dev` Reverts `PauseExpired` once the sunset has passed. Call at the top /// of each `pause()` entrypoint, before `_pause()`. function _requirePauseWindowOpen() internal view {Subclasses then become
function pause() external onlyRole(PAUSER_ROLE) whenPauseWindowOpen { _pause(); }.🤖 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/src/SunsettingPausable.sol` around lines 19 - 39, Add a base-contract modifier for the sunset check in SunsettingPausable so subclasses cannot forget to call _requirePauseWindowOpen() inside pause(). Keep the existing pauseDeadline and PauseExpired logic, but expose the guard as a declarative modifier such as whenPauseWindowOpen that performs the same timestamp check before continuing. Then update any pause() implementations that use SunsettingPausable to apply the new modifier alongside the existing role check, instead of relying on a manual internal call.Source: Path instructions
contracts/src/FeeRouter.sol (1)
344-347: 🩺 Stability & Availability | 🔵 TrivialConsider monitoring/alerting on the approaching sunset.
After
pauseDeadline,pause()reverts permanently with no role carve-out, so the emergency brake is unavailable until a governed redeploy. This is the intended ADR-009 behavior, but it's an availability cliff — an off-chain alert well ahead ofdeployTimestamp + 365 dayswould give governance time to redeploy before losing the pause capability.🤖 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/src/FeeRouter.sol` around lines 344 - 347, The `pause()` flow in `FeeRouter` has a hard sunset after `pauseDeadline`, so add a governance-facing warning/monitoring path keyed off `deployTimestamp` and the pause cutoff. Update the relevant pause-window logic around `_requirePauseWindowOpen()`/`pause()` to surface an alert or emitted signal well before the deadline so operators can redeploy before `PAUSER_ROLE` loses the emergency brake.
🤖 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.
Nitpick comments:
In `@contracts/src/FeeRouter.sol`:
- Around line 344-347: The `pause()` flow in `FeeRouter` has a hard sunset after
`pauseDeadline`, so add a governance-facing warning/monitoring path keyed off
`deployTimestamp` and the pause cutoff. Update the relevant pause-window logic
around `_requirePauseWindowOpen()`/`pause()` to surface an alert or emitted
signal well before the deadline so operators can redeploy before `PAUSER_ROLE`
loses the emergency brake.
In `@contracts/src/SunsettingPausable.sol`:
- Around line 19-39: Add a base-contract modifier for the sunset check in
SunsettingPausable so subclasses cannot forget to call _requirePauseWindowOpen()
inside pause(). Keep the existing pauseDeadline and PauseExpired logic, but
expose the guard as a declarative modifier such as whenPauseWindowOpen that
performs the same timestamp check before continuing. Then update any pause()
implementations that use SunsettingPausable to apply the new modifier alongside
the existing role check, instead of relying on a manual internal call.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1ee71e2a-19d8-4e89-87be-7f07606764fb
📒 Files selected for processing (15)
adr/009-governance.mdcontracts/src/BuybackBurner.solcontracts/src/CapacityBond.solcontracts/src/FeeRouter.solcontracts/src/PaymentChannel.solcontracts/src/SlashAppeal.solcontracts/src/SlashJudge.solcontracts/src/SunsettingPausable.solcontracts/test/BuybackBurner.t.solcontracts/test/CapacityBond.t.solcontracts/test/FeeRouter.t.solcontracts/test/PaymentChannel.t.solcontracts/test/SlashAppeal.t.solcontracts/test/SlashJudge.t.solcontracts/test/SunsettingPausable.t.sol
- Remove unused `Pausable` import from SunsettingPausable.t.sol (Copilot: the harness inherits SunsettingPausable, which already pulls in Pausable; the bare import is dead under `--deny warnings`). - ADR 009: `pause()` reverts with the custom error `PauseExpired`, not a string `"PauseExpired"` (Copilot), and `pauseDeadline` is anchored at each contract's own construction time, not a single shared deploy timestamp (Gemini). Co-Authored-By: Claude Opus 4.8 <[email protected]>
The solidity build+test job compares deterministic gas entries against the committed .gas-snapshot baseline; the SunsettingPausable rollout changed constructor and pause-path gas across the pausable contracts, so the baseline is regenerated under FOUNDRY_PROFILE=ci on top of the merged main history. Co-Authored-By: Claude Fable 5 <[email protected]>
Review — pause sunset via
|
…sable model Addresses review feedback on #1027: - ADR 016 §Emergency Multisig: drop the stale shared-`deployTimestamp` framing; the sunset is anchored per-contract at construction via the shared `SunsettingPausable` base, matching the shipped code and ADR 009. - ADR 009 §Contract-layer enforcement: scope "every pausable contract" to "every pausable protocol contract" — the testnet-only `TestnetFaucet` keeps a permanent (non-sunsetting) pause and is outside the emergency-multisig surface. - Tests: retire the `deployTimestamp + 365 days` phrasing in the six per-contract sunset-test comments and the "ADR 009 Option A" label in `SunsettingPausable.t.sol` (no such option label exists in the ADR). Comment/markdown only; no logic change. `forge fmt --check` and `FOUNDRY_PROFILE=ci forge build --deny warnings` pass. Skipped the local cargo-deny hook: it flags a pre-existing Rust-dependency advisory (RUSTSEC-2026-0204) unrelated to this doc-only diff. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Addressed the doc-consistency findings in 5706f20:
Comment/markdown only, no logic change. Not done (per discussion): the deploy-time |
Resolves the .gas-snapshot conflict by regenerating from the merged code. Full suite green: 696 passed, 0 failed, 6 skipped. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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]>
What
Enforces the ADR 009 emergency-pause sunset at the contract layer — the remaining contract piece tracked by #976 after the decision was recorded in #977.
A new
SunsettingPausablebase (extends OZPausable) fixespauseDeadline = block.timestamp + 365 daysas an immutable at each contract's own construction and revertsPauseExpiredfrompause()once the deadline passes. All six pausable contracts inherit it and guard theirpause():BuybackBurner(→GuardedBuybackBurner→ Uniswap/Balancer concretes)CapacityBond,FeeRouter,PaymentChannel,SlashAppeal,SlashJudgeWhy
ADR 009 § Emergency Multisig: the protocol-wide pause is the most centralization-sensitive emergency power, so it sunsets hard; the narrow unlawful-content-removal powers stay permanent. Before this PR the ADR itself noted "the emergency surface does not yet carry a deploy-time sunset" —
pause()never expired.Design decisions (confirmed with maintainer)
pause()reverts even for a timelock/governance call — progressive immutability, no standing freeze switch. Post-sunset recourse is a governed redeploy with a fresh deadline. This is the strongest decentralization posture and matches ADR 009 as written.block.timestampanchor — each contract sets its own deadline at construction; no shared deploy-timestamp param, no constructor-signature churn.ContentBlacklist, so the blacklist path and the pause path already hold independent lifetimes by construction rather than by splitting a shared deadline.Tests (TDD)
SunsettingPausable.t.sol: deadline value, succeeds before/at deadline, reverts after, reverts after deadline for a governance-class caller (locks the no-carve-out decision), role enforcement intact.test_pause_revertsAfterSunsetadded to each of the six contracts' suites.forge fmt --check,FOUNDRY_PROFILE=ci forge build --deny warnings, and aderyn all clean (no new High; theblock.timestampcomparison carries the standardforge-lint: disable-next-line(block-timestamp)waiver used across the codebase).Follow-up / out of scope
#7ininternal/Legal/content-liability-posture.md. It does not block this contract change.Closes the contract-implementation item of #976.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes