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

upgrade arbos action contracts #170

Merged
merged 19 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
14 changes: 7 additions & 7 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ L1ArbitrumTokenTest:testInitZeroNovaGateway() (gas: 3177210)
L1ArbitrumTokenTest:testInitZeroNovaRouter() (gas: 3177144)
L1ArbitrumTokenTest:testRegisterTokenOnL2() (gas: 4568521)
L1ArbitrumTokenTest:testRegisterTokenOnL2NotEnoughVal() (gas: 4425708)
L1GovernanceFactoryTest:testL1GovernanceFactory() (gas: 10226950)
L1GovernanceFactoryTest:testL1GovernanceFactory() (gas: 10226942)
L1GovernanceFactoryTest:testSetMinDelay() (gas: 10201836)
L1GovernanceFactoryTest:testSetMinDelayRevertsForCoreAddress() (gas: 10254791)
L2AddressRegistryTest:testAddressRegistryAddress() (gas: 54658)
Expand Down Expand Up @@ -91,14 +91,14 @@ L2GovernanceFactoryTest:testSanityCheckValues() (gas: 28415663)
L2GovernanceFactoryTest:testSetMinDelay() (gas: 28364376)
L2GovernanceFactoryTest:testSetMinDelayRevertsForCoreAddress() (gas: 28417247)
L2GovernanceFactoryTest:testUpgraderCanCancel() (gas: 28657360)
OutboxActionsTest:testAddOutbxesAction() (gas: 651591)
OutboxActionsTest:testCantAddEOA() (gas: 969161)
OutboxActionsTest:testCantReAddOutbox() (gas: 974559)
OutboxActionsTest:testRemoveAllOutboxes() (gas: 693238)
OutboxActionsTest:testRemoveOutboxes() (gas: 854205)
OutboxActionsTest:testAddOutbxesAction() (gas: 651420)
OutboxActionsTest:testCantAddEOA() (gas: 968990)
OutboxActionsTest:testCantReAddOutbox() (gas: 974388)
OutboxActionsTest:testRemoveAllOutboxes() (gas: 692972)
OutboxActionsTest:testRemoveOutboxes() (gas: 853926)
ProxyUpgradeAndCallActionTest:testUpgrade() (gas: 137095)
ProxyUpgradeAndCallActionTest:testUpgradeAndCall() (gas: 143042)
SequencerActionsTest:testAddAndRemoveSequencer() (gas: 483356)
SequencerActionsTest:testAddAndRemoveSequencer() (gas: 483444)
SequencerActionsTest:testCantAddZeroAddress() (gas: 235614)
SetInitialGovParamsActionTest:testL1() (gas: 259904)
SetInitialGovParamsActionTest:testL2() (gas: 688888)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"typescript": "^4.8.4"
},
"dependencies": {
"@arbitrum/nitro-contracts": "1.0.1",
"@arbitrum/nitro-contracts": "1.0.3-beta.0",
"@arbitrum/token-bridge-contracts": "1.0.0-beta.0",
"@openzeppelin/contracts": "4.7.3",
"@openzeppelin/contracts-upgradeable": "4.7.3",
Expand Down
2 changes: 1 addition & 1 deletion src/L1ArbitrumMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ abstract contract L1ArbitrumMessenger {
}

/// @dev the l2ToL1Sender behaves as the tx.origin, the msg.sender should be validated to protect against reentrancies
function getL2ToL1Sender(address _inbox) internal returns (address) {
function getL2ToL1Sender(address _inbox) internal view returns (address) {
IOutbox outbox = IOutbox(getBridge(_inbox).activeOutbox());
address l2ToL1Sender = outbox.l2ToL1Sender();

Expand Down
4 changes: 2 additions & 2 deletions src/gov-action-contracts/AIPs/AIP1Point1Target.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pragma solidity 0.8.16;
/// and for bookkeeping.
/// @dev note that this is not a "Gov Action" contract and thus does not conform to that standard.
contract AIP1Point1Target {
address immutable public treasuryTimelock;
address immutable public arbitrumFoundationWallet;
address public immutable treasuryTimelock;
address public immutable arbitrumFoundationWallet;

bool public passed = false;

Expand Down
6 changes: 4 additions & 2 deletions src/gov-action-contracts/AIPs/AIP1Point2Action.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ contract AIP1Point2Action {
);
}

function setProposalThreshold(IL2ArbitrumGoverner gov, uint256 newProposalThreshold) internal {
function setProposalThreshold(IL2ArbitrumGoverner gov, uint256 _newProposalThreshold)
internal
{
bytes memory setProposalThresholdCalldata = abi.encodeWithSelector(
IL2ArbitrumGoverner.setProposalThreshold.selector, newProposalThreshold
IL2ArbitrumGoverner.setProposalThreshold.selector, _newProposalThreshold
);
gov.relay(address(gov), 0, setProposalThresholdCalldata);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../../address-registries/L1AddressRegistry.sol";

/// @notice should be included in an operation batch in the L1 timelock along with UpgradeArbOSVersionAction
contract SetWasmModuleRootAction {
DZGoldman marked this conversation as resolved.
Show resolved Hide resolved
address public immutable rollup;
bytes32 public immutable newWasmModuleRoot;

constructor(L1AddressRegistry _l1AddressRegistry, bytes32 _newWasmModuleRoot) {
rollup = address(_l1AddressRegistry.rollup());
newWasmModuleRoot = _newWasmModuleRoot;
}

function perform() external {
IRollupAdmin(rollup).setWasmModuleRoot(newWasmModuleRoot);

// verify:
require(
IRollupCore(rollup).wasmModuleRoot() == newWasmModuleRoot,
"SetWasmModuleRootAction: wasm module root not set"
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "@arbitrum/nitro-contracts/src/precompiles/ArbOwner.sol";

/// @notice should be included in an operation batch in the L1 timelock along with SetWasmModuleRootAction
contract UpgradeArbOSVersionAction {
DZGoldman marked this conversation as resolved.
Show resolved Hide resolved
uint64 public immutable newArbOSVersion;
uint64 public immutable upgradeTimeDelaySeconds;

constructor(uint64 _newArbOSVersion, uint64 _upgradeTimeDelaySeconds) {
newArbOSVersion = _newArbOSVersion;
upgradeTimeDelaySeconds = _upgradeTimeDelaySeconds;
}

function perform() external {
ArbOwner arbOwner = ArbOwner(0x0000000000000000000000000000000000000070);
arbOwner.scheduleArbOSUpgrade({
newVersion: newArbOSVersion,
timestamp: uint64(block.timestamp) + upgradeTimeDelaySeconds
});
}
}
12 changes: 2 additions & 10 deletions src/gov-action-contracts/address-registries/interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ import "@arbitrum/nitro-contracts/src/bridge/IBridge.sol";
import "@arbitrum/nitro-contracts/src/bridge/IInbox.sol";
import "@arbitrum/nitro-contracts/src/bridge/IOutbox.sol";
import "@arbitrum/nitro-contracts/src/bridge/ISequencerInbox.sol";

interface IRollupCore {
function pause() external;
function resume() external;
function forceResolveChallenge(address[] memory stackerA, address[] memory stackerB) external;
function outbox() external view returns (IOutbox);
function setOutbox(IOutbox _outbox) external;
function setValidator(address[] memory _validator, bool[] memory _val) external;
function setValidatorWhitelistDisabled(bool _validatorWhitelistDisabled) external;
}
import "@arbitrum/nitro-contracts/src/rollup/IRollupAdmin.sol";
import "@arbitrum/nitro-contracts/src/rollup/IRollupLogic.sol";

interface IL1Timelock {
function updateDelay(uint256 newDelay) external;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract EnableValidatorWhitelistAction {
}

function perform() external {
addressRegistry.rollup().setValidatorWhitelistDisabled(false);
IRollupAdmin(address(addressRegistry.rollup())).setValidatorWhitelistDisabled(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract ForceResolveChallengeAction {
}

function perform(address[] calldata stakerA, address[] calldata stakerB) external {
addressRegistry.rollup().forceResolveChallenge(stakerA, stakerB);
IRollupAdmin(address(addressRegistry.rollup())).forceResolveChallenge(stakerA, stakerB);
}
}
2 changes: 1 addition & 1 deletion src/gov-action-contracts/rollup/PauseRollupAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract PauseRollupAction {
}

function perform() external {
addressRegistry.rollup().pause();
IRollupAdmin(address(addressRegistry.rollup())).pause();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract DisableValidatorWhitelistAction {
}

function perform() external {
addressRegistry.rollup().setValidatorWhitelistDisabled(true);
IRollupAdmin(address(addressRegistry.rollup())).setValidatorWhitelistDisabled(true);
}
}
2 changes: 1 addition & 1 deletion src/gov-action-contracts/rollup/SetValidatorsAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract SetValidatorsAction {
}

function perform(address[] calldata _validators, bool[] calldata _values) external {
addressRegistry.rollup().setValidator(_validators, _values);
IRollupAdmin(address(addressRegistry.rollup())).setValidator(_validators, _values);
}
}
2 changes: 1 addition & 1 deletion src/gov-action-contracts/rollup/UnpauseRollupAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ contract UnpauseRollupAction {
}

function perform() external {
addressRegistry.rollup().resume();
IRollupAdmin(address(addressRegistry.rollup())).resume();
}
}
2 changes: 1 addition & 1 deletion src/gov-action-contracts/set-outbox/OutboxActionLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ library OutboxActionLib {
require(
Address.isContract(address(outbox)), "SetRollupOutboxAction: outbox must be contract"
);
addressRegistry.rollup().setOutbox(outbox);
IRollupAdmin(address(addressRegistry.rollup())).setOutbox(outbox);
}
}
2 changes: 1 addition & 1 deletion src/interfaces/IArbitrumDAOConstitution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ interface IArbitrumDAOConstitution {
function constitutionHash() external view returns (bytes32);
function setConstitutionHash(bytes32 _constitutionHash) external;
function owner() external view returns (address);
}
}
2 changes: 1 addition & 1 deletion test/L1GovernanceFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract L1GovernanceFactoryTest is Test {
assertEq(timelock.governanceChainInbox(), address(inbox), "timelock inbox set");
assertEq(timelock.l2Timelock(), l2Timelock, "timelock l2Timelock set");
assertEq(timelock.getMinDelay(), minDelay, "timelock minDelay set");
address[] memory proposers;
// address[] memory proposers;
address[] memory executors;
vm.expectRevert("Initializable: contract is already initialized");
timelock.initialize(minDelay, executors, address(inbox), l2Timelock);
Expand Down
3 changes: 3 additions & 0 deletions test/util/InboxMock.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../../src/L1ArbitrumTimelock.sol";

contract InboxMock is IInboxSubmissionFee {
Expand Down
9 changes: 4 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
resolved "https://registry.yarnpkg.com/@aduh95/viz.js/-/viz.js-3.7.0.tgz#a20d86c5fc8f6abebdc39b96a4326e10375d77c0"
integrity sha512-20Pk2Z98fbPLkECcrZSJszKos/OgtvJJR3NcbVfgCJ6EQjDNzW2P1BKqImOz3tJ952dvO2DWEhcLhQ1Wz1e9ng==

"@arbitrum/nitro-contracts@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@arbitrum/nitro-contracts/-/nitro-contracts-1.0.1.tgz#c9b4e6fba7375f8a2e7cacbda8248870bef2d61b"
integrity sha512-gNbtcWM1QkLPYs4nxvC1RnoHqcg+uk6acs11C4XRcp77vC72izpQ1+4GqMVXV6viHCNquz8posG9rButW8nHFw==
"@arbitrum/nitro-contracts@1.0.3-beta.0":
version "1.0.3-beta.0"
resolved "https://registry.yarnpkg.com/@arbitrum/nitro-contracts/-/nitro-contracts-1.0.3-beta.0.tgz#ab6bb7bd2cef453b0d7748a7b13d1d04e62fd286"
integrity sha512-AjUSGSSL9V5cgxHFGVEfRugNnjJ1aCeJOHsedjWt25carFk9bf2eOQhclH92VcZticj7+NZM9aWVCI6fzfipvg==
dependencies:
"@openzeppelin/contracts" "4.5.0"
"@openzeppelin/contracts-upgradeable" "4.5.2"
hardhat "^2.6.6"
patch-package "^6.4.7"
optionalDependencies:
sol2uml "2.2.0"
Expand Down