Skip to content
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

Member self rotation #315

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
55e52cf
Added first pass of self rotation
yahgwai Sep 27, 2024
1685791
Commented out old rotation test
yahgwai Sep 27, 2024
68a5a52
Added tests and min rotation setter
yahgwai Oct 2, 2024
2a30471
Formatting
yahgwai Oct 2, 2024
30f79eb
Formatted tests
yahgwai Oct 2, 2024
e6e3c80
Updated snapshot
yahgwai Oct 2, 2024
066c5b8
Gas checks
yahgwai Oct 2, 2024
821ea93
Merge from main
yahgwai Oct 3, 2024
5b12e6d
First draft of rotation upgrade action
yahgwai Oct 3, 2024
5c871aa
Added member removal action
yahgwai Oct 3, 2024
cd3608e
Added 712 init to postupgradeinit
yahgwai Oct 3, 2024
956d707
Merge remote-tracking branch 'ArbitrumFoundation/main' into sc-rotation
gzeoneth Oct 3, 2024
5d37f89
chore: update storage and 4bytes
gzeoneth Oct 3, 2024
3dd1d3f
Own 712 update
yahgwai Oct 3, 2024
e6b9e80
Merge branch 'sc-rotation' of https://github.com/ArbitrumFoundation/g…
yahgwai Oct 3, 2024
717b0e7
Snapshot update
yahgwai Oct 3, 2024
bb72192
Updated test.bash to include arb timelock
yahgwai Oct 3, 2024
cb5dae1
Reduced the storage gap
yahgwai Oct 3, 2024
d1ff738
Updated gap storage file
yahgwai Oct 3, 2024
b057634
Updated sigs
yahgwai Oct 3, 2024
162f0a2
Merge branch 'sc-rotation' into sc-rotation-upgrade
yahgwai Oct 3, 2024
7ba9c8a
Rotate members test
yahgwai Oct 4, 2024
d8a3cd4
Formatting
yahgwai Oct 4, 2024
1c58ab9
Added cancel timelock and rotate test
yahgwai Oct 4, 2024
91cc2a8
Updated test
yahgwai Oct 4, 2024
d4e204e
File rename
yahgwai Oct 7, 2024
315f7f2
Removed dao constitution
yahgwai Oct 7, 2024
057638b
Formatting
yahgwai Oct 7, 2024
9fc3dd5
Updates from code review
yahgwai Oct 7, 2024
73593e4
Updated snapshot
yahgwai Oct 7, 2024
bc7bfa8
Merge branch 'sc-rotation' into sc-rotation-upgrade
yahgwai Oct 7, 2024
2728de6
Updated snapshot
yahgwai Oct 7, 2024
003401f
Removed block fork
yahgwai Oct 7, 2024
538b2a2
Removed the roll block forking
yahgwai Oct 7, 2024
34a2b6b
Inlined proxy util
yahgwai Oct 10, 2024
65d95fa
Merge pull request #318 from ArbitrumFoundation/sc-rotation-upgrade
yahgwai Oct 10, 2024
2838626
Updated reference
yahgwai Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 158 additions & 153 deletions .gas-snapshot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ coverage :; forge coverage
gas :; forge test --gas-report
gas-check :; forge snapshot --check --tolerance 1
snapshot :; forge snapshot
test-unit :; forge test -vvv
test-unit :; ARB_RPC_URL=https://arb1.arbitrum.io/rpc forge test -vvv
clean :; forge clean
fmt :; forge fmt
gen-network :; yarn gen:network
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "../../address-registries/L2AddressRegistryInterfaces.sol";
import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol";

/// @notice Upgrades the sec council manager to allow member rotation and sets min rotation vars
contract RotateMembersUpgradeAction {
IL2AddressRegistry public immutable l2AddressRegistry;
address public immutable secCouncilManagerImpl;
uint256 public immutable minRotationPeriod;
address public immutable minRotationPeriodSetter;

constructor(
IL2AddressRegistry _l2AddressRegistry,
address _secCouncilManagerImpl,
uint256 _minRotationPeriod,
address _minRotationPeriodSetter
) {
l2AddressRegistry = _l2AddressRegistry;
secCouncilManagerImpl = _secCouncilManagerImpl;
minRotationPeriod = _minRotationPeriod;
minRotationPeriodSetter = _minRotationPeriodSetter;
}

function perform() external {
ISecurityCouncilManager secCouncilManager = l2AddressRegistry.securityCouncilManager();
l2AddressRegistry.govProxyAdmin().upgradeAndCall(
TransparentUpgradeableProxy(payable(address(secCouncilManager))),
secCouncilManagerImpl,
abi.encodeCall(
ISecurityCouncilManager(secCouncilManagerImpl).postUpgradeInit,
(minRotationPeriod, minRotationPeriodSetter)
)
);

require(
minRotationPeriod == secCouncilManager.minRotationPeriod(),
"RotateMembersUpgradeAction: Min rotation period not set"
);
require(
IAccessControlUpgradeable(address(secCouncilManager)).hasRole(
secCouncilManager.MIN_ROTATION_PERIOD_SETTER_ROLE(), minRotationPeriodSetter
),
"RotateMembersUpgradeAction: Min rotation period setter not set"
);
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "./L2AddressRegistryInterfaces.sol";

contract L2AddressRegistry is IL2AddressRegistry {
IL2ArbitrumGoverner public immutable coreGov;
IL2ArbitrumGoverner public immutable treasuryGov;
IFixedDelegateErc20Wallet public immutable treasuryWallet;
IArbitrumDAOConstitution public immutable arbitrumDAOConstitution;
ProxyAdmin public immutable govProxyAdmin;
ISecurityCouncilNomineeElectionGovernor public immutable scNomineeElectionGovernor;

constructor(
IL2ArbitrumGoverner _coreGov,
IL2ArbitrumGoverner _treasuryGov,
IFixedDelegateErc20Wallet _treasuryWallet,
IArbitrumDAOConstitution _arbitrumDAOConstitution
IArbitrumDAOConstitution _arbitrumDAOConstitution,
ProxyAdmin _govProxyAdmin,
ISecurityCouncilNomineeElectionGovernor _scNomineeElectionGovernor
) {
require(
_treasuryWallet.owner() == _treasuryGov.timelock(),
Expand All @@ -27,6 +32,13 @@ contract L2AddressRegistry is IL2AddressRegistry {
treasuryGov = _treasuryGov;
treasuryWallet = _treasuryWallet;
arbitrumDAOConstitution = _arbitrumDAOConstitution;
require(
_govProxyAdmin.getProxyAdmin(TransparentUpgradeableProxy(payable(address(_coreGov))))
== address(_govProxyAdmin),
"GovProxyAdmin must be proxy admin of the core governor"
);
govProxyAdmin = _govProxyAdmin;
scNomineeElectionGovernor = _scNomineeElectionGovernor;
}

function coreGovTimelock() external view returns (IArbitrumTimelock) {
Expand All @@ -40,4 +52,16 @@ contract L2AddressRegistry is IL2AddressRegistry {
function l2ArbitrumToken() external view returns (IL2ArbitrumToken) {
return IL2ArbitrumGoverner(address(coreGov)).token();
}

function scMemberElectionGovernor()
external
view
returns (ISecurityCouncilMemberElectionGovernor)
{
return scNomineeElectionGovernor.securityCouncilMemberElectionGovernor();
}

function securityCouncilManager() external view returns (ISecurityCouncilManager) {
return scNomineeElectionGovernor.securityCouncilManager();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
pragma solidity 0.8.16;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "../../interfaces/IArbitrumTimelock.sol";
import "../../interfaces/IFixedDelegateErc20Wallet.sol";
import "../../interfaces/IL2ArbitrumToken.sol";
import "../../interfaces/IL2ArbitrumGovernor.sol";
import "../../interfaces/IArbitrumDAOConstitution.sol";
import "../../security-council-mgmt/interfaces/ISecurityCouncilManager.sol";
import "../../security-council-mgmt/interfaces/ISecurityCouncilNomineeElectionGovernor.sol";
import "../../security-council-mgmt/interfaces/ISecurityCouncilMemberElectionGovernor.sol";

interface ICoreGovTimelockGetter {
function coreGovTimelock() external view returns (IArbitrumTimelock);
Expand Down Expand Up @@ -36,12 +40,30 @@ interface IArbitrumDAOConstitutionGetter {
function arbitrumDAOConstitution() external view returns (IArbitrumDAOConstitution);
}

interface IGovProxyAdminGetter {
function govProxyAdmin() external view returns (ProxyAdmin);
}

interface ISecurityCouncilGetters {
function securityCouncilManager() external view returns (ISecurityCouncilManager);
function scNomineeElectionGovernor()
external
view
returns (ISecurityCouncilNomineeElectionGovernor);
function scMemberElectionGovernor()
external
view
returns (ISecurityCouncilMemberElectionGovernor);
}

interface IL2AddressRegistry is
ICoreGovGetter,
ICoreGovTimelockGetter,
ITreasuryGovTimelockGetter,
IDaoTreasuryGetter,
ITreasuryGovGetter,
IL2ArbitrumTokenGetter,
IArbitrumDAOConstitutionGetter
IArbitrumDAOConstitutionGetter,
IGovProxyAdminGetter,
ISecurityCouncilGetters
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../address-registries/L2AddressRegistry.sol";
import "./CancelTimelockOperation.sol";

contract CancelTimelockAndRemoveMemberOAction {
IL2AddressRegistry public immutable l2AddressRegistry;

constructor(IL2AddressRegistry _l2AddressRegistry) {
l2AddressRegistry = _l2AddressRegistry;
}

function perform(address memberToRemove, bytes32 operationId) public {
// first remove the council member
ISecurityCouncilManager scm = l2AddressRegistry.securityCouncilManager();
IAccessControlUpgradeable(address(scm)).grantRole(scm.MEMBER_REMOVER_ROLE(), address(this));
scm.removeMember(memberToRemove);
IAccessControlUpgradeable(address(scm)).revokeRole(scm.MEMBER_REMOVER_ROLE(), address(this));

// then cancel the rotation operation in the timelock
CancelTimelockOperation.cancel(l2AddressRegistry.coreGov(), operationId);
}
}
1 change: 1 addition & 0 deletions src/interfaces/IArbitrumTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ interface IArbitrumTimelock {
) external;
function getMinDelay() external view returns (uint256 duration);
function updateDelay(uint256 newDelay) external;
function isOperation(bytes32 id) external view returns (bool registered);
}
Loading
Loading