From 34887a0a01177a810bd4bfe1df24698f98eb09df Mon Sep 17 00:00:00 2001 From: Michalina Date: Tue, 5 Sep 2023 10:53:28 +0200 Subject: [PATCH] Support deployment on Sepolia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Görli testnet currently used by Threshold/Keep for development purposes is planned to become deprecated with the end of year 2023. The testnet that is planned to replace it is called [Holešky](https://github.com/eth-clients/holesky), however it's not yet available - it's planned it will become widely accessible on Oct 1, 2023 ([source](https://everstake.one/blog/new-ethereum-testnet-holesky-all-you-need-to-know-now)). Switching our infrastructure to support new testnet is quite time consuming, so moving directly from Görli to Holešky may be quite risky, especially if there would be some delays in the date of Holešky genesis (not meeting the planned timelines is not a rare occurrence in the Ethereum space). 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. --- .github/workflows/contracts-ecdsa.yml | 44 ++++++++++++++++--- .github/workflows/contracts-random-beacon.yml | 44 ++++++++++++++++--- .../09_deploy_wallet_registry_governance.ts | 7 ++- solidity/ecdsa/hardhat.config.ts | 16 +++++++ solidity/random-beacon/hardhat.config.ts | 12 +++++ 5 files changed, 107 insertions(+), 16 deletions(-) diff --git a/.github/workflows/contracts-ecdsa.yml b/.github/workflows/contracts-ecdsa.yml index b3cd549f5a..25dfd0bb8b 100644 --- a/.github/workflows/contracts-ecdsa.yml +++ b/.github/workflows/contracts-ecdsa.yml @@ -27,7 +27,7 @@ on: workflow_dispatch: inputs: environment: - description: "Environment (network) for workflow execution, e.g. `goerli`" + description: "Environment (network) for workflow execution, e.g. `sepolia`" required: false upstream_builds: description: "Upstream builds" @@ -252,9 +252,24 @@ jobs: - name: Deploy contracts env: - CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }} - ACCOUNTS_PRIVATE_KEYS: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }} - ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + # Use fake ternary expressions to decide which credentials to use, + # depending on chosen environment. Note: if `GOERLI...` credentials + # are empty, the expressions will be evaluated to the `SEPOLIA...` + # ones. + CHAIN_API_URL: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_HOSTNAME_HTTP + || secrets.SEPOLIA_ETH_HOSTNAME_HTTP }} + # TODO: Shouldn't we use `ACCOUNTS_PRIVATE_KEYS` here instead of the + # two below envs? + CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }} + KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }} run: yarn deploy --network ${{ github.event.inputs.environment }} - name: Bump up package version @@ -340,9 +355,24 @@ jobs: - name: Deploy contracts env: - CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }} - ACCOUNTS_PRIVATE_KEYS: ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }} - ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + # Use fake ternary expressions to decide which credentials to use, + # depending on chosen environment. Note: if `GOERLI...` credentials + # are empty, the expressions will be evaluated to the `SEPOLIA...` + # ones. + CHAIN_API_URL: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_HOSTNAME_HTTP + || secrets.SEPOLIA_ETH_HOSTNAME_HTTP }} + # TODO: Shouldn't we use `ACCOUNTS_PRIVATE_KEYS` here instead of the + # two below envs? + CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.DAPP_DEV_SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }} + KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }} run: yarn deploy --network ${{ github.event.inputs.environment }} - name: Bump up package version diff --git a/.github/workflows/contracts-random-beacon.yml b/.github/workflows/contracts-random-beacon.yml index 17cf44b937..2d2255acb7 100644 --- a/.github/workflows/contracts-random-beacon.yml +++ b/.github/workflows/contracts-random-beacon.yml @@ -27,7 +27,7 @@ on: workflow_dispatch: inputs: environment: - description: "Environment (network) for workflow execution, e.g. `goerli`" + description: "Environment (network) for workflow execution, e.g. `sepolia`" required: false upstream_builds: description: "Upstream builds" @@ -248,9 +248,24 @@ jobs: - name: Deploy contracts env: - CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }} - ACCOUNTS_PRIVATE_KEYS: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }} - ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + # Use fake ternary expressions to decide which credentials to use, + # depending on chosen environment. Note: if `GOERLI...` credentials + # are empty, the expressions will be evaluated to the `SEPOLIA...` + # ones. + CHAIN_API_URL: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_HOSTNAME_HTTP + || secrets.SEPOLIA_ETH_HOSTNAME_HTTP }} + # TODO: Shouldn't we use `ACCOUNTS_PRIVATE_KEYS` here instead of the + # two below envs? + CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }} + KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }} run: yarn deploy --network ${{ github.event.inputs.environment }} - name: Bump up package version @@ -334,9 +349,24 @@ jobs: - name: Deploy contracts env: - CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }} - ACCOUNTS_PRIVATE_KEYS: ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }} - ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + # Use fake ternary expressions to decide which credentials to use, + # depending on chosen environment. Note: if `GOERLI...` credentials + # are empty, the expressions will be evaluated to the `SEPOLIA...` + # ones. + CHAIN_API_URL: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_ETH_HOSTNAME_HTTP + || secrets.SEPOLIA_ETH_HOSTNAME_HTTP }} + # TODO: Shouldn't we use `ACCOUNTS_PRIVATE_KEYS` here instead of the + # two below envs? + CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.DAPP_DEV_SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }} + KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: | + ${{ inputs.github.event.inputs.environment == 'goerli' + && secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY + || secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }} run: yarn deploy --network ${{ github.event.inputs.environment }} - name: Bump up package version diff --git a/solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts b/solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts index 90ebc50acb..965e04ad0a 100644 --- a/solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts +++ b/solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts @@ -7,8 +7,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const WalletRegistry = await deployments.get("WalletRegistry") - // 60 seconds for Goerli. 1 week otherwise. - const GOVERNANCE_DELAY = hre.network.name === "goerli" ? 60 : 604800 + // 60 seconds for Goerli/Sepolia. 1 week otherwise. + const GOVERNANCE_DELAY = + hre.network.name === "goerli" || hre.network.name === "sepolia" + ? 60 + : 604800 const WalletRegistryGovernance = await deployments.deploy( "WalletRegistryGovernance", diff --git a/solidity/ecdsa/hardhat.config.ts b/solidity/ecdsa/hardhat.config.ts index 52bad239db..0fc0f0e67d 100644 --- a/solidity/ecdsa/hardhat.config.ts +++ b/solidity/ecdsa/hardhat.config.ts @@ -121,6 +121,14 @@ const config: HardhatUserConfig = { : undefined, tags: ["etherscan", "tenderly", "useRandomBeaconChaosnet"], }, + sepolia: { + url: process.env.CHAIN_API_URL || "", + chainId: 11155111, + accounts: process.env.ACCOUNTS_PRIVATE_KEYS + ? process.env.ACCOUNTS_PRIVATE_KEYS.split(",") + : undefined, + tags: ["etherscan", "tenderly", "useRandomBeaconChaosnet"], + }, mainnet: { url: process.env.CHAIN_API_URL || "", chainId: 1, @@ -143,21 +151,25 @@ const config: HardhatUserConfig = { deployer: { default: 1, // take the second account goerli: 0, + sepolia: 0, mainnet: 0, // "0x123694886DBf5Ac94DDA07135349534536D14cAf" }, governance: { default: 2, goerli: 0, + sepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council }, chaosnetOwner: { default: 3, goerli: 0, + sepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council }, esdm: { default: 4, goerli: 0, + sepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council }, }, @@ -192,6 +204,10 @@ const config: HardhatUserConfig = { "node_modules/@threshold-network/solidity-contracts/artifacts", "node_modules/@keep-network/random-beacon/artifacts", ], + sepolia: [ + "node_modules/@threshold-network/solidity-contracts/artifacts", + "node_modules/@keep-network/random-beacon/artifacts", + ], mainnet: ["./external/mainnet"], }, }, diff --git a/solidity/random-beacon/hardhat.config.ts b/solidity/random-beacon/hardhat.config.ts index a4a4092bfb..020c0ce0d9 100644 --- a/solidity/random-beacon/hardhat.config.ts +++ b/solidity/random-beacon/hardhat.config.ts @@ -109,6 +109,14 @@ const config: HardhatUserConfig = { : undefined, tags: ["etherscan", "tenderly"], }, + sepolia: { + url: process.env.CHAIN_API_URL || "", + chainId: 11155111, + accounts: process.env.ACCOUNTS_PRIVATE_KEYS + ? process.env.ACCOUNTS_PRIVATE_KEYS.split(",") + : undefined, + tags: ["etherscan", "tenderly"], + }, mainnet: { url: process.env.CHAIN_API_URL || "", chainId: 1, @@ -131,16 +139,19 @@ const config: HardhatUserConfig = { deployer: { default: 1, goerli: 0, + sepolia: 0, mainnet: 0, // "0x123694886DBf5Ac94DDA07135349534536D14cAf" }, governance: { default: 2, goerli: 0, + sepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council }, chaosnetOwner: { default: 3, goerli: 0, + sepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council }, }, @@ -166,6 +177,7 @@ const config: HardhatUserConfig = { "node_modules/@threshold-network/solidity-contracts/deployments/development", ], goerli: ["node_modules/@threshold-network/solidity-contracts/artifacts"], + sepolia: ["node_modules/@threshold-network/solidity-contracts/artifacts"], mainnet: ["./external/mainnet"], }, },