Skip to content

Commit

Permalink
Add Sepolia / Arbitrum Sepolia support for Arbitrum 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
(Base Goerli) needs to be migrated to Sepolia-based chain (Arbitrum Sepolia).
At the moment Arbitrum 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 58c817f
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cross-chain/arbitrum/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 `ArbitrumTBTC` 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 `arbitrumGoerli/OptimismWormholeGateway.json.`
directory for a specific network, such as `arbitrumSepolia/OptimismWormholeGateway.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
- `arbitrumGoerli` - L2 testing network
- `arbitrumSepolia` - L2 testing network
- `arbitrumOne` - 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://arb-goerli.g.alchemy.com/v2/<alchemy_api_key>`
- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://arb-sepolia.g.alchemy.com/v2/<alchemy_api_key>`
- `L2_ACCOUNTS_PRIVATE_KEYS` - Private keys for the deployer and council `<0xOwnerPrivKey,0xCouncilPrivKey>`
- `ARBISCAN_API_KEY` - Arbiscan 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 Arbitrum Goerli and Mainnet
// TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole
// supports that testnet)
const wormholeChainID = 23

const ArbitrumWormholeGateway = 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 Optimism Goerli and Mainnet
// TODO: check if id is correct for Optimism Sepolia as well (once Wormhole
// supports that testnet)
const optimismWormholeChainID = 24

const optimismWormholeGateway = await deployments.getOrNull(
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 Polygon Testnet (Mumbai) and Mainnet
// TODO: check ID for the new L2 Polygon testnet once it's annunced and
// supported by Wormhole
const polygonWormholeChainID = 5

const polygonWormholeGateway = 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 Base Sepolia as well (once Wormhole
// supports that testnet)
const baseWormholeChainID = 30

const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway")
Expand Down
32 changes: 32 additions & 0 deletions cross-chain/arbitrum/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,19 @@ const config: HardhatUserConfig = {
// l1: "goerli",
// },
},
arbitrumSepolia: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 421614,
deploy: ["deploy_l2"],
accounts: process.env.L2_ACCOUNTS_PRIVATE_KEYS
? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
// TODO: uncomment below line once https://github.com/NomicFoundation/hardhat/issues/4582 is resolved
// tags: ["arbiscan"],

Check failure on line 85 in cross-chain/arbitrum/hardhat.config.ts

View workflow job for this annotation

GitHub Actions / contracts-format

Delete `·`
// companionNetworks: {
// l1: "sepolia",
// },
},
arbitrumOne: {
url: process.env.L2_CHAIN_API_URL || "",
chainId: 42161,
Expand All @@ -82,24 +104,30 @@ const config: HardhatUserConfig = {
external: {
deployments: {
goerli: ["./external/goerli"],
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
arbitrumGoerli: ["./external/arbitrumGoerli"],
arbitrumSepolia: ["./external/arbitrumSepolia"],
arbitrumOne: ["./external/arbitrumOne"],
},
},

deploymentArtifactsExport: {
goerli: "artifacts/l1",
sepolia: "artifacts/l1",
mainnet: "artifacts/l1",
arbitrumGoerli: "artifacts/l2",
arbitrumSepolia: "artifacts/l2",
arbitrumOne: "artifacts/l2",
},

etherscan: {
apiKey: {
goerli: process.env.ETHERSCAN_API_KEY,
sepolia: process.env.ETHERSCAN_API_KEY,
mainnet: process.env.ETHERSCAN_API_KEY,
arbitrumGoerli: process.env.ARBISCAN_API_KEY,
arbitrumSepolia: process.env.ARBISCAN_API_KEY,
arbitrumOne: process.env.ARBISCAN_API_KEY,
},
},
Expand All @@ -108,14 +136,18 @@ const config: HardhatUserConfig = {
deployer: {
default: 1,
goerli: 0,
sepolia: 0,
arbitrumGoerli: 0,
arbitrumSepolia: 0,
mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
arbitrumOne: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
governance: {
default: 2,
goerli: 0,
sepolia: 0,
arbitrumGoerli: 0,
arbitrumSepolia: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
arbitrumOne: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
},
Expand Down
1 change: 1 addition & 0 deletions cross-chain/arbitrum/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 arbitrumGoerli",
"export-artifacts:sepolia": "yarn hardhat export-deployment-artifacts --network arbitrumSepolia",
"export-artifacts:mainnet": "yarn hardhat export-deployment-artifacts --network arbitrumOne",
"prepublishOnly": "npm run export-artifacts:$npm_config_network",
"test": "hardhat test"
Expand Down

0 comments on commit 58c817f

Please sign in to comment.