Skip to content

Commit

Permalink
Add Sepolia / Optimism Sepolia support for Optimism cross-chain
Browse files Browse the repository at this point in the history
The Goerli testnet currently used by Threshold/Keep for development purposes is
planned to become deprecated with the end of year 2023. The testnet that was
created to replace it is called
[Holešky](https://github.com/eth-clients/holesky), however it will take some
time until it gets integrated with by some of the projects we rely on.
As a solution, we decided to switch first to another testnet that is currently
live - Sepolia. This testnet's EOL is planned for 2026, which gives us plenty of
time to move to Holešky before Sepolia gets deprecated.
Until Görli is not dead we want to support both testnets.

The Goerli -> Sepolia migration means that also L2 testnet basing on Goerli
(Optimism Goerli) needs to be migrated to Sepolia-based chain (Optimism Sepolia).
At the moment Optimism Sepolia is not supported by Wormhole, so deployment of our
contracts on that testnet is yet not possible. But we're already adding changes
that prepare us for the moment when it will be supported.
Once support is confirmed, we'll need to verify if `wormholeChainID` we use in
the config is correct for the testnet.
  • Loading branch information
michalinacienciala committed Nov 22, 2023
1 parent 20fdcd7 commit d2e7f6d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions cross-chain/optimism/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/deployments/mainnet/
!/deployments/optimism/
!/deployments/optimismGoerli/
!/deployments/optimismSepolia/

# OZ
/.openzeppelin/unknown-*.json
6 changes: 3 additions & 3 deletions cross-chain/optimism/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Wormhole-specific tBTC representation into the canonical `OptimismTBTC` token.

The deployment scripts are responsible for managing updates of the tBTC gateway
addresses across various chains. These addresses are stored in the `external/`
directory for a specific network, such as `optimismGoerli/ArbitrumWormholeGateway.json.`
directory for a specific network, such as `optimismSepolia/ArbitrumWormholeGateway.json.`
It is important to note that these addresses should remain constant for the
mainnet network. However, there may be instances where a new version of a
cross-chain module is deployed to the testing network, which would require a
Expand All @@ -42,7 +42,7 @@ yarn deploy --network <network>

Supported networks:
- `hardhat` - for local development
- `optimismGoerli` - L2 testing network
- `optimismSepolia` - L2 testing network
- `optimism` - L2 mainnet

Currently, this module does not deploy any contracts on L1. All the existing
Expand All @@ -54,6 +54,6 @@ the contracts before running the deployment script. This command produces
an `export.json` file containing contract deployment info. Note that for the
chains other than `hardhat` the following environment variables are needed:

- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://opt-goerli.g.alchemy.com/v2/<alchemy_api_key>`
- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://optimism-sepolia.infura.io/v3/<infura_api_key>`
- `L2_ACCOUNTS_PRIVATE_KEYS` - Private keys for the deployer and council `<0xOwnerPrivKey,0xCouncilPrivKey>`
- `OPTIMISM_ETHERSCAN_API_KEY` - Optimism Etherscan API key
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Optimism Goerli and Mainnet
// TODO: check if id is correct for Optimism Sepolia as well (once Wormhole
// supports that testnet)
const wormholeChainID = 24

const optimismWormholeGateway = await deployments.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Arbitrum Goerli and Mainnet
// TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole
// supports that testnet)
const arbitrumWormholeChainID = 23

const arbitrumWormholeGateway = await deployments.getOrNull(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base
// This ID is valid for both Base Testnet and Mainnet
// TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole
// supports that testnet)
const baseWormholeChainID = 30

const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway")
Expand Down
33 changes: 33 additions & 0 deletions cross-chain/optimism/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ const config: HardhatUserConfig = {
: undefined,
tags: ["etherscan"],
},
sepolia: {
url: process.env.L1_CHAIN_API_URL || "",
chainId: 11155111,
deploy: ["deploy_l1"],
accounts: process.env.L1_ACCOUNTS_PRIVATE_KEYS
? process.env.L1_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
tags: ["etherscan"],
},
mainnet: {
url: process.env.L1_CHAIN_API_URL || "",
chainId: 1,
Expand All @@ -65,6 +74,20 @@ const config: HardhatUserConfig = {
// l1: "goerli",
// },
},
optimismSepolia: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 11155420,
deploy: ["deploy_l2"],
accounts: process.env.L2_ACCOUNTS_PRIVATE_KEYS
? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
// TODO: uncomment below line once `hardhat-verify` supports OP Sepolia
// (tracked in https://github.com/NomicFoundation/hardhat/issues/4607)
// tags: ["optimism_etherscan"],
// companionNetworks: {
// l1: "sepolia",
// },
},
optimism: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 10,
Expand All @@ -82,24 +105,30 @@ const config: HardhatUserConfig = {
external: {
deployments: {
goerli: ["./external/goerli"],
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
optimismGoerli: ["./external/optimismGoerli"],
optimismSepolia: ["./external/optimismSepolia"],
optimism: ["./external/optimism"],
},
},

deploymentArtifactsExport: {
goerli: "artifacts/l1",
sepolia: "artifacts/l1",
mainnet: "artifacts/l1",
optimismGoerli: "artifacts/l2",
optimismSepolia: "artifacts/l2",
optimism: "artifacts/l2",
},

etherscan: {
apiKey: {
goerli: process.env.ETHERSCAN_API_KEY,
sepolia: process.env.ETHERSCAN_API_KEY,
mainnet: process.env.ETHERSCAN_API_KEY,
optimisticGoerli: process.env.OPTIMISM_ETHERSCAN_API_KEY,
optimisticSepolia: process.env.OPTIMISM_ETHERSCAN_API_KEY,
optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY,
},
},
Expand All @@ -108,14 +137,18 @@ const config: HardhatUserConfig = {
deployer: {
default: 1,
goerli: 0,
sepolia: 0,
optimismGoerli: 0,
optimismSepolia: 0,
mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
optimism: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
governance: {
default: 2,
goerli: 0,
sepolia: 0,
optimismGoerli: 0,
optimismSepolia: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
optimism: "0x7fB50BBabeDEE52b8760Ba15c0c199aF33Fc2EfA",
},
Expand Down
1 change: 1 addition & 0 deletions cross-chain/optimism/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lint:config:fix": "prettier --write '**/*.@(json|yaml)'",
"prepack": "tsc -p tsconfig.export.json && hardhat export-artifacts export/artifacts",
"export-artifacts:goerli": "yarn hardhat export-deployment-artifacts --network optimismGoerli",
"export-artifacts:sepolia": "yarn hardhat export-deployment-artifacts --network optimismSepolia",
"export-artifacts:mainnet": "yarn hardhat export-deployment-artifacts --network optimism",
"prepublishOnly": "npm run export-artifacts:$npm_config_network",
"test": "hardhat test"
Expand Down

0 comments on commit d2e7f6d

Please sign in to comment.