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

Use latest upgrade executor #319

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@arbitrum/nitro-contracts": "1.1.1",
"@arbitrum/token-bridge-contracts": "1.0.0-beta.0",
"@gnosis.pm/safe-contracts": "1.3.0",
"@offchainlabs/upgrade-executor": "1.1.1",
gzeoneth marked this conversation as resolved.
Show resolved Hide resolved
"@openzeppelin/contracts": "4.7.3",
"@openzeppelin/contracts-upgradeable": "4.7.3",
"@types/yargs": "^17.0.17",
Expand Down
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
forge-std/=lib/forge-std/src/
solady/=lib/solady/src/
@offchainlabs/upgrade-executor/=node_modules/@offchainlabs/upgrade-executor/
@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/
Expand Down
2 changes: 1 addition & 1 deletion src/L1GovernanceFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.16;

import "./L1ArbitrumTimelock.sol";
import "./UpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/L2GovernanceFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.16;
import "./L2ArbitrumToken.sol";
import "./L2ArbitrumGovernor.sol";
import "./ArbitrumTimelock.sol";
import "./UpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";
import "./FixedDelegateErc20Wallet.sol";
import "./ArbitrumDAOConstitution.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/UpgradeExecRouteBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.16;

import "@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol";
import "./UpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";
import "./L1ArbitrumTimelock.sol";
import "./security-council-mgmt/Common.sol";

Expand Down
60 changes: 0 additions & 60 deletions src/UpgradeExecutor.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import "../../../security-council-mgmt/interfaces/IGnosisSafe.sol";
import "../../address-registries/L2AddressRegistryInterfaces.sol";
import "./SecurityCouncilMgmtUpgradeLib.sol";
import "../../../interfaces/IArbitrumDAOConstitution.sol";
import "../../../interfaces/IUpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/IUpgradeExecutor.sol";
import "../../../interfaces/ICoreTimelock.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/IAccessControl.sol";

contract GovernanceChainSCMgmtActivationAction {
IGnosisSafe public immutable newEmergencySecurityCouncil;
Expand Down Expand Up @@ -116,11 +117,11 @@ contract GovernanceChainSCMgmtActivationAction {
// confirm updates
bytes32 EXECUTOR_ROLE = upgradeExecutor.EXECUTOR_ROLE();
require(
upgradeExecutor.hasRole(EXECUTOR_ROLE, address(newEmergencySecurityCouncil)),
IAccessControl(address(upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(newEmergencySecurityCouncil)),
"NonGovernanceChainSCMgmtActivationAction: new emergency security council not set"
);
require(
!upgradeExecutor.hasRole(EXECUTOR_ROLE, address(prevEmergencySecurityCouncil)),
!IAccessControl(address(upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(prevEmergencySecurityCouncil)),
"NonGovernanceChainSCMgmtActivationAction: prev emergency security council still set"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.16;

import "../../../security-council-mgmt/interfaces/IGnosisSafe.sol";
import "../../../interfaces/IUpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/IUpgradeExecutor.sol";
import "../../../interfaces/ICoreTimelock.sol";
import "./SecurityCouncilMgmtUpgradeLib.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ contract NonGovernanceChainSCMgmtActivationAction {
// confirm updates
bytes32 EXECUTOR_ROLE = upgradeExecutor.EXECUTOR_ROLE();
require(
upgradeExecutor.hasRole(EXECUTOR_ROLE, address(newEmergencySecurityCouncil)),
IAccessControl(address(upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(newEmergencySecurityCouncil)),
"NonGovernanceChainSCMgmtActivationAction: new emergency security council not set"
);
require(
!upgradeExecutor.hasRole(EXECUTOR_ROLE, address(prevEmergencySecurityCouncil)),
!IAccessControl(address(upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(prevEmergencySecurityCouncil)),
"NonGovernanceChainSCMgmtActivationAction: prev emergency security council still set"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
pragma solidity 0.8.16;

import "../../../security-council-mgmt/interfaces/IGnosisSafe.sol";
import "../../../interfaces/IUpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/IUpgradeExecutor.sol";
import "@openzeppelin/contracts/access/IAccessControl.sol";

library SecurityCouncilMgmtUpgradeLib {
function replaceEmergencySecurityCouncil(
Expand All @@ -14,16 +15,16 @@ library SecurityCouncilMgmtUpgradeLib {
requireSafesEquivalent(_prevSecurityCouncil, _newSecurityCouncil, _threshold);
bytes32 EXECUTOR_ROLE = _upgradeExecutor.EXECUTOR_ROLE();
require(
_upgradeExecutor.hasRole(EXECUTOR_ROLE, address(_prevSecurityCouncil)),
IAccessControl(address(_upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(_prevSecurityCouncil)),
"SecurityCouncilMgmtUpgradeLib: prev council not executor"
);
require(
!_upgradeExecutor.hasRole(EXECUTOR_ROLE, address(_newSecurityCouncil)),
!IAccessControl(address(_upgradeExecutor)).hasRole(EXECUTOR_ROLE, address(_newSecurityCouncil)),
"SecurityCouncilMgmtUpgradeLib: new council already executor"
);

_upgradeExecutor.revokeRole(EXECUTOR_ROLE, address(_prevSecurityCouncil));
_upgradeExecutor.grantRole(EXECUTOR_ROLE, address(_newSecurityCouncil));
IAccessControl(address(_upgradeExecutor)).revokeRole(EXECUTOR_ROLE, address(_prevSecurityCouncil));
IAccessControl(address(_upgradeExecutor)).grantRole(EXECUTOR_ROLE, address(_newSecurityCouncil));
}

function requireSafesEquivalent(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import {UpgradeExecutor} from "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";
import {
ProxyAdmin,
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

contract UpgradeExecutorUpgradeAction {
address public immutable newUpgradeExecutorImplementation;
ProxyAdmin public immutable proxyAdmin;

constructor(address _proxyAdmin) {
proxyAdmin = ProxyAdmin(_proxyAdmin);
newUpgradeExecutorImplementation = address(new UpgradeExecutor());
}

function perform() external {
TransparentUpgradeableProxy proxy = TransparentUpgradeableProxy(payable(address(this)));

proxyAdmin.upgrade(proxy, newUpgradeExecutorImplementation);

require(
proxyAdmin.getProxyImplementation(proxy) == newUpgradeExecutorImplementation,
"UpgradeExecutorUpgradeAction: upgrade failed"
);
}
}

// Proxy Admins:
// Arb1: 0xdb216562328215E010F819B5aBe947bad4ca961e
// Nova: 0xf58eA15B20983116c21b05c876cc8e6CDAe5C2b9
// L1: 0x5613AF0474EB9c528A34701A5b1662E3C8FA0678

contract ArbOneUpgradeExecutorUpgradeAction is UpgradeExecutorUpgradeAction {
constructor() UpgradeExecutorUpgradeAction(0xdb216562328215E010F819B5aBe947bad4ca961e) {}
}

contract NovaUpgradeExecutorUpgradeAction is UpgradeExecutorUpgradeAction {
constructor() UpgradeExecutorUpgradeAction(0xf58eA15B20983116c21b05c876cc8e6CDAe5C2b9) {}
}

contract L1UpgradeExecutorUpgradeAction is UpgradeExecutorUpgradeAction {
constructor() UpgradeExecutorUpgradeAction(0x5613AF0474EB9c528A34701A5b1662E3C8FA0678) {}
}
10 changes: 0 additions & 10 deletions src/interfaces/IUpgradeExecutor.sol

This file was deleted.

2 changes: 1 addition & 1 deletion src/security-council-mgmt/SecurityCouncilManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.16;

import "../ArbitrumTimelock.sol";
import "../UpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";
import "../L1ArbitrumTimelock.sol";
import "./SecurityCouncilMgmtUtils.sol";
import "./interfaces/ISecurityCouncilManager.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.16;
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./modules/SecurityCouncilMemberElectionGovernorCountingUpgradeable.sol";
import "../interfaces/ISecurityCouncilMemberElectionGovernor.sol";
import "../interfaces/ISecurityCouncilNomineeElectionGovernor.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import
"@openzeppelin/contracts-upgradeable/governance/extensions/GovernorCountingSimpleUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./../interfaces/ISecurityCouncilManager.sol";
import "../Common.sol";
import "./modules/ArbitrumGovernorVotesQuorumFractionUpgradeable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.16;

import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/ISecurityCouncilMemberElectionGovernor.sol";
import "../interfaces/ISecurityCouncilNomineeElectionGovernor.sol";
import "./modules/SecurityCouncilNomineeElectionGovernorCountingUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/L2GovernanceFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import "../src/L2GovernanceFactory.sol";
import "../src/L2ArbitrumGovernor.sol";
import "../src/UpgradeExecutor.sol";
import "@offchainlabs/upgrade-executor/src/UpgradeExecutor.sol";
import "../src/ArbitrumTimelock.sol";
import "../src/ArbitrumDAOConstitution.sol";

Expand Down
Loading
Loading