-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security Council Manager Affordance Change Action #284
Changes from all commits
7c7b46f
17c676a
4e5e6d4
99f69f1
d06b79a
115b737
af13939
bdab94b
adfc064
3580208
39b5dc2
4edff8d
208fd9c
6eb3867
fd26592
704d543
31402a4
92a940b
1d1c684
43431a7
fb72034
2cb8230
199e4f1
275b6a8
7d76dec
8a2ba80
2e7c38c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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/ |
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; | ||
fredlacs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could add checks/verifications after roles are granted for extra layer of safety (even though it's tested in fork test so probably not necessary) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good call |
||
// 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); | ||
fredlacs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// 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"); | ||
} | ||
} |
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)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only consistent with the constitution because we're also making the non emergency governor a 9/12 multisig - so in the future we would need to be careful if we ever reduced the threshold again to move these roles back to the emergency governor.
I dont know how we can guard against. Could do:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could put something in
gotchas.md
orsecurity-council-manager.md
but i'm not sure they would be noticedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually think documenting it should be sufficient, the nonemergency can only do 2 things: queue l2 timelock and call the manager, so when the threshold is changed I would think this would be remembered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lets stick it in the gotchas or something then