Skip to content

Commit

Permalink
Support deployment on Sepolia (#3706)
Browse files Browse the repository at this point in the history
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.

Refs:
threshold-network/solidity-contracts#150
keep-network/ci#48
threshold-network/solidity-contracts#151
keep-network/tbtc-v2#691
threshold-network/token-dashboard#605

- [ ] Update `TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY` so that it is
prefixed with `0x`
  • Loading branch information
lukasz-zimnoch committed Sep 25, 2023
2 parents 968ac3e + ece4f94 commit 94ed595
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 14 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/contracts-ecdsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ on:
workflow_dispatch:
inputs:
environment:
description: "Environment (network) for workflow execution, e.g. `goerli`"
required: false
description: "Environment (network) for workflow execution, e.g. `sepolia`"
required: true
upstream_builds:
description: "Upstream builds"
required: false
Expand Down Expand Up @@ -252,8 +252,15 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
# Using fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
# is empty, the expression will be evaluated to
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

Expand Down Expand Up @@ -340,8 +347,15 @@ 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 }}
# Using fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
# is empty, the expression will be evaluated to
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.DAPP_DEV_TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/contracts-random-beacon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ on:
workflow_dispatch:
inputs:
environment:
description: "Environment (network) for workflow execution, e.g. `goerli`"
required: false
description: "Environment (network) for workflow execution, e.g. `sepolia`"
required: true
upstream_builds:
description: "Upstream builds"
required: false
Expand Down Expand Up @@ -248,8 +248,15 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
# Using fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
# is empty, the expression will be evaluated to
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

Expand Down Expand Up @@ -334,8 +341,15 @@ 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 }}
# Using fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
# is empty, the expression will be evaluated to
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.DAPP_DEV_TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

Expand Down
7 changes: 5 additions & 2 deletions solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions solidity/ecdsa/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
},
},
Expand Down Expand Up @@ -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"],
},
},
Expand Down
5 changes: 5 additions & 0 deletions solidity/random-beacon/deploy/01_deploy_reimbursement_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
ReimbursementPool.transactionHash,
2,
300000
)
await helpers.etherscan.verify(ReimbursementPool)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
)

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
BeaconSortitionPool.transactionHash,
2,
300000
)
await helpers.etherscan.verify(BeaconSortitionPool)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
BeaconDkgValidator.transactionHash,
2,
300000
)
await helpers.etherscan.verify(BeaconDkgValidator)
}

Expand Down
5 changes: 5 additions & 0 deletions solidity/random-beacon/deploy/04_deploy_random_beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
)

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
RandomBeacon.transactionHash,
2,
300000
)
await helpers.etherscan.verify(BLS)
await helpers.etherscan.verify(BeaconAuthorization)
await helpers.etherscan.verify(BeaconDkg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
)

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
RandomBeaconGovernance.transactionHash,
2,
300000
)
await helpers.etherscan.verify(RandomBeaconGovernance)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
)

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
RandomBeaconChaosnet.transactionHash,
2,
300000
)
await helpers.etherscan.verify(RandomBeaconChaosnet)
}

Expand Down
12 changes: 12 additions & 0 deletions solidity/random-beacon/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
},
},
Expand All @@ -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"],
},
},
Expand Down

0 comments on commit 94ed595

Please sign in to comment.