Skip to content

Commit

Permalink
Support deployment on Sepolia
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.
  • Loading branch information
michalinacienciala committed Sep 5, 2023
1 parent f6996df commit a1cde6b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 22 deletions.
49 changes: 41 additions & 8 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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"
Expand Down Expand Up @@ -153,9 +153,22 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_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 }}
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
Expand Down Expand Up @@ -224,7 +237,14 @@ jobs:
- name: Verify contracts on Etherscan
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
# Use fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI...` credential
# is empty, the expressions will be evaluated to the `SEPOLIA...`
# one.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
run: |
yarn run hardhat --network ${{ github.event.inputs.environment }} \
etherscan-verify --license GPL-3.0 --force-license
Expand Down Expand Up @@ -259,9 +279,22 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_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 }}
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
Expand Down
2 changes: 1 addition & 1 deletion deploy/00_resolve_nucypher_staking_escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
} else if (
// TODO: For testnets currently we deploy a stub contract. We should consider
// switching to an actual contract.
hre.network.name !== "ropsten" &&
hre.network.name !== "sepolia" &&
hre.network.name !== "goerli" &&
(!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)
Expand Down
2 changes: 1 addition & 1 deletion deploy/00_resolve_nucypher_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
} else if (
// TODO: For testnets currently we deploy a stub contract. We should consider
// switching to an actual contract.
hre.network.name !== "ropsten" &&
hre.network.name !== "sepolia" &&
hre.network.name !== "goerli" &&
(!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)
Expand Down
2 changes: 1 addition & 1 deletion deploy/07_deploy_token_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
]
const tokenStakingInitializerArgs = []

// TODO: Consider upgradable deployment also for goerli.
// TODO: Consider upgradable deployment also for goerli/sepolia.
let tokenStakingAddress
if (hre.network.name == "mainnet") {
const TokenStaking = await ethers.getContractFactory("TokenStaking")
Expand Down
17 changes: 6 additions & 11 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,13 @@ const config: HardhatUserConfig = {
: undefined,
tags: ["tenderly"],
},
rinkeby: {
sepolia: {
url: process.env.CHAIN_API_URL || "",
chainId: 4,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
: undefined,
tags: ["tenderly"],
},
ropsten: {
url: process.env.CHAIN_API_URL || "",
chainId: 3,
chainId: 11155111,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [
process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY,
process.env.KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY,
process.env.KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY, // TODO: verify if we have different owner here or can we remove this
]
: undefined,
tags: ["tenderly"],
Expand Down Expand Up @@ -100,13 +92,15 @@ const config: HardhatUserConfig = {
// to the contract artifacts.
hardhat: process.env.FORKING_URL ? ["./external/mainnet"] : [],
goerli: ["./external/goerli"],
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
},
},
namedAccounts: {
deployer: {
default: 1, // take the first account as deployer
goerli: 0,
sepolia: 0,
// mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
thresholdCouncil: {
Expand All @@ -116,6 +110,7 @@ const config: HardhatUserConfig = {
default: 1, // same as the deployer
ropsten: "0x923C5Dbf353e99394A21Aa7B67F3327Ca111C67D",
goerli: "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc",
// sepolia: "", TODO: Fill with the address of the deployer
},
},
mocha: {
Expand Down

0 comments on commit a1cde6b

Please sign in to comment.