From 118249eeeabf9705362b50c84ceab8b05bafceed Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 20:08:55 +0200 Subject: [PATCH 1/7] Add deploy test --- .github/workflows/main.yml | 88 ++++++++++---------------------- proxy/hardhat.config.ts | 1 - proxy/migrations/deploySchain.ts | 64 +++++++++++------------ proxy/package.json | 2 +- proxy/scripts/test_deploy.sh | 20 ++++++++ proxy/yarn.lock | 78 +++++++++++++++++++++++----- 6 files changed, 144 insertions(+), 109 deletions(-) create mode 100755 proxy/scripts/test_deploy.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 159f0aa8b..bf3292561 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,82 +10,65 @@ on: branches-ignore: - 'docs-v*' +env: + NODE_VERSION: 20 + PYTHON_VERSION: 3.8 + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: test-contracts: runs-on: ubuntu-latest - env: - working-directory: ./proxy + defaults: + run: + working-directory: proxy steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: - submodules: recursive - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + submodules: true - name: Install PYTHON - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: ${{ env.PYTHON_VERSION }} + cache: 'pip' - name: Install NODE JS - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 18 + node-version: ${{ env.NODE_VERSION }} + cache: 'yarn' - name: Install project - working-directory: ${{env.working-directory}} run: | yarn install - name: Install slither - working-directory: ${{env.working-directory}} run: pip3 install -r scripts/requirements.txt - name: Lint solidity - working-directory: ${{env.working-directory}} run: yarn lint - name: Compile typescript - working-directory: ${{env.working-directory}} run: yarn tsc - name: Lint typescript - working-directory: ${{env.working-directory}} run: yarn eslint - name: Slither checks - working-directory: ${{env.working-directory}} run: yarn slither - name: Gas calculation test - working-directory: ${{env.working-directory}} run: npx hardhat test gas/calculateGas.ts + - name: Test deploy + run: bash ./scripts/test_deploy.sh + - name: Test upgrade - run: bash ./proxy/scripts/test_upgrade.sh + run: bash ./scripts/test_upgrade.sh - name: Run tests - working-directory: ${{env.working-directory}} run: | npx hardhat coverage --solcoverjs .solcover.js bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" @@ -98,38 +81,21 @@ jobs: working-directory: proxy steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - uses: actions/cache@v2 + - uses: actions/checkout@v4 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + submodules: true - name: Install PYTHON - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: ${{ env.PYTHON_VERSION }} + cache: 'pip' - name: Install NODE JS - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 18 + node-version: ${{ env.NODE_VERSION }} + cache: 'yarn' - name: Install project run: | diff --git a/proxy/hardhat.config.ts b/proxy/hardhat.config.ts index 43f4396a2..ebd01cb73 100644 --- a/proxy/hardhat.config.ts +++ b/proxy/hardhat.config.ts @@ -63,7 +63,6 @@ const config: HardhatUserConfig = { }, schain: { url: getCustomUrl(process.env.URL_W3_S_CHAIN), - gas: 12000000, accounts: getCustomPrivateKey(process.env.PRIVATE_KEY_FOR_SCHAIN), } }, diff --git a/proxy/migrations/deploySchain.ts b/proxy/migrations/deploySchain.ts index e9066244d..db6b1b3fd 100644 --- a/proxy/migrations/deploySchain.ts +++ b/proxy/migrations/deploySchain.ts @@ -24,7 +24,7 @@ */ import { promises as fs } from 'fs'; import { Interface } from "ethers/lib/utils"; -import { ethers, upgrades, network } from "hardhat"; +import { ethers, upgrades } from "hardhat"; import hre from "hardhat"; import { getAbi, getVersion } from '@skalenetwork/upgrade-tools'; import { Manifest } from "@openzeppelin/upgrades-core"; @@ -181,36 +181,36 @@ async function main() { deployed.set( "TokenManagerEth", { address: tokenManagerEth.address, interface: tokenManagerEth.interface } ); console.log("Contract TokenManagerEth deployed to", tokenManagerEth.address); - /* - In the moment of this code was written - ganache had a bug - that prevented proper execution - of estimateGas function - during deployment of smart contract - that exceed 24KB limit. - - In addition to this problem - upgrade-hardhat library - did not supported - manual gas limit configuration. - - TODO: in case of any one or both issues fixed - please remove this crazy workaround below - */ - if (network.config.gas === "auto") { - throw Error("Can't use auto because of problems with gas estimations"); - } - if (!process.env.PRIVATE_KEY_FOR_SCHAIN) { - throw Error("PRIVATE_KEY_FOR_SCHAIN is not set"); - } - const key = process.env.PRIVATE_KEY_FOR_SCHAIN; - const signerWithFixedGasEstimation = new ethers.Wallet(key, ethers.provider); - signerWithFixedGasEstimation.estimateGas = async() => { - return ethers.BigNumber.from(network.config.gas as number); - } + // /* + // In the moment of this code was written + // ganache had a bug + // that prevented proper execution + // of estimateGas function + // during deployment of smart contract + // that exceed 24KB limit. + + // In addition to this problem + // upgrade-hardhat library + // did not supported + // manual gas limit configuration. + + // TODO: in case of any one or both issues fixed + // please remove this crazy workaround below + // */ + // if (network.config.gas === "auto") { + // throw Error("Can't use auto because of problems with gas estimations"); + // } + // if (!process.env.PRIVATE_KEY_FOR_SCHAIN) { + // throw Error("PRIVATE_KEY_FOR_SCHAIN is not set"); + // } + // const key = process.env.PRIVATE_KEY_FOR_SCHAIN; + // const signerWithFixedGasEstimation = new ethers.Wallet(key, ethers.provider); + // signerWithFixedGasEstimation.estimateGas = async() => { + // return ethers.BigNumber.from(network.config.gas as number); + // } console.log("Deploy TokenManagerERC20"); - const tokenManagerERC20Factory = await ethers.getContractFactory("TokenManagerERC20", signerWithFixedGasEstimation); + const tokenManagerERC20Factory = await ethers.getContractFactory("TokenManagerERC20"); const tokenManagerERC20 = await upgrades.deployProxy(tokenManagerERC20Factory, [ schainName, messageProxy.address, @@ -225,7 +225,7 @@ async function main() { // The end of TODO: console.log("Deploy TokenManagerERC721"); - const tokenManagerERC721Factory = await ethers.getContractFactory("TokenManagerERC721", signerWithFixedGasEstimation); + const tokenManagerERC721Factory = await ethers.getContractFactory("TokenManagerERC721"); const tokenManagerERC721 = await upgrades.deployProxy(tokenManagerERC721Factory, [ schainName, messageProxy.address, @@ -238,7 +238,7 @@ async function main() { console.log("Contract TokenManagerERC721 deployed to", tokenManagerERC721.address); console.log("Deploy TokenManagerERC1155"); - const tokenManagerERC1155Factory = await ethers.getContractFactory("TokenManagerERC1155", signerWithFixedGasEstimation); + const tokenManagerERC1155Factory = await ethers.getContractFactory("TokenManagerERC1155"); const tokenManagerERC1155 = await upgrades.deployProxy(tokenManagerERC1155Factory, [ schainName, messageProxy.address, @@ -251,7 +251,7 @@ async function main() { console.log("Contract TokenManagerERC1155 deployed to", tokenManagerERC1155.address); console.log("Deploy TokenManagerERC721WithMetadata"); - const tokenManagerERC721WithMetadataFactory = await ethers.getContractFactory("TokenManagerERC721WithMetadata", signerWithFixedGasEstimation); + const tokenManagerERC721WithMetadataFactory = await ethers.getContractFactory("TokenManagerERC721WithMetadata"); const tokenManagerERC721WithMetadata = await upgrades.deployProxy(tokenManagerERC721WithMetadataFactory, [ schainName, messageProxy.address, diff --git a/proxy/package.json b/proxy/package.json index 99371bca6..356792a7b 100644 --- a/proxy/package.json +++ b/proxy/package.json @@ -58,7 +58,7 @@ "codecov": "^3.7.1", "eslint": "^8.46.0", "ethereum-waffle": "^4.0.10", - "ganache": "7.4.3", + "ganache": "7.9.2", "kill-port": "^1.6.1", "solhint": "3.3.6", "solidity-coverage": "^0.8.4", diff --git a/proxy/scripts/test_deploy.sh b/proxy/scripts/test_deploy.sh new file mode 100755 index 000000000..c1f40067c --- /dev/null +++ b/proxy/scripts/test_deploy.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +ACCOUNTS=accounts.json +GANACHE=$(npx ganache \ + --😈 \ + --wallet.accountKeysPath "$ACCOUNTS" \ + --chain.allowUnlimitedContractSize \ +) +PRIVATE_KEY=$(cat "$ACCOUNTS" | jq -r "first(.private_keys[])") + +export CHAIN_NAME_SCHAIN="d2-chain" +export PRIVATE_KEY_FOR_ETHEREUM=$PRIVATE_KEY +export PRIVATE_KEY_FOR_SCHAIN=$PRIVATE_KEY + +yarn deploy-skale-manager-components +yarn deploy-to-both-chains + +npx ganache instances stop $GANACHE diff --git a/proxy/yarn.lock b/proxy/yarn.lock index 59b261e68..929cd7b08 100644 --- a/proxy/yarn.lock +++ b/proxy/yarn.lock @@ -1455,6 +1455,16 @@ dependencies: node-gyp-build "4.3.0" +"@trufflesuite/uws-js-unofficial@20.30.0-unofficial.0": + version "20.30.0-unofficial.0" + resolved "https://registry.yarnpkg.com/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.30.0-unofficial.0.tgz#2fbc2f8ef7e82fbeea6abaf7e8a9d42a02b479d3" + integrity sha512-r5X0aOQcuT6pLwTRLD+mPnAM/nlKtvIK4Z+My++A8tTOR0qTjNRx8UB8jzRj3D+p9PMAp5LnpCUUGmz7/TppwA== + dependencies: + ws "8.13.0" + optionalDependencies: + bufferutil "4.0.7" + utf-8-validate "6.0.3" + "@typechain/ethers-v5@^10.0.0": version "10.2.1" resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz#50241e6957683281ecfa03fb5a6724d8a3ce2391" @@ -1774,7 +1784,7 @@ abortcontroller-polyfill@^1.7.3: resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== -abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: +abstract-level@1.0.3, abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/abstract-level/-/abstract-level-1.0.3.tgz#78a67d3d84da55ee15201486ab44c09560070741" integrity sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA== @@ -1787,18 +1797,7 @@ abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: module-error "^1.0.1" queue-microtask "^1.2.3" -abstract-leveldown@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" - integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== - dependencies: - buffer "^5.5.0" - immediate "^3.2.3" - level-concat-iterator "~2.0.0" - level-supports "~1.0.0" - xtend "~4.0.0" - -abstract-leveldown@^7.2.0: +abstract-leveldown@7.2.0, abstract-leveldown@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz#08d19d4e26fb5be426f7a57004851b39e1795a2e" integrity sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ== @@ -1810,6 +1809,17 @@ abstract-leveldown@^7.2.0: level-supports "^2.0.1" queue-microtask "^1.2.3" +abstract-leveldown@^6.2.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" + integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + abstract-leveldown@~6.2.1: version "6.2.3" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb" @@ -2079,7 +2089,7 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-eventemitter@^0.2.4: +async-eventemitter@0.2.4, async-eventemitter@^0.2.4: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== @@ -2347,6 +2357,13 @@ bufferutil@4.0.5: dependencies: node-gyp-build "^4.3.0" +bufferutil@4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" + integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== + dependencies: + node-gyp-build "^4.3.0" + bufferutil@^4.0.1: version "4.0.4" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.4.tgz#ab81373d313a6ead0d734e98c448c722734ae7bb" @@ -3907,6 +3924,27 @@ ganache@7.4.3: bufferutil "4.0.5" utf-8-validate "5.0.7" +ganache@7.9.2: + version "7.9.2" + resolved "https://registry.yarnpkg.com/ganache/-/ganache-7.9.2.tgz#77f506ad2735dd9109696ffa1834a9dd2f806449" + integrity sha512-7gsVVDpO9AhrFyDMWWl7SpMsPpqGcnAzjxz3k32LheIPNd64p2XsY9GYRdhWmKuryb60W1iaWPZWDkFKlbRWHA== + dependencies: + "@trufflesuite/bigint-buffer" "1.1.10" + "@trufflesuite/uws-js-unofficial" "20.30.0-unofficial.0" + "@types/bn.js" "^5.1.0" + "@types/lru-cache" "5.1.1" + "@types/seedrandom" "3.0.1" + abstract-level "1.0.3" + abstract-leveldown "7.2.0" + async-eventemitter "0.2.4" + emittery "0.10.0" + keccak "3.0.2" + leveldown "6.1.0" + secp256k1 "4.0.3" + optionalDependencies: + bufferutil "4.0.5" + utf-8-validate "5.0.7" + get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -6991,6 +7029,13 @@ utf-8-validate@5.0.7: dependencies: node-gyp-build "^4.3.0" +utf-8-validate@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-6.0.3.tgz#7d8c936d854e86b24d1d655f138ee27d2636d777" + integrity sha512-uIuGf9TWQ/y+0Lp+KGZCMuJWc3N9BHA+l/UmHd/oUHwJJDeysyTRxNQVkbzsIWfGFbRe3OcgML/i0mvVRPOyDA== + dependencies: + node-gyp-build "^4.3.0" + utf-8-validate@^5.0.2: version "5.0.6" resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.6.tgz#e1b3e0a5cc8648a3b44c1799fbb170d1aaaffe80" @@ -7294,6 +7339,11 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.13.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + ws@^7.4.6: version "7.5.5" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" From 43483ca6144bf2553f46b5e9dec07bfec083d7f6 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 20:39:36 +0200 Subject: [PATCH 2/7] Fix upgrade test --- proxy/package.json | 1 - proxy/scripts/test_upgrade.sh | 10 ++++++++-- proxy/yarn.lock | 18 ------------------ 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/proxy/package.json b/proxy/package.json index 356792a7b..a78711f25 100644 --- a/proxy/package.json +++ b/proxy/package.json @@ -59,7 +59,6 @@ "eslint": "^8.46.0", "ethereum-waffle": "^4.0.10", "ganache": "7.9.2", - "kill-port": "^1.6.1", "solhint": "3.3.6", "solidity-coverage": "^0.8.4", "ts-generator": "^0.1.1", diff --git a/proxy/scripts/test_upgrade.sh b/proxy/scripts/test_upgrade.sh index 3711481ce..bc7209ea9 100755 --- a/proxy/scripts/test_upgrade.sh +++ b/proxy/scripts/test_upgrade.sh @@ -22,7 +22,13 @@ DEPLOYED_DIR=$GITHUB_WORKSPACE/deployed-IMA/ git clone --branch "$DEPLOYED_TAG" "https://github.com/$GITHUB_REPOSITORY.git" "$DEPLOYED_DIR" ACCOUNTS_FILENAME="$DEPLOYED_DIR/proxy/generatedAccounts.json" -npx ganache-cli --gasLimit 9000000 --quiet --allowUnlimitedContractSize --account_keys_path "$ACCOUNTS_FILENAME" & +GANACHE=$(npx ganache-cli \ + --😈 \ + --miner.blockGasLimit 9000000 \ + --logging.quiet \ + --chain.allowUnlimitedContractSize \ + --wallet.accountKeysPath "$ACCOUNTS_FILENAME" \ +) cd "$DEPLOYED_DIR" yarn install @@ -66,4 +72,4 @@ ALLOW_NOT_ATOMIC_UPGRADE="OK" \ VERSION=$VERSION_TAG \ npx hardhat run migrations/upgradeSchain.ts --network localhost -npx kill-port 8545 +npx ganache instances stop $GANACHE diff --git a/proxy/yarn.lock b/proxy/yarn.lock index 929cd7b08..19b5c35c8 100644 --- a/proxy/yarn.lock +++ b/proxy/yarn.lock @@ -3982,11 +3982,6 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" -get-them-args@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/get-them-args/-/get-them-args-1.3.2.tgz#74a20ba8a4abece5ae199ad03f2bcc68fdfc9ba5" - integrity sha1-dKILqKSr7OWuGZrQPyvMaP38m6U= - getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -4919,14 +4914,6 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -kill-port@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/kill-port/-/kill-port-1.6.1.tgz#560fe79484583bdf3a5e908557dae614447618aa" - integrity sha512-un0Y55cOM7JKGaLnGja28T38tDDop0AQ8N0KlAdyh+B1nmMoX8AnNmqPNZbS3mUMgiST51DCVqmbFT1gNJpVNw== - dependencies: - get-them-args "1.3.2" - shell-exec "1.0.2" - kind-of@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" @@ -6295,11 +6282,6 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-exec@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/shell-exec/-/shell-exec-1.0.2.tgz#2e9361b0fde1d73f476c4b6671fa17785f696756" - integrity sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg== - shelljs@^0.8.3: version "0.8.4" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" From 26f2b9c96ab52ec6e51dab962d3f67efb2c5d7bd Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 20:52:05 +0200 Subject: [PATCH 3/7] Fix upgrade test working directory --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf3292561..be0a61e6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,8 @@ jobs: run: bash ./scripts/test_deploy.sh - name: Test upgrade - run: bash ./scripts/test_upgrade.sh + working-directory: / + run: bash ./proxy/scripts/test_upgrade.sh - name: Run tests run: | From 352fc15b806dcaf97b4300b4417f452e459a0f8c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 20:58:48 +0200 Subject: [PATCH 4/7] Fix codacy warnings --- proxy/scripts/test_deploy.sh | 4 ++-- proxy/scripts/test_upgrade.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/scripts/test_deploy.sh b/proxy/scripts/test_deploy.sh index c1f40067c..25d88d5e1 100755 --- a/proxy/scripts/test_deploy.sh +++ b/proxy/scripts/test_deploy.sh @@ -8,7 +8,7 @@ GANACHE=$(npx ganache \ --wallet.accountKeysPath "$ACCOUNTS" \ --chain.allowUnlimitedContractSize \ ) -PRIVATE_KEY=$(cat "$ACCOUNTS" | jq -r "first(.private_keys[])") +PRIVATE_KEY=$(jq -r "first(.private_keys[])" < "$ACCOUNTS") export CHAIN_NAME_SCHAIN="d2-chain" export PRIVATE_KEY_FOR_ETHEREUM=$PRIVATE_KEY @@ -17,4 +17,4 @@ export PRIVATE_KEY_FOR_SCHAIN=$PRIVATE_KEY yarn deploy-skale-manager-components yarn deploy-to-both-chains -npx ganache instances stop $GANACHE +npx ganache instances stop "$GANACHE" diff --git a/proxy/scripts/test_upgrade.sh b/proxy/scripts/test_upgrade.sh index bc7209ea9..ed7ec3f9b 100755 --- a/proxy/scripts/test_upgrade.sh +++ b/proxy/scripts/test_upgrade.sh @@ -72,4 +72,4 @@ ALLOW_NOT_ATOMIC_UPGRADE="OK" \ VERSION=$VERSION_TAG \ npx hardhat run migrations/upgradeSchain.ts --network localhost -npx ganache instances stop $GANACHE +npx ganache instances stop "$GANACHE" From 4601260fa7857442eb6e0d98ca26448f1f53cc13 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 21:04:20 +0200 Subject: [PATCH 5/7] Change upgrade test working directory --- .github/workflows/main.yml | 3 +-- proxy/scripts/test_upgrade.sh | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be0a61e6b..bf3292561 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,8 +66,7 @@ jobs: run: bash ./scripts/test_deploy.sh - name: Test upgrade - working-directory: / - run: bash ./proxy/scripts/test_upgrade.sh + run: bash ./scripts/test_upgrade.sh - name: Run tests run: | diff --git a/proxy/scripts/test_upgrade.sh b/proxy/scripts/test_upgrade.sh index ed7ec3f9b..82b388334 100755 --- a/proxy/scripts/test_upgrade.sh +++ b/proxy/scripts/test_upgrade.sh @@ -12,6 +12,8 @@ then GITHUB_REPOSITORY="skalenetwork/IMA" fi +echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" + DEPLOYED_TAG="$(cat "$GITHUB_WORKSPACE"/proxy/DEPLOYED)" VERSION_TAG="$(cat "$GITHUB_WORKSPACE"/VERSION)" @@ -22,7 +24,7 @@ DEPLOYED_DIR=$GITHUB_WORKSPACE/deployed-IMA/ git clone --branch "$DEPLOYED_TAG" "https://github.com/$GITHUB_REPOSITORY.git" "$DEPLOYED_DIR" ACCOUNTS_FILENAME="$DEPLOYED_DIR/proxy/generatedAccounts.json" -GANACHE=$(npx ganache-cli \ +GANACHE=$(npx ganache \ --😈 \ --miner.blockGasLimit 9000000 \ --logging.quiet \ @@ -30,6 +32,8 @@ GANACHE=$(npx ganache-cli \ --wallet.accountKeysPath "$ACCOUNTS_FILENAME" \ ) +echo "Ganache: $GANACHE" + cd "$DEPLOYED_DIR" yarn install cd proxy From 8029c3d02029fb79edf6a13004d7b017674a2ff2 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 15 Jan 2024 21:21:30 +0200 Subject: [PATCH 6/7] Downgrade nodejs --- .github/workflows/main.yml | 2 +- proxy/scripts/test_upgrade.sh | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf3292561..76548c7d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ on: - 'docs-v*' env: - NODE_VERSION: 20 + NODE_VERSION: 18 PYTHON_VERSION: 3.8 # A workflow run is made up of one or more jobs that can run sequentially or in parallel diff --git a/proxy/scripts/test_upgrade.sh b/proxy/scripts/test_upgrade.sh index 82b388334..68aec7329 100755 --- a/proxy/scripts/test_upgrade.sh +++ b/proxy/scripts/test_upgrade.sh @@ -12,8 +12,6 @@ then GITHUB_REPOSITORY="skalenetwork/IMA" fi -echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" - DEPLOYED_TAG="$(cat "$GITHUB_WORKSPACE"/proxy/DEPLOYED)" VERSION_TAG="$(cat "$GITHUB_WORKSPACE"/VERSION)" @@ -32,8 +30,6 @@ GANACHE=$(npx ganache \ --wallet.accountKeysPath "$ACCOUNTS_FILENAME" \ ) -echo "Ganache: $GANACHE" - cd "$DEPLOYED_DIR" yarn install cd proxy From 99271d987b85839588f7116c83a6ae59b1e28f6a Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 16 Jan 2024 16:54:08 +0200 Subject: [PATCH 7/7] Remove unnecessary comments --- proxy/migrations/deploySchain.ts | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/proxy/migrations/deploySchain.ts b/proxy/migrations/deploySchain.ts index db6b1b3fd..ed4863d9e 100644 --- a/proxy/migrations/deploySchain.ts +++ b/proxy/migrations/deploySchain.ts @@ -181,34 +181,6 @@ async function main() { deployed.set( "TokenManagerEth", { address: tokenManagerEth.address, interface: tokenManagerEth.interface } ); console.log("Contract TokenManagerEth deployed to", tokenManagerEth.address); - // /* - // In the moment of this code was written - // ganache had a bug - // that prevented proper execution - // of estimateGas function - // during deployment of smart contract - // that exceed 24KB limit. - - // In addition to this problem - // upgrade-hardhat library - // did not supported - // manual gas limit configuration. - - // TODO: in case of any one or both issues fixed - // please remove this crazy workaround below - // */ - // if (network.config.gas === "auto") { - // throw Error("Can't use auto because of problems with gas estimations"); - // } - // if (!process.env.PRIVATE_KEY_FOR_SCHAIN) { - // throw Error("PRIVATE_KEY_FOR_SCHAIN is not set"); - // } - // const key = process.env.PRIVATE_KEY_FOR_SCHAIN; - // const signerWithFixedGasEstimation = new ethers.Wallet(key, ethers.provider); - // signerWithFixedGasEstimation.estimateGas = async() => { - // return ethers.BigNumber.from(network.config.gas as number); - // } - console.log("Deploy TokenManagerERC20"); const tokenManagerERC20Factory = await ethers.getContractFactory("TokenManagerERC20"); const tokenManagerERC20 = await upgrades.deployProxy(tokenManagerERC20Factory, [