Skip to content

feat(contracts)!: renounce DEFAULT_ADMIN_ROLE, scope rotatable roles to GOVERNANCE_ROLE (#2028) - #2042

Merged
alpergundogdu merged 3 commits into
mainfrom
claude/pauser-role-governance-capture-bf5b9e
Sep 17, 2026
Merged

alpergundogdu merged 3 commits into
mainfrom
claude/pauser-role-governance-capture-bf5b9e

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #2028.

Problem

DEFAULT_ADMIN_ROLE is the admin of every other role. Held by the Timelock post-handoff, it is a master key: a captured governance can grantRole(GOVERNANCE_ROLE, attackerEOA) and hand a fresh account the entire governance surface with no vote and no 48h timelock delay (every governance setter is onlyRole(GOVERNANCE_ROLE), and the Timelock is just an address holding that role). That converts a transient, vote-gated capture into a permanent, unilateral one — the meta-lever that bypasses every other hardening fix in the Governance-hardening milestone.

The milestone premise: a captured governance must never reach a state the electorate can't vote its way back out of. This is the last open entrenchment hole against it.

Fix — #2028 option B, extended

Renounce the blanket DEFAULT_ADMIN_ROLE to no one at deploy end (freezing the role table), but re-home the genuinely-rotatable off-chain-key roles to GOVERNANCE_ROLE admin so a compromised key stays evictable via a timelocked proposal:

  • Rescoped to GOVERNANCE_ROLE admin: PAUSER_ROLE (PaymentPool, FeeRouter, CapacityBond, SlashJudge, SlashAppeal, BuybackBurner), EMERGENCY_MULTISIG_ROLE (ContentBlacklist, SlashAppeal), KEEPER_ROLE (BuybackBurner). Extends the issue's PAUSER-only scope to the other roles with the same key-compromise exposure. Same idiom already used for VETTER_ROLE.
  • Frozen: GOVERNANCE_ROLE (its admin is the now-unheld DEFAULT_ADMIN_ROLE) → no new governance key can ever be minted; migration = redeploy. The contract-held peer roles (ROUTER_CALLER, SLASH, SLASH_APPEAL, BLACKLIST) freeze too — they point at immutable contract addresses. REGIONAL_BODY_ROLE needs no rescope (granted via internal _grantRole in governance-gated registerRegionalBody, which bypasses the admin check).

The deliberate indefinite pause kill-switch is unchanged — keeping PAUSER_ROLE rotatable is exactly what lets a compromised pauser be evicted while an intentional pause-and-abandon still works.

Changes

  • Constructors: _setRoleAdmin(role, GOVERNANCE_ROLE) for the rescoped roles.
  • BaseProtocolDeploy: handoff renounces DEFAULT_ADMIN_ROLE (last role op per target); _assertNoBackDoors asserts no address holds it; _assertPeerRolesWired / _assertBuybackActivated assert each rotatable role's admin is GOVERNANCE_ROLE (a dropped _setRoleAdmin would otherwise silently freeze the role — this fails the deploy loudly).
  • ActivateBuyback runbook: prints a third Timelock renounceRole(DEFAULT_ADMIN_ROLE, timelock) step so a post-launch burner freezes its admin too.
  • ADR 016 / 011 / 018: updated to the renounced-admin model (present-tense canon).
  • Tests: flipped the old "Timelock holds DEFAULT_ADMIN" assertions across DeployProtocol / GovernanceLifecycle / GenesisBuyback; added acceptance tests that grantRole(GOVERNANCE_ROLE, x) reverts post-handoff and that governance can rotate PAUSER.

Verification

  • forge test — 851 passed, 0 failed, 12 skipped.
  • forge fmt --check, FOUNDRY_PROFILE=ci forge build --sizes --deny-warnings — clean (no EIP-170 regressions).
  • aderyn — 4 high findings, all pre-existing in files/lines untouched by this change (constructors vs. PublisherRegistry/BuybackBurnerBalancerV3/CapacityBond:1009/1033); none introduced.
  • slither not installed locally — relying on CI (change adds no external-call/arithmetic/reentrancy surface, only role-admin config and standard OZ _setRoleAdmin/renounceRole/getRoleAdmin).

Rationale and the A/B/C analysis (including the correction to C's "no added risk" claim) are in the #2028 thread.

🤖 Generated with Claude Code

…to GOVERNANCE_ROLE (#2028)

DEFAULT_ADMIN_ROLE is the admin of every other role, so a holder can
grantRole(GOVERNANCE_ROLE, anyEOA) and hand a fresh account the whole
governance surface with no vote and no timelock delay — the master-key
bypass of every other hardening in the milestone. It turns a transient,
vote-gated capture into a permanent, unilateral one.

Fix (#2028 option B, extended): the deploy hands GOVERNANCE_ROLE to the
Timelock and then renounces DEFAULT_ADMIN_ROLE to no one, freezing the
role table. The roles that genuinely need rotation — PAUSER_ROLE,
EMERGENCY_MULTISIG_ROLE, KEEPER_ROLE — are re-homed in each constructor
to GOVERNANCE_ROLE admin, so a compromised off-chain key is still
rotatable through a timelocked proposal while GOVERNANCE_ROLE itself
stays frozen (migration = redeploy). This keeps the deliberate indefinite
pause kill-switch evictable if the pauser is ever compromised.

- Constructors: _setRoleAdmin(role, GOVERNANCE_ROLE) for PAUSER on the six
  Pausable contracts, EMERGENCY_MULTISIG on ContentBlacklist + SlashAppeal,
  KEEPER on BuybackBurner. REGIONAL_BODY_ROLE needs no rescope (granted via
  internal _grantRole in governance-gated registerRegionalBody).
- BaseProtocolDeploy: handoff renounces DEFAULT_ADMIN_ROLE (last op per
  target); _assertNoBackDoors asserts no holder; _assertPeerRolesWired /
  _assertBuybackActivated assert each rotatable role's admin is GOVERNANCE_ROLE.
- ActivateBuyback runbook: prints a third Timelock renounceRole step so a
  post-launch burner freezes its admin too.
- ADR 016/011/018 updated to the renounced-admin model (present-tense canon).
- Tests: flipped the "Timelock holds DEFAULT_ADMIN" assertions; added
  acceptance tests that grantRole(GOVERNANCE_ROLE, x) reverts post-handoff
  and that governance can rotate PAUSER.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 17, 2026 13:38
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.61% (2570/2868 lines)
▼ -0.12pp vs base (89.73% → 89.61%)
Run: 35230404175

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

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.

🟡 Changes recommended

A few newly added/updated comments are technically inaccurate or misleading (especially in deploy/runbook code), which should be corrected to avoid operational confusion around the new security invariants.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR hardens the Solidity governance/role model by eliminating DEFAULT_ADMIN_ROLE as a post-deploy “master key” across governed contracts, while preserving timelock-rotatable control for a minimal set of operational off-chain-key roles.

Changes:

  • Renounce DEFAULT_ADMIN_ROLE at deploy end across governed targets to freeze the role table and prevent post-handoff grantRole(GOVERNANCE_ROLE, …) bypasses.
  • Re-scope rotatable operational roles (e.g. PAUSER_ROLE, EMERGENCY_MULTISIG_ROLE, KEEPER_ROLE) so their admin is GOVERNANCE_ROLE.
  • Strengthen deploy assertions/runbook + update tests and ADRs to reflect the new invariants.
File summaries
File Description
contracts/src/SlashJudge.sol Sets PAUSER_ROLE admin to GOVERNANCE_ROLE in constructor to keep pauser rotatable post-freeze.
contracts/src/SlashAppeal.sol Sets PAUSER_ROLE/EMERGENCY_MULTISIG_ROLE admin to GOVERNANCE_ROLE in constructor.
contracts/src/PaymentPool.sol Sets PAUSER_ROLE admin to GOVERNANCE_ROLE in constructor and documents frozen-governance implications.
contracts/src/FeeRouter.sol Sets PAUSER_ROLE admin to GOVERNANCE_ROLE in constructor.
contracts/src/ContentBlacklist.sol Sets EMERGENCY_MULTISIG_ROLE admin to GOVERNANCE_ROLE in constructor; clarifies regional-body grant path.
contracts/src/CapacityBond.sol Sets PAUSER_ROLE admin to GOVERNANCE_ROLE in constructor.
contracts/src/BuybackBurner.sol Sets PAUSER_ROLE/KEEPER_ROLE admin to GOVERNANCE_ROLE in constructor.
contracts/script/BaseProtocolDeploy.s.sol Renounces DEFAULT_ADMIN_ROLE per target in handoff loop; adds deploy-time assertions for role-admin scoping.
contracts/script/ActivateBuyback.s.sol Prints an additional timelock step to renounce burner DEFAULT_ADMIN_ROLE during non-genesis activation.
contracts/test/DeployProtocol.t.sol Updates role-matrix tests and adds acceptance tests for post-handoff governance immutability + pauser rotation.
contracts/test/GovernanceLifecycle.t.sol Updates lifecycle assertions to require DEFAULT_ADMIN_ROLE has no holder post-deploy.
contracts/test/GenesisBuybackActivation.t.sol Updates genesis buyback activation assertions to require burner admin renounced and admins scoped to governance.
adr/016-contract-interactions.md Updates contract inventory and access-control matrix to reflect renounced-default-admin model and role admin scoping.
adr/018-liquidity-strategy.md Updates activation runbook description to include burner DEFAULT_ADMIN_ROLE renounce step.
adr/011-content-takedown.md Updates governance-holder references from DEFAULT_ADMIN_ROLE to GOVERNANCE_ROLE consistent with new model.
Review details

Suppressed comments (1)

contracts/script/BaseProtocolDeploy.s.sol:945

  • This doc comment still describes these as “DEFAULT_ADMIN_ROLE-bearing targets handed off to the Timelock”, but DEFAULT_ADMIN_ROLE is no longer handed off; it is renounced on each target in the handoff loop. Updating the wording helps avoid confusion when extending the governed-target set.
    /// @dev The nine GOVERNANCE_ROLE/DEFAULT_ADMIN_ROLE-bearing targets handed
    ///      off to the Timelock (router, bond, blacklist, slashAppeal, registry,
    ///      paymentPool, slashJudge, originAssignment, vettingPolicy) — single
  • Files reviewed: 15/15 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread contracts/script/ActivateBuyback.s.sol Resolved
alpergundogdu and others added 2 commits September 17, 2026 14:55
The DEFAULT_ADMIN_ROLE renounce + constructor _setRoleAdmin calls + new
deploy assertions shift deterministic deploy/handoff gas. Regenerated via
`FOUNDRY_PROFILE=ci forge snapshot --snap .gas-snapshot`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- ActivateBuyback: state OZ renounceRole's second arg must equal msg.sender,
  rather than describing it loosely as "the account argument".
- BaseProtocolDeploy: the DEFAULT_ADMIN_ROLE check covers the deployer (held it
  transiently) and the Timelock (never granted it here), not "addresses that
  ever held it"; _governedTargets docstring now says GOVERNANCE_ROLE is handed
  off and DEFAULT_ADMIN_ROLE is renounced, not both handed to the Timelock.

Comment-only; no logic or gas change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu merged commit cb4fc40 into main Sep 17, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/pauser-role-governance-capture-bf5b9e branch September 17, 2026 14: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.

[security] Lock down DEFAULT_ADMIN_ROLE after deploy — grantRole is a capture bypass

2 participants