From 97860c5b4b5e1eaa7c95f8417075a698b393623d Mon Sep 17 00:00:00 2001 From: Marco Tabasco Date: Fri, 17 May 2024 01:50:28 +0200 Subject: [PATCH] env settings, remove GOERLI config and references --- .env.example | 4 +--- .github/workflows/tests-forked.yaml | 4 +++- docs/local-dev.md | 11 ++++++----- docs/tasks.md | 12 ++++++------ hardhat.config.ts | 27 +++------------------------ tasks/deploy.ts | 4 ++-- tasks/update-module.ts | 2 +- tasks/upgrade.ts | 4 ++-- 8 files changed, 24 insertions(+), 44 deletions(-) diff --git a/.env.example b/.env.example index c5dd187f..f66bb501 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,3 @@ -GOERLI_ETH_NODE_URL= -GOERLI_OWNER_PRIVATE_KEY= HOLESKY_ETH_NODE_URL= HOLESKY_OWNER_PRIVATE_KEY= MAINNET_ETH_NODE_URL= @@ -7,7 +5,7 @@ MAINNET_OWNER_PRIVATE_KEY= GAS_PRICE= GAS= ETHERSCAN_KEY= -INFURA_KEY= +NODE_PROVIDER_KEY= MINIMUM_BLOCKS_BEFORE_LIQUIDATION=100800 MINIMUM_LIQUIDATION_COLLATERAL=200000000 OPERATOR_MAX_FEE_INCREASE=3 diff --git a/.github/workflows/tests-forked.yaml b/.github/workflows/tests-forked.yaml index 3a2b419f..0e399fa6 100644 --- a/.github/workflows/tests-forked.yaml +++ b/.github/workflows/tests-forked.yaml @@ -7,8 +7,10 @@ jobs: runs-on: ubuntu-latest name: Hardhat unit test (forked network) env: # Set environment variables for all steps in this job - GH_TOKEN: ${{ secrets.github_token }} FORK_TESTING_ENABLED: true + GH_TOKEN: ${{ secrets.github_token }} + MAINNET_ETH_NODE_URL: ${{ secrets.mainnet_eth_node_url }} + NODE_PROVIDER_KEY: ${{ secrets.node_provider_key }} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 diff --git a/docs/local-dev.md b/docs/local-dev.md index dfcfceb3..7b40f3a9 100644 --- a/docs/local-dev.md +++ b/docs/local-dev.md @@ -33,11 +33,12 @@ In [hardhat.config.ts](../hardhat.config.ts) you can find specific configs for d For example, in `.env` file you can set: ``` -GOERLI_ETH_NODE_URL="https://goerli.infura.io/v3/..." -GOERLI_OWNER_PRIVATE_KEY="d79d.." +HOLESKY_ETH_NODE_URL="https://holesky.infura.io/v3/..." +NODE_PROVIDER_KEY="abcd1234..." +HOLESKY_OWNER_PRIVATE_KEY="d79d.." ``` -That means Hardhat will pick `config.networks.goerli` section in `hardhat.config.ts` to set the network parameters. +That means Hardhat will pick `config.networks.holesky` section in `hardhat.config.ts` to set the network parameters. ### Start the local node @@ -53,7 +54,7 @@ For more details about it and how to use MainNet forking you can find [here](htt The inital deployment process involves the deployment of all main modules (SSVClusters, SSVOperators, SSVDAO and SSVViews), SSVNetwork and SSVNetworkViews contracts. -Note: The SSV token address used when deploying to live networks (goerli, mainnet) is set in the hardhat config file. To deploy the contracts to a custom network defined in the hardhat config file, leave `SSVTOKEN_ADDRESS` empty in the `.env` file. You can set a specific SSV token address for custom networks too, if needed. +Note: The SSV token address used when deploying to live networks (holesky, mainnet) is set in the hardhat config file. To deploy the contracts to a custom network defined in the hardhat config file, leave `SSVTOKEN_ADDRESS` empty in the `.env` file. You can set a specific SSV token address for custom networks too, if needed. To run the deployment, execute: @@ -120,7 +121,7 @@ contracts/SSVNetwork.sol:SSVNetwork at 0x2279B7... for verification on the block explorer. Waiting for verification result... Successfully verified contract SSVNetwork on Etherscan. -https://goerli.etherscan.io/address/0x227...#code +https://holesky.etherscan.io/address/0x227...#code ``` After this action, you can go to the proxy contract in Etherscan and start interacting with it. diff --git a/docs/tasks.md b/docs/tasks.md index e0981ad3..2c64cb1a 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -47,17 +47,17 @@ npm run size-contracts This project uses hardhat tasks to perform the deployment and upgrade of the main contracts and modules. -Following Hardhat's way of working, you must specify the network against which you want to run the task using the `--network` parameter. In all the following examples, the goerli network will be used, but you can specify any defined in your `hardhat.config` file. +Following Hardhat's way of working, you must specify the network against which you want to run the task using the `--network` parameter. In all the following examples, the holesky network will be used, but you can specify any defined in your `hardhat.config` file. ### Deploy all contracts Runs the deployment of the main SSVNetwork and SSVNetworkViews contracts, along with their associated modules: ``` -npx hardhat --network goerli_testnet deploy:all +npx hardhat --network holesky_testnet deploy:all ``` -When deploying to live networks like Goerli or Mainnet, please double check the environment variables: +When deploying to live networks like Holesky or Mainnet, please double check the environment variables: - MINIMUM_BLOCKS_BEFORE_LIQUIDATION - MINIMUM_LIQUIDATION_COLLATERAL @@ -94,7 +94,7 @@ POSITIONAL ARGUMENTS: params Function parameters Example: -npx hardhat --network goerli_testnet upgrade:proxy --proxy-address 0x1234... --contract SSVNetworkV2 --init-function initializev2 param1 param2 +npx hardhat --network holesky_testnet upgrade:proxy --proxy-address 0x1234... --contract SSVNetworkV2 --init-function initializev2 param1 param2 ``` It is crucial to verify the upgraded contract using its proxy address. @@ -118,7 +118,7 @@ OPTIONS: Example: Update 'SSVOperators' module contract in the SSVNetwork -npx hardhat --network goerli_testnet update:module --module SSVOperators --attach-module true --proxy-address 0x1234... +npx hardhat --network holesky_testnet update:module --module SSVOperators --attach-module true --proxy-address 0x1234... ``` ### Upgrade a library @@ -144,7 +144,7 @@ OPTIONS: --proxy-address Proxy address of SSVNetwork / SSVNetworkViews (default: null) Example: -npx hardhat --network goerli_testnet upgrade:prepare --proxy-address 0x1234... --contract SSVNetworkViewsV2 +npx hardhat --network holesky_testnet upgrade:prepare --proxy-address 0x1234... --contract SSVNetworkViewsV2 ``` The task will return the new implementation address. After that, you can run `upgradeTo` or `upgradeToAndCall` in SSVNetwork / SSVNetworkViews proxy address, providing it as a parameter. diff --git a/hardhat.config.ts b/hardhat.config.ts index fa461825..bf5a4b62 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -82,30 +82,9 @@ const config: HardhatUserConfig = { }, }; -if (process.env.GOERLI_ETH_NODE_URL) { - const sharedConfig = { - url: process.env.GOERLI_ETH_NODE_URL, - accounts: [`0x${process.env.GOERLI_OWNER_PRIVATE_KEY}`], - gasPrice: +(process.env.GAS_PRICE || ''), - gas: +(process.env.GAS || ''), - }; - //@ts-ignore - config.networks = { - ...config.networks, - goerli_development: { - ...sharedConfig, - ssvToken: '0x6471F70b932390f527c6403773D082A0Db8e8A9F', - } as SSVNetworkConfig, - goerli_testnet: { - ...sharedConfig, - ssvToken: '0x3a9f01091C446bdE031E39ea8354647AFef091E7', - } as SSVNetworkConfig, - }; -} - if (process.env.HOLESKY_ETH_NODE_URL) { const sharedConfig = { - url: process.env.HOLESKY_ETH_NODE_URL, + url: `${process.env.HOLESKY_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`, accounts: [`0x${process.env.HOLESKY_OWNER_PRIVATE_KEY}`], gasPrice: +(process.env.GAS_PRICE || ''), gas: +(process.env.GAS || ''), @@ -129,7 +108,7 @@ if (process.env.MAINNET_ETH_NODE_URL) { config.networks = { ...config.networks, mainnet: { - url: process.env.MAINNET_ETH_NODE_URL, + url: `${process.env.MAINNET_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`, accounts: [`0x${process.env.MAINNET_OWNER_PRIVATE_KEY}`], gasPrice: +(process.env.GAS_PRICE || ''), gas: +(process.env.GAS || ''), @@ -145,7 +124,7 @@ if (process.env.FORK_TESTING_ENABLED) { ...config.networks?.hardhat, forking: { enabled: process.env.FORK_TESTING_ENABLED === 'true', - url: process.env.MAINNET_ETH_NODE_URL ? process.env.MAINNET_ETH_NODE_URL : '', + url: `${process.env.MAINNET_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`, blockNumber: 19621100, }, }, diff --git a/tasks/deploy.ts b/tasks/deploy.ts index 19aafd77..bd4c2c1e 100644 --- a/tasks/deploy.ts +++ b/tasks/deploy.ts @@ -9,7 +9,7 @@ It uses the Hardhat Runtime Environment (HRE) to execute the deployment tasks an it will be printed to the console, and the process will exit with a non-zero status code. @example // Deploy all contracts with the default deployer account -npx hardhat --network goerli_testnet deploy:all +npx hardhat --network holesky_testnet deploy:all @remarks The deployer account used will be the first one returned by ethers.getSigners(). Therefore, it should be appropriately configured in your Hardhat network configuration. @@ -49,7 +49,7 @@ The contract parameter specifies the name of the contract implementation to be d it will be printed to the console, and the process will exit with a non-zero status code. @example // Deploy SSVNetwork implementation contract with the default deployer account -npx hardhat --network goerli_testnet deploy:main-impl --contract SSVNetwork +npx hardhat --network holesky_testnet deploy:main-impl --contract SSVNetwork @remarks The deployer account used will be the first one returned by ethers.getSigners(). Therefore, it should be appropriately configured in your Hardhat network configuration. diff --git a/tasks/update-module.ts b/tasks/update-module.ts index e8dbbeef..dbdc28bb 100644 --- a/tasks/update-module.ts +++ b/tasks/update-module.ts @@ -11,7 +11,7 @@ The address of the SSVNetwork Proxy is expected to be set in the environment var @param {string} proxyAddress - The proxy address of the SSVNetwork contract. @example // Update 'SSVOperators' module contract in the SSVNetwork -npx hardhat --network goerli_testnet update:module --module SSVOperators +npx hardhat --network holesky_testnet update:module --module SSVOperators @remarks The deployer account used will be the first one returned by ethers.getSigners(). Therefore, it should be appropriately configured in your Hardhat network configuration. diff --git a/tasks/upgrade.ts b/tasks/upgrade.ts index 2bcbde82..cd24e0d8 100644 --- a/tasks/upgrade.ts +++ b/tasks/upgrade.ts @@ -16,7 +16,7 @@ If 'initFunction' is not provided, this parameter has no effect. @returns {void} This function doesn't return anything. After successfully upgrading, it prints the new implementation address to the console. @example // Upgrade the SSVNetwork contract to a new version 'SSVNetworkV2', and call a function 'initializev2' with parameters after upgrade: -npx hardhat --network goerli_testnet upgrade:proxy --proxyAddress 0x1234... --contract SSVNetworkV2 --initFunction initializev2 --params param1 param2 +npx hardhat --network holesky_testnet upgrade:proxy --proxyAddress 0x1234... --contract SSVNetworkV2 --initFunction initializev2 --params param1 param2 */ task('upgrade:proxy', 'Upgrade SSVNetwork / SSVNetworkViews proxy via hardhat upgrades plugin') .addParam('proxyAddress', 'Proxy address of SSVNetwork / SSVNetworkViews', null, types.string) @@ -60,7 +60,7 @@ The proxy address and contract name must be provided as parameters. @param {string} contract - The name of the new implementation contract to deploy for the upgrade. @example // Prepare an upgrade for the SSVNetworkViews proxy contract with a new implementation contract named 'SSVNetworkViewsV2' -npx hardhat --network goerli_testnet upgrade:prepare --proxyAddress 0x1234... --contract SSVNetworkViewsV2 +npx hardhat --network holesky_testnet upgrade:prepare --proxyAddress 0x1234... --contract SSVNetworkViewsV2 @remarks The deployer account used will be the first one returned by ethers.getSigners(). Therefore, it should be appropriately configured in your Hardhat network configuration.