Repository navigation
feat(contracts)!: renounce DEFAULT_ADMIN_ROLE, scope rotatable roles to GOVERNANCE_ROLE (#2028) - #2042
Conversation
…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]>
Contracts coverageLine coverage: 89.61% (2570/2868 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
🟡 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_ROLEat deploy end across governed targets to freeze the role table and prevent post-handoffgrantRole(GOVERNANCE_ROLE, …)bypasses. - Re-scope rotatable operational roles (e.g.
PAUSER_ROLE,EMERGENCY_MULTISIG_ROLE,KEEPER_ROLE) so their admin isGOVERNANCE_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.
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]>
Closes #2028.
Problem
DEFAULT_ADMIN_ROLEis the admin of every other role. Held by the Timelock post-handoff, it is a master key: a captured governance cangrantRole(GOVERNANCE_ROLE, attackerEOA)and hand a fresh account the entire governance surface with no vote and no 48h timelock delay (every governance setter isonlyRole(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_ROLEto no one at deploy end (freezing the role table), but re-home the genuinely-rotatable off-chain-key roles toGOVERNANCE_ROLEadmin so a compromised key stays evictable via a timelocked proposal:GOVERNANCE_ROLEadmin: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 forVETTER_ROLE.GOVERNANCE_ROLE(its admin is the now-unheldDEFAULT_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_ROLEneeds no rescope (granted via internal_grantRolein governance-gatedregisterRegionalBody, which bypasses the admin check).The deliberate indefinite pause kill-switch is unchanged — keeping
PAUSER_ROLErotatable is exactly what lets a compromised pauser be evicted while an intentional pause-and-abandon still works.Changes
_setRoleAdmin(role, GOVERNANCE_ROLE)for the rescoped roles.BaseProtocolDeploy: handoff renouncesDEFAULT_ADMIN_ROLE(last role op per target);_assertNoBackDoorsasserts no address holds it;_assertPeerRolesWired/_assertBuybackActivatedassert each rotatable role's admin isGOVERNANCE_ROLE(a dropped_setRoleAdminwould otherwise silently freeze the role — this fails the deploy loudly).ActivateBuybackrunbook: prints a third TimelockrenounceRole(DEFAULT_ADMIN_ROLE, timelock)step so a post-launch burner freezes its admin too.grantRole(GOVERNANCE_ROLE, x)reverts post-handoff and that governance can rotatePAUSER.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.slithernot 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