Skip to content

Commit

Permalink
Add Sepolia / Arbitrum Sepolia support for Arbitrum cross-chain (#753)
Browse files Browse the repository at this point in the history
The Goerli testnet currently used by Threshold/Keep for development
purposes was planned to become deprecated with the end of year 2023.
Although it's already 2024, the testnet is still live, but it will loose
validators over the time and may become unusable at some point. 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.

The Goerli -> Sepolia migration means that also L2 testnet based on
Goerli (Arbitrum Goerli) needs to be migrated to Sepolia-based chain
(Arbitrum Sepolia). In this PR we're adjusting the config used to deploy
testnet contracts in the `@keep-network/tbtc-v2-arbitrum` project. After
the update, both deploy to `arbitrumGoerli` and `arbitrumSepolia`
networks will be supported (we may remove `arbitrumGoerli` support once
we're sure the `arbitrumSepolia` deployment works as expected).

TODO
- [x] Add `external/arbitrumSepolia/ArbitrumWormholeTBTC.json` - in
order to get the address we need to perform attestation of the Ethereum
Sepolia TBTC token on Arbitrum Sepolia (but atm Arbitrum Sepolia is not
available on the list of target networks on
https://wormhole-foundation.github.io/example-token-bridge-ui/#/register)

Ref: threshold-network/solidity-contracts#150
  • Loading branch information
lukasz-zimnoch committed Feb 19, 2024
2 parents 2604b3d + 109fcaa commit 1f7151f
Show file tree
Hide file tree
Showing 16 changed files with 1,432 additions and 17 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 @@ -6,9 +6,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { execute } = deployments
const { deployer } = await getNamedAccounts()

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Arbitrum Goerli and Mainnet
const wormholeChainID = 23
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum-sepolia
// The value `23` is valid for both Arbitrum Goerli and Arbitrum Mainnet. The
// value for Arbitrum Sepolia is `10003`.
const wormholeChainID = hre.network.name === "arbitrumSepolia" ? 10003 : 23

const ArbitrumWormholeGateway = await deployments.get(
"ArbitrumWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakeOptimismWormholeGateway =
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Optimism Goerli and Mainnet
const optimismWormholeChainID = 24
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism-sepolia
// The value `24` is valid for both Optimism Goerli and Optimism Mainnet. The
// value for Optimism Sepolia is `10005`.
const optimismWormholeChainID =
hre.network.name === "arbitrumSepolia" ? 10005 : 24

const optimismWormholeGateway = await deployments.getOrNull(
"OptimismWormholeGateway"
Expand All @@ -38,4 +41,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetOptimismGatewayAddress"]
func.dependencies = ["OptimismWormholeGateway"]
func.dependencies = ["OptimismWormholeGateway", "ArbitrumWormholeGateway"]
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakePolygonWormholeGateway =
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Polygon Testnet (Mumbai) and Mainnet
// This ID is valid for both Polygonn Goerli-based Testnet (Mumbai) and
// Mainnet. Wormhole does not support the Sepolia-based Amoy Testnet yet.
// TODO: Update the ID once the support is added.
const polygonWormholeChainID = 5

const polygonWormholeGateway = await deployments.getOrNull(
Expand All @@ -36,4 +37,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetPolygonGatewayAddress"]
func.dependencies = ["OptimismWormholeGateway"]
func.dependencies = ["PolygonWormholeGateway", "ArbitrumWormholeGateway"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Fake BaseWormholeGateway for local development purposes only.
const fakeBaseWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base
// This ID is valid for both Base Testnet and Mainnet
const baseWormholeChainID = 30
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base and
// https://docs.wormhole.com/wormhole/blockchain-environments/evm#base-sepolia
// The value `30` is valid for both Base Goerli and Base Mainnet. The value
// for Base Sepolia is `10004`.
const baseWormholeChainID =
hre.network.name === "arbitrumSepolia" ? 10004 : 30

const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway")

Expand All @@ -33,4 +36,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetBaseGatewayAddress"]
func.dependencies = ["BaseWormholeGateway"]
func.dependencies = ["BaseWormholeGateway", "ArbitrumWormholeGateway"]
1 change: 1 addition & 0 deletions cross-chain/arbitrum/deployments/arbitrumSepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
421614
Loading

0 comments on commit 1f7151f

Please sign in to comment.