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

pre-deploy various gov action contracts #47

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
11 changes: 11 additions & 0 deletions files/actions/critical-421163.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"l1AddressRegistry": "0x8b194bEae1d3e0788A1a35173978001ACDFba668",
"pauseInboxAction": "0x294BBF03C2596C4a15D613C1748B9D3903CE9C10",
"unpauseInboxAction": "0x8e42E22C091b5b11943F0A454231A5f17099Eb63",
"pauseRollupAction": "0x0CE51000d5244F1EAac0B313a792D5a5f96931BF",
"unpauseRollupAction": "0xb1A19D75C6F7FD8a5A669333dEFEFF2A6390C1Ba",
"bridgeRemoveAllOutboxesAction": "0x67bEb568Da5D69e4436Dbc3a55dd747316F223f9",
"bridgeAddOutboxesAction": "0xd5605Febd7AEaD686F66b2135536bB67Cc286953",
"sequencerAddAction": "0x723ab310FAf6426bCA988308F21AE98649696eD9",
"sequencerRemoveAction": "0x38F32cC18B517814816fC14F84D74967817fAe29"
}
11 changes: 11 additions & 0 deletions files/actions/critical-42161.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"l1AddressRegistry": "0xd514C2b3aaBDBfa10800B9C96dc1eB25427520A0",
"pauseInboxAction": "0x2DC1a2d23d741Cc43fE1e95C904137551D7c33F4",
"unpauseInboxAction": "0x4ac407ebA00B2Be46a685b81e5f0405c576a727E",
"pauseRollupAction": "0x8213d67dBca4F485FceA3F3A00436327c8833214",
"unpauseRollupAction": "0x02C74a956d4E50D4219240869db89780B5baA989",
"bridgeRemoveAllOutboxesAction": "0x6506229cfDFCd414cA648f9a1B720Ed0008B0F48",
"bridgeAddOutboxesAction": "0x2fF2F228784C4407C80D158c0db775034A762d62",
"sequencerAddAction": "0xF8f44E7DA5eC978F69d34F6a566E5836d6107D95",
"sequencerRemoveAction": "0xD46b90c540c52F4e02F57fA3A59A3dff045f0191"
}
11 changes: 11 additions & 0 deletions files/actions/critical-42170.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"l1AddressRegistry": "0xA5d0f3C50421d2671D42214b9ff42d445c436639",
"pauseInboxAction": "0xc48430A412c7AfF5c7822d9535db1b488683e1a0",
"unpauseInboxAction": "0x178aeC1641C2A1c9b0e0cE7074441F982369D6Be",
"pauseRollupAction": "0xf2afa16225510990446233b02EfDF2474E43A88B",
"unpauseRollupAction": "0x12fB735Ad4196729BE7a714CA12d251860A51D68",
"bridgeRemoveAllOutboxesAction": "0xC399A1ebdB291677e0ABf62fd7a18e4cFa422f5F",
"bridgeAddOutboxesAction": "0x4909dF591cE5cD901Ab29138993E9f284cc107eF",
"sequencerAddAction": "0xc9E49E5ca552C52D08e76dc31B7b8B67DADF876f",
"sequencerRemoveAction": "0xf322DAAefDc7c1E522Ad679677E838762C06e1ec"
}
172 changes: 172 additions & 0 deletions scripts/deployCriticalGovActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import {
L1AddressRegistry__factory,
PauseInboxAction__factory,
UnpauseInboxAction__factory,
PauseRollupAction__factory,
UnpauseRollupAction__factory,
BridgeRemoveAllOutboxesAction__factory,
BridgeAddOutboxesAction__factory,
AddSequencerAction__factory,
RemoveSequencerAction__factory,
} from "../typechain-types";
import { ContractVerifier } from "./contractVerifier";
import { Wallet, utils } from "ethers";
import { JsonRpcProvider } from "@ethersproject/providers";
import fs from "fs";

import dotenv from "dotenv";
dotenv.config();
const abi = utils.defaultAbiCoder;

const l1RPC = process.env.ETH_URL;
const apiKey = process.env.VERIFY_API_KEY as string;
const l1Key = process.env.ETH_KEY as string;
const l2ChainID = +(process.env.ARB_CHAIN_ID as string);

interface L1RegistryConstructorArgs {
inbox: string;
govL1Timelock: string;
customGateway: string;
l1GatewayRouter: string;
}

type RegistryArgMamp = {
[key: number]: L1RegistryConstructorArgs;
};

const chainIdToRegistryAddresses: RegistryArgMamp = {
42161: {
inbox: "0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f",
govL1Timelock: "0xE6841D92B0C345144506576eC13ECf5103aC7f49",
customGateway: "0xcEe284F754E854890e311e3280b767F80797180d",
l1GatewayRouter: "0x72Ce9c846789fdB6fC1f34aC4AD25Dd9ef7031ef",
},
421613: {
inbox: "0x6BEbC4925716945D46F0Ec336D5C2564F419682C",
govL1Timelock: "0x364188EcF8E0733cB90d8EbeD90d56E56205dDfE",
customGateway: "0x9fDD1C4E4AA24EEc1d913FABea925594a20d43C7",
l1GatewayRouter: "0x4c7708168395aEa569453Fc36862D2ffcDaC588c",
},
42170: {
inbox: "0xc4448b71118c9071Bcb9734A0EAc55D18A153949",
govL1Timelock: "0xE6841D92B0C345144506576eC13ECf5103aC7f49",
customGateway: "0x23122da8C581AA7E0d07A36Ff1f16F799650232f",
l1GatewayRouter: "0xC840838Bc438d73C16c2f8b22D2Ce3669963cD48",
},
};

interface DeployedContracts {
l1AddressRegistry: string;
pauseInboxAction: string;
unpauseInboxAction: string;
pauseRollupAction: string;
unpauseRollupAction: string;
bridgeRemoveAllOutboxesAction: string;
bridgeAddOutboxesAction: string;
sequencerAddAction: string;
sequencerRemoveAction: string;
}

const deployAll = async () => {
const l1Deployer = new Wallet(l1Key, new JsonRpcProvider(l1RPC));

const hasBal = (await l1Deployer.getBalance()).gt(0);
if (!hasBal) {
throw new Error("L1 deployer has no balance");
}
const chainID = await l1Deployer.getChainId();
if (chainID === 5 && l2ChainID !== 421613) {
console.log(chainID, l2ChainID);

throw new Error("L1 / L2 missmatch");
} else if (chainID === 1 && l2ChainID != 42161 && l2ChainID != 42170) {
throw new Error("L1 / L2 missmatch");
}

const registryConstructorAddresses = chainIdToRegistryAddresses[l2ChainID];
if (!registryConstructorAddresses) {
throw new Error("unsupported chain id");
}

const connectedL1AddressRegistryFactory = new L1AddressRegistry__factory().connect(l1Deployer);
console.log(L1AddressRegistry__factory.name);

const l1AddressRegistry = await connectedL1AddressRegistryFactory.deploy(
registryConstructorAddresses.inbox,
registryConstructorAddresses.govL1Timelock,
registryConstructorAddresses.customGateway,
registryConstructorAddresses.l1GatewayRouter
);
await l1AddressRegistry.deployed();
const l1RegistryAddress = l1AddressRegistry.address;
console.log("deployed: L1AddressRegistry", l1RegistryAddress);
const factories = [
PauseInboxAction__factory,
UnpauseInboxAction__factory,
PauseRollupAction__factory,
UnpauseRollupAction__factory,
BridgeRemoveAllOutboxesAction__factory,
BridgeAddOutboxesAction__factory,
AddSequencerAction__factory,
RemoveSequencerAction__factory,
];

const deploymentsAddresses: string[] = [];
for (let factory of factories) {
const contractFactory = new factory().connect(l1Deployer);
const contract = await contractFactory.deploy(l1RegistryAddress);
await contract.deployed();
const contractAddress = contract.address;
console.log("deployed:", factory.name, contractAddress);
deploymentsAddresses.push(contractAddress);
}
console.log(deploymentsAddresses);

const deployments: DeployedContracts = {
l1AddressRegistry: l1RegistryAddress,
pauseInboxAction: deploymentsAddresses[0],
unpauseInboxAction: deploymentsAddresses[1],
pauseRollupAction: deploymentsAddresses[2],
unpauseRollupAction: deploymentsAddresses[3],
bridgeRemoveAllOutboxesAction: deploymentsAddresses[4],
bridgeAddOutboxesAction: deploymentsAddresses[5],
sequencerAddAction: deploymentsAddresses[6],
sequencerRemoveAction: deploymentsAddresses[7],
};
console.log(deployments);

fs.writeFileSync(`./files/actions/critical-${l2ChainID}.json`, JSON.stringify(deployments));
DZGoldman marked this conversation as resolved.
Show resolved Hide resolved
return deployments;
};

const verifyAll = async () => {
const provider = new JsonRpcProvider(l1RPC);
const chainID = (await provider.getNetwork()).chainId;
const data = fs.readFileSync(`./files/actions/critical-${l2ChainID}.json`);
const deploymentData: DeployedContracts = JSON.parse(data.toString());
const l2Verifier = new ContractVerifier(chainID, apiKey, {});

for (const [key, value] of Object.entries(deploymentData)) {
const registryConstructorAddresses = chainIdToRegistryAddresses[l2ChainID];

const constructorArgs =
key === "l1AddressRegistry"
? abi.encode(
["address", "address", "address", "address"],
[
registryConstructorAddresses.inbox,
registryConstructorAddresses.govL1Timelock,
registryConstructorAddresses.customGateway,
registryConstructorAddresses.l1GatewayRouter,
]
)
: abi.encode(["address"], [deploymentData.l1AddressRegistry]);

await l2Verifier.verifyWithAddress(key, value, constructorArgs);
}
};

(async () => {
await deployAll();
await verifyAll();
})();
50 changes: 50 additions & 0 deletions src/gov-action-contracts/GovActionDeployments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Critical Governance Action Deployments

## L1 Actions

#### For Arb One

- Pause Arb One Inbox: [0x2DC1a2d23d741Cc43fE1e95C904137551D7c33F4](https://etherscan.io/address/0x2DC1a2d23d741Cc43fE1e95C904137551D7c33F4)
- Unpause Arb One Inbox: [0x4ac407ebA00B2Be46a685b81e5f0405c576a727E](https://etherscan/address/0x4ac407ebA00B2Be46a685b81e5f0405c576a727E)
<br/>

- Pause Arb One Rollup: [0x8213d67dBca4F485FceA3F3A00436327c8833214](https://etherscan.io/address/0x8213d67dBca4F485FceA3F3A00436327c8833214)
- Unpause Arb One Rollup: [0x02C74a956d4E50D4219240869db89780B5baA989](https://etherscan.io/address/0x02C74a956d4E50D4219240869db89780B5baA989)
<br/>


- Remove All Arb One Outboxes: [0x6506229cfDFCd414cA648f9a1B720Ed0008B0F48](https://etherscan.io/address/0x6506229cfDFCd414cA648f9a1B720Ed0008B0F48)
- Add Arb One Outboxes: [0x2fF2F228784C4407C80D158c0db775034A762d62](https://etherscan.io/address/0x2fF2F228784C4407C80D158c0db775034A762d62)
<br/>

- Add Arb One Sequencer: [0xF8f44E7DA5eC978F69d34F6a566E5836d6107D95](https://etherscan.io/address/0xF8f44E7DA5eC978F69d34F6a566E5836d6107D95)
- Remove Arb One Sequencer: [0xD46b90c540c52F4e02F57fA3A59A3dff045f0191](https://etherscan.io/address/0xD46b90c540c52F4e02F57fA3A59A3dff045f0191)
<br/>


Arb One Address Registry: [0xA5d0f3C50421d2671D42214b9ff42d445c436639](https://etherscan.io/address/0xA5d0f3C50421d2671D42214b9ff42d445c436639)


#### For Nova

- Pause Nova Inbox: [0xc48430A412c7AfF5c7822d9535db1b488683e1a0](https://etherscan.io/address/0xc48430A412c7AfF5c7822d9535db1b488683e1a0)
- Unpause Nova Inbox: [0x178aeC1641C2A1c9b0e0cE7074441F982369D6Be](https://etherscan/address/0x178aeC1641C2A1c9b0e0cE7074441F982369D6Be)
<br/>


- Pause Nova Rollup: [0xf2afa16225510990446233b02EfDF2474E43A88B](https://etherscan.io/address/0xf2afa16225510990446233b02EfDF2474E43A88B)
- Unpause Nova Rollup: [0x12fB735Ad4196729BE7a714CA12d251860A51D68](https://etherscan.io/address/0x12fB735Ad4196729BE7a714CA12d251860A51D68)
<br/>


- Remove All Nova Outboxes: [0xC399A1ebdB291677e0ABf62fd7a18e4cFa422f5F](https://etherscan.io/address/0xC399A1ebdB291677e0ABf62fd7a18e4cFa422f5F)
- Add Nova Outboxes: [0x4909dF591cE5cD901Ab29138993E9f284cc107eF](https://etherscan.io/address/0x4909dF591cE5cD901Ab29138993E9f284cc107eF)
<br/>


- Add Nova Sequencer: [0xc9E49E5ca552C52D08e76dc31B7b8B67DADF876f](https://etherscan.io/address/0xc9E49E5ca552C52D08e76dc31B7b8B67DADF876f)
- Remove Nova Sequencer: [0xf322DAAefDc7c1E522Ad679677E838762C06e1ec](https://etherscan.io/address/0xf322DAAefDc7c1E522Ad679677E838762C06e1ec)
<br/>


Nova Address Registry: [0xA5d0f3C50421d2671D42214b9ff42d445c436639](https://etherscan.io/address/0xA5d0f3C50421d2671D42214b9ff42d445c436639)
Loading