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

Feature/automaton deploy script #42

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ee442ec
add new deploy script for automaton deployment
kovalgek Oct 29, 2024
8ade9e9
mark function export
kovalgek Oct 29, 2024
badf3e3
save state in file
kovalgek Oct 29, 2024
571d7f9
update hardhat version
kovalgek Oct 29, 2024
10d492f
add test for op stack pusher
kovalgek Oct 31, 2024
be3b202
fix deploy params
kovalgek Nov 1, 2024
88cd010
remove gov executor config
kovalgek Nov 1, 2024
80f8344
remove lido from test
kovalgek Nov 1, 2024
871369f
fix test for anvil
kovalgek Nov 7, 2024
e97eb49
use unichain messenger
kovalgek Nov 8, 2024
1047114
add unichain in config
kovalgek Nov 8, 2024
c21e667
save deploy args
kovalgek Nov 8, 2024
f7a1502
fix saving args
kovalgek Nov 8, 2024
c35f7c8
update verifier
kovalgek Nov 10, 2024
cfa89ae
save array of args for verification
kovalgek Nov 11, 2024
822d0c0
feat: burn nonces on L2 deployer if L1 and L2 clash
arwer13 Nov 14, 2024
45e6772
feat: add env var L2_DEPLOY_SKIP_PROMPTS
arwer13 Nov 14, 2024
77f745a
remove network name from
kovalgek Dec 6, 2024
0388134
refactor deployment paramteres
kovalgek Dec 9, 2024
c2f506f
fix env names
kovalgek Dec 9, 2024
939d270
remove unichain dependency from verifier
kovalgek Dec 10, 2024
7e1c955
rename envs in hardhat config
kovalgek Dec 10, 2024
34839bb
rename etherscan var
kovalgek Dec 10, 2024
9a204ef
add block explorer api url envs
kovalgek Dec 10, 2024
3517a57
add empty default values to config in order to compile
kovalgek Dec 19, 2024
2c52c10
get rid of automaton word
kovalgek Jan 14, 2025
26615fa
add comments for two envs
kovalgek Jan 14, 2025
9c9f3d7
fix tests
kovalgek Jan 14, 2025
0ddc2b1
fix tests2
kovalgek Jan 14, 2025
17a98db
save deploy block number to file
kovalgek Jan 19, 2025
d408ffe
remove unused script, add pring functions for other deployemnt parame…
kovalgek Jan 20, 2025
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
25 changes: 11 additions & 14 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@
# RPCs
# ############################

RPC_ETH_MAINNET=
RPC_ETH_SEPOLIA=
L1_CHAIN_ID=10
L2_CHAIN_ID=11155420

RPC_OPT_MAINNET=https://mainnet.optimism.io
RPC_OPT_SEPOLIA=https://sepolia.optimism.io
L1_PRC_URL=https://sepolia.infura.io/v3/
L2_PRC_URL=https://optimism-sepolia.infura.io/v3/

L1_CROSSDOMAIN_MESSENGER=0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1
L2_CROSSDOMAIN_MESSENGER=0x4200000000000000000000000000000000000007

# ############################
# Etherscan
# ############################

ETHERSCAN_API_KEY_ETH=
ETHERSCAN_API_KEY_OPT=
L1_BLOCK_EXPLORER_API_KEY=
L2_BLOCK_EXPLORER_API_KEY=

# ############################
# Bridge/Gateway Deployment
# ############################

# Name of the network environments used by deployment scripts.
# Might be one of: "mainnet", "sepolia".
NETWORK=mainnet

# Run deployment in the forking network instead of public ones
FORKING=true

# Private key of the deployer account used for deployment process
ETH_DEPLOYER_PRIVATE_KEY=
OPT_DEPLOYER_PRIVATE_KEY=
L1_DEPLOYER_PRIVATE_KEY=
L2_DEPLOYER_PRIVATE_KEY=

# Address of bridge executor.
GOV_BRIDGE_EXECUTOR=
Expand Down Expand Up @@ -148,8 +147,6 @@ L2_WITHDRAWALS_DISABLERS=[]
# Integration Acceptance & E2E Testing
# ############################

TESTING_OPT_NETWORK=

TESTING_OPT_L1_LIDO=
TESTING_OPT_L1_REBASABLE_TOKEN=
TESTING_OPT_L1_NON_REBASABLE_TOKEN=
Expand Down
25 changes: 11 additions & 14 deletions .env.steth.opt_mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@
# RPCs
# ############################

RPC_ETH_SEPOLIA=https://sepolia.infura.io/v3/
RPC_OPT_SEPOLIA=https://optimism-sepolia.infura.io/v3/
L1_CHAIN_ID=10
L2_CHAIN_ID=11155420

RPC_ETH_MAINNET=https://mainnet.infura.io/v3/
RPC_OPT_MAINNET=https://optimism-mainnet.infura.io/v3/
L1_PRC_URL=https://sepolia.infura.io/v3/
L2_PRC_URL=https://optimism-sepolia.infura.io/v3/

L1_CROSSDOMAIN_MESSENGER=0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1
L2_CROSSDOMAIN_MESSENGER=0x4200000000000000000000000000000000000007

# ############################
# Etherscan
# ############################

ETHERSCAN_API_KEY_ETH=
ETHERSCAN_API_KEY_OPT=
L1_BLOCK_EXPLORER_API_KEY=
L2_BLOCK_EXPLORER_API_KEY=

# ############################
# Bridge/Gateway Deployment
# ############################

# Name of the network environments used by deployment scripts.
# Might be one of: "mainnet", "sepolia".
NETWORK=mainnet

# Run deployment in the forking network instead of public ones
FORKING=false

# Private key of the deployer account used for deployment process
ETH_DEPLOYER_PRIVATE_KEY=
OPT_DEPLOYER_PRIVATE_KEY=
L1_DEPLOYER_PRIVATE_KEY=
L2_DEPLOYER_PRIVATE_KEY=

# Address of bridge executor.
GOV_BRIDGE_EXECUTOR=0xefa0db536d2c8089685630fafe88cf7805966fc3
Expand Down Expand Up @@ -150,8 +149,6 @@ L2_WITHDRAWALS_DISABLERS=["0xEfa0dB536d2c8089685630fafe88CF7805966FC3","0x4Cf8fE
# Integration & E2E Testing
# ############################

TESTING_OPT_NETWORK=sepolia

TESTING_OPT_L1_LIDO=
TESTING_OPT_L1_REBASABLE_TOKEN=
TESTING_OPT_L1_NON_REBASABLE_TOKEN=
Expand Down
24 changes: 12 additions & 12 deletions .env.steth.opt_sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@
# RPCs
# ############################

RPC_ETH_SEPOLIA=https://sepolia.infura.io/v3/<infura_key>
RPC_OPT_SEPOLIA=https://optimism-sepolia.infura.io/v3/<infura_key>
L1_CHAIN_ID=10
L2_CHAIN_ID=11155420

L1_PRC_URL=https://sepolia.infura.io/v3/
L2_PRC_URL=https://optimism-sepolia.infura.io/v3/

L1_CROSSDOMAIN_MESSENGER=0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1
L2_CROSSDOMAIN_MESSENGER=0x4200000000000000000000000000000000000007

# ############################
# Etherscan
# ############################

ETHERSCAN_API_KEY_ETH=
ETHERSCAN_API_KEY_OPT=
L1_BLOCK_EXPLORER_API_KEY=
L2_BLOCK_EXPLORER_API_KEY=

# ############################
# Bridge/Gateway Deployment
# ############################

# Name of the network environments used by deployment scripts.
# Might be one of: "mainnet", "sepolia".
NETWORK=sepolia

# Run deployment in the forking network instead of public ones
FORKING=false

# Private key of the deployer account used for deployment process
ETH_DEPLOYER_PRIVATE_KEY=
OPT_DEPLOYER_PRIVATE_KEY=
L1_DEPLOYER_PRIVATE_KEY=
L2_DEPLOYER_PRIVATE_KEY=

# Address of bridge executor.
GOV_BRIDGE_EXECUTOR=
Expand Down Expand Up @@ -145,8 +147,6 @@ L2_WITHDRAWALS_DISABLERS="["0xf695357C66bA514150Da95b189acb37b46DDe602", "0xa5F1
# Integration & E2E Testing
# ############################

TESTING_OPT_NETWORK=sepolia

TESTING_OPT_L1_LIDO=0x3e3FE7dBc6B4C189E7128855dD526361c49b40Af
TESTING_OPT_L1_REBASABLE_TOKEN=0x3e3FE7dBc6B4C189E7128855dD526361c49b40Af
TESTING_OPT_L1_NON_REBASABLE_TOKEN=0xB82381A3fBD3FaFA77B3a7bE693342618240067b
Expand Down
58 changes: 15 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ The configuration of the deployment scripts happens via the ENV variables. The f
- [`L2_TOKEN`](#L2_TOKEN) - address of the non-rebasable token on L2.
- [`L2_TOKEN_RATE_ORACLE`](#L2_TOKEN_RATE_ORACLE) - address of token rate oracle on L2.
- [`GOV_BRIDGE_EXECUTOR`](#GOV_BRIDGE_EXECUTOR) - address of bridge executor.
- [`NETWORK`](#NETWORK) - name of the network environments used by deployment scripts. Allowed values: `mainnet`, `sepolia`.
- [`FORKING`](#FORKING) - run deployment in the forking network instead of real ones
- [`ETH_DEPLOYER_PRIVATE_KEY`](#ETH_DEPLOYER_PRIVATE_KEY) - The private key of the deployer account in the Ethereum network is used during the deployment process.
- [`OPT_DEPLOYER_PRIVATE_KEY`](#OPT_DEPLOYER_PRIVATE_KEY) - The private key of the deployer account in the Optimism network is used during the deployment process.
- [`L1_DEPLOYER_PRIVATE_KEY`](#L1_DEPLOYER_PRIVATE_KEY) - The private key of the deployer account in the Ethereum network is used during the deployment process.
- [`L2_DEPLOYER_PRIVATE_KEY`](#L2_DEPLOYER_PRIVATE_KEY) - The private key of the deployer account in the Optimism network is used during the deployment process.
- [`L1_PROXY_ADMIN`](#L1_PROXY_ADMIN) - The address to grant admin rights of the `OssifiableProxy` on the L1 bridge
- [`L1_BRIDGE_ADMIN`](#L1_BRIDGE_ADMIN) - Address to grant the `DEFAULT_ADMIN_ROLE` on the L1 bridge
- [`L2_PROXY_ADMIN`](#L2_PROXY_ADMIN) - The address to grant admin rights of the `OssifiableProxy` on the L2 bridge
Expand Down Expand Up @@ -101,14 +100,14 @@ npm run optimism:test:unit

### Integration tests

Before running integration tests, run the hardhat forked nodes in the standalone tabs corresponding to `TESTING_OPT_NETWORK` env variable or if it's not set use `mainnet` network. Example of the commands for the `mainnet` network:
Before running integration tests, run the hardhat forked nodes in the standalone tabs. Example of the commands:

```bash
# Required to run Optimism integraton tests
npm run fork:eth:mainnet
# Required to run integration tests
npm run fork:l1

# Required to run Optimism integration tests
npm run fork:opt:mainnet
# Required to run integration tests
npm run fork:l2

The integration tests might be run via the following commands:

Expand All @@ -129,7 +128,6 @@ TESTING_USE_DEPLOYED_CONTRACTS=true
TESTING_L1_TOKENS_HOLDER=

# Addresses of the Optimism bridge
TESTING_OPT_NETWORK=
TESTING_OPT_L1_TOKEN=
TESTING_OPT_L2_TOKEN=
TESTING_OPT_L1_ERC20_TOKEN_BRIDGE=
Expand Down Expand Up @@ -160,7 +158,6 @@ Additionally, tests might be run on the deployed contracts. To do it, set the fo
TESTING_PRIVATE_KEY=

# Addresses of the Optimism bridge
TESTING_OPT_NETWORK=
TESTING_OPT_L1_TOKEN=
TESTING_OPT_L2_TOKEN=
TESTING_OPT_L1_ERC20_TOKEN_BRIDGE=
Expand All @@ -181,39 +178,24 @@ The configuration of the project happens via set of ENV variables. The full list

### RPCs

#### `RPC_URL_ETH_MAINNET`
#### `L1_PRC_URL`

Address of the RPC node for **Mainnet** Ethereum network.
Address of the RPC node for **L1** Ethereum network.

#### `RPC_ETH_SEPOLIA`

Address of the RPC node for **Sepolia** Ethereum network.

#### `RPC_OPT_SEPOLIA`

Address of the RPC node for **Sepolia** Optimism network.

#### `RPC_OPT_MAINNET`

> **Warning**
>
> Please, don't use the default value for production deployments! The default RPC node might not be available or fail suddenly during the request.

Address of the RPC node for **Mainnet** Optimism network.

> Default value: `https://mainnet.optimism.io`
#### `L2_PRC_URL`

Address of the RPC node for **L2** Ethereum network.

### Etherscan

Below variables are required for successfull verification of the contracts on block explorer for certain networks.

#### `ETHERSCAN_API_KEY_ETH`
#### `L1_BLOCK_EXPLORER_API_KEY`

API key from the [Etherscan](https://etherscan.io/) block explorer. See details here: https://info.etherscan.com/api-keys/


#### `ETHERSCAN_API_KEY_OPT`
#### `L2_BLOCK_EXPLORER_API_KEY`

API key from the [Optimistic Ethereum](https://optimistic.etherscan.io/) block explorer.

Expand All @@ -229,23 +211,17 @@ Address of the existing non-rebasable token to deploy a new bridge for on the Et

Address of the existing rebasable token to deploy new bridge for on the Ethereum chain.

#### `NETWORK`

> Default value: `mainnet`

Name of the network environments used by deployment scripts. Might be one of: `mainnet`, `sepolia`.

#### `FORKING`

Run deployment in the forking network instead of public ones

> Default value: `true`

#### `ETH_DEPLOYER_PRIVATE_KEY`
#### `L1_DEPLOYER_PRIVATE_KEY`

The private key of the deployer account in the Ethereum network is used during the deployment process.

#### `OPT_DEPLOYER_PRIVATE_KEY`
#### `L2_DEPLOYER_PRIVATE_KEY`

The private key of the deployer account in the Optimism network is used during the deployment process.

Expand Down Expand Up @@ -349,10 +325,6 @@ The array of addresses to grant `WITHDRAWALS_DISABLER_ROLE` on L2 bridge/gateway

The following variables are used in the process of the Integration & E2E testing.

#### `TESTING_OPT_NETWORK`

Name of the network environments used for Optimism Integration & E2E testing. Might be one of: `mainnet`, `sepolia`.

#### `TESTING_OPT_L1_TOKEN`

Address of the token to use in the Acceptance Integration & E2E (when `TESTING_USE_DEPLOYED_CONTRACTS` is set to true) testing of the bridging between Ethereum and Optimism networks.
Expand Down
66 changes: 22 additions & 44 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as dotenv from "dotenv";

import { HardhatUserConfig } from "hardhat/config";
import "@nomiclabs/hardhat-etherscan";
import "@nomicfoundation/hardhat-verify";
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
Expand Down Expand Up @@ -38,67 +38,45 @@ const config: HardhatUserConfig = {
}
}
},
// Ethereum Public Chains
eth_mainnet: {
url: env.string("RPC_ETH_MAINNET", ""),
l1: {
url: env.string("L1_PRC_URL", "")
},
eth_sepolia: {
url: env.string("RPC_ETH_SEPOLIA", ""),
l2: {
url: env.string("L2_PRC_URL", "")
},

// Ethereum Fork Chains
eth_mainnet_fork: {
url: "http://localhost:8545",
},
eth_sepolia_fork: {
url: "http://localhost:8545",
},

// Optimism Public Chains
opt_mainnet: {
url: env.string("RPC_OPT_MAINNET", ""),
},
opt_sepolia: {
url: env.string("RPC_OPT_SEPOLIA", ""),
},

// Optimism Fork Chains
opt_mainnet_fork: {
url: "http://localhost:9545",
},
opt_sepolia_fork: {
url: "http://localhost:9545",
l1_fork: {
url: "http://localhost:8545"
},
l2_fork: {
url: "http://localhost:9545"
}
},
gasReporter: {
enabled: env.string("REPORT_GAS", "false") !== "false",
currency: "USD",
},
etherscan: {
apiKey: {
mainnet: env.string("ETHERSCAN_API_KEY_ETH", ""),
sepolia: env.string("ETHERSCAN_API_KEY_ETH", ""),
optimisticEthereum: env.string("ETHERSCAN_API_KEY_OPT", ""),
"opt_sepolia": env.string("ETHERSCAN_API_KEY_OPT", ""),
"l1": env.string("L1_BLOCK_EXPLORER_API_KEY", ""),
"l2": env.string("L2_BLOCK_EXPLORER_API_KEY", ""),
},

customChains: [
{
network: 'sepolia',
chainId: 11155111,
network: 'l1',
chainId: env.number("L1_CHAIN_ID", ""),
urls: {
apiURL: 'https://api-sepolia.etherscan.io/api',
browserURL: 'https://sepolia.etherscan.io',
apiURL: env.string("L1_BLOCK_EXPLORER_API_URL", ""),
browserURL: env.string("L1_BLOCK_EXPLORER_BROWSER_URL", ""),
},
},
{
network: 'opt_sepolia',
chainId: 11155420,
urls: {
apiURL: 'https://api-sepolia-optimism.etherscan.io/api',
browserURL: 'https://sepolia-optimism.etherscan.io',
},
network: 'l2',
chainId: env.number("L2_CHAIN_ID", ""),
urls: {
apiURL: env.string("L2_BLOCK_EXPLORER_API_URL", ""),
browserURL: env.string("L2_BLOCK_EXPLORER_BROWSER_URL", ""),
},
},
],
},
typechain: {
Expand Down
Loading
Loading