forked from ArbitrumFoundation/governance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Security Council Manager Affordance Change Action (ArbitrumFoundation…
…#284) * fix overflow when aliasing * remove commented * remove unused offset var * update forge-std to v1.8.2 * take advantage of skip cheatcode for fork test * GrantRotatorRoleToNonEmergencyCouncil * use l1 timelock alias in test * rename and cleanup * all roles * rename * fix test * update diagram * update docs * gas snapshot * Revert "gas snapshot" This reverts commit fd26592. * use previous forge-std version * use old fork check * gas snapshot * update docs * add checks in perform * update gotchas * update remappings
- Loading branch information
1 parent
be42c9f
commit 8c6a155
Showing
10 changed files
with
108 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
forge-std/=lib/forge-std/src/ | ||
solady/=lib/solady/src/ | ||
|
||
@arbitrum/token-bridge-contracts/=node_modules/@arbitrum/token-bridge-contracts | ||
@arbitrum/token-bridge-contracts/=node_modules/@arbitrum/token-bridge-contracts/ | ||
@arbitrum/nitro-contracts/=node_modules/@arbitrum/nitro-contracts/ | ||
|
||
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/ | ||
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ | ||
@gnosis.pm/safe-contracts/=node_modules/@gnosis.pm/safe-contracts/ | ||
@gnosis.pm/safe-contracts/=node_modules/@gnosis.pm/safe-contracts/ | ||
ds-test/=lib/forge-std/lib/ds-test/src/ |
44 changes: 44 additions & 0 deletions
44
src/gov-action-contracts/nonemergency/SwitchManagerRolesAction.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity 0.8.16; | ||
|
||
import "../../security-council-mgmt/SecurityCouncilManager.sol"; | ||
|
||
/// @notice Grant the non emergency council the MEMBER_ADDER_ROLE, MEMBER_REPLACER_ROLE, MEMBER_ROTATOR_ROLE and MEMBER_REMOVER_ROLE on the SecurityCouncilManager. | ||
/// Revoke those same roles from the emergency council. | ||
contract SwitchManagerRolesAction { | ||
SecurityCouncilManager public constant securityCouncilManager = | ||
SecurityCouncilManager(0xD509E5f5aEe2A205F554f36E8a7d56094494eDFC); | ||
|
||
address public constant nonEmergencyCouncil = 0xADd68bCb0f66878aB9D37a447C7b9067C5dfa941; | ||
address public constant emergencyCouncil = 0x423552c0F05baCCac5Bfa91C6dCF1dc53a0A1641; | ||
|
||
bytes32 public immutable MEMBER_ADDER_ROLE = securityCouncilManager.MEMBER_ADDER_ROLE(); | ||
bytes32 public immutable MEMBER_REPLACER_ROLE = securityCouncilManager.MEMBER_REPLACER_ROLE(); | ||
bytes32 public immutable MEMBER_ROTATOR_ROLE = securityCouncilManager.MEMBER_ROTATOR_ROLE(); | ||
bytes32 public immutable MEMBER_REMOVER_ROLE = securityCouncilManager.MEMBER_REMOVER_ROLE(); | ||
|
||
function perform() public { | ||
// grant roles to non emergency council | ||
securityCouncilManager.grantRole(MEMBER_ADDER_ROLE, nonEmergencyCouncil); | ||
securityCouncilManager.grantRole(MEMBER_REPLACER_ROLE, nonEmergencyCouncil); | ||
securityCouncilManager.grantRole(MEMBER_ROTATOR_ROLE, nonEmergencyCouncil); | ||
securityCouncilManager.grantRole(MEMBER_REMOVER_ROLE, nonEmergencyCouncil); | ||
|
||
// revoke roles from emergency council | ||
securityCouncilManager.revokeRole(MEMBER_ADDER_ROLE, emergencyCouncil); | ||
securityCouncilManager.revokeRole(MEMBER_REPLACER_ROLE, emergencyCouncil); | ||
securityCouncilManager.revokeRole(MEMBER_ROTATOR_ROLE, emergencyCouncil); | ||
securityCouncilManager.revokeRole(MEMBER_REMOVER_ROLE, emergencyCouncil); | ||
|
||
// ensure roles were changed | ||
require(securityCouncilManager.hasRole(MEMBER_ADDER_ROLE, nonEmergencyCouncil), "Adder role not granted"); | ||
require(securityCouncilManager.hasRole(MEMBER_REPLACER_ROLE, nonEmergencyCouncil), "Replacer role not granted"); | ||
require(securityCouncilManager.hasRole(MEMBER_ROTATOR_ROLE, nonEmergencyCouncil), "Rotator role not granted"); | ||
require(securityCouncilManager.hasRole(MEMBER_REMOVER_ROLE, nonEmergencyCouncil), "Remover role not granted"); | ||
|
||
require(!securityCouncilManager.hasRole(MEMBER_ADDER_ROLE, emergencyCouncil), "Adder role not revoked"); | ||
require(!securityCouncilManager.hasRole(MEMBER_REPLACER_ROLE, emergencyCouncil), "Replacer role not revoked"); | ||
require(!securityCouncilManager.hasRole(MEMBER_ROTATOR_ROLE, emergencyCouncil), "Rotator role not revoked"); | ||
require(!securityCouncilManager.hasRole(MEMBER_REMOVER_ROLE, emergencyCouncil), "Remover role not revoked"); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity 0.8.16; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import "../../src/gov-action-contracts/nonemergency/SwitchManagerRolesAction.sol"; | ||
|
||
contract SwitchManagerRolesActionTest is Test { | ||
UpgradeExecutor arbOneUe = UpgradeExecutor(0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827); | ||
|
||
function testAction() external { | ||
if (!isFork()) { | ||
console.log("not fork test, skipping SwitchManagerRolesActionTest"); | ||
return; | ||
} | ||
|
||
SwitchManagerRolesAction gac = new SwitchManagerRolesAction(); | ||
|
||
address emergencyCouncil = gac.emergencyCouncil(); | ||
address nonEmergencyCouncil = gac.nonEmergencyCouncil(); | ||
SecurityCouncilManager manager = gac.securityCouncilManager(); | ||
|
||
vm.prank(0xf7951D92B0C345144506576eC13Ecf5103aC905a); // L1 Timelock Alias | ||
arbOneUe.execute(address(gac), abi.encodeWithSignature("perform()")); | ||
|
||
assertTrue(manager.hasRole(manager.MEMBER_ADDER_ROLE(), nonEmergencyCouncil)); | ||
assertTrue(manager.hasRole(manager.MEMBER_REPLACER_ROLE(), nonEmergencyCouncil)); | ||
assertTrue(manager.hasRole(manager.MEMBER_ROTATOR_ROLE(), nonEmergencyCouncil)); | ||
assertTrue(manager.hasRole(manager.MEMBER_REMOVER_ROLE(), nonEmergencyCouncil)); | ||
|
||
assertFalse(manager.hasRole(manager.MEMBER_ADDER_ROLE(), emergencyCouncil)); | ||
assertFalse(manager.hasRole(manager.MEMBER_REPLACER_ROLE(), emergencyCouncil)); | ||
assertFalse(manager.hasRole(manager.MEMBER_ROTATOR_ROLE(), emergencyCouncil)); | ||
assertFalse(manager.hasRole(manager.MEMBER_REMOVER_ROLE(), emergencyCouncil)); | ||
} | ||
} |