From dd4063167e6f32e70166963c666d077a948d70b1 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 20 Jun 2023 19:11:47 +0300 Subject: [PATCH 01/83] Add ABI generation --- .github/workflows/publish.yml | 18 ++++++++++--- .github/workflows/test.yml | 3 +++ scripts/generateAbi.ts | 50 +++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 scripts/generateAbi.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2484101e..bd99e1d4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,7 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - + - name: Install NODE JS uses: actions/setup-node@v2 with: @@ -39,7 +39,7 @@ jobs: - name: Install project run: yarn install - + - name: Build and publish container run: | export BRANCH=${GITHUB_REF##*/} @@ -50,7 +50,10 @@ jobs: ( test $BRANCH = "stable" || test $BRANCH = "master" && export PRERELEASE=false ) || export PRERELEASE=true echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV bash ./scripts/build_and_publish.sh - + + - name: Generate ABI + run: npx hardhat run scripts/generateAbi.ts + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -61,3 +64,12 @@ jobs: release_name: ${{ env.VERSION }} draft: false prerelease: ${{ env.PRERELEASE }} + + - name: Upload ABIs + id: upload-abi + uses: dwenegar/upload-release-assets@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ steps.create_release.outputs.id }} + assets_path: data/skale-manager-*-abi.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 101865fe..8a1ebec8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,6 +71,9 @@ jobs: NODE_VERSION: ${{ matrix.node-version }} run: ./scripts/test_upgrade.sh + - name: Test ABI ageneration + run: npx hardhat run scripts/generateAbi.ts + - name: Run tests run: npx hardhat coverage --solcoverjs .solcover.js diff --git a/scripts/generateAbi.ts b/scripts/generateAbi.ts new file mode 100644 index 00000000..f622a464 --- /dev/null +++ b/scripts/generateAbi.ts @@ -0,0 +1,50 @@ +import { promises as fs } from 'fs'; +import { contracts } from "../migrations/deploy"; +import { ethers } from "hardhat"; +import { getAbi, getVersion } from '@skalenetwork/upgrade-tools'; +import { ContractFactory } from 'ethers'; +import { Libraries } from '@nomiclabs/hardhat-ethers/types'; + +async function main() { + const allContracts = contracts.concat(["ContractManager", "TimeHelpersWithDebug"]) + const abi: {[name: string]: []} = {}; + const librariesRequirements: {[name: string]: string[]} = { + "Nodes": [ + "SegmentTree" + ], + "SkaleDKG": [ + "SkaleDkgAlright", + "SkaleDkgBroadcast", + "SkaleDkgComplaint", + "SkaleDkgPreResponse", + "SkaleDkgResponse" + ] + } + for (const contractName of allContracts) { + console.log(`Load ABI of ${contractName}`); + let factory: ContractFactory; + if (Object.keys(librariesRequirements).includes(contractName)) { + const libraries: Libraries = {}; + for(const library of librariesRequirements[contractName]) { + libraries[library] = ethers.constants.AddressZero; + } + factory = await ethers.getContractFactory(contractName, {libraries}); + } else { + factory = await ethers.getContractFactory(contractName); + } + abi[contractName] = getAbi(factory.interface); + } + const version = await getVersion(); + const filename = `data/skale-manager-${version}-abi.json`; + console.log(`Save to ${filename}`) + await fs.writeFile(filename, JSON.stringify(abi, null, 4)); +} + +if (require.main === module) { + main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); +} From 3cf1d615c550797fd2fe2022dd1b44db0680a614 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 3 Jul 2023 17:06:02 +0300 Subject: [PATCH 02/83] Integrate skale-contract into the upgrade script --- .github/workflows/test.yml | 2 +- migrations/upgrade.ts | 28 ++- package.json | 2 +- yarn.lock | 419 ++++++++++++++++++++++++++++++++++++- 4 files changed, 434 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a1ebec8..b9901b78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,7 +71,7 @@ jobs: NODE_VERSION: ${{ matrix.node-version }} run: ./scripts/test_upgrade.sh - - name: Test ABI ageneration + - name: Test ABI generation run: npx hardhat run scripts/generateAbi.ts - name: Run tests diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 5284cb65..31fd1c72 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -1,37 +1,43 @@ import chalk from "chalk"; import { contracts } from "./deploy"; -import { promises as fs } from "fs"; import { ethers } from "hardhat"; import { Upgrader, AutoSubmitter } from "@skalenetwork/upgrade-tools"; -import { SkaleABIFile } from "@skalenetwork/upgrade-tools/dist/src/types/SkaleABIFile"; +import { skaleContracts, Instance } from "@skalenetwork/skale-contracts"; import { SkaleManager } from "../typechain-types"; -async function getSkaleManagerAbiAndAddresses(): Promise { - if (!process.env.ABI) { - console.log(chalk.red("Set path to file with ABI and addresses to ABI environment variables")); +async function getSkaleManagerInstance() { + if (process.env.ABI) { + console.log("This version of the upgrade script ignores manually provided ABI"); + console.log("Do not set ABI environment variable"); + } + if (!process.env.TARGET) { + console.log(chalk.red("Specify desired skale-manager instance")); + console.log(chalk.red("Set instance alias or SkaleManager address to TARGET environment variable")); process.exit(1); } - const abiFilename = process.env.ABI; - return JSON.parse(await fs.readFile(abiFilename, "utf-8")) as SkaleABIFile; + const network = await skaleContracts.getNetworkByChainId((await ethers.provider.getNetwork()).chainId); + const project = await network.getProject("skale-manager"); + return await project.getInstance(process.env.TARGET); } class SkaleManagerUpgrader extends Upgrader { constructor( targetVersion: string, - abi: SkaleABIFile, + instance: Instance, contractNamesToUpgrade: string[], submitter = new AutoSubmitter()) { super( "skale-manager", targetVersion, - abi, + instance, contractNamesToUpgrade, submitter); } async getSkaleManager() { - return await ethers.getContractAt("SkaleManager", this.abi.skale_manager_address as string) as SkaleManager; + // TODO: replace with this.instance.getContract + return await ethers.getContractAt("SkaleManager", await this.instance.getContractAddress("SkaleManager")) as SkaleManager; } getDeployedVersion = async () => { @@ -59,7 +65,7 @@ class SkaleManagerUpgrader extends Upgrader { async function main() { const upgrader = new SkaleManagerUpgrader( "1.9.3", - await getSkaleManagerAbiAndAddresses(), + await getSkaleManagerInstance(), contracts, ); await upgrader.upgrade(); diff --git a/package.json b/package.json index 885328e8..5cc2a894 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.6.0", "@openzeppelin/hardhat-upgrades": "^1.13.0", "@skalenetwork/skale-manager-interfaces": "2.0.0", - "@skalenetwork/upgrade-tools": "^2.0.0-develop.0", + "@skalenetwork/upgrade-tools": "^3.0.0-skale-contracts.0", "@typechain/hardhat": "^4.0.0", "dotenv": "^16.0.0", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 6844ec20..395289fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -549,6 +549,21 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/abstract-provider@5.5.1", "@ethersproject/abstract-provider@^5.5.0": version "5.5.1" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz#2f1f6e8a3ab7d378d8ad0b5718460f85649710c5" @@ -562,6 +577,19 @@ "@ethersproject/transactions" "^5.5.0" "@ethersproject/web" "^5.5.0" +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + "@ethersproject/abstract-signer@5.5.0", "@ethersproject/abstract-signer@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz#590ff6693370c60ae376bf1c7ada59eb2a8dd08d" @@ -573,6 +601,17 @@ "@ethersproject/logger" "^5.5.0" "@ethersproject/properties" "^5.5.0" +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/address@5.5.0", "@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.0.4", "@ethersproject/address@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" @@ -584,6 +623,17 @@ "@ethersproject/logger" "^5.5.0" "@ethersproject/rlp" "^5.5.0" +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/base64@5.5.0", "@ethersproject/base64@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.5.0.tgz#881e8544e47ed976930836986e5eb8fab259c090" @@ -591,6 +641,13 @@ dependencies: "@ethersproject/bytes" "^5.5.0" +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/basex@5.5.0", "@ethersproject/basex@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.5.0.tgz#e40a53ae6d6b09ab4d977bd037010d4bed21b4d3" @@ -599,6 +656,14 @@ "@ethersproject/bytes" "^5.5.0" "@ethersproject/properties" "^5.5.0" +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/bignumber@5.5.0", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.7", "@ethersproject/bignumber@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.5.0.tgz#875b143f04a216f4f8b96245bde942d42d279527" @@ -608,6 +673,15 @@ "@ethersproject/logger" "^5.5.0" bn.js "^4.11.9" +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + "@ethersproject/bytes@5.5.0", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c" @@ -615,6 +689,13 @@ dependencies: "@ethersproject/logger" "^5.5.0" +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + "@ethersproject/constants@5.5.0", "@ethersproject/constants@>=5.0.0-beta.128", "@ethersproject/constants@^5.0.4", "@ethersproject/constants@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.5.0.tgz#d2a2cd7d94bd1d58377d1d66c4f53c9be4d0a45e" @@ -622,6 +703,13 @@ dependencies: "@ethersproject/bignumber" "^5.5.0" +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/contracts@5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.5.0.tgz#b735260d4bd61283a670a82d5275e2a38892c197" @@ -638,6 +726,22 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/transactions" "^5.5.0" +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/hash@5.5.0", "@ethersproject/hash@>=5.0.0-beta.128", "@ethersproject/hash@^5.0.4", "@ethersproject/hash@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.5.0.tgz#7cee76d08f88d1873574c849e0207dcb32380cc9" @@ -652,6 +756,21 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/hdnode@5.5.0", "@ethersproject/hdnode@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.5.0.tgz#4a04e28f41c546f7c978528ea1575206a200ddf6" @@ -670,6 +789,24 @@ "@ethersproject/transactions" "^5.5.0" "@ethersproject/wordlists" "^5.5.0" +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + "@ethersproject/json-wallets@5.5.0", "@ethersproject/json-wallets@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz#dd522d4297e15bccc8e1427d247ec8376b60e325" @@ -689,6 +826,25 @@ aes-js "3.0.0" scrypt-js "3.0.1" +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + "@ethersproject/keccak256@5.5.0", "@ethersproject/keccak256@>=5.0.0-beta.127", "@ethersproject/keccak256@^5.0.3", "@ethersproject/keccak256@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.5.0.tgz#e4b1f9d7701da87c564ffe336f86dcee82983492" @@ -697,11 +853,24 @@ "@ethersproject/bytes" "^5.5.0" js-sha3 "0.8.0" +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + "@ethersproject/logger@5.5.0", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.5", "@ethersproject/logger@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d" integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg== +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + "@ethersproject/networks@5.5.2", "@ethersproject/networks@^5.5.0": version "5.5.2" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.2.tgz#784c8b1283cd2a931114ab428dae1bd00c07630b" @@ -709,6 +878,13 @@ dependencies: "@ethersproject/logger" "^5.5.0" +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2@5.5.0", "@ethersproject/pbkdf2@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz#e25032cdf02f31505d47afbf9c3e000d95c4a050" @@ -717,6 +893,14 @@ "@ethersproject/bytes" "^5.5.0" "@ethersproject/sha2" "^5.5.0" +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/properties@5.5.0", "@ethersproject/properties@>=5.0.0-beta.131", "@ethersproject/properties@^5.0.3", "@ethersproject/properties@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.5.0.tgz#61f00f2bb83376d2071baab02245f92070c59995" @@ -724,6 +908,13 @@ dependencies: "@ethersproject/logger" "^5.5.0" +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + "@ethersproject/providers@5.5.2": version "5.5.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.2.tgz#131ccf52dc17afd0ab69ed444b8c0e3a27297d99" @@ -749,6 +940,32 @@ bech32 "1.1.4" ws "7.4.6" +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + "@ethersproject/random@5.5.1", "@ethersproject/random@^5.5.0": version "5.5.1" resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.5.1.tgz#7cdf38ea93dc0b1ed1d8e480ccdaf3535c555415" @@ -757,6 +974,14 @@ "@ethersproject/bytes" "^5.5.0" "@ethersproject/logger" "^5.5.0" +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp@5.5.0", "@ethersproject/rlp@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.5.0.tgz#530f4f608f9ca9d4f89c24ab95db58ab56ab99a0" @@ -765,6 +990,14 @@ "@ethersproject/bytes" "^5.5.0" "@ethersproject/logger" "^5.5.0" +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2@5.5.0", "@ethersproject/sha2@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7" @@ -774,6 +1007,15 @@ "@ethersproject/logger" "^5.5.0" hash.js "1.1.7" +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + "@ethersproject/signing-key@5.5.0", "@ethersproject/signing-key@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.5.0.tgz#2aa37169ce7e01e3e80f2c14325f624c29cedbe0" @@ -786,6 +1028,18 @@ elliptic "6.5.4" hash.js "1.1.7" +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + "@ethersproject/solidity@5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.5.0.tgz#2662eb3e5da471b85a20531e420054278362f93f" @@ -798,6 +1052,18 @@ "@ethersproject/sha2" "^5.5.0" "@ethersproject/strings" "^5.5.0" +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/strings@5.5.0", "@ethersproject/strings@>=5.0.0-beta.130", "@ethersproject/strings@^5.0.4", "@ethersproject/strings@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.5.0.tgz#e6784d00ec6c57710755699003bc747e98c5d549" @@ -807,6 +1073,15 @@ "@ethersproject/constants" "^5.5.0" "@ethersproject/logger" "^5.5.0" +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/transactions@5.5.0", "@ethersproject/transactions@^5.0.0-beta.135", "@ethersproject/transactions@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.5.0.tgz#7e9bf72e97bcdf69db34fe0d59e2f4203c7a2908" @@ -822,6 +1097,21 @@ "@ethersproject/rlp" "^5.5.0" "@ethersproject/signing-key" "^5.5.0" +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/units@5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.5.0.tgz#104d02db5b5dc42cc672cc4587bafb87a95ee45e" @@ -831,6 +1121,15 @@ "@ethersproject/constants" "^5.5.0" "@ethersproject/logger" "^5.5.0" +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/wallet@5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.5.0.tgz#322a10527a440ece593980dca6182f17d54eae75" @@ -852,6 +1151,27 @@ "@ethersproject/transactions" "^5.5.0" "@ethersproject/wordlists" "^5.5.0" +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/json-wallets" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + "@ethersproject/web@5.5.1", "@ethersproject/web@^5.5.0": version "5.5.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.1.tgz#cfcc4a074a6936c657878ac58917a61341681316" @@ -863,6 +1183,17 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/wordlists@5.5.0", "@ethersproject/wordlists@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.5.0.tgz#aac74963aa43e643638e5172353d931b347d584f" @@ -874,6 +1205,17 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@humanwhocodes/config-array@^0.9.2": version "0.9.3" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.3.tgz#f2564c744b387775b436418491f15fce6601f63e" @@ -1178,17 +1520,26 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@skalenetwork/skale-contracts@^0.0.1-main.15": + version "0.0.1-main.15" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.0.1-main.15.tgz#86d9dba1e617f6c5c250a02e55745b50eae5fc9e" + integrity sha512-vlztY9cLSOo3Sk61dE5kmXxFmv6mKG4B1wbF9cVk6ErYLSpamPsOkIsqFL6+tw/nAXgkzkzRi2uiLKvTy2PtAA== + dependencies: + axios "^1.4.0" + ethers "^5.7.2" + "@skalenetwork/skale-manager-interfaces@2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0.tgz#afb63131e5c498cfa69219567f9f52b85f0856c9" integrity sha512-Pge3p4vpeNaXHjwntX+8b38NEcT81a67I32bbnU+l1uSo4kmyXd0VblHMO84H1Azr9TzF3ZmNCG+GI2yntSx2w== -"@skalenetwork/upgrade-tools@^2.0.0-develop.0": - version "2.0.0-refactor.20" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-2.0.0-refactor.20.tgz#98a1ebc3f2dcd022316c7fe1b6158aaff80f23a6" - integrity sha512-m0LqIrxvPdiEBXi3OUZs+y0wS2zxgCK9OowrvoGNUMrLqtHUqNCodE45M8fvtjSMOCtg+Q0O4ijJW+9Zt7KxCg== +"@skalenetwork/upgrade-tools@^3.0.0-skale-contracts.0": + version "3.0.0-skale-contracts.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.0.tgz#db1e0f81ab6d72715c982e0bd5006c9a11bf377a" + integrity sha512-ekJpPUblmSUvoClEfT4gsg0hWL7wEOwmoCk3fxBDMS8/djePeyRa8EM09ZoFzzaX0nzXaSS+zq/X0Pc8RrE42w== dependencies: "@openzeppelin/contracts-upgradeable" "^4.4.2" + "@skalenetwork/skale-contracts" "^0.0.1-main.15" axios "^0.27.2" ethereumjs-util "^7.1.4" @@ -1930,6 +2281,15 @@ axios@^0.27.2: follow-redirects "^1.14.9" form-data "^4.0.0" +axios@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" + integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -2544,6 +2904,11 @@ bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.1.3, bn.js@^5.2.0: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== +bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + body-parser@1.20.1: version "1.20.1" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" @@ -4609,6 +4974,42 @@ ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7, ethers@^5.5.2, ethers@^5.5.3: "@ethersproject/web" "5.5.1" "@ethersproject/wordlists" "5.5.0" +ethers@^5.7.2: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -4988,6 +5389,11 @@ follow-redirects@^1.12.1, follow-redirects@^1.14.9: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4" integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ== +follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + for-each@^0.3.3, for-each@~0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -8027,6 +8433,11 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" From 950f8145e1f1bf2a4f6706d670ee6c242e96426b Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 3 Jul 2023 17:48:15 +0300 Subject: [PATCH 03/83] Modify upgrade testing script --- migrations/deploy.ts | 12 ++++++++++++ scripts/test_upgrade.sh | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 07a73d7f..2f94b0ca 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -136,6 +136,17 @@ async function main() { await skaleToken.mint(owner.address, money, "0x", "0x"); } + console.log("Store addresses"); + + const addressesOutput: {[name: string]: string} = {}; + for (const artifact of contractArtifacts) { + addressesOutput[artifact.contract] = artifact.address; + } + await fs.writeFile(`data/skale-manager-${version}-${network.name}-contracts.json`, JSON.stringify(addressesOutput, null, 4)); + + + // TODO: remove storing of ABIs to a file + console.log("Store ABIs"); const outputObject: {[k: string]: unknown} = {}; @@ -147,6 +158,7 @@ async function main() { await fs.writeFile(`data/skale-manager-${version}-${network.name}-abi.json`, JSON.stringify(outputObject, null, 4)); + console.log("Done"); } diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index b45dc0eb..4ed0744f 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -34,6 +34,9 @@ yarn install PRODUCTION=true VERSION=$DEPLOYED_VERSION npx hardhat run migrations/deploy.ts --network localhost rm $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json || true cp .openzeppelin/unknown-*.json $GITHUB_WORKSPACE/.openzeppelin +CONTRACTS_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-contracts.json" +# TODO: copy contracts.json file when deployed version starts supporting it +# cp "data/$CONTRACTS_FILENAME" "$GITHUB_WORKSPACE/data" ABI_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-abi.json" cp "data/$ABI_FILENAME" "$GITHUB_WORKSPACE/data" @@ -41,8 +44,9 @@ cd $GITHUB_WORKSPACE nvm use $CURRENT_NODE_VERSION rm -r --interactive=never $DEPLOYED_DIR -# TODO remove after upgrade from 1.9.2 -python3 scripts/change_manifest.py $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json -ALLOW_NOT_ATOMIC_UPGRADE="OK" ABI="data/$ABI_FILENAME" npx hardhat run migrations/upgrade.ts --network localhost +# TODO: use contracts.json file when deployed version starts supporting it +# SKALE_MANAGER_ADDRESS=$(cat data/$CONTRACTS_FILENAME | jq -r .SkaleManager) +SKALE_MANAGER_ADDRESS=$(cat data/$ABI_FILENAME | jq -r .skale_manager_address) +ALLOW_NOT_ATOMIC_UPGRADE="OK" TARGET="$SKALE_MANAGER_ADDRESS" npx hardhat run migrations/upgrade.ts --network localhost npx kill-port 8545 From ed28b96c6ff749816454f80497df829e2b20731f Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 4 Jul 2023 19:01:34 +0300 Subject: [PATCH 04/83] Update ethers --- migrations/upgrade.ts | 5 ++--- package.json | 4 ++-- yarn.lock | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 31fd1c72..b0c852dc 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -15,7 +15,7 @@ async function getSkaleManagerInstance() { console.log(chalk.red("Set instance alias or SkaleManager address to TARGET environment variable")); process.exit(1); } - const network = await skaleContracts.getNetworkByChainId((await ethers.provider.getNetwork()).chainId); + const network = await skaleContracts.getNetworkByProvider(ethers.provider); const project = await network.getProject("skale-manager"); return await project.getInstance(process.env.TARGET); } @@ -36,8 +36,7 @@ class SkaleManagerUpgrader extends Upgrader { } async getSkaleManager() { - // TODO: replace with this.instance.getContract - return await ethers.getContractAt("SkaleManager", await this.instance.getContractAddress("SkaleManager")) as SkaleManager; + return await this.instance.getContract("SkaleManager") as SkaleManager; } getDeployedVersion = async () => { diff --git a/package.json b/package.json index 5cc2a894..1c4bf209 100644 --- a/package.json +++ b/package.json @@ -45,11 +45,11 @@ "@openzeppelin/contracts-upgradeable": "^4.6.0", "@openzeppelin/hardhat-upgrades": "^1.13.0", "@skalenetwork/skale-manager-interfaces": "2.0.0", - "@skalenetwork/upgrade-tools": "^3.0.0-skale-contracts.0", + "@skalenetwork/upgrade-tools": "^3.0.0-skale-contracts.1", "@typechain/hardhat": "^4.0.0", "dotenv": "^16.0.0", "ethereumjs-util": "^7.1.5", - "ethers": "^5.5.3", + "ethers": "^5.7.2", "hardhat": "^2.8.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 395289fa..0da02d25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1520,10 +1520,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@skalenetwork/skale-contracts@^0.0.1-main.15": - version "0.0.1-main.15" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.0.1-main.15.tgz#86d9dba1e617f6c5c250a02e55745b50eae5fc9e" - integrity sha512-vlztY9cLSOo3Sk61dE5kmXxFmv6mKG4B1wbF9cVk6ErYLSpamPsOkIsqFL6+tw/nAXgkzkzRi2uiLKvTy2PtAA== +"@skalenetwork/skale-contracts@^0.0.1-main.16": + version "0.0.1-main.16" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.0.1-main.16.tgz#e789baa1f72826d688bbc0870fb7c1ab4fb9f98d" + integrity sha512-vURGIkbT0FhW0wUDI6tM+QvESDr/N5zAbJiRUPGgUb+GIZP3wMtN6xIZGGlhbLcdcGohwi3lqG1hiVyjdbenPg== dependencies: axios "^1.4.0" ethers "^5.7.2" @@ -1533,13 +1533,13 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0.tgz#afb63131e5c498cfa69219567f9f52b85f0856c9" integrity sha512-Pge3p4vpeNaXHjwntX+8b38NEcT81a67I32bbnU+l1uSo4kmyXd0VblHMO84H1Azr9TzF3ZmNCG+GI2yntSx2w== -"@skalenetwork/upgrade-tools@^3.0.0-skale-contracts.0": - version "3.0.0-skale-contracts.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.0.tgz#db1e0f81ab6d72715c982e0bd5006c9a11bf377a" - integrity sha512-ekJpPUblmSUvoClEfT4gsg0hWL7wEOwmoCk3fxBDMS8/djePeyRa8EM09ZoFzzaX0nzXaSS+zq/X0Pc8RrE42w== +"@skalenetwork/upgrade-tools@^3.0.0-skale-contracts.1": + version "3.0.0-skale-contracts.1" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.1.tgz#137c1c7b69176ac92494ef53099ef2958ee3e94d" + integrity sha512-074hVRsi3QNm77YkIINJ2al7OvkLyf8BllN4YZwdi9bJvSWZICAPMsY2/laptuzg4SreZF8nMyOd46EcaMKeQQ== dependencies: "@openzeppelin/contracts-upgradeable" "^4.4.2" - "@skalenetwork/skale-contracts" "^0.0.1-main.15" + "@skalenetwork/skale-contracts" "^0.0.1-main.16" axios "^0.27.2" ethereumjs-util "^7.1.4" @@ -4938,7 +4938,7 @@ ethers@^4.0.32: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7, ethers@^5.5.2, ethers@^5.5.3: +ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7, ethers@^5.5.2: version "5.5.3" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.3.tgz#1e361516711c0c3244b6210e7e3ecabf0c75fca0" integrity sha512-fTT4WT8/hTe/BLwRUtl7I5zlpF3XC3P/Xwqxc5AIP2HGlH15qpmjs0Ou78az93b1rLITzXLFxoNX63B8ZbUd7g== From 1595c65d78054b02f7bd8a1e6d36875115ace7d5 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 10 Jul 2023 13:09:58 +0300 Subject: [PATCH 05/83] Integrate skale-contracts --- package.json | 2 +- scripts/test_upgrade.sh | 2 +- yarn.lock | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 1c4bf209..fd955f43 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.6.0", "@openzeppelin/hardhat-upgrades": "^1.13.0", "@skalenetwork/skale-manager-interfaces": "2.0.0", - "@skalenetwork/upgrade-tools": "^3.0.0-skale-contracts.1", + "@skalenetwork/upgrade-tools": "^3.0.0-skale-contracts.6", "@typechain/hardhat": "^4.0.0", "dotenv": "^16.0.0", "ethereumjs-util": "^7.1.5", diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index 4ed0744f..81b7b306 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -16,7 +16,7 @@ export NVM_DIR=~/.nvm; source $NVM_DIR/nvm.sh; DEPLOYED_TAG=$(cat $GITHUB_WORKSPACE/DEPLOYED) -DEPLOYED_VERSION=$(echo $DEPLOYED_TAG | cut -d '-' -f 1) +DEPLOYED_VERSION=$(echo $DEPLOYED_TAG | xargs ) # trim DEPLOYED_DIR=$GITHUB_WORKSPACE/deployed-skale-manager/ DEPLOYED_WITH_NODE_VERSION="lts/fermium" diff --git a/yarn.lock b/yarn.lock index 0da02d25..b1ad34cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1520,10 +1520,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@skalenetwork/skale-contracts@^0.0.1-main.16": - version "0.0.1-main.16" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.0.1-main.16.tgz#e789baa1f72826d688bbc0870fb7c1ab4fb9f98d" - integrity sha512-vURGIkbT0FhW0wUDI6tM+QvESDr/N5zAbJiRUPGgUb+GIZP3wMtN6xIZGGlhbLcdcGohwi3lqG1hiVyjdbenPg== +"@skalenetwork/skale-contracts@^0.0.1-main.20": + version "0.0.1-main.20" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.0.1-main.20.tgz#961e9e710ac3e78430c8c6155d208416f35b0333" + integrity sha512-yUowWey14mLXrfTc5aY4DhsLRPlAzIMeIFxnTuU14rMG7graSqV8f8I5JDx0vQcnjXtziOSnjDYIYVtyoGx2Sw== dependencies: axios "^1.4.0" ethers "^5.7.2" @@ -1533,13 +1533,13 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0.tgz#afb63131e5c498cfa69219567f9f52b85f0856c9" integrity sha512-Pge3p4vpeNaXHjwntX+8b38NEcT81a67I32bbnU+l1uSo4kmyXd0VblHMO84H1Azr9TzF3ZmNCG+GI2yntSx2w== -"@skalenetwork/upgrade-tools@^3.0.0-skale-contracts.1": - version "3.0.0-skale-contracts.1" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.1.tgz#137c1c7b69176ac92494ef53099ef2958ee3e94d" - integrity sha512-074hVRsi3QNm77YkIINJ2al7OvkLyf8BllN4YZwdi9bJvSWZICAPMsY2/laptuzg4SreZF8nMyOd46EcaMKeQQ== +"@skalenetwork/upgrade-tools@^3.0.0-skale-contracts.6": + version "3.0.0-skale-contracts.6" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.6.tgz#a0b8c48b9b25b6f816afd8a264a67758aeb58db0" + integrity sha512-imKRT//6S/Bh7hvrPfUdxdEnrp+yGuGUoYKKqR02j/PxbQqYMlFte3/OnSgCnNaxjjqzlBoPqZ2mfHCNcRWQ7g== dependencies: "@openzeppelin/contracts-upgradeable" "^4.4.2" - "@skalenetwork/skale-contracts" "^0.0.1-main.16" + "@skalenetwork/skale-contracts" "^0.0.1-main.20" axios "^0.27.2" ethereumjs-util "^7.1.4" From 8a22d5cb34d5a6ec5a8d384677fdf0918ad8c128 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 19 Sep 2023 17:00:52 +0300 Subject: [PATCH 06/83] Update upgrade-tools --- dictionaries/libraries.txt | 1 + hardhat.config.ts | 2 +- migrations/upgrade.ts | 12 ++++++--- package.json | 4 +-- yarn.lock | 51 ++++++++++++++++++++------------------ 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/dictionaries/libraries.txt b/dictionaries/libraries.txt index 840b6da0..f4d45d39 100644 --- a/dictionaries/libraries.txt +++ b/dictionaries/libraries.txt @@ -21,6 +21,7 @@ mulmod muln nbconvert nbformat +nomicfoundation nomiclabs pygments pyplot diff --git a/hardhat.config.ts b/hardhat.config.ts index 5a24e312..5549b709 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,5 +1,5 @@ import { task, HardhatUserConfig } from "hardhat/config"; -import "@nomiclabs/hardhat-etherscan"; +import "@nomicfoundation/hardhat-verify"; import "@nomiclabs/hardhat-waffle"; import "@openzeppelin/hardhat-upgrades"; import '@typechain/hardhat' diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 73422d0f..92beb02b 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -28,10 +28,14 @@ class SkaleManagerUpgrader extends Upgrader { contractNamesToUpgrade: string[], submitter = new AutoSubmitter()) { super( - "skale-manager", - targetVersion, - instance, - contractNamesToUpgrade, + { + name: "skale-manager", + instance + }, + { + version: targetVersion, + contractNamesToUpgrade + }, submitter); } diff --git a/package.json b/package.json index 5bc9c9da..cc0497da 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.14.0", "@skalenetwork/skale-manager-interfaces": "2.0.0-develop.1", - "@skalenetwork/upgrade-tools": "3.0.0-skale-contracts.8", + "@skalenetwork/upgrade-tools": "3.0.0-linter.26", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", @@ -53,7 +53,7 @@ "hardhat": "2.11.0 - 2.16.1" }, "devDependencies": { - "@nomiclabs/hardhat-etherscan": "^3.1.0", + "@nomicfoundation/hardhat-verify": "^1.1.1", "@nomiclabs/hardhat-waffle": "^2.0.2", "@typechain/ethers-v5": "^11.1.1", "@types/chai": "^4.3.5", diff --git a/yarn.lock b/yarn.lock index 27281f1a..ec5ee502 100644 --- a/yarn.lock +++ b/yarn.lock @@ -684,7 +684,7 @@ "@ethersproject/logger" "^5.5.0" "@ethersproject/properties" "^5.5.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -695,7 +695,7 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/rlp" "^5.7.0" -"@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.5.0": +"@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" integrity sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw== @@ -1354,6 +1354,21 @@ mcl-wasm "^0.7.1" rustbn.js "~0.2.0" +"@nomicfoundation/hardhat-verify@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.1.1.tgz#6a433d777ce0172d1f0edf7f2d3e1df14b3ecfc1" + integrity sha512-9QsTYD7pcZaQFEA3tBb/D/oCStYDiEVDN7Dxeo/4SCyHRSm86APypxxdOMEPlGmXsAvd+p1j/dTODcpxb8aztA== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@ethersproject/address" "^5.0.2" + cbor "^8.1.0" + chalk "^2.4.2" + debug "^4.1.1" + lodash.clonedeep "^4.5.0" + semver "^6.3.0" + table "^6.8.0" + undici "^5.14.0" + "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.1": version "0.1.1" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.1.tgz#4c858096b1c17fe58a474fe81b46815f93645c15" @@ -1425,22 +1440,6 @@ resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0" integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg== -"@nomiclabs/hardhat-etherscan@^3.1.0": - version "3.1.7" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz#72e3d5bd5d0ceb695e097a7f6f5ff6fcbf062b9a" - integrity sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ== - dependencies: - "@ethersproject/abi" "^5.1.2" - "@ethersproject/address" "^5.0.2" - cbor "^8.1.0" - chalk "^2.4.2" - debug "^4.1.1" - fs-extra "^7.0.1" - lodash "^4.17.11" - semver "^6.3.0" - table "^6.8.0" - undici "^5.14.0" - "@nomiclabs/hardhat-waffle@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-waffle/-/hardhat-waffle-2.0.2.tgz#6030aa6fd9ea05327bf79d1107356af906d8b1e4" @@ -1557,7 +1556,7 @@ dependencies: "@oclif/core" "^2.11.7" -"@openzeppelin/contracts-upgradeable@^4.4.2", "@openzeppelin/contracts-upgradeable@^4.9.3": +"@openzeppelin/contracts-upgradeable@^4.9.3": version "4.9.3" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.3.tgz#ff17a80fb945f5102571f8efecb5ce5915cc4811" integrity sha512-jjaHAVRMrE4UuZNfDwjlLGDxTHWIOwTJS2ldnc278a0gevfXfPr8hxKEVBGFBE96kl2G3VHDZhUimw/+G3TG2A== @@ -1846,12 +1845,11 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0-develop.1.tgz#fde4e8a40878b890f7e1b50dd8513a76eb1d2d46" integrity sha512-SYm407j/RQlcTUcnIWWhPc8wK1AYxMIVhUgRSGhLblZ+4UJQuHAs2rz0aOiovvVaE5Xg2OYNwtCOd1gLW3wCDw== -"@skalenetwork/upgrade-tools@3.0.0-skale-contracts.8": - version "3.0.0-skale-contracts.8" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-skale-contracts.8.tgz#c4b2d38441ac1d61d902d6d26053175f89f25ac3" - integrity sha512-bRFUp6r8Ox+OwOJT/TU1Pvqrb2z4sjgRB3lmrxYqifAf1UL4SOb2LPqFVaJDGskTEUPajCe24Bhnhf6UnYtr2Q== +"@skalenetwork/upgrade-tools@3.0.0-linter.26": + version "3.0.0-linter.26" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.26.tgz#aa87a6e535a4ff280d6e0bac86fc6eef6b8ffb95" + integrity sha512-HiYZSBGMbWvr/1tnm2x6fuRh8svR7HJMY1q1ozAopW7qtTCOmr6DlO/S5LIzPZmRObrjnonAD2b8aWlLXSyLEQ== dependencies: - "@openzeppelin/contracts-upgradeable" "^4.4.2" "@safe-global/api-kit" "^1.3.0" "@safe-global/protocol-kit" "^1.2.0" "@safe-global/safe-core-sdk-types" "^2.2.0" @@ -7870,6 +7868,11 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" From 36b6c94776cf80dbe6a8b10bea87de4a414d9d63 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 19 Sep 2023 18:13:02 +0300 Subject: [PATCH 07/83] Update upgrade-tools --- package.json | 2 +- test/tools/deploy/factory.ts | 6 +++--- yarn.lock | 17 +++++------------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index b8b07826..21511fca 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.14.0", "@skalenetwork/skale-manager-interfaces": "2.0.0-develop.1", - "@skalenetwork/upgrade-tools": "3.0.0-linter.26", + "@skalenetwork/upgrade-tools": "3.0.0-linter.27", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/test/tools/deploy/factory.ts b/test/tools/deploy/factory.ts index e603122b..a9d75d6c 100644 --- a/test/tools/deploy/factory.ts +++ b/test/tools/deploy/factory.ts @@ -1,6 +1,6 @@ import { ethers, upgrades } from "hardhat"; import { ContractManager } from "../../../typechain-types"; -import { deployLibraries, getLinkedContractFactory } from "@skalenetwork/upgrade-tools"; +import { deployLibraries } from "@skalenetwork/upgrade-tools"; async function defaultDeploy(contractName: string, contractManager: ContractManager) { @@ -68,7 +68,7 @@ function deployWithLibraryFunctionFactory( ) { return async (contractManager: ContractManager) => { const libraries = await deployLibraries(libraryNames); - const contractFactory = await getLinkedContractFactory(contractName, libraries); + const contractFactory = await ethers.getContractFactory(contractName, {libraries: Object.fromEntries(libraries)}); try { return contractFactory.attach(await contractManager.getContract(contractName)); } catch (e) { @@ -88,7 +88,7 @@ function deployWithLibraryWithConstructor( ) { return async (contractManager: ContractManager) => { const libraries = await deployLibraries(libraryNames); - const contractFactory = await getLinkedContractFactory(contractName, libraries); + const contractFactory = await ethers.getContractFactory(contractName, {libraries: Object.fromEntries(libraries)}); try { return contractFactory.attach(await contractManager.getContract(contractName)); } catch (e) { diff --git a/yarn.lock b/yarn.lock index 812546ca..d23dbdeb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1845,10 +1845,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0-develop.1.tgz#fde4e8a40878b890f7e1b50dd8513a76eb1d2d46" integrity sha512-SYm407j/RQlcTUcnIWWhPc8wK1AYxMIVhUgRSGhLblZ+4UJQuHAs2rz0aOiovvVaE5Xg2OYNwtCOd1gLW3wCDw== -"@skalenetwork/upgrade-tools@3.0.0-linter.26": - version "3.0.0-linter.26" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.26.tgz#aa87a6e535a4ff280d6e0bac86fc6eef6b8ffb95" - integrity sha512-HiYZSBGMbWvr/1tnm2x6fuRh8svR7HJMY1q1ozAopW7qtTCOmr6DlO/S5LIzPZmRObrjnonAD2b8aWlLXSyLEQ== +"@skalenetwork/upgrade-tools@3.0.0-linter.27": + version "3.0.0-linter.27" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.27.tgz#2eb97d05a8e5019a6ba3bf6493dffa2884f58c15" + integrity sha512-uCOZc2whVLuepW5BDyDiU4nPq0NUivW7gSVQ7z+aUOhKLIO9jklvmaxDl1sQw7+WjdvqnphdMosduD9VToB0FA== dependencies: "@safe-global/api-kit" "^1.3.0" "@safe-global/protocol-kit" "^1.2.0" @@ -7589,14 +7589,7 @@ keyv@^3.0.0: dependencies: json-buffer "3.0.0" -keyv@^4.5.3: - version "4.5.3" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" - integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== - dependencies: - json-buffer "3.0.1" - -keyv@^4.0.0: +keyv@^4.0.0, keyv@^4.5.3: version "4.5.3" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== From 2993852f8672a0174c47c99ea2af505b640eab65 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 20 Sep 2023 16:36:04 +0300 Subject: [PATCH 08/83] Update ganache --- package.json | 3 +- scripts/test_deploy.sh | 4 +- scripts/test_upgrade.sh | 4 +- yarn.lock | 269 ++++++++++++++++++++-------------------- 4 files changed, 141 insertions(+), 139 deletions(-) diff --git a/package.json b/package.json index 21511fca..ded6374c 100644 --- a/package.json +++ b/package.json @@ -74,8 +74,7 @@ "elliptic": "^6.5.3", "eslint": "^8.49.0", "ethereum-waffle": "^3.4.4", - "ganache-cli": "^6.11.0", - "kill-port": "^2.0.1", + "ganache": "^7.9.1", "solhint": "3.6.2", "solidity-coverage": "^0.8.4", "solidity-docgen": "^0.5.17", diff --git a/scripts/test_deploy.sh b/scripts/test_deploy.sh index 7f7a0f2d..dd8ce2d5 100755 --- a/scripts/test_deploy.sh +++ b/scripts/test_deploy.sh @@ -2,8 +2,8 @@ set -e -npx ganache-cli --gasLimit 8000000 --quiet & +GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000) PRODUCTION=true npx hardhat run migrations/deploy.ts --network localhost -npx kill-port 8545 +npx ganache instances stop $GANACHE_SESSION diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index 81b7b306..5603ba1e 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -24,7 +24,7 @@ CURRENT_NODE_VERSION=$(nvm current) git clone --branch $DEPLOYED_TAG https://github.com/$GITHUB_REPOSITORY.git $DEPLOYED_DIR -npx ganache-cli --gasLimit 8000000 --quiet & +GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000) cd $DEPLOYED_DIR nvm install $DEPLOYED_WITH_NODE_VERSION @@ -49,4 +49,4 @@ rm -r --interactive=never $DEPLOYED_DIR SKALE_MANAGER_ADDRESS=$(cat data/$ABI_FILENAME | jq -r .skale_manager_address) ALLOW_NOT_ATOMIC_UPGRADE="OK" TARGET="$SKALE_MANAGER_ADDRESS" npx hardhat run migrations/upgrade.ts --network localhost -npx kill-port 8545 +npx ganache instances stop $GANACHE_SESSION diff --git a/yarn.lock b/yarn.lock index d23dbdeb..35e47a81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1885,6 +1885,23 @@ dependencies: defer-to-connect "^2.0.1" +"@trufflesuite/bigint-buffer@1.1.10": + version "1.1.10" + resolved "https://registry.yarnpkg.com/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz#a1d9ca22d3cad1a138b78baaf15543637a3e1692" + integrity sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw== + dependencies: + node-gyp-build "4.4.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" + "@tsconfig/node10@^1.0.7": version "1.0.8" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" @@ -2016,7 +2033,7 @@ dependencies: "@types/node" "*" -"@types/lru-cache@^5.1.0": +"@types/lru-cache@5.1.1", "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw== @@ -2102,6 +2119,11 @@ dependencies: "@types/node" "*" +"@types/seedrandom@3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-3.0.1.tgz#1254750a4fec4aff2ebec088ccd0bb02e91fedb4" + integrity sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw== + "@types/semver@^7.3.12": version "7.5.1" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367" @@ -2280,7 +2302,7 @@ abortcontroller-polyfill@^1.7.5: 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== @@ -2300,6 +2322,18 @@ abstract-leveldown@3.0.0: dependencies: xtend "~4.0.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== + dependencies: + buffer "^6.0.3" + catering "^2.0.0" + is-buffer "^2.0.5" + level-concat-iterator "^3.0.0" + level-supports "^2.0.1" + queue-microtask "^1.2.3" + abstract-leveldown@^2.4.1, abstract-leveldown@~2.7.1: version "2.7.2" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz#87a44d7ebebc341d59665204834c8b7e0932cc93" @@ -2661,7 +2695,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.2: +async-eventemitter@0.2.4, async-eventemitter@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== @@ -3591,6 +3625,20 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" +bufferutil@4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.5.tgz#da9ea8166911cc276bf677b8aed2d02d31f59028" + integrity sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A== + 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.6" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.6.tgz#ebd6c67c7922a0e902f053e5d8be5ec850e48433" @@ -3735,7 +3783,7 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -catering@^2.1.0, catering@^2.1.1: +catering@^2.0.0, catering@^2.1.0, catering@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== @@ -4278,7 +4326,7 @@ cross-fetch@^4.0.0: dependencies: node-fetch "^2.6.12" -cross-spawn@^6.0.0, cross-spawn@^6.0.5: +cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -4760,6 +4808,11 @@ elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.3, elliptic@^6.5 minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +emittery@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.0.tgz#bb373c660a9d421bb44706ec4967ed50c02a8026" + integrity sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ== + emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -5580,19 +5633,6 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - exit-on-epipe@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692" @@ -6110,15 +6150,6 @@ functions-have-names@^1.2.2, functions-have-names@^1.2.3: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== -ganache-cli@^6.11.0: - version "6.12.2" - resolved "https://registry.yarnpkg.com/ganache-cli/-/ganache-cli-6.12.2.tgz#c0920f7db0d4ac062ffe2375cb004089806f627a" - integrity sha512-bnmwnJDBDsOWBUP8E/BExWf85TsdDEFelQSzihSJm9VChVO1SHp94YXLP5BlA4j/OTxp0wR4R1Tje9OHOuAJVw== - dependencies: - ethereumjs-util "6.2.1" - source-map-support "0.5.12" - yargs "13.2.4" - ganache-core@^2.13.2: version "2.13.2" resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.13.2.tgz#27e6fc5417c10e6e76e2e646671869d7665814a3" @@ -6156,6 +6187,27 @@ ganache-core@^2.13.2: ethereumjs-wallet "0.6.5" web3 "1.2.11" +ganache@^7.9.1: + version "7.9.1" + resolved "https://registry.yarnpkg.com/ganache/-/ganache-7.9.1.tgz#94f8518215c7989ff5fd542db80bd47d7c7da786" + integrity sha512-Tqhd4J3cpiLeYTD6ek/zlchSB107IVPMIm4ypyg+xz1sdkeALUnYYZnmY4Bdjqj3i6QwtlZPCu7U4qKy7HlWTA== + 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" + gensequence@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gensequence/-/gensequence-6.0.0.tgz#ae46a0f89ebd7cc334e45cfb8f1c99a65248694e" @@ -6210,7 +6262,7 @@ get-stream@^3.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= -get-stream@^4.0.0, get-stream@^4.1.0: +get-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== @@ -6237,11 +6289,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= - get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -6932,11 +6979,6 @@ invert-kv@^1.0.0: resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== - io-ts@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-1.10.4.tgz#cd5401b138de88e4f920adbcb7026e2d1967e6e2" @@ -7234,7 +7276,7 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" -is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: +is-stream@^1.0.0, is-stream@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -7564,7 +7606,7 @@ keccak@3.0.1: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" -keccak@^3.0.0: +keccak@3.0.2, keccak@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== @@ -7596,14 +7638,6 @@ keyv@^4.0.0, keyv@^4.5.3: dependencies: json-buffer "3.0.1" -kill-port@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/kill-port/-/kill-port-2.0.1.tgz#e5e18e2706b13d54320938be42cb7d40609b15cf" - integrity sha512-e0SVOV5jFo0mx8r7bS29maVWp17qGqLBZ5ricNSajON6//kmb7qqqNnml4twNE8Dtj97UQD+gNFOaipS/q1zzQ== - dependencies: - get-them-args "1.3.2" - shell-exec "1.0.2" - kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -7649,13 +7683,6 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - level-codec@^9.0.0: version "9.0.2" resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" @@ -7668,6 +7695,13 @@ level-codec@~7.0.0: resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7" integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ== +level-concat-iterator@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz#5235b1f744bc34847ed65a50548aa88d22e881cf" + integrity sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ== + dependencies: + catering "^2.1.0" + level-errors@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.1.2.tgz#4399c2f3d3ab87d0625f7e3676e2d807deff404d" @@ -7756,6 +7790,11 @@ level-sublevel@6.6.4: typewiselite "~1.0.0" xtend "~4.0.0" +level-supports@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-2.1.0.tgz#9af908d853597ecd592293b2fad124375be79c5f" + integrity sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA== + level-supports@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-4.0.1.tgz#431546f9d81f10ff0fea0e74533a0e875c08c66a" @@ -7794,6 +7833,15 @@ level@^8.0.0: browser-level "^1.0.1" classic-level "^1.2.0" +leveldown@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/leveldown/-/leveldown-6.1.0.tgz#7ab1297706f70c657d1a72b31b40323aa612b9ee" + integrity sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w== + dependencies: + abstract-leveldown "^7.2.0" + napi-macros "~2.0.0" + node-gyp-build "^4.3.0" + levelup@3.1.1, levelup@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/levelup/-/levelup-3.1.1.tgz#c2c0b3be2b4dc316647c53b42e2f559e232d2189" @@ -8009,13 +8057,6 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -8047,15 +8088,6 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - memdown@^1.0.0: version "1.4.1" resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.4.1.tgz#b4e4e192174664ffbae41361aa500f3119efe215" @@ -8205,11 +8237,6 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mimic-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - mimic-response@^1.0.0, mimic-response@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" @@ -8483,6 +8510,11 @@ napi-macros@^2.2.2: resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.2.2.tgz#817fef20c3e0e40a963fbf7b37d1600bd0201044" integrity sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g== +napi-macros@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== + natural-compare-lite@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" @@ -8565,6 +8597,11 @@ node-fetch@~1.7.1: encoding "^0.1.11" is-stream "^1.0.1" +node-gyp-build@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" + integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== + node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" @@ -8607,13 +8644,6 @@ normalize-url@^6.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -8827,15 +8857,6 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" -os-locale@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.0.0" - os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -8856,21 +8877,11 @@ p-cancelable@^3.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -9085,7 +9096,7 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-key@^2.0.0, path-key@^2.0.1: +path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= @@ -9888,7 +9899,7 @@ scryptsy@^1.2.1: dependencies: pbkdf2 "^3.0.3" -secp256k1@^4.0.1: +secp256k1@4.0.3, secp256k1@^4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== @@ -10038,11 +10049,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.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" @@ -10061,7 +10067,7 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.0, signal-exit@^3.0.2: +signal-exit@^3.0.2: version "3.0.6" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af" integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ== @@ -10553,11 +10559,6 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" @@ -11261,6 +11262,20 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utf-8-validate@5.0.7: + version "5.0.7" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.7.tgz#c15a19a6af1f7ad9ec7ddc425747ca28c3644922" + integrity sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q== + 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.8" resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.8.tgz#4a735a61661dbb1c59a0868c397d2fe263f14e58" @@ -12073,6 +12088,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@^3.0.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" @@ -12178,7 +12198,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@13.1.2, yargs-parser@^13.1.0, yargs-parser@^13.1.2: +yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== @@ -12223,23 +12243,6 @@ yargs-unparser@2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@13.2.4: - version "13.2.4" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83" - integrity sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg== - dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - os-locale "^3.1.0" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.0" - yargs@13.3.2, yargs@^13.3.0: version "13.3.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" From 3a4d23426869b7c4445b9253cd2d5146d47b59e3 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 20 Sep 2023 19:34:51 +0300 Subject: [PATCH 09/83] Update upgrade-tools --- migrations/upgrade.ts | 8 +++----- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 92beb02b..72ee2f40 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -29,12 +29,10 @@ class SkaleManagerUpgrader extends Upgrader { submitter = new AutoSubmitter()) { super( { + contractNamesToUpgrade, + instance, name: "skale-manager", - instance - }, - { - version: targetVersion, - contractNamesToUpgrade + version: targetVersion }, submitter); } diff --git a/package.json b/package.json index feced4f2..933f3e59 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.14.0", "@skalenetwork/skale-manager-interfaces": "2.0.0-develop.1", - "@skalenetwork/upgrade-tools": "3.0.0-linter.27", + "@skalenetwork/upgrade-tools": "3.0.0-linter.29", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 1e1729ad..2325197c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1845,10 +1845,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0-develop.1.tgz#fde4e8a40878b890f7e1b50dd8513a76eb1d2d46" integrity sha512-SYm407j/RQlcTUcnIWWhPc8wK1AYxMIVhUgRSGhLblZ+4UJQuHAs2rz0aOiovvVaE5Xg2OYNwtCOd1gLW3wCDw== -"@skalenetwork/upgrade-tools@3.0.0-linter.27": - version "3.0.0-linter.27" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.27.tgz#2eb97d05a8e5019a6ba3bf6493dffa2884f58c15" - integrity sha512-uCOZc2whVLuepW5BDyDiU4nPq0NUivW7gSVQ7z+aUOhKLIO9jklvmaxDl1sQw7+WjdvqnphdMosduD9VToB0FA== +"@skalenetwork/upgrade-tools@3.0.0-linter.29": + version "3.0.0-linter.29" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.29.tgz#6df550b1b5c6114eef124aa6f85ac85a6238585c" + integrity sha512-cgDGJITaCZ0q3k4vGOiBMHGP2OJM6AkzMIni0+J815lsz9NY8VcGmSSF2jHaBzJBSQUCM1Bl7BXIen7/oSpHKw== dependencies: "@safe-global/api-kit" "^1.3.0" "@safe-global/protocol-kit" "^1.2.0" From f048869aeb2cc337a0f8891344bd13a5e6ebe663 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 25 Sep 2023 19:20:52 +0300 Subject: [PATCH 10/83] Update upgrade-tools --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 933f3e59..cd1a17eb 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.14.0", "@skalenetwork/skale-manager-interfaces": "2.0.0-develop.1", - "@skalenetwork/upgrade-tools": "3.0.0-linter.29", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.33", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 2325197c..6e539a47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1845,10 +1845,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0-develop.1.tgz#fde4e8a40878b890f7e1b50dd8513a76eb1d2d46" integrity sha512-SYm407j/RQlcTUcnIWWhPc8wK1AYxMIVhUgRSGhLblZ+4UJQuHAs2rz0aOiovvVaE5Xg2OYNwtCOd1gLW3wCDw== -"@skalenetwork/upgrade-tools@3.0.0-linter.29": - version "3.0.0-linter.29" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.29.tgz#6df550b1b5c6114eef124aa6f85ac85a6238585c" - integrity sha512-cgDGJITaCZ0q3k4vGOiBMHGP2OJM6AkzMIni0+J815lsz9NY8VcGmSSF2jHaBzJBSQUCM1Bl7BXIen7/oSpHKw== +"@skalenetwork/upgrade-tools@^3.0.0-linter.33": + version "3.0.0-linter.33" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.33.tgz#b1a35905815b2b0b379c3baf1c55a226c0903354" + integrity sha512-UBQDyZTuNkTu/g4YFIbSyIjY9cBosAwZSmWAV7CoW8Cd7Qr3dTFEy9WynvPfLgp7RFviGGRa2RqoTYXqlIY4GA== dependencies: "@safe-global/api-kit" "^1.3.0" "@safe-global/protocol-kit" "^1.2.0" From 08252d8ca3e62b73e0260d874bd79a5313ac6f34 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 26 Sep 2023 16:10:39 +0300 Subject: [PATCH 11/83] Set block time during deployment testing --- scripts/test_deploy.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/test_deploy.sh b/scripts/test_deploy.sh index dd8ce2d5..b508a6e3 100755 --- a/scripts/test_deploy.sh +++ b/scripts/test_deploy.sh @@ -2,7 +2,13 @@ set -e -GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000) +# Have to set --miner.blockTime 1 +# because there is a bug in ganache +# https://github.com/trufflesuite/ganache/issues/4165 +# TODO: remove --miner.blockTime 1 +# when ganache processes pending queue correctly +# to speed up testing process +GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000 --miner.blockTime 1) PRODUCTION=true npx hardhat run migrations/deploy.ts --network localhost From 9a28350a1863f9aa7368bfedfd5c2a37e2b59487 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 26 Sep 2023 16:35:23 +0300 Subject: [PATCH 12/83] Set block time during upgrade testing --- scripts/test_upgrade.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index 5603ba1e..e340f9ac 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -24,7 +24,13 @@ CURRENT_NODE_VERSION=$(nvm current) git clone --branch $DEPLOYED_TAG https://github.com/$GITHUB_REPOSITORY.git $DEPLOYED_DIR -GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000) +# Have to set --miner.blockTime 1 +# because there is a bug in ganache +# https://github.com/trufflesuite/ganache/issues/4165 +# TODO: remove --miner.blockTime 1 +# when ganache processes pending queue correctly +# to speed up testing process +GANACHE_SESSION=$(npx ganache --😈 --miner.blockGasLimit 8000000 --miner.blockTime 1) cd $DEPLOYED_DIR nvm install $DEPLOYED_WITH_NODE_VERSION From a4962cbb0240fe3411db91b8f3dadbfeeb3f7c3a Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 27 Sep 2023 16:20:57 +0300 Subject: [PATCH 13/83] Fixe FieldOperationsTester deployment --- test/tools/deploy/test/fieldOperationsTester.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/tools/deploy/test/fieldOperationsTester.ts b/test/tools/deploy/test/fieldOperationsTester.ts index abbee5c2..13fffc56 100644 --- a/test/tools/deploy/test/fieldOperationsTester.ts +++ b/test/tools/deploy/test/fieldOperationsTester.ts @@ -1,7 +1,8 @@ import { ContractManager, FieldOperationsTester } from "../../../../typechain-types"; -import { deployWithLibraryWithConstructor } from "../factory"; +import { deployWithConstructor, deployWithConstructorFunctionFactory } from "../factory"; -export const deployFieldOperationsTester = deployWithLibraryWithConstructor( +export const deployFieldOperationsTester = deployWithConstructorFunctionFactory( "FieldOperationsTester", - ["Fp2Operations", "G1Operations", "G2Operations"] + () => Promise.resolve(undefined), + () => deployWithConstructor("FieldOperationsTester") ) as (contractManager: ContractManager) => Promise; From bda24f6fd5cdd464cdd46e20ff43d9d2310f7d2b Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 27 Sep 2023 17:18:35 +0300 Subject: [PATCH 14/83] Update eslint --- .eslintrc | 29 -- .eslintrc.cjs | 39 +++ gas/createSchain.ts | 26 +- gas/nodeRotation.ts | 39 ++- hardhat.config.ts | 10 +- long-test/Treetest.ts | 36 +-- long-test/createSchain.ts | 28 +- migrations/deploy.ts | 10 +- migrations/submitTransactions.ts | 6 +- migrations/upgrade.ts | 11 +- package.json | 10 +- scripts/byteCodeSize.ts | 3 +- scripts/gen-nav.js | 10 +- scripts/generateAbi.ts | 12 +- test/Bounty.ts | 30 +-- test/ConstantsHolder.ts | 13 +- test/ContractManager.ts | 14 +- test/Decryption.ts | 8 +- test/ECDH.ts | 16 +- test/NodeRotation.ts | 40 ++- test/NodesData.ts | 32 +-- test/NodesFunctionality.ts | 34 ++- test/Pricing.ts | 45 ++-- test/Schains.ts | 59 ++-- test/SchainsInternal.ts | 32 ++- test/SkaleDKG.ts | 59 ++-- test/SkaleDkgFakeComplaint.ts | 46 ++-- test/SkaleManager.ts | 55 ++-- test/SkaleToken.ts | 22 +- test/SkaleVerifier.ts | 47 ++-- test/SlashingTable.ts | 14 +- test/SyncMananager.ts | 22 +- test/Wallets.ts | 36 +-- test/delegation/Delegation.ts | 48 ++-- test/delegation/DelegationController.ts | 29 +- test/delegation/PartialDifferences.ts | 9 +- test/delegation/TimeHelpers.ts | 12 +- test/delegation/TokenState.ts | 22 +- test/delegation/ValidatorService.ts | 25 +- test/tools/constants.ts | 2 +- test/tools/deploy/bounty.ts | 12 +- test/tools/deploy/constantsHolder.ts | 4 +- test/tools/deploy/contractManager.ts | 4 +- test/tools/deploy/decryption.ts | 4 +- .../deploy/delegation/delegationController.ts | 14 +- .../delegation/delegationPeriodManager.ts | 4 +- test/tools/deploy/delegation/distributor.ts | 16 +- test/tools/deploy/delegation/punisher.ts | 8 +- test/tools/deploy/delegation/timeHelpers.ts | 6 +- test/tools/deploy/delegation/tokenState.ts | 10 +- .../deploy/delegation/validatorService.ts | 8 +- test/tools/deploy/ecdh.ts | 4 +- test/tools/deploy/factory.ts | 11 +- test/tools/deploy/keyStorage.ts | 10 +- test/tools/deploy/nodeRotation.ts | 10 +- test/tools/deploy/nodes.ts | 12 +- test/tools/deploy/pricing.ts | 8 +- test/tools/deploy/schains.ts | 14 +- test/tools/deploy/schainsInternal.ts | 12 +- test/tools/deploy/skaleDKG.ts | 16 +- test/tools/deploy/skaleManager.ts | 22 +- test/tools/deploy/skaleToken.ts | 14 +- test/tools/deploy/skaleVerifier.ts | 6 +- test/tools/deploy/slashingTable.ts | 4 +- test/tools/deploy/syncManager.ts | 4 +- .../deploy/test/fieldOperationsTester.ts | 4 +- test/tools/deploy/test/nodesMock.ts | 4 +- .../deploy/test/partialDifferencesTester.ts | 4 +- test/tools/deploy/test/reentrancyTester.ts | 6 +- test/tools/deploy/test/schainsInternalMock.ts | 12 +- test/tools/deploy/test/segmentTreeTester.ts | 4 +- test/tools/deploy/test/skaleDKGTester.ts | 14 +- test/tools/deploy/test/skaleManagerMock.ts | 4 +- .../tools/deploy/test/timeHelpersWithDebug.ts | 6 +- test/tools/deploy/wallets.ts | 10 +- test/tools/hashes.ts | 2 +- test/tools/mocha.ts | 2 +- test/tools/signatures.ts | 6 +- test/tools/snapshot.ts | 2 +- test/tools/time.ts | 8 +- test/utils/FieldOperations.ts | 8 +- test/utils/MathUtils.ts | 6 +- test/utils/SegmentTree.ts | 14 +- yarn.lock | 254 +++++++----------- 84 files changed, 772 insertions(+), 875 deletions(-) delete mode 100644 .eslintrc create mode 100644 .eslintrc.cjs diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 4adcdd82..00000000 --- a/.eslintrc +++ /dev/null @@ -1,29 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "mocha": true, - "jest": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": ".", - }, - "plugins": ["@typescript-eslint"], - "rules": { - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": ["error"] - }, - "ignorePatterns": [ - "coverage/**", - "docs/**", - "typechain-types/**" - ] -} \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 00000000..9db0d269 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,39 @@ +/* eslint-env node */ +module.exports = { + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "ignorePatterns": [ + "coverage/**", + "typechain-types/**" + ], + "env": { + "node": true + }, + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "root": true, + "rules": { + // "@typescript-eslint/no-shadow": "error", + "lines-around-comment": [ + "error", + {"allowBlockStart": true} + ], + "no-console": "off", + // Replaced with @typescript-eslint/no-shadow + "no-shadow": "off", + "no-warning-comments": "warn", + "object-curly-spacing": "error", + "one-var": [ + "error", + "never" + ], + "padded-blocks": [ + "error", + "never" + ], + + "@typescript-eslint/no-shadow": "warn" + } +}; diff --git a/gas/createSchain.ts b/gas/createSchain.ts index cea4914b..52fec6c2 100644 --- a/gas/createSchain.ts +++ b/gas/createSchain.ts @@ -1,17 +1,17 @@ -import { deployContractManager } from "../test/tools/deploy/contractManager"; -import { deployValidatorService } from "../test/tools/deploy/delegation/validatorService"; -import { deploySkaleManager } from "../test/tools/deploy/skaleManager"; -import { ContractManager, Schains, SkaleManager, ValidatorService } from "../typechain-types"; -import { deploySchains } from "../test/tools/deploy/schains"; +import {deployContractManager} from "../test/tools/deploy/contractManager"; +import {deployValidatorService} from "../test/tools/deploy/delegation/validatorService"; +import {deploySkaleManager} from "../test/tools/deploy/skaleManager"; +import {ContractManager, Schains, SkaleManager, ValidatorService} from "../typechain-types"; +import {deploySchains} from "../test/tools/deploy/schains"; import fs from 'fs'; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { Event, Wallet } from "ethers"; -import { getPublicKey, getValidatorIdSignature } from "../test/tools/signatures"; -import { fastBeforeEach } from "../test/tools/mocha"; -import { SchainType } from "../test/tools/types"; -import { TypedEvent } from "../typechain-types/common"; -import { SchainNodesEvent } from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {Event, Wallet} from "ethers"; +import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; +import {fastBeforeEach} from "../test/tools/mocha"; +import {SchainType} from "../test/tools/types"; +import {TypedEvent} from "../typechain-types/common"; +import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; function findEvent(events: Event[] | undefined, eventName: string) { if (events) { diff --git a/gas/nodeRotation.ts b/gas/nodeRotation.ts index 2ac0d917..9c17d0a5 100644 --- a/gas/nodeRotation.ts +++ b/gas/nodeRotation.ts @@ -1,6 +1,6 @@ -import { deployContractManager } from "../test/tools/deploy/contractManager"; -import { deployValidatorService } from "../test/tools/deploy/delegation/validatorService"; -import { deploySkaleManager } from "../test/tools/deploy/skaleManager"; +import {deployContractManager} from "../test/tools/deploy/contractManager"; +import {deployValidatorService} from "../test/tools/deploy/delegation/validatorService"; +import {deploySkaleManager} from "../test/tools/deploy/skaleManager"; import { ContractManager, Nodes, @@ -10,23 +10,23 @@ import { SkaleManager, ValidatorService } from "../typechain-types"; -import { privateKeys } from "../test/tools/private-keys"; -import { deploySchains } from "../test/tools/deploy/schains"; -import { deploySchainsInternalMock } from "../test/tools/deploy/test/schainsInternalMock"; -import { deploySkaleDKGTester } from "../test/tools/deploy/test/skaleDKGTester"; -import { skipTime } from "../test/tools/time"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { ethers } from "hardhat"; -import { Event, Wallet } from "ethers"; +import {privateKeys} from "../test/tools/private-keys"; +import {deploySchains} from "../test/tools/deploy/schains"; +import {deploySchainsInternalMock} from "../test/tools/deploy/test/schainsInternalMock"; +import {deploySkaleDKGTester} from "../test/tools/deploy/test/skaleDKGTester"; +import {skipTime} from "../test/tools/time"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {ethers} from "hardhat"; +import {Event, Wallet} from "ethers"; import fs from 'fs'; -import { getPublicKey, getValidatorIdSignature } from "../test/tools/signatures"; -import { stringKeccak256 } from "../test/tools/hashes"; -import { fastBeforeEach } from "../test/tools/mocha"; -import { SchainType } from "../test/tools/types"; -import { applySnapshot, makeSnapshot } from "../test/tools/snapshot"; -import { deployNodes } from "../test/tools/deploy/nodes"; -import { TypedEvent } from "../typechain-types/common"; -import { SchainNodesEvent } from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; +import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; +import {stringKeccak256} from "../test/tools/hashes"; +import {fastBeforeEach} from "../test/tools/mocha"; +import {SchainType} from "../test/tools/types"; +import {applySnapshot, makeSnapshot} from "../test/tools/snapshot"; +import {deployNodes} from "../test/tools/deploy/nodes"; +import {TypedEvent} from "../typechain-types/common"; +import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; function findEvent(events: Event[] | undefined, eventName: string) { if (events) { @@ -76,7 +76,6 @@ describe("nodeRotation", () => { }) describe("Tests without memory", () => { - fastBeforeEach(() => Promise.resolve(undefined)); it("64 node rotations on 17 nodes", async () => { diff --git a/hardhat.config.ts b/hardhat.config.ts index 5549b709..61c78212 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,16 +1,16 @@ -import { task, HardhatUserConfig } from "hardhat/config"; +import {task, HardhatUserConfig} from "hardhat/config"; import "@nomicfoundation/hardhat-verify"; import "@nomiclabs/hardhat-waffle"; import "@openzeppelin/hardhat-upgrades"; import '@typechain/hardhat' import "solidity-coverage"; import * as dotenv from "dotenv" -import { utils, Wallet } from "ethers"; -import { HardhatNetworkAccountUserConfig } from "hardhat/types/config"; +import {utils, Wallet} from "ethers"; +import {HardhatNetworkAccountUserConfig} from "hardhat/types/config"; dotenv.config(); -task("erc1820", "Deploy ERC1820 contract", async (_, { ethers }) => { +task("erc1820", "Deploy ERC1820 contract", async (_, {ethers}) => { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { console.log("Deploy ERC1820 contract"); const [ owner,] = await ethers.getSigners(); @@ -22,7 +22,7 @@ task("erc1820", "Deploy ERC1820 contract", async (_, { ethers }) => { }); -task("accounts", "Prints the list of accounts", async (_, { ethers }) => { +task("accounts", "Prints the list of accounts", async (_, {ethers}) => { const accounts = await ethers.getSigners(); for (const account of accounts) { diff --git a/long-test/Treetest.ts b/long-test/Treetest.ts index 4a9fc1f1..a57917df 100644 --- a/long-test/Treetest.ts +++ b/long-test/Treetest.ts @@ -1,6 +1,6 @@ -import { deployContractManager } from "../test/tools/deploy/contractManager"; -import { deployValidatorService } from "../test/tools/deploy/delegation/validatorService"; -import { deploySkaleManager } from "../test/tools/deploy/skaleManager"; +import {deployContractManager} from "../test/tools/deploy/contractManager"; +import {deployValidatorService} from "../test/tools/deploy/delegation/validatorService"; +import {deploySkaleManager} from "../test/tools/deploy/skaleManager"; import { ContractManager, Nodes, @@ -11,21 +11,21 @@ import { ValidatorService, Wallets } from "../typechain-types"; -import { privateKeys } from "../test/tools/private-keys"; -import { deploySchains } from "../test/tools/deploy/schains"; -import { deploySchainsInternalMock } from "../test/tools/deploy/test/schainsInternalMock"; -import { deploySkaleDKGTester } from "../test/tools/deploy/test/skaleDKGTester"; -import { deployNodes } from "../test/tools/deploy/nodes"; -import { deployWallets } from "../test/tools/deploy/wallets"; -import { skipTime } from "../test/tools/time"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { ethers } from "hardhat"; -import { BigNumberish, BytesLike, Signer, Wallet } from "ethers"; -import { assert } from "chai"; -import { getPublicKey, getValidatorIdSignature } from "../test/tools/signatures"; -import { stringKeccak256 } from "../test/tools/hashes"; -import { fastBeforeEach } from "../test/tools/mocha"; -import { SchainType } from "../test/tools/types"; +import {privateKeys} from "../test/tools/private-keys"; +import {deploySchains} from "../test/tools/deploy/schains"; +import {deploySchainsInternalMock} from "../test/tools/deploy/test/schainsInternalMock"; +import {deploySkaleDKGTester} from "../test/tools/deploy/test/skaleDKGTester"; +import {deployNodes} from "../test/tools/deploy/nodes"; +import {deployWallets} from "../test/tools/deploy/wallets"; +import {skipTime} from "../test/tools/time"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {ethers} from "hardhat"; +import {BigNumberish, BytesLike, Signer, Wallet} from "ethers"; +import {assert} from "chai"; +import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; +import {stringKeccak256} from "../test/tools/hashes"; +import {fastBeforeEach} from "../test/tools/mocha"; +import {SchainType} from "../test/tools/types"; async function createNode(skaleManager: SkaleManager, node: Wallet, nodeId: number) { await skaleManager.connect(node).createNode( diff --git a/long-test/createSchain.ts b/long-test/createSchain.ts index ab3cec26..99f03f19 100644 --- a/long-test/createSchain.ts +++ b/long-test/createSchain.ts @@ -1,17 +1,17 @@ -import { deployContractManager } from "../test/tools/deploy/contractManager"; -import { deployValidatorService } from "../test/tools/deploy/delegation/validatorService"; -import { deploySkaleManager } from "../test/tools/deploy/skaleManager"; -import { deploySchainsInternalMock } from "../test/tools/deploy/test/schainsInternalMock"; -import { ContractManager, Schains, SkaleManager, ValidatorService, SchainsInternalMock } from "../typechain-types"; -import { privateKeys } from "../test/tools/private-keys"; -import { deploySchains } from "../test/tools/deploy/schains"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { Event, Wallet } from "ethers"; -import { getPublicKey, getValidatorIdSignature } from "../test/tools/signatures"; -import { SchainType } from "../test/tools/types"; -import { TypedEvent } from "../typechain-types/common"; -import { SchainNodesEvent } from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; +import {deployContractManager} from "../test/tools/deploy/contractManager"; +import {deployValidatorService} from "../test/tools/deploy/delegation/validatorService"; +import {deploySkaleManager} from "../test/tools/deploy/skaleManager"; +import {deploySchainsInternalMock} from "../test/tools/deploy/test/schainsInternalMock"; +import {ContractManager, Schains, SkaleManager, ValidatorService, SchainsInternalMock} from "../typechain-types"; +import {privateKeys} from "../test/tools/private-keys"; +import {deploySchains} from "../test/tools/deploy/schains"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {Event, Wallet} from "ethers"; +import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; +import {SchainType} from "../test/tools/types"; +import {TypedEvent} from "../typechain-types/common"; +import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; function findEvent(events: Event[] | undefined, eventName: string) { if (events) { diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 2f94b0ca..959db11a 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -1,7 +1,7 @@ -import { promises as fs } from 'fs'; -import { Interface } from "ethers/lib/utils"; -import { ethers, upgrades, network, run } from "hardhat"; -import { ContractManager, SkaleManager, SkaleToken } from "../typechain-types"; +import {promises as fs} from 'fs'; +import {Interface} from "ethers/lib/utils"; +import {ethers, upgrades, network, run} from "hardhat"; +import {ContractManager, SkaleManager, SkaleToken} from "../typechain-types"; import { getAbi, getVersion, @@ -101,7 +101,7 @@ async function main() { for (const contract of contracts.filter(contract => contract != "ContractManager")) { const contractFactory = await getContractFactory(contract); console.log("Deploy", contract); - const proxy = await upgrades.deployProxy(contractFactory, getInitializerParameters(contract, contractManager.address), { unsafeAllowLinkedLibraries: true }); + const proxy = await upgrades.deployProxy(contractFactory, getInitializerParameters(contract, contractManager.address), {unsafeAllowLinkedLibraries: true}); await proxy.deployTransaction.wait(); const contractName = getNameInContractManager(contract); console.log("Register", contract, "as", contractName, "=>", proxy.address); diff --git a/migrations/submitTransactions.ts b/migrations/submitTransactions.ts index 65e9b87e..d2c520ed 100644 --- a/migrations/submitTransactions.ts +++ b/migrations/submitTransactions.ts @@ -1,6 +1,6 @@ -import { createMultiSendTransaction } from "@skalenetwork/upgrade-tools"; -import { UnsignedTransaction } from "ethers"; -import { promises as fs } from "fs"; +import {createMultiSendTransaction} from "@skalenetwork/upgrade-tools"; +import {UnsignedTransaction} from "ethers"; +import {promises as fs} from "fs"; async function main() { if (!process.env.TRANSACTIONS || !process.env.SAFE) { diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 72ee2f40..836217ad 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -1,9 +1,9 @@ import chalk from "chalk"; -import { contracts } from "./deploy"; -import { ethers } from "hardhat"; -import { Upgrader, AutoSubmitter } from "@skalenetwork/upgrade-tools"; -import { skaleContracts, Instance } from "@skalenetwork/skale-contracts-ethers-v5"; -import { SkaleManager } from "../typechain-types"; +import {contracts} from "./deploy"; +import {ethers} from "hardhat"; +import {Upgrader, AutoSubmitter} from "@skalenetwork/upgrade-tools"; +import {skaleContracts, Instance} from "@skalenetwork/skale-contracts-ethers-v5"; +import {SkaleManager} from "../typechain-types"; async function getSkaleManagerInstance() { if (process.env.ABI) { @@ -21,7 +21,6 @@ async function getSkaleManagerInstance() { } class SkaleManagerUpgrader extends Upgrader { - constructor( targetVersion: string, instance: Instance, diff --git a/package.json b/package.json index 1549f8ff..819d982c 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "slither": "slither .", "test": "yarn tsc && npx hardhat test", "tsc": "tsc --noEmit", - "eslint": "npx eslint --cache --ext .js,.jsx,.ts,.tsx .", + "eslint": "npx eslint .", "cspell": "npx cspell \"**/*\"" }, "dependencies": { @@ -64,15 +64,15 @@ "@types/mocha": "^9.1.1", "@types/node": "^20.6.3", "@types/sinon-chai": "^3.2.9", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.10.1", + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", "bignumber.js": "^9.1.2", "chai": "^4.3.8", "chai-almost": "^1.0.1", "chai-as-promised": "^7.1.1", "cspell": "^7.3.6", "elliptic": "^6.5.3", - "eslint": "^8.49.0", + "eslint": "^8.50.0", "ethereum-waffle": "^3.4.4", "ganache": "^7.9.1", "solhint": "3.6.2", @@ -81,6 +81,6 @@ "ts-generator": "^0.1.1", "ts-node": "10.4.0", "typechain": "^8.3.1", - "typescript": "5.1.6" + "typescript": "5.2.2" } } diff --git a/scripts/byteCodeSize.ts b/scripts/byteCodeSize.ts index dfefac0c..8fc2f7db 100644 --- a/scripts/byteCodeSize.ts +++ b/scripts/byteCodeSize.ts @@ -1,4 +1,4 @@ -import { lstatSync, promises as fs } from 'fs'; +import {lstatSync, promises as fs} from 'fs'; interface SizeStatistics { name: string; @@ -49,7 +49,6 @@ function format(contract: SizeStatistics) { } async function main() { - const contracts = (await getByteCodesSizes("../artifacts/contracts/")) .filter(contract => contract.size > 0) .sort((a, b) => b.size - a.size) diff --git a/scripts/gen-nav.js b/scripts/gen-nav.js index 6cddc6db..0b412811 100644 --- a/scripts/gen-nav.js +++ b/scripts/gen-nav.js @@ -1,18 +1,18 @@ #!/usr/bin/env node -import { parse } from 'path'; -import { execFileSync } from 'child_process'; +import {parse} from 'path'; +import {execFileSync} from 'child_process'; const baseDir = process.argv[2]; const PREFIX = "/technology/skale-manager/" const files = execFileSync( - 'find', [baseDir, '-type', 'f'], { encoding: 'utf8' } + 'find', [baseDir, '-type', 'f'], {encoding: 'utf8'} ).split('\n').filter(s => s !== ''); const links = files.map((file) => { const doc = file.replace(baseDir + "/", ''); - const { dir, name } = parse(doc); + const {dir, name} = parse(doc); return { title: name, link: `${PREFIX}${dir ? dir + '/' : ''}${name}`.toLowerCase(), @@ -22,7 +22,7 @@ const links = files.map((file) => { // Case-insensitive sort based on titles (so 'token/ERC20' gets sorted as 'erc20') const sortedLinks = links.sort(function (a, b) { - return a.title.toLowerCase().localeCompare(b.title.toLowerCase(), undefined, { numeric: true }); + return a.title.toLowerCase().localeCompare(b.title.toLowerCase(), undefined, {numeric: true}); }); console.log(JSON.stringify(sortedLinks)) diff --git a/scripts/generateAbi.ts b/scripts/generateAbi.ts index f622a464..29cf9b9d 100644 --- a/scripts/generateAbi.ts +++ b/scripts/generateAbi.ts @@ -1,9 +1,9 @@ -import { promises as fs } from 'fs'; -import { contracts } from "../migrations/deploy"; -import { ethers } from "hardhat"; -import { getAbi, getVersion } from '@skalenetwork/upgrade-tools'; -import { ContractFactory } from 'ethers'; -import { Libraries } from '@nomiclabs/hardhat-ethers/types'; +import {promises as fs} from 'fs'; +import {contracts} from "../migrations/deploy"; +import {ethers} from "hardhat"; +import {getAbi, getVersion} from '@skalenetwork/upgrade-tools'; +import {ContractFactory} from 'ethers'; +import {Libraries} from '@nomiclabs/hardhat-ethers/types'; async function main() { const allContracts = contracts.concat(["ContractManager", "TimeHelpersWithDebug"]) diff --git a/test/Bounty.ts b/test/Bounty.ts index 21792e41..4930e9db 100644 --- a/test/Bounty.ts +++ b/test/Bounty.ts @@ -7,24 +7,24 @@ import { SkaleToken, ValidatorService } from "../typechain-types"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployBounty } from "./tools/deploy/bounty"; -import { currentTime, nextMonth, skipTime, skipTimeToDate } from "./tools/time"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployBounty} from "./tools/deploy/bounty"; +import {currentTime, nextMonth, skipTime, skipTimeToDate} from "./tools/time"; import chaiAsPromised from "chai-as-promised"; import chaiAlmost from "chai-almost"; import * as chai from "chai"; -import { deployNodesMock } from "./tools/deploy/test/nodesMock"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { deployDelegationController } from "./tools/deploy/delegation/delegationController"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployDelegationPeriodManager } from "./tools/deploy/delegation/delegationPeriodManager"; -import { deploySkaleManagerMock } from "./tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { BigNumber } from "ethers"; -import { deployPunisher } from "./tools/deploy/delegation/punisher"; -import { fastBeforeEach } from "./tools/mocha"; +import {deployNodesMock} from "./tools/deploy/test/nodesMock"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployDelegationPeriodManager} from "./tools/deploy/delegation/delegationPeriodManager"; +import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {BigNumber} from "ethers"; +import {deployPunisher} from "./tools/deploy/delegation/punisher"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/ConstantsHolder.ts b/test/ConstantsHolder.ts index 5f67a1fe..3fd06ba6 100644 --- a/test/ConstantsHolder.ts +++ b/test/ConstantsHolder.ts @@ -1,12 +1,12 @@ import chaiAsPromised from "chai-as-promised"; -import { ConstantsHolder, - ContractManager } from "../typechain-types"; +import {ConstantsHolder, + ContractManager} from "../typechain-types"; import chai = require("chai"); -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; chai.should(); chai.use(chaiAsPromised); @@ -193,5 +193,4 @@ describe("ConstantsHolder", () => { await constantsHolder.setMinNodeBalance(minNodeBalance); (await constantsHolder.minNodeBalance()).should.be.equal(minNodeBalance); }); - }); diff --git a/test/ContractManager.ts b/test/ContractManager.ts index a383ab40..9bf1d54c 100644 --- a/test/ContractManager.ts +++ b/test/ContractManager.ts @@ -1,12 +1,12 @@ -import { ConstantsHolder, - ContractManager } from "../typechain-types"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {ConstantsHolder, + ContractManager} from "../typechain-types"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { fastBeforeEach } from "./tools/mocha"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/Decryption.ts b/test/Decryption.ts index 771814d5..c3ddfbfc 100644 --- a/test/Decryption.ts +++ b/test/Decryption.ts @@ -1,9 +1,9 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { Decryption } from "../typechain-types"; -import { deployDecryption } from "./tools/deploy/decryption"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { fastBeforeEach } from "./tools/mocha"; +import {Decryption} from "../typechain-types"; +import {deployDecryption} from "./tools/deploy/decryption"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/ECDH.ts b/test/ECDH.ts index e858315b..aadbb4b8 100644 --- a/test/ECDH.ts +++ b/test/ECDH.ts @@ -1,14 +1,14 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ECDH } from "../typechain-types"; -import { ec } from "elliptic"; +import {ECDH} from "../typechain-types"; +import {ec} from "elliptic"; const secp256k1Curve = new ec("secp256k1"); -import { BigNumber } from "ethers"; -import { deployECDH } from "./tools/deploy/ecdh"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { fastBeforeEach } from "./tools/mocha"; +import {BigNumber} from "ethers"; +import {deployECDH} from "./tools/deploy/ecdh"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -22,7 +22,6 @@ describe("ECDH", () => { let ecdh: ECDH; fastBeforeEach(async () => { - const contractManager = await deployContractManager(); ecdh = await deployECDH(contractManager); @@ -211,7 +210,6 @@ describe("ECDH", () => { const result1 = await ecdh.jMul(d, 1, result, 1); result1.x3.should.be.equal(1); result1.z3.should.be.equal(1); - }); it("Should Calculate inverse big number", async () => { @@ -286,7 +284,6 @@ describe("ECDH", () => { y2 = y2.mul(result1).mod(n); x2.should.be.equal("89565891926547004231252920425935692360644145829622209833684329913297188986597"); y2.should.be.equal("12158399299693830322967808612713398636155367887041628176798871954788371653930"); - }); it("Add EC", async () => { const x2 = BigNumber.from("89565891926547004231252920425935692360644145829622209833684329913297188986597"); @@ -361,7 +358,6 @@ describe("ECDH", () => { }); it("Should follow associative property", async () => { - const key1 = secp256k1Curve.genKeyPair(); const key2 = secp256k1Curve.genKeyPair(); const d1 = BigNumber.from("0x" + key1.getPrivate().toString(16)); diff --git a/test/NodeRotation.ts b/test/NodeRotation.ts index 9dccc263..3fe4993e 100644 --- a/test/NodeRotation.ts +++ b/test/NodeRotation.ts @@ -1,23 +1,23 @@ -import { ethers } from "hardhat"; -import { fastBeforeEach } from "./tools/mocha"; -import { ConstantsHolder, NodeRotation, Nodes, Schains, SchainsInternal, SkaleDKGTester, SkaleManager, ValidatorService, Wallets } from "../typechain-types"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { Wallet } from "ethers"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { deploySchains } from "./tools/deploy/schains"; -import { SchainType, schainParametersType } from "./tools/types"; -import { deploySchainsInternal } from "./tools/deploy/schainsInternal"; -import { stringKeccak256 } from "./tools/hashes"; +import {ethers} from "hardhat"; +import {fastBeforeEach} from "./tools/mocha"; +import {ConstantsHolder, NodeRotation, Nodes, Schains, SchainsInternal, SkaleDKGTester, SkaleManager, ValidatorService, Wallets} from "../typechain-types"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {Wallet} from "ethers"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {deploySchains} from "./tools/deploy/schains"; +import {SchainType, schainParametersType} from "./tools/types"; +import {deploySchainsInternal} from "./tools/deploy/schainsInternal"; +import {stringKeccak256} from "./tools/hashes"; import _ from "underscore"; -import { deploySkaleDKGTester } from "./tools/deploy/test/skaleDKGTester"; -import { skipTime } from "./tools/time"; -import { deployWallets } from "./tools/deploy/wallets"; -import { deployNodeRotation } from "./tools/deploy/nodeRotation"; +import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; +import {skipTime} from "./tools/time"; +import {deployWallets} from "./tools/deploy/wallets"; +import {deployNodeRotation} from "./tools/deploy/nodeRotation"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; @@ -104,7 +104,6 @@ describe("NodeRotation", () => { let chainNodes: RegisteredNode[]; fastBeforeEach(async () => { - const schainType = SchainType.LARGE; const deposit = await schains.getSchainPrice(schainType, 5); @@ -214,7 +213,6 @@ describe("NodeRotation", () => { it("a node that fails DKG after node exit " + "should have finish_ts 1 sec bigger than a leaving node", async () => { - const exitingNodeFinishTs = (await nodeRotation.getLeavingHistory(exitingNode.id))[0].finishedRotation.toNumber(); const failingNodeFinishTs = (await nodeRotation.getLeavingHistory(failingNode.id))[0].finishedRotation.toNumber(); diff --git a/test/NodesData.ts b/test/NodesData.ts index d9e089ad..e21f556f 100644 --- a/test/NodesData.ts +++ b/test/NodesData.ts @@ -1,21 +1,21 @@ import chaiAsPromised from "chai-as-promised"; -import { ContractManager, +import {ContractManager, Nodes, ValidatorService} from "../typechain-types"; -import { skipTime } from "./tools/time"; -import { privateKeys } from "./tools/private-keys"; +import {skipTime} from "./tools/time"; +import {privateKeys} from "./tools/private-keys"; import chai = require("chai"); -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deploySkaleManagerMock } from "./tools/deploy/test/skaleManagerMock"; -import { BigNumber, Wallet } from "ethers"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert } from "chai"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { fastBeforeEach } from "./tools/mocha"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; +import {BigNumber, Wallet} from "ethers"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert} from "chai"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -382,7 +382,6 @@ describe("NodesData", () => { (await nodes.countNodesWithFreeSpace(1)).should.be.equal(2); }); }); - }); describe("when two nodes are added", () => { @@ -457,9 +456,6 @@ describe("NodesData", () => { const spaceAfter = nodesFillingAfter["0"]; parseInt(spaceBefore.toString(), 10).should.be.equal(parseInt(spaceAfter.toString(), 10)); }); - }); - }); - }); diff --git a/test/NodesFunctionality.ts b/test/NodesFunctionality.ts index d6595c48..fc4e7598 100644 --- a/test/NodesFunctionality.ts +++ b/test/NodesFunctionality.ts @@ -1,26 +1,26 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ContractManager, +import {ContractManager, Nodes, SkaleToken, ValidatorService, DelegationController, ConstantsHolder} from "../typechain-types"; -import { privateKeys } from "./tools/private-keys"; -import { nextMonth } from "./tools/time"; -import { Wallet } from "ethers"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { deployDelegationController } from "./tools/deploy/delegation/delegationController"; -import { deploySkaleManagerMock } from "./tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { expect } from "chai"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { fastBeforeEach } from "./tools/mocha"; +import {privateKeys} from "./tools/private-keys"; +import {nextMonth} from "./tools/time"; +import {Wallet} from "ethers"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; +import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {expect} from "chai"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); @@ -69,7 +69,6 @@ describe("NodesFunctionality", () => { const NODE_MANAGER_ROLE = await nodes.NODE_MANAGER_ROLE(); await nodes.grantRole(NODE_MANAGER_ROLE, owner.address); - }); it("should fail to create node if ip is zero", async () => { @@ -170,7 +169,6 @@ describe("NodesFunctionality", () => { }); it("should complete exiting", async () => { - await nodes.completeExit(0) .should.be.eventually.rejectedWith("Node is not Leaving"); diff --git a/test/Pricing.ts b/test/Pricing.ts index f7666377..5426b4bc 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -1,32 +1,32 @@ -import { Wallet } from "ethers"; +import {Wallet} from "ethers"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ContractManager, +import {ContractManager, Nodes, Pricing, SchainsInternal, ValidatorService, ConstantsHolder, - NodeRotation } from "../typechain-types"; - -import { privateKeys } from "./tools/private-keys"; - -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deployPricing } from "./tools/deploy/pricing"; -import { deploySchainsInternal } from "./tools/deploy/schainsInternal"; -import { skipTime, currentTime } from "./tools/time"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deploySchains } from "./tools/deploy/schains"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployNodeRotation } from "./tools/deploy/nodeRotation"; -import { deploySkaleManagerMock } from "./tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { fastBeforeEach } from "./tools/mocha"; + NodeRotation} from "../typechain-types"; + +import {privateKeys} from "./tools/private-keys"; + +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deployPricing} from "./tools/deploy/pricing"; +import {deploySchainsInternal} from "./tools/deploy/schainsInternal"; +import {skipTime, currentTime} from "./tools/time"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deploySchains} from "./tools/deploy/schains"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployNodeRotation} from "./tools/deploy/nodeRotation"; +import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -140,7 +140,6 @@ describe("Pricing", () => { name: "elvis4", domainName: "some.domain.name" }); - }); it("should increase number of schains", async () => { @@ -159,11 +158,9 @@ describe("Pricing", () => { const jacobSchainHash = stringKeccak256("JacobSchain"); fastBeforeEach(async () => { - await schainsInternal.createGroupForSchain(bobSchainHash, 1, 32); await schainsInternal.createGroupForSchain(davidSchainHash, 1, 32); await schainsInternal.createGroupForSchain(jacobSchainHash, 2, 128); - }); async function getLoadCoefficient() { diff --git a/test/Schains.ts b/test/Schains.ts index e6cec6a9..e3d52f4b 100644 --- a/test/Schains.ts +++ b/test/Schains.ts @@ -1,6 +1,6 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ConstantsHolder, +import {ConstantsHolder, ContractManager, Nodes, SchainsInternal, @@ -11,27 +11,27 @@ import { ConstantsHolder, ValidatorService, NodeRotation, Wallets} from "../typechain-types"; -import { BigNumber, Wallet } from "ethers"; -import { skipTime, currentTime } from "./tools/time"; -import { privateKeys } from "./tools/private-keys"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deploySchainsInternal } from "./tools/deploy/schainsInternal"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleDKGTester } from "./tools/deploy/test/skaleDKGTester"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deployNodeRotation } from "./tools/deploy/nodeRotation"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert, expect } from "chai"; -import { deployWallets } from "./tools/deploy/wallets"; -import { fastBeforeEach } from "./tools/mocha"; -import { stringKeccak256 } from "./tools/hashes"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { schainParametersType, SchainType } from "./tools/types"; +import {BigNumber, Wallet} from "ethers"; +import {skipTime, currentTime} from "./tools/time"; +import {privateKeys} from "./tools/private-keys"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deploySchainsInternal} from "./tools/deploy/schainsInternal"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deployNodeRotation} from "./tools/deploy/nodeRotation"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert, expect} from "chai"; +import {deployWallets} from "./tools/deploy/wallets"; +import {fastBeforeEach} from "./tools/mocha"; +import {stringKeccak256} from "./tools/hashes"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); @@ -566,7 +566,6 @@ describe("Schains", () => { await nodeRotation.getPreviousNode(schainHash, 1).should.be.eventually.rejectedWith("No previous node"); await nodeRotation.getPreviousNode(schainHash, 0).should.be.eventually.rejectedWith("No previous node"); await nodeRotation.getPreviousNode(schainHash, 5).should.be.eventually.rejectedWith("No previous node"); - }); it("should get previous nodes after DKG failure", async () => { @@ -748,7 +747,6 @@ describe("Schains", () => { await nodeRotation.getPreviousNode(schainHash, 1).should.be.eventually.rejectedWith("No previous node"); await nodeRotation.getPreviousNode(schainHash, 0).should.be.eventually.rejectedWith("No previous node"); await nodeRotation.getPreviousNode(schainHash, 5).should.be.eventually.rejectedWith("No previous node"); - }); }); @@ -1508,11 +1506,9 @@ describe("Schains", () => { "D2", ).should.be.eventually.rejectedWith("Message sender is not the owner of the Schain"); }); - }); describe("when test schain is created", () => { - fastBeforeEach(async () => { const deposit = await schains.getSchainPrice(4, 5); await schains.addSchain( @@ -1552,7 +1548,6 @@ describe("Schains", () => { }); it("should be able to delete schain", async () => { - await schains.deleteSchain( holder.address, "D2", @@ -1561,15 +1556,12 @@ describe("Schains", () => { }); it("should fail on deleting schain if owner is wrong", async () => { - await schains.deleteSchain( nodeAddress1.address, "D2", ).should.be.eventually.rejectedWith("Message sender is not the owner of the Schain"); }); - }); - }); }); @@ -2242,7 +2234,6 @@ describe("Schains", () => { }); describe("when 6 nodes, 4 schains and 2 rotations(Kavoon test)", () => { - fastBeforeEach(async () => { const deposit = await schains.getSchainPrice(5, 5); const nodesCount = 6; @@ -2332,7 +2323,6 @@ describe("Schains", () => { await skaleDKG.setSuccessfulDKGPublic( stringKeccak256("d4"), ); - }); it("should rotate 1 node with 3 schains", async () => { @@ -2400,7 +2390,6 @@ describe("Schains", () => { }); describe("when 8 nodes, 4 schains and 2 rotations(Kavoon test)", () => { - fastBeforeEach(async () => { const deposit = await schains.getSchainPrice(5, 5); const nodesCount = 6; @@ -2506,7 +2495,6 @@ describe("Schains", () => { await skaleDKG.setSuccessfulDKGPublic( stringKeccak256("d4"), ); - }); it("should rotate 1 node with 3 schains", async () => { @@ -2745,7 +2733,6 @@ describe("Schains", () => { } if (!(await nodes.isNodeLeft(rotIndex))) { - while (!(await nodes.isNodeLeft(rotIndex))) { await skaleManager.connect(senderAddress).nodeExit(rotIndex); } @@ -2771,12 +2758,10 @@ describe("Schains", () => { (await nodeRotation.isRotationInProgress(schainHash)).should.be.false; } } - }); }); describe("when 17 nodes, 1 schain and remove schain type", () => { - const encryptedSecretKeyContributions: {share: string, publicKey: [string, string]}[][] = [ [ { diff --git a/test/SchainsInternal.ts b/test/SchainsInternal.ts index ba8b20c7..86aafb54 100644 --- a/test/SchainsInternal.ts +++ b/test/SchainsInternal.ts @@ -1,22 +1,22 @@ -import { ContractManager, +import {ContractManager, Nodes, SchainsInternalMock, - ValidatorService } from "../typechain-types"; -import { privateKeys } from "./tools/private-keys"; -import { Wallet } from "ethers"; + ValidatorService} from "../typechain-types"; +import {privateKeys} from "./tools/private-keys"; +import {Wallet} from "ethers"; import chai = require("chai"); import chaiAsPromised from "chai-as-promised"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { skipTime } from "./tools/time"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { expect } from "chai"; -import { fastBeforeEach } from "./tools/mocha"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {skipTime} from "./tools/time"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {expect} from "chai"; +import {fastBeforeEach} from "./tools/mocha"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; chai.should(); chai.use(chaiAsPromised); @@ -302,7 +302,6 @@ describe("SchainsInternal", () => { it("should return number of schains per node", async () => { (await schainsInternal.checkSchainOnNode(nodeIndex, schainNameHash)).should.be.equal(true); }); - }); it("should return list of schains", async () => { @@ -396,6 +395,5 @@ describe("SchainsInternal", () => { resSchainType.partOfNode.should.be.equal(32); resSchainType.numberOfNodes.should.be.equal(16); }); - }); }); diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index ba94a64f..03f7a9d6 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -1,6 +1,6 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ContractManager, +import {ContractManager, DelegationController, KeyStorage, Nodes, @@ -12,30 +12,30 @@ import { ContractManager, SlashingTable, ValidatorService, SkaleManager, - Wallets } from "../typechain-types"; -import { skipTime, currentTime, nextMonth } from "./tools/time"; -import { privateKeys } from "./tools/private-keys"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployDelegationController } from "./tools/deploy/delegation/delegationController"; -import { deployKeyStorage } from "./tools/deploy/keyStorage"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleDKG } from "./tools/deploy/skaleDKG"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { deploySlashingTable } from "./tools/deploy/slashingTable"; -import { deployNodeRotation } from "./tools/deploy/nodeRotation"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deployWallets } from "./tools/deploy/wallets"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert, expect } from "chai"; -import { makeSnapshot, applySnapshot } from "./tools/snapshot"; -import { BytesLike, ContractTransaction, Wallet } from "ethers"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { schainParametersType, SchainType } from "./tools/types"; + Wallets} from "../typechain-types"; +import {skipTime, currentTime, nextMonth} from "./tools/time"; +import {privateKeys} from "./tools/private-keys"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; +import {deployKeyStorage} from "./tools/deploy/keyStorage"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleDKG} from "./tools/deploy/skaleDKG"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {deploySlashingTable} from "./tools/deploy/slashingTable"; +import {deployNodeRotation} from "./tools/deploy/nodeRotation"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deployWallets} from "./tools/deploy/wallets"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert, expect} from "chai"; +import {makeSnapshot, applySnapshot} from "./tools/snapshot"; +import {BytesLike, ContractTransaction, Wallet} from "ethers"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); @@ -56,7 +56,6 @@ async function reimbursed(transaction: ContractTransaction, operation?: string) if (operation !== undefined) { console.log(`During ${operation}`); } - } balanceAfter.should.be.least(balanceBefore); balanceAfter.should.be.closeTo(balanceBefore, weiTolerance); @@ -872,7 +871,6 @@ describe("SkaleDKG", () => { 0 ).should.emit(skaleDKG, "BadGuy") .withArgs(0); - }); after(async () => { @@ -1299,7 +1297,6 @@ describe("SkaleDKG", () => { }); describe("when complaint successfully sent", () => { - let nodeSentBadData: number; before(async () => { nodeSentBadData = await makeSnapshot(); @@ -1781,7 +1778,6 @@ describe("SkaleDKG", () => { }); it("16 nodes schain test", async () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -1892,11 +1888,9 @@ describe("SkaleDKG", () => { assert(prevPubKey.x.b, "0"); assert(prevPubKey.y.a, "0"); assert(prevPubKey.y.b, "0"); - }); it("16 nodes schain test with incorrect complaint and response", async () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -2251,7 +2245,6 @@ describe("SkaleDKG", () => { }); it("16 nodes schain test with incorrect complaint and deleting Schain", async () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -2333,7 +2326,6 @@ describe("SkaleDKG", () => { }); it("16 nodes schain test with incorrect complaint and restart Schain creation", async () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -2470,7 +2462,6 @@ describe("SkaleDKG", () => { }); it("16 nodes schain test with incorrect complaint and creating new schain", async () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, diff --git a/test/SkaleDkgFakeComplaint.ts b/test/SkaleDkgFakeComplaint.ts index 7343c390..821e7510 100644 --- a/test/SkaleDkgFakeComplaint.ts +++ b/test/SkaleDkgFakeComplaint.ts @@ -1,6 +1,6 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ContractManager, +import {ContractManager, DelegationController, Nodes, SchainsInternalMock, @@ -11,30 +11,30 @@ import { ContractManager, ValidatorService, Wallets} from "../typechain-types"; -import { nextMonth, skipTime } from "./tools/time"; +import {nextMonth, skipTime} from "./tools/time"; -import { curve, ec } from "elliptic"; +import {curve, ec} from "elliptic"; const secp256k1Curve = new ec("secp256k1"); -import { privateKeys } from "./tools/private-keys"; - -import { Wallet } from "ethers"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployDelegationController } from "./tools/deploy/delegation/delegationController"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleDKG } from "./tools/deploy/skaleDKG"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { deploySlashingTable } from "./tools/deploy/slashingTable"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert } from "chai"; -import { deployWallets } from "./tools/deploy/wallets"; -import { makeSnapshot, applySnapshot } from "./tools/snapshot"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { schainParametersType, SchainType } from "./tools/types"; +import {privateKeys} from "./tools/private-keys"; + +import {Wallet} from "ethers"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleDKG} from "./tools/deploy/skaleDKG"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {deploySlashingTable} from "./tools/deploy/slashingTable"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert} from "chai"; +import {deployWallets} from "./tools/deploy/wallets"; +import {makeSnapshot, applySnapshot} from "./tools/snapshot"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/SkaleManager.ts b/test/SkaleManager.ts index 9ce22719..5c244eb6 100644 --- a/test/SkaleManager.ts +++ b/test/SkaleManager.ts @@ -1,6 +1,6 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ConstantsHolder, +import {ConstantsHolder, ContractManager, DelegationController, DelegationPeriodManager, @@ -15,31 +15,31 @@ import { ConstantsHolder, BountyV2, Wallets} from "../typechain-types"; -import { privateKeys } from "./tools/private-keys"; - -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deploySkaleDKGTester } from "./tools/deploy/test/skaleDKGTester"; -import { deployDelegationController } from "./tools/deploy/delegation/delegationController"; -import { deployDelegationPeriodManager } from "./tools/deploy/delegation/delegationPeriodManager"; -import { deployDistributor } from "./tools/deploy/delegation/distributor"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { skipTime, currentTime, nextMonth } from "./tools/time"; -import { deployBounty } from "./tools/deploy/bounty"; -import { BigNumber, ContractTransaction, Wallet } from "ethers"; -import { deployTimeHelpers } from "./tools/deploy/delegation/timeHelpers"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { deployWallets } from "./tools/deploy/wallets"; +import {privateKeys} from "./tools/private-keys"; + +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; +import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; +import {deployDelegationPeriodManager} from "./tools/deploy/delegation/delegationPeriodManager"; +import {deployDistributor} from "./tools/deploy/delegation/distributor"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {skipTime, currentTime, nextMonth} from "./tools/time"; +import {deployBounty} from "./tools/deploy/bounty"; +import {BigNumber, ContractTransaction, Wallet} from "ethers"; +import {deployTimeHelpers} from "./tools/deploy/delegation/timeHelpers"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {deployWallets} from "./tools/deploy/wallets"; import chaiAlmost from "chai-almost"; -import { fastBeforeEach } from "./tools/mocha"; -import { getPublicKey } from "./tools/signatures"; -import { schainParametersType, SchainType } from "./tools/types"; +import {fastBeforeEach} from "./tools/mocha"; +import {getPublicKey} from "./tools/signatures"; +import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); @@ -573,7 +573,6 @@ describe("SkaleManager", () => { }); describe("when another schain is created", () => { - fastBeforeEach(async () => { await skaleToken.connect(developer).send( skaleManager.address, @@ -631,7 +630,6 @@ describe("SkaleManager", () => { }); describe("when developer has SKALE tokens", () => { - fastBeforeEach(async () => { await skaleToken.transfer(developer.address, "0x3635C9ADC5DEA000000"); }); @@ -678,7 +676,6 @@ describe("SkaleManager", () => { }); describe("when schains are created", () => { - fastBeforeEach(async () => { await skaleToken.connect(developer).send( skaleManager.address, @@ -728,9 +725,7 @@ describe("SkaleManager", () => { }); }); describe("when 16 nodes are in the system", () => { - it("should create 16 nodes & create & delete all types of schain", async () => { - await skaleToken.transfer(validator.address, "0x32D26D12E980B600000"); for (let i = 0; i < 16; ++i) { diff --git a/test/SkaleToken.ts b/test/SkaleToken.ts index af36e80b..cdeaa055 100644 --- a/test/SkaleToken.ts +++ b/test/SkaleToken.ts @@ -1,19 +1,19 @@ -import { BigNumber } from "ethers"; -import { ContractManager, +import {BigNumber} from "ethers"; +import {ContractManager, SkaleToken, SkaleTokenInternalTester} from "../typechain-types"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deploySkaleToken } from "./tools/deploy/skaleToken"; -import { deployReentrancyTester } from "./tools/deploy/test/reentrancyTester"; -import { deploySkaleManagerMock } from "./tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { expect } from "chai"; -import { fastBeforeEach } from "./tools/mocha"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deploySkaleToken} from "./tools/deploy/skaleToken"; +import {deployReentrancyTester} from "./tools/deploy/test/reentrancyTester"; +import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {expect} from "chai"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/SkaleVerifier.ts b/test/SkaleVerifier.ts index 4603b2f9..cb6259ab 100644 --- a/test/SkaleVerifier.ts +++ b/test/SkaleVerifier.ts @@ -1,6 +1,6 @@ import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ConstantsHolder, +import {ConstantsHolder, ContractManager, KeyStorage, Nodes, @@ -9,28 +9,28 @@ import { ConstantsHolder, SkaleDKGTester, SkaleManager, SkaleVerifier, - ValidatorService } from "../typechain-types"; -import { privateKeys } from "./tools/private-keys"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deploySchainsInternalMock } from "./tools/deploy/test/schainsInternalMock"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleVerifier } from "./tools/deploy/skaleVerifier"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deployKeyStorage } from "./tools/deploy/keyStorage"; -import { deploySkaleDKGTester } from "./tools/deploy/test/skaleDKGTester"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert } from "chai"; -import { deploySchainsInternal } from "./tools/deploy/schainsInternal"; -import { Wallet } from "ethers"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { fastBeforeEach } from "./tools/mocha"; -import { skipTime } from "./tools/time"; -import { schainParametersType, SchainType } from "./tools/types"; + ValidatorService} from "../typechain-types"; +import {privateKeys} from "./tools/private-keys"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleVerifier} from "./tools/deploy/skaleVerifier"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deployKeyStorage} from "./tools/deploy/keyStorage"; +import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert} from "chai"; +import {deploySchainsInternal} from "./tools/deploy/schainsInternal"; +import {Wallet} from "ethers"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {fastBeforeEach} from "./tools/mocha"; +import {skipTime} from "./tools/time"; +import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); @@ -84,7 +84,6 @@ describe("SkaleVerifier", () => { }); describe("when skaleVerifier contract is activated", () => { - it("should verify valid signatures with valid data", async () => { const isVerified = await skaleVerifier.verify( { diff --git a/test/SlashingTable.ts b/test/SlashingTable.ts index 6ec6a981..28809836 100644 --- a/test/SlashingTable.ts +++ b/test/SlashingTable.ts @@ -1,12 +1,12 @@ -import { ContractManager, SlashingTable } from "../typechain-types"; -import { deployContractManager } from "./tools/deploy/contractManager"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; +import {ContractManager, SlashingTable} from "../typechain-types"; +import {deployContractManager} from "./tools/deploy/contractManager"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; import chaiAsPromised from "chai-as-promised"; import * as chai from "chai"; -import { deploySlashingTable } from "./tools/deploy/slashingTable"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { fastBeforeEach } from "./tools/mocha"; +import {deploySlashingTable} from "./tools/deploy/slashingTable"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/SyncMananager.ts b/test/SyncMananager.ts index 9d9f5e8f..edded024 100644 --- a/test/SyncMananager.ts +++ b/test/SyncMananager.ts @@ -1,12 +1,12 @@ -import { ContractManager, SyncManager } from "../typechain-types"; -import { deployContractManager } from "./tools/deploy/contractManager"; +import {ContractManager, SyncManager} from "../typechain-types"; +import {deployContractManager} from "./tools/deploy/contractManager"; import chaiAsPromised from "chai-as-promised"; import * as chai from "chai"; -import { deploySyncManager } from "./tools/deploy/syncManager"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { expect } from "chai"; -import { fastBeforeEach } from "./tools/mocha"; +import {deploySyncManager} from "./tools/deploy/syncManager"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {expect} from "chai"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -25,7 +25,6 @@ describe("SyncManager", () => { syncManager = await deploySyncManager(contractManager); await syncManager.grantRole(await syncManager.SYNC_MANAGER_ROLE(), owner.address); - }); it("should revert addIPRange or removeIPRange if sender does not have required role", async () => { @@ -36,7 +35,6 @@ describe("SyncManager", () => { await syncManager.grantRole(await syncManager.SYNC_MANAGER_ROLE(), user.address); await syncManager.connect(user).addIPRange("range", "0x00000001", "0x00000001"); await syncManager.connect(user).removeIPRange("range"); - }); it("should revert if IP range name is already taken", async () => { @@ -63,7 +61,7 @@ describe("SyncManager", () => { .should.emit(syncManager, "IPRangeAdded") .withArgs(rangeName, newStartIP, newEndIP); { - const { startIP, endIP } = await syncManager.getIPRangeByName(rangeName); + const {startIP, endIP} = await syncManager.getIPRangeByName(rangeName); expect(startIP).to.be.equal(newStartIP); expect(endIP).to.be.equal(newEndIP); } @@ -71,7 +69,7 @@ describe("SyncManager", () => { .should.emit(syncManager, "IPRangeRemoved") .withArgs(rangeName); { - const { startIP, endIP } = await syncManager.getIPRangeByName(rangeName); + const {startIP, endIP} = await syncManager.getIPRangeByName(rangeName); expect(startIP).to.be.equal("0x00000000"); expect(endIP).to.be.equal("0x00000000"); } @@ -95,7 +93,7 @@ describe("SyncManager", () => { await syncManager.addIPRange(ipRanges[1].name, ipRanges[1].startIP, ipRanges[1].endIP); const ipRangesNumber = (await syncManager.getIPRangesNumber()).toNumber(); for (let i = 0; i < ipRangesNumber; i++) { - const { startIP, endIP } = await syncManager.getIPRangeByIndex(i); + const {startIP, endIP} = await syncManager.getIPRangeByIndex(i); expect(startIP).to.be.equal(ipRanges[i].startIP); expect(endIP).to.be.equal(ipRanges[i].endIP); } diff --git a/test/Wallets.ts b/test/Wallets.ts index 6c8c87e9..cc31454f 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -1,29 +1,29 @@ -import { ConstantsHolder, ContractManager, +import {ConstantsHolder, ContractManager, Nodes, Schains, SkaleDKGTester, SkaleManager, ValidatorService, - Wallets } from "../typechain-types"; -import { deployContractManager } from "./tools/deploy/contractManager"; + Wallets} from "../typechain-types"; +import {deployContractManager} from "./tools/deploy/contractManager"; import chaiAsPromised from "chai-as-promised"; import * as chai from "chai"; -import { privateKeys } from "./tools/private-keys"; -import { deployWallets } from "./tools/deploy/wallets"; -import { deployValidatorService } from "./tools/deploy/delegation/validatorService"; -import { deploySchains } from "./tools/deploy/schains"; -import { deploySkaleManager } from "./tools/deploy/skaleManager"; -import { deploySkaleDKGTester } from "./tools/deploy/test/skaleDKGTester"; -import { SchainType } from "./tools/types"; +import {privateKeys} from "./tools/private-keys"; +import {deployWallets} from "./tools/deploy/wallets"; +import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; +import {deploySchains} from "./tools/deploy/schains"; +import {deploySkaleManager} from "./tools/deploy/skaleManager"; +import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; +import {SchainType} from "./tools/types"; import chaiAlmost from "chai-almost"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { ContractTransaction, Wallet } from "ethers"; -import { makeSnapshot, applySnapshot } from "./tools/snapshot"; -import { getPublicKey, getValidatorIdSignature } from "./tools/signatures"; -import { stringKeccak256 } from "./tools/hashes"; -import { deployNodes } from "./tools/deploy/nodes"; -import { deployConstantsHolder } from "./tools/deploy/constantsHolder"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {ContractTransaction, Wallet} from "ethers"; +import {makeSnapshot, applySnapshot} from "./tools/snapshot"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {deployNodes} from "./tools/deploy/nodes"; +import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/delegation/Delegation.ts b/test/delegation/Delegation.ts index 064e58ce..3b7de5e9 100644 --- a/test/delegation/Delegation.ts +++ b/test/delegation/Delegation.ts @@ -1,4 +1,4 @@ -import { ConstantsHolder, +import {ConstantsHolder, ContractManager, DelegationController, DelegationPeriodManager, @@ -11,31 +11,31 @@ import { ConstantsHolder, Nodes, SlashingTable} from "../../typechain-types"; -import { currentTime, nextMonth, skipTimeToDate } from "../tools/time"; +import {currentTime, nextMonth, skipTimeToDate} from "../tools/time"; -import { BigNumber, Wallet } from "ethers"; +import {BigNumber, Wallet} from "ethers"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployConstantsHolder } from "../tools/deploy/constantsHolder"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deployDelegationController } from "../tools/deploy/delegation/delegationController"; -import { deployDelegationPeriodManager } from "../tools/deploy/delegation/delegationPeriodManager"; -import { deployDistributor } from "../tools/deploy/delegation/distributor"; -import { deployPunisher } from "../tools/deploy/delegation/punisher"; -import { deployTokenState } from "../tools/deploy/delegation/tokenState"; -import { deployValidatorService } from "../tools/deploy/delegation/validatorService"; -import { deploySkaleToken } from "../tools/deploy/skaleToken"; -import { State } from "../tools/types"; -import { deployNodes } from "../tools/deploy/nodes"; -import { deploySlashingTable } from "../tools/deploy/slashingTable"; -import { deployTimeHelpersWithDebug } from "../tools/deploy/test/timeHelpersWithDebug"; -import { deploySkaleManager } from "../tools/deploy/skaleManager"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { deploySkaleManagerMock } from "../tools/deploy/test/skaleManagerMock"; -import { assert, expect } from "chai"; -import { getValidatorIdSignature } from "../tools/signatures"; -import { fastBeforeEach } from "../tools/mocha"; +import {deployConstantsHolder} from "../tools/deploy/constantsHolder"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deployDelegationController} from "../tools/deploy/delegation/delegationController"; +import {deployDelegationPeriodManager} from "../tools/deploy/delegation/delegationPeriodManager"; +import {deployDistributor} from "../tools/deploy/delegation/distributor"; +import {deployPunisher} from "../tools/deploy/delegation/punisher"; +import {deployTokenState} from "../tools/deploy/delegation/tokenState"; +import {deployValidatorService} from "../tools/deploy/delegation/validatorService"; +import {deploySkaleToken} from "../tools/deploy/skaleToken"; +import {State} from "../tools/types"; +import {deployNodes} from "../tools/deploy/nodes"; +import {deploySlashingTable} from "../tools/deploy/slashingTable"; +import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDebug"; +import {deploySkaleManager} from "../tools/deploy/skaleManager"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; +import {assert, expect} from "chai"; +import {getValidatorIdSignature} from "../tools/signatures"; +import {fastBeforeEach} from "../tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -272,7 +272,6 @@ describe("Delegation", () => { }); describe("when delegation request is sent", () => { - fastBeforeEach(async () => { await delegationController.connect(holder1).delegate( validatorId, defaultAmount.toString(), delegationPeriod, "D2 is even"); @@ -626,7 +625,6 @@ describe("Delegation", () => { }); describe("Slashing", () => { - it("should slash validator and lock delegators fund in proportion of delegation share", async () => { // do 5 separate slashes to check aggregation const slashesNumber = 5; diff --git a/test/delegation/DelegationController.ts b/test/delegation/DelegationController.ts index cc9c674e..4db6fdf4 100644 --- a/test/delegation/DelegationController.ts +++ b/test/delegation/DelegationController.ts @@ -1,24 +1,24 @@ -import { ContractManager, +import {ContractManager, DelegationController, SkaleToken, ValidatorService} from "../../typechain-types"; -import { currentTime, nextMonth, skipTime } from "../tools/time"; +import {currentTime, nextMonth, skipTime} from "../tools/time"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deployDelegationController } from "../tools/deploy/delegation/delegationController"; -import { deployValidatorService } from "../tools/deploy/delegation/validatorService"; -import { deploySkaleToken } from "../tools/deploy/skaleToken"; -import { deployTimeHelpersWithDebug } from "../tools/deploy/test/timeHelpersWithDebug"; -import { State } from "../tools/types"; -import { deployTimeHelpers } from "../tools/deploy/delegation/timeHelpers"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { deploySkaleManagerMock } from "../tools/deploy/test/skaleManagerMock"; -import { expect, assert } from "chai"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deployDelegationController} from "../tools/deploy/delegation/delegationController"; +import {deployValidatorService} from "../tools/deploy/delegation/validatorService"; +import {deploySkaleToken} from "../tools/deploy/skaleToken"; +import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDebug"; +import {State} from "../tools/types"; +import {deployTimeHelpers} from "../tools/deploy/delegation/timeHelpers"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; +import {expect, assert} from "chai"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); @@ -134,7 +134,6 @@ describe("DelegationController", () => { await delegationController.connect(holder1).delegate(validatorId, amount + 1, delegationPeriod, info); await delegationController.connect(holder1).delegate(validatorId, amount, delegationPeriod, info) .should.be.eventually.rejectedWith("Token holder does not have enough tokens to delegate"); - }); it("should reject canceling if delegation doesn't exist", async () => { diff --git a/test/delegation/PartialDifferences.ts b/test/delegation/PartialDifferences.ts index 7de694db..13928328 100644 --- a/test/delegation/PartialDifferences.ts +++ b/test/delegation/PartialDifferences.ts @@ -1,9 +1,9 @@ -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deployPartialDifferencesTester } from "../tools/deploy/test/partialDifferencesTester"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deployPartialDifferencesTester} from "../tools/deploy/test/partialDifferencesTester"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { PartialDifferencesTester } from "../../typechain-types"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {PartialDifferencesTester} from "../../typechain-types"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); @@ -61,6 +61,5 @@ describe("PartialDifferences", () => { await partialDifferencesTester.getAndUpdateSequenceItem(sequence, 1); await partialDifferencesTester.reduceSequence(sequence, 1, 2, 1); (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 1)).toNumber().should.be.equal(0); - }); }); \ No newline at end of file diff --git a/test/delegation/TimeHelpers.ts b/test/delegation/TimeHelpers.ts index 6b332888..43b33822 100644 --- a/test/delegation/TimeHelpers.ts +++ b/test/delegation/TimeHelpers.ts @@ -1,11 +1,11 @@ -import { TimeHelpers, ContractManager } from "../../typechain-types"; -import { deployTimeHelpers } from "../tools/deploy/delegation/timeHelpers"; -import { deployContractManager } from "../tools/deploy/contractManager"; +import {TimeHelpers, ContractManager} from "../../typechain-types"; +import {deployTimeHelpers} from "../tools/deploy/delegation/timeHelpers"; +import {deployContractManager} from "../tools/deploy/contractManager"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployTimeHelpersWithDebug } from "../tools/deploy/test/timeHelpersWithDebug"; -import { currentTime } from "../tools/time"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDebug"; +import {currentTime} from "../tools/time"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/delegation/TokenState.ts b/test/delegation/TokenState.ts index f84eb6c4..ed3d0256 100644 --- a/test/delegation/TokenState.ts +++ b/test/delegation/TokenState.ts @@ -1,21 +1,21 @@ -import { ContractManager, +import {ContractManager, DelegationController, SkaleToken, ValidatorService} from "../../typechain-types"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { nextMonth } from "../tools/time"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {nextMonth} from "../tools/time"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployDelegationController } from "../tools/deploy/delegation/delegationController"; -import { deployValidatorService } from "../tools/deploy/delegation/validatorService"; -import { deploySkaleToken } from "../tools/deploy/skaleToken"; -import { State } from "../tools/types"; -import { deploySkaleManagerMock } from "../tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {deployDelegationController} from "../tools/deploy/delegation/delegationController"; +import {deployValidatorService} from "../tools/deploy/delegation/validatorService"; +import {deploySkaleToken} from "../tools/deploy/skaleToken"; +import {State} from "../tools/types"; +import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/delegation/ValidatorService.ts b/test/delegation/ValidatorService.ts index facb1447..d515f9eb 100644 --- a/test/delegation/ValidatorService.ts +++ b/test/delegation/ValidatorService.ts @@ -1,4 +1,4 @@ -import { ContractManager, +import {ContractManager, DelegationController, SkaleToken, ValidatorService} from "../../typechain-types"; @@ -6,17 +6,17 @@ import { ContractManager, import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deployDelegationController } from "../tools/deploy/delegation/delegationController"; -import { deployValidatorService } from "../tools/deploy/delegation/validatorService"; -import { deploySkaleToken } from "../tools/deploy/skaleToken"; -import { deploySkaleManager } from "../tools/deploy/skaleManager"; -import { deploySkaleManagerMock } from "../tools/deploy/test/skaleManagerMock"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; -import { assert } from "chai"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; -import { getValidatorIdSignature } from "../tools/signatures"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deployDelegationController} from "../tools/deploy/delegation/delegationController"; +import {deployValidatorService} from "../tools/deploy/delegation/validatorService"; +import {deploySkaleToken} from "../tools/deploy/skaleToken"; +import {deploySkaleManager} from "../tools/deploy/skaleManager"; +import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {assert} from "chai"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; +import {getValidatorIdSignature} from "../tools/signatures"; chai.should(); chai.use(chaiAsPromised); @@ -111,7 +111,6 @@ describe("ValidatorService", () => { 500, 100) .should.be.eventually.rejectedWith("Validator with such address already exists"); - }); it("should reset name, description, minimum delegation amount", async () => { diff --git a/test/tools/constants.ts b/test/tools/constants.ts index ac3ccb39..2c295a8a 100644 --- a/test/tools/constants.ts +++ b/test/tools/constants.ts @@ -2,4 +2,4 @@ const rewardPeriod = 3600; const deltaPeriod = 300; const checkTime = 120; -export { rewardPeriod, deltaPeriod, checkTime }; \ No newline at end of file +export {rewardPeriod, deltaPeriod, checkTime}; \ No newline at end of file diff --git a/test/tools/deploy/bounty.ts b/test/tools/deploy/bounty.ts index 8a029e31..e6a9b393 100644 --- a/test/tools/deploy/bounty.ts +++ b/test/tools/deploy/bounty.ts @@ -1,9 +1,9 @@ -import { deployNodes } from "./nodes"; -import { ContractManager, BountyV2 } from "../../../typechain-types"; -import { defaultDeploy, deployFunctionFactory } from "./factory"; -import { deployConstantsHolder } from "./constantsHolder"; -import { deployTimeHelpers } from "./delegation/timeHelpers"; -import { deployWallets } from "./wallets"; +import {deployNodes} from "./nodes"; +import {ContractManager, BountyV2} from "../../../typechain-types"; +import {defaultDeploy, deployFunctionFactory} from "./factory"; +import {deployConstantsHolder} from "./constantsHolder"; +import {deployTimeHelpers} from "./delegation/timeHelpers"; +import {deployWallets} from "./wallets"; export const deployBounty = deployFunctionFactory( "BountyV2", diff --git a/test/tools/deploy/constantsHolder.ts b/test/tools/deploy/constantsHolder.ts index 019efe6e..b4801001 100644 --- a/test/tools/deploy/constantsHolder.ts +++ b/test/tools/deploy/constantsHolder.ts @@ -1,5 +1,5 @@ -import { ConstantsHolder, ContractManager } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +import {ConstantsHolder, ContractManager} from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; const name = "ConstantsHolder"; diff --git a/test/tools/deploy/contractManager.ts b/test/tools/deploy/contractManager.ts index bf9ed27c..7f0b550c 100644 --- a/test/tools/deploy/contractManager.ts +++ b/test/tools/deploy/contractManager.ts @@ -1,5 +1,5 @@ -import { ethers } from "hardhat"; -import { ContractManager } from "../../../typechain-types"; +import {ethers} from "hardhat"; +import {ContractManager} from "../../../typechain-types"; export async function deployContractManager() { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { diff --git a/test/tools/deploy/decryption.ts b/test/tools/deploy/decryption.ts index 5ffbfce6..b7bc40a0 100644 --- a/test/tools/deploy/decryption.ts +++ b/test/tools/deploy/decryption.ts @@ -1,5 +1,5 @@ -import { ContractManager, Decryption } from "../../../typechain-types"; -import { deployFunctionFactory, deployWithConstructor } from "./factory"; +import {ContractManager, Decryption} from "../../../typechain-types"; +import {deployFunctionFactory, deployWithConstructor} from "./factory"; export const deployDecryption = deployFunctionFactory( "Decryption", diff --git a/test/tools/deploy/delegation/delegationController.ts b/test/tools/deploy/delegation/delegationController.ts index c0986e94..52b3df9b 100644 --- a/test/tools/deploy/delegation/delegationController.ts +++ b/test/tools/deploy/delegation/delegationController.ts @@ -1,10 +1,10 @@ -import { ContractManager, DelegationController } from "../../../../typechain-types"; -import { deployBounty } from "../bounty"; -import { deployFunctionFactory } from "../factory"; -import { deploySkaleToken } from "../skaleToken"; -import { deployDelegationPeriodManager } from "./delegationPeriodManager"; -import { deployTimeHelpers } from "./timeHelpers"; -import { deployValidatorService } from "./validatorService"; +import {ContractManager, DelegationController} from "../../../../typechain-types"; +import {deployBounty} from "../bounty"; +import {deployFunctionFactory} from "../factory"; +import {deploySkaleToken} from "../skaleToken"; +import {deployDelegationPeriodManager} from "./delegationPeriodManager"; +import {deployTimeHelpers} from "./timeHelpers"; +import {deployValidatorService} from "./validatorService"; export const deployDelegationController = deployFunctionFactory( "DelegationController", diff --git a/test/tools/deploy/delegation/delegationPeriodManager.ts b/test/tools/deploy/delegation/delegationPeriodManager.ts index f9fab4ac..d3bdca93 100644 --- a/test/tools/deploy/delegation/delegationPeriodManager.ts +++ b/test/tools/deploy/delegation/delegationPeriodManager.ts @@ -1,5 +1,5 @@ -import { ContractManager, DelegationPeriodManager } from "../../../../typechain-types"; -import { deployFunctionFactory } from "../factory"; +import {ContractManager, DelegationPeriodManager} from "../../../../typechain-types"; +import {deployFunctionFactory} from "../factory"; const name = "DelegationPeriodManager"; diff --git a/test/tools/deploy/delegation/distributor.ts b/test/tools/deploy/delegation/distributor.ts index 1b535d18..acd1a1f5 100644 --- a/test/tools/deploy/delegation/distributor.ts +++ b/test/tools/deploy/delegation/distributor.ts @@ -1,11 +1,11 @@ -import { ContractManager, Distributor } from "../../../../typechain-types"; -import { deployConstantsHolder } from "../constantsHolder"; -import { deployFunctionFactory } from "../factory"; -import { deploySkaleToken } from "../skaleToken"; -import { deployDelegationController } from "./delegationController"; -import { deployDelegationPeriodManager } from "./delegationPeriodManager"; -import { deployTimeHelpers } from "./timeHelpers"; -import { deployValidatorService } from "./validatorService"; +import {ContractManager, Distributor} from "../../../../typechain-types"; +import {deployConstantsHolder} from "../constantsHolder"; +import {deployFunctionFactory} from "../factory"; +import {deploySkaleToken} from "../skaleToken"; +import {deployDelegationController} from "./delegationController"; +import {deployDelegationPeriodManager} from "./delegationPeriodManager"; +import {deployTimeHelpers} from "./timeHelpers"; +import {deployValidatorService} from "./validatorService"; const name = "Distributor"; diff --git a/test/tools/deploy/delegation/punisher.ts b/test/tools/deploy/delegation/punisher.ts index 82b4aaa9..819f52c8 100644 --- a/test/tools/deploy/delegation/punisher.ts +++ b/test/tools/deploy/delegation/punisher.ts @@ -1,7 +1,7 @@ -import { ContractManager, Punisher } from "../../../../typechain-types"; -import { deployFunctionFactory } from "../factory"; -import { deployDelegationController } from "./delegationController"; -import { deployValidatorService } from "./validatorService"; +import {ContractManager, Punisher} from "../../../../typechain-types"; +import {deployFunctionFactory} from "../factory"; +import {deployDelegationController} from "./delegationController"; +import {deployValidatorService} from "./validatorService"; export const deployPunisher = deployFunctionFactory( "Punisher", diff --git a/test/tools/deploy/delegation/timeHelpers.ts b/test/tools/deploy/delegation/timeHelpers.ts index 753dc52d..b7d58dcf 100644 --- a/test/tools/deploy/delegation/timeHelpers.ts +++ b/test/tools/deploy/delegation/timeHelpers.ts @@ -1,6 +1,6 @@ -import { ContractManager, - TimeHelpers } from "../../../../typechain-types"; -import { deployWithConstructor, deployWithConstructorFunctionFactory } from "../factory"; +import {ContractManager, + TimeHelpers} from "../../../../typechain-types"; +import {deployWithConstructor, deployWithConstructorFunctionFactory} from "../factory"; const name = "TimeHelpers"; diff --git a/test/tools/deploy/delegation/tokenState.ts b/test/tools/deploy/delegation/tokenState.ts index b368da50..bb9d15b8 100644 --- a/test/tools/deploy/delegation/tokenState.ts +++ b/test/tools/deploy/delegation/tokenState.ts @@ -1,8 +1,8 @@ -import { ContractManager, TokenState } from "../../../../typechain-types"; -import { deployFunctionFactory } from "../factory"; -import { deployDelegationController } from "./delegationController"; -import { deployPunisher } from "./punisher"; -import { deployTimeHelpers } from "./timeHelpers"; +import {ContractManager, TokenState} from "../../../../typechain-types"; +import {deployFunctionFactory} from "../factory"; +import {deployDelegationController} from "./delegationController"; +import {deployPunisher} from "./punisher"; +import {deployTimeHelpers} from "./timeHelpers"; const name = "TokenState"; diff --git a/test/tools/deploy/delegation/validatorService.ts b/test/tools/deploy/delegation/validatorService.ts index ff38a285..a6ab1a04 100644 --- a/test/tools/deploy/delegation/validatorService.ts +++ b/test/tools/deploy/delegation/validatorService.ts @@ -1,7 +1,7 @@ -import { ContractManager, ValidatorService } from "../../../../typechain-types"; -import { deployConstantsHolder } from "../constantsHolder"; -import { deployFunctionFactory } from "../factory"; -import { deployDelegationController } from "./delegationController"; +import {ContractManager, ValidatorService} from "../../../../typechain-types"; +import {deployConstantsHolder} from "../constantsHolder"; +import {deployFunctionFactory} from "../factory"; +import {deployDelegationController} from "./delegationController"; const name = "ValidatorService"; diff --git a/test/tools/deploy/ecdh.ts b/test/tools/deploy/ecdh.ts index 62bfe576..6092223d 100644 --- a/test/tools/deploy/ecdh.ts +++ b/test/tools/deploy/ecdh.ts @@ -1,5 +1,5 @@ -import { ContractManager, ECDH } from "../../../typechain-types"; -import { deployFunctionFactory, deployWithConstructor } from "./factory"; +import {ContractManager, ECDH} from "../../../typechain-types"; +import {deployFunctionFactory, deployWithConstructor} from "./factory"; export const deployECDH = deployFunctionFactory( "ECDH", diff --git a/test/tools/deploy/factory.ts b/test/tools/deploy/factory.ts index a9d75d6c..f9265f68 100644 --- a/test/tools/deploy/factory.ts +++ b/test/tools/deploy/factory.ts @@ -1,6 +1,6 @@ -import { ethers, upgrades } from "hardhat"; -import { ContractManager } from "../../../typechain-types"; -import { deployLibraries } from "@skalenetwork/upgrade-tools"; +import {ethers, upgrades} from "hardhat"; +import {ContractManager} from "../../../typechain-types"; +import {deployLibraries} from "@skalenetwork/upgrade-tools"; async function defaultDeploy(contractName: string, contractManager: ContractManager) { @@ -30,7 +30,6 @@ function deployFunctionFactory( return await defaultDeploy(contractName, contractManager); } ) { - return async (contractManager: ContractManager) => { const contractFactory = await ethers.getContractFactory(contractName); try { @@ -72,7 +71,7 @@ function deployWithLibraryFunctionFactory( try { return contractFactory.attach(await contractManager.getContract(contractName)); } catch (e) { - const instance = await upgrades.deployProxy(contractFactory, [contractManager.address], { unsafeAllowLinkedLibraries: true }); + const instance = await upgrades.deployProxy(contractFactory, [contractManager.address], {unsafeAllowLinkedLibraries: true}); await contractManager.setContractsAddress(contractName, instance.address); await deployDependencies(contractManager); return instance; @@ -92,7 +91,7 @@ function deployWithLibraryWithConstructor( try { return contractFactory.attach(await contractManager.getContract(contractName)); } catch (e) { - const instance = await upgrades.deployProxy(contractFactory, { unsafeAllowLinkedLibraries: true }); + const instance = await upgrades.deployProxy(contractFactory, {unsafeAllowLinkedLibraries: true}); await contractManager.setContractsAddress(contractName, instance.address); await deployDependencies(contractManager); return instance; diff --git a/test/tools/deploy/keyStorage.ts b/test/tools/deploy/keyStorage.ts index 7a8c0bdc..187af3da 100644 --- a/test/tools/deploy/keyStorage.ts +++ b/test/tools/deploy/keyStorage.ts @@ -1,8 +1,8 @@ -import { ContractManager, KeyStorage } from "../../../typechain-types"; -import { deployDecryption } from "./decryption"; -import { deployECDH } from "./ecdh"; -import { deployFunctionFactory } from "./factory"; -import { deploySchainsInternal } from "./schainsInternal"; +import {ContractManager, KeyStorage} from "../../../typechain-types"; +import {deployDecryption} from "./decryption"; +import {deployECDH} from "./ecdh"; +import {deployFunctionFactory} from "./factory"; +import {deploySchainsInternal} from "./schainsInternal"; export const deployKeyStorage = deployFunctionFactory( "KeyStorage", diff --git a/test/tools/deploy/nodeRotation.ts b/test/tools/deploy/nodeRotation.ts index 8cab67b9..82496bfe 100644 --- a/test/tools/deploy/nodeRotation.ts +++ b/test/tools/deploy/nodeRotation.ts @@ -1,8 +1,8 @@ -import { deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchainsInternal } from "./schainsInternal"; -import { deployConstantsHolder } from "./constantsHolder"; -import { ContractManager, NodeRotation } from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchainsInternal} from "./schainsInternal"; +import {deployConstantsHolder} from "./constantsHolder"; +import {ContractManager, NodeRotation} from "../../../typechain-types"; export const deployNodeRotation = deployFunctionFactory( "NodeRotation", diff --git a/test/tools/deploy/nodes.ts b/test/tools/deploy/nodes.ts index 27073b98..18163d09 100644 --- a/test/tools/deploy/nodes.ts +++ b/test/tools/deploy/nodes.ts @@ -1,9 +1,9 @@ -import { ContractManager, Nodes } from "../../../typechain-types"; -import { deployBounty } from "./bounty"; -import { deployConstantsHolder } from "./constantsHolder"; -import { deployValidatorService } from "./delegation/validatorService"; -import { deployWithLibraryFunctionFactory } from "./factory"; -import { deployNodeRotation } from "./nodeRotation"; +import {ContractManager, Nodes} from "../../../typechain-types"; +import {deployBounty} from "./bounty"; +import {deployConstantsHolder} from "./constantsHolder"; +import {deployValidatorService} from "./delegation/validatorService"; +import {deployWithLibraryFunctionFactory} from "./factory"; +import {deployNodeRotation} from "./nodeRotation"; export const deployNodes = deployWithLibraryFunctionFactory( "Nodes", diff --git a/test/tools/deploy/pricing.ts b/test/tools/deploy/pricing.ts index 47d56bd8..e15e1749 100644 --- a/test/tools/deploy/pricing.ts +++ b/test/tools/deploy/pricing.ts @@ -1,7 +1,7 @@ -import { ContractManager, Pricing } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchainsInternal } from "./schainsInternal"; +import {ContractManager, Pricing} from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchainsInternal} from "./schainsInternal"; export const deployPricing = deployFunctionFactory( "Pricing", diff --git a/test/tools/deploy/schains.ts b/test/tools/deploy/schains.ts index 43381f0e..d9b0acae 100644 --- a/test/tools/deploy/schains.ts +++ b/test/tools/deploy/schains.ts @@ -1,10 +1,10 @@ -import { deployConstantsHolder } from "./constantsHolder"; -import { deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchainsInternal } from "./schainsInternal"; -import { deploySkaleVerifier } from "./skaleVerifier"; -import { deployNodeRotation } from "./nodeRotation"; -import { ContractManager, Schains } from "../../../typechain-types"; +import {deployConstantsHolder} from "./constantsHolder"; +import {deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchainsInternal} from "./schainsInternal"; +import {deploySkaleVerifier} from "./skaleVerifier"; +import {deployNodeRotation} from "./nodeRotation"; +import {ContractManager, Schains} from "../../../typechain-types"; export const deploySchains = deployFunctionFactory( "Schains", diff --git a/test/tools/deploy/schainsInternal.ts b/test/tools/deploy/schainsInternal.ts index c9c8237e..d8eba69a 100644 --- a/test/tools/deploy/schainsInternal.ts +++ b/test/tools/deploy/schainsInternal.ts @@ -1,9 +1,9 @@ -import { ethers } from "hardhat"; -import { ContractManager, SchainsInternal } from "../../../typechain-types"; -import { deployConstantsHolder } from "./constantsHolder"; -import { defaultDeploy, deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySkaleDKG } from "./skaleDKG"; +import {ethers} from "hardhat"; +import {ContractManager, SchainsInternal} from "../../../typechain-types"; +import {deployConstantsHolder} from "./constantsHolder"; +import {defaultDeploy, deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySkaleDKG} from "./skaleDKG"; export const deploySchainsInternal = deployFunctionFactory( "SchainsInternal", diff --git a/test/tools/deploy/skaleDKG.ts b/test/tools/deploy/skaleDKG.ts index 266d7675..9c66a3ce 100644 --- a/test/tools/deploy/skaleDKG.ts +++ b/test/tools/deploy/skaleDKG.ts @@ -1,11 +1,11 @@ -import { deployPunisher } from "./delegation/punisher"; -import { deployKeyStorage } from "./keyStorage"; -import { deployWithLibraryFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchainsInternal } from "./schainsInternal"; -import { deploySlashingTable } from "./slashingTable"; -import { deployNodeRotation } from "./nodeRotation"; -import { ContractManager, SkaleDKG } from "../../../typechain-types"; +import {deployPunisher} from "./delegation/punisher"; +import {deployKeyStorage} from "./keyStorage"; +import {deployWithLibraryFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchainsInternal} from "./schainsInternal"; +import {deploySlashingTable} from "./slashingTable"; +import {deployNodeRotation} from "./nodeRotation"; +import {ContractManager, SkaleDKG} from "../../../typechain-types"; const libraries = [ "SkaleDkgAlright", diff --git a/test/tools/deploy/skaleManager.ts b/test/tools/deploy/skaleManager.ts index 56c7435b..269b2cd5 100644 --- a/test/tools/deploy/skaleManager.ts +++ b/test/tools/deploy/skaleManager.ts @@ -1,14 +1,14 @@ -import { deployConstantsHolder } from "./constantsHolder"; -import { deployDistributor } from "./delegation/distributor"; -import { deployValidatorService } from "./delegation/validatorService"; -import { deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchains } from "./schains"; -import { deploySkaleToken } from "./skaleToken"; -import { deployNodeRotation } from "./nodeRotation"; -import { deployBounty } from "./bounty"; -import { deployWallets } from "./wallets"; -import { ContractManager, SkaleManager } from "../../../typechain-types"; +import {deployConstantsHolder} from "./constantsHolder"; +import {deployDistributor} from "./delegation/distributor"; +import {deployValidatorService} from "./delegation/validatorService"; +import {deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchains} from "./schains"; +import {deploySkaleToken} from "./skaleToken"; +import {deployNodeRotation} from "./nodeRotation"; +import {deployBounty} from "./bounty"; +import {deployWallets} from "./wallets"; +import {ContractManager, SkaleManager} from "../../../typechain-types"; export const deploySkaleManager = deployFunctionFactory( "SkaleManager", diff --git a/test/tools/deploy/skaleToken.ts b/test/tools/deploy/skaleToken.ts index b777d4d6..a0b31cf8 100644 --- a/test/tools/deploy/skaleToken.ts +++ b/test/tools/deploy/skaleToken.ts @@ -1,10 +1,10 @@ -import { ethers } from "hardhat"; -import { ContractManager, SkaleToken } from "../../../typechain-types"; -import { deployDelegationController } from "./delegation/delegationController"; -import { deployPunisher } from "./delegation/punisher"; -import { deployTokenState } from "./delegation/tokenState"; -import { deployFunctionFactory } from "./factory"; -import { deploySkaleManager } from "./skaleManager"; +import {ethers} from "hardhat"; +import {ContractManager, SkaleToken} from "../../../typechain-types"; +import {deployDelegationController} from "./delegation/delegationController"; +import {deployPunisher} from "./delegation/punisher"; +import {deployTokenState} from "./delegation/tokenState"; +import {deployFunctionFactory} from "./factory"; +import {deploySkaleManager} from "./skaleManager"; const name = "SkaleToken"; diff --git a/test/tools/deploy/skaleVerifier.ts b/test/tools/deploy/skaleVerifier.ts index 0c86c6de..9178e4db 100644 --- a/test/tools/deploy/skaleVerifier.ts +++ b/test/tools/deploy/skaleVerifier.ts @@ -1,6 +1,6 @@ -import { ContractManager, SkaleVerifier } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; -import { deploySchainsInternal } from "./schainsInternal"; +import {ContractManager, SkaleVerifier} from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; +import {deploySchainsInternal} from "./schainsInternal"; export const deploySkaleVerifier = deployFunctionFactory( "SkaleVerifier", diff --git a/test/tools/deploy/slashingTable.ts b/test/tools/deploy/slashingTable.ts index 1005fb54..2bb61534 100644 --- a/test/tools/deploy/slashingTable.ts +++ b/test/tools/deploy/slashingTable.ts @@ -1,5 +1,5 @@ -import { ContractManager, SlashingTable } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +import {ContractManager, SlashingTable} from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; const name = "SlashingTable"; diff --git a/test/tools/deploy/syncManager.ts b/test/tools/deploy/syncManager.ts index d94e0e4f..b9dceb79 100644 --- a/test/tools/deploy/syncManager.ts +++ b/test/tools/deploy/syncManager.ts @@ -1,5 +1,5 @@ -import { ContractManager, SyncManager } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +import {ContractManager, SyncManager} from "../../../typechain-types"; +import {deployFunctionFactory} from "./factory"; const name = "SyncManager"; diff --git a/test/tools/deploy/test/fieldOperationsTester.ts b/test/tools/deploy/test/fieldOperationsTester.ts index 13fffc56..ded8c7d5 100644 --- a/test/tools/deploy/test/fieldOperationsTester.ts +++ b/test/tools/deploy/test/fieldOperationsTester.ts @@ -1,5 +1,5 @@ -import { ContractManager, FieldOperationsTester } from "../../../../typechain-types"; -import { deployWithConstructor, deployWithConstructorFunctionFactory } from "../factory"; +import {ContractManager, FieldOperationsTester} from "../../../../typechain-types"; +import {deployWithConstructor, deployWithConstructorFunctionFactory} from "../factory"; export const deployFieldOperationsTester = deployWithConstructorFunctionFactory( "FieldOperationsTester", diff --git a/test/tools/deploy/test/nodesMock.ts b/test/tools/deploy/test/nodesMock.ts index ff53c1fe..38d41099 100644 --- a/test/tools/deploy/test/nodesMock.ts +++ b/test/tools/deploy/test/nodesMock.ts @@ -1,5 +1,5 @@ -import { ContractManager, NodesMock } from "../../../../typechain-types"; -import { deployWithConstructorFunctionFactory } from "../factory"; +import {ContractManager, NodesMock} from "../../../../typechain-types"; +import {deployWithConstructorFunctionFactory} from "../factory"; export const deployNodesMock = deployWithConstructorFunctionFactory("NodesMock") as (contractManager: ContractManager) => Promise; \ No newline at end of file diff --git a/test/tools/deploy/test/partialDifferencesTester.ts b/test/tools/deploy/test/partialDifferencesTester.ts index 4aa6d710..b06ff27d 100644 --- a/test/tools/deploy/test/partialDifferencesTester.ts +++ b/test/tools/deploy/test/partialDifferencesTester.ts @@ -1,5 +1,5 @@ -import { ContractManager, PartialDifferencesTester } from "../../../../typechain-types"; -import { deployWithConstructor, deployWithConstructorFunctionFactory } from "../factory"; +import {ContractManager, PartialDifferencesTester} from "../../../../typechain-types"; +import {deployWithConstructor, deployWithConstructorFunctionFactory} from "../factory"; export const deployPartialDifferencesTester = deployWithConstructorFunctionFactory( "PartialDifferencesTester", diff --git a/test/tools/deploy/test/reentrancyTester.ts b/test/tools/deploy/test/reentrancyTester.ts index dfc6f703..42588bbd 100644 --- a/test/tools/deploy/test/reentrancyTester.ts +++ b/test/tools/deploy/test/reentrancyTester.ts @@ -1,6 +1,6 @@ -import { ContractManager, ReentrancyTester } from "../../../../typechain-types"; -import { deployWithConstructorFunctionFactory } from "../factory"; -import { deploySkaleToken } from "../skaleToken"; +import {ContractManager, ReentrancyTester} from "../../../../typechain-types"; +import {deployWithConstructorFunctionFactory} from "../factory"; +import {deploySkaleToken} from "../skaleToken"; export const deployReentrancyTester = deployWithConstructorFunctionFactory( "ReentrancyTester", diff --git a/test/tools/deploy/test/schainsInternalMock.ts b/test/tools/deploy/test/schainsInternalMock.ts index f8001aa2..eff223b8 100644 --- a/test/tools/deploy/test/schainsInternalMock.ts +++ b/test/tools/deploy/test/schainsInternalMock.ts @@ -1,9 +1,9 @@ -import { ContractManager, SchainsInternalMock } from "../../../../typechain-types"; -import { deployConstantsHolder } from "../constantsHolder"; -import { defaultDeploy, deployFunctionFactory } from "../factory"; -import { deployNodes } from "../nodes"; -import { deploySkaleDKG } from "../skaleDKG"; -import { ethers } from "hardhat"; +import {ContractManager, SchainsInternalMock} from "../../../../typechain-types"; +import {deployConstantsHolder} from "../constantsHolder"; +import {defaultDeploy, deployFunctionFactory} from "../factory"; +import {deployNodes} from "../nodes"; +import {deploySkaleDKG} from "../skaleDKG"; +import {ethers} from "hardhat"; export const deploySchainsInternalMock = deployFunctionFactory( "SchainsInternalMock", diff --git a/test/tools/deploy/test/segmentTreeTester.ts b/test/tools/deploy/test/segmentTreeTester.ts index c1930638..ca8a4555 100644 --- a/test/tools/deploy/test/segmentTreeTester.ts +++ b/test/tools/deploy/test/segmentTreeTester.ts @@ -1,5 +1,5 @@ -import { ContractManager, SegmentTreeTester } from "../../../../typechain-types"; -import { deployWithLibraryWithConstructor } from "../factory"; +import {ContractManager, SegmentTreeTester} from "../../../../typechain-types"; +import {deployWithLibraryWithConstructor} from "../factory"; export const deploySegmentTreeTester = deployWithLibraryWithConstructor( "SegmentTreeTester", diff --git a/test/tools/deploy/test/skaleDKGTester.ts b/test/tools/deploy/test/skaleDKGTester.ts index 433984dc..756c3e68 100644 --- a/test/tools/deploy/test/skaleDKGTester.ts +++ b/test/tools/deploy/test/skaleDKGTester.ts @@ -1,10 +1,10 @@ -import { deployPunisher } from "../delegation/punisher"; -import { deployKeyStorage } from "../keyStorage"; -import { deployWithLibraryFunctionFactory } from "../factory"; -import { deployNodes } from "../nodes"; -import { deploySchainsInternal } from "../schainsInternal"; -import { deploySlashingTable } from "../slashingTable"; -import { ContractManager, SkaleDKGTester } from "../../../../typechain-types"; +import {deployPunisher} from "../delegation/punisher"; +import {deployKeyStorage} from "../keyStorage"; +import {deployWithLibraryFunctionFactory} from "../factory"; +import {deployNodes} from "../nodes"; +import {deploySchainsInternal} from "../schainsInternal"; +import {deploySlashingTable} from "../slashingTable"; +import {ContractManager, SkaleDKGTester} from "../../../../typechain-types"; const libraries = [ "SkaleDkgAlright", diff --git a/test/tools/deploy/test/skaleManagerMock.ts b/test/tools/deploy/test/skaleManagerMock.ts index 510b22f5..061c0991 100644 --- a/test/tools/deploy/test/skaleManagerMock.ts +++ b/test/tools/deploy/test/skaleManagerMock.ts @@ -1,5 +1,5 @@ -import { ContractManager, SkaleManagerMock } from "../../../../typechain-types"; -import { deployWithConstructorFunctionFactory } from "../factory"; +import {ContractManager, SkaleManagerMock} from "../../../../typechain-types"; +import {deployWithConstructorFunctionFactory} from "../factory"; export const deploySkaleManagerMock = deployWithConstructorFunctionFactory("SkaleManagerMock") as (contractManager: ContractManager) => Promise; diff --git a/test/tools/deploy/test/timeHelpersWithDebug.ts b/test/tools/deploy/test/timeHelpersWithDebug.ts index 42753650..7467ef4b 100644 --- a/test/tools/deploy/test/timeHelpersWithDebug.ts +++ b/test/tools/deploy/test/timeHelpersWithDebug.ts @@ -1,6 +1,6 @@ -import { deployFunctionFactory } from "../factory"; -import { ethers } from "hardhat"; -import { ContractManager, TimeHelpersWithDebug } from "../../../../typechain-types"; +import {deployFunctionFactory} from "../factory"; +import {ethers} from "hardhat"; +import {ContractManager, TimeHelpersWithDebug} from "../../../../typechain-types"; export const deployTimeHelpersWithDebug = deployFunctionFactory( "TimeHelpersWithDebug", diff --git a/test/tools/deploy/wallets.ts b/test/tools/deploy/wallets.ts index 077d7b51..7deeb225 100644 --- a/test/tools/deploy/wallets.ts +++ b/test/tools/deploy/wallets.ts @@ -1,8 +1,8 @@ -import { ContractManager, Wallets } from "../../../typechain-types"; -import { deployValidatorService } from "./delegation/validatorService"; -import { deployFunctionFactory } from "./factory"; -import { deployNodes } from "./nodes"; -import { deploySchainsInternal } from "./schainsInternal"; +import {ContractManager, Wallets} from "../../../typechain-types"; +import {deployValidatorService} from "./delegation/validatorService"; +import {deployFunctionFactory} from "./factory"; +import {deployNodes} from "./nodes"; +import {deploySchainsInternal} from "./schainsInternal"; export const deployWallets = deployFunctionFactory( "Wallets", diff --git a/test/tools/hashes.ts b/test/tools/hashes.ts index b6cdd818..749c06ac 100644 --- a/test/tools/hashes.ts +++ b/test/tools/hashes.ts @@ -1,4 +1,4 @@ -import { ethers } from "hardhat"; +import {ethers} from "hardhat"; export function stringKeccak256(value: string) { return ethers.utils.solidityKeccak256(["string"], [value]); diff --git a/test/tools/mocha.ts b/test/tools/mocha.ts index 64edab92..01422312 100644 --- a/test/tools/mocha.ts +++ b/test/tools/mocha.ts @@ -1,4 +1,4 @@ -import { applySnapshot, makeSnapshot } from "./snapshot"; +import {applySnapshot, makeSnapshot} from "./snapshot"; export function fastBeforeEach(fn: Mocha.AsyncFunc) { let initialState: number diff --git a/test/tools/signatures.ts b/test/tools/signatures.ts index 18292b87..c69abee2 100644 --- a/test/tools/signatures.ts +++ b/test/tools/signatures.ts @@ -1,6 +1,6 @@ -import { BigNumberish, BytesLike, Signer, Wallet } from "ethers"; -import { ethers } from "hardhat"; -import { ec } from "elliptic"; +import {BigNumberish, BytesLike, Signer, Wallet} from "ethers"; +import {ethers} from "hardhat"; +import {ec} from "elliptic"; const secp256k1EC = new ec("secp256k1"); diff --git a/test/tools/snapshot.ts b/test/tools/snapshot.ts index 566f261e..2fa1ff93 100644 --- a/test/tools/snapshot.ts +++ b/test/tools/snapshot.ts @@ -1,4 +1,4 @@ -import { ethers } from "hardhat"; +import {ethers} from "hardhat"; export async function makeSnapshot() { return parseInt(await ethers.provider.send("evm_snapshot", []) as string, 16); diff --git a/test/tools/time.ts b/test/tools/time.ts index 3329d426..1443aef1 100644 --- a/test/tools/time.ts +++ b/test/tools/time.ts @@ -1,7 +1,7 @@ -import { ethers } from "hardhat"; -import { ContractManager } from "../../typechain-types"; -import { deployTimeHelpers } from "./deploy/delegation/timeHelpers"; -import { BigNumberish } from "ethers"; +import {ethers} from "hardhat"; +import {ContractManager} from "../../typechain-types"; +import {deployTimeHelpers} from "./deploy/delegation/timeHelpers"; +import {BigNumberish} from "ethers"; export async function skipTime(seconds: BigNumberish) { diff --git a/test/utils/FieldOperations.ts b/test/utils/FieldOperations.ts index 15532b7c..c453e15d 100644 --- a/test/utils/FieldOperations.ts +++ b/test/utils/FieldOperations.ts @@ -1,9 +1,9 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { FieldOperationsTester } from "../../typechain-types"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deployFieldOperationsTester } from "../tools/deploy/test/fieldOperationsTester"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {FieldOperationsTester} from "../../typechain-types"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deployFieldOperationsTester} from "../tools/deploy/test/fieldOperationsTester"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/utils/MathUtils.ts b/test/utils/MathUtils.ts index 87637aed..947781bd 100644 --- a/test/utils/MathUtils.ts +++ b/test/utils/MathUtils.ts @@ -1,8 +1,8 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { ethers } from "hardhat" -import { MathUtilsTester } from "../../typechain-types"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; +import {ethers} from "hardhat" +import {MathUtilsTester} from "../../typechain-types"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/utils/SegmentTree.ts b/test/utils/SegmentTree.ts index dd5a94f9..97d68afe 100644 --- a/test/utils/SegmentTree.ts +++ b/test/utils/SegmentTree.ts @@ -1,9 +1,9 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import { deployContractManager } from "../tools/deploy/contractManager"; -import { deploySegmentTreeTester } from "../tools/deploy/test/segmentTreeTester"; -import { makeSnapshot, applySnapshot } from "../tools/snapshot"; -import { SegmentTreeTester } from "../../typechain-types"; +import {deployContractManager} from "../tools/deploy/contractManager"; +import {deploySegmentTreeTester} from "../tools/deploy/test/segmentTreeTester"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; +import {SegmentTreeTester} from "../../typechain-types"; chai.should(); chai.use(chaiAsPromised); @@ -96,7 +96,6 @@ describe("SegmentTree", () => { }); describe("when initialized", () => { - before(async () => { cleanContracts = await makeSnapshot(); await segmentTree.addElemInPlaces(128, 150); @@ -108,7 +107,6 @@ describe("SegmentTree", () => { }); describe("move elements", () => { - it("should add elem to some place", async () => { await segmentTree.addToPlace(53, 12); // let index = 0; @@ -211,7 +209,6 @@ describe("SegmentTree", () => { }); describe("calculating sum", () => { - it("should calculate correct sum", async () => { (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); (await segmentTree.sumFromPlaceToLast(1)).toNumber().should.be.equal(150); @@ -295,7 +292,6 @@ describe("SegmentTree", () => { }); describe("random elem", () => { - it("should return last place", async () => { (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(128); @@ -338,8 +334,6 @@ describe("SegmentTree", () => { (await segmentTree.getRandomElem(127)).toNumber().should.be.equal(127); await segmentTree.getRandomElem(129).should.be.rejectedWith("Incorrect place"); await segmentTree.getRandomElem(100000).should.be.rejectedWith("Incorrect place"); - - }); it("should return and remove random places", async () => { diff --git a/yarn.lock b/yarn.lock index fb59d47b..7a246cf4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -468,14 +468,19 @@ resolved "https://registry.yarnpkg.com/@ensdomains/resolver/-/resolver-0.2.4.tgz#c10fe28bf5efbf49bff4666d909aed0265efbc89" integrity sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA== -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.5.1": + version "4.9.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.9.0.tgz#7ccb5f58703fa61ffdcbf39e2c604a109e781162" + integrity sha512-zJmuCWj2VLBt4c25CfBIbMZLGLyhkvs7LznyVX5HfpzeocThgIj5XQK4L+g3U36mMcx8bPMhGyPpwCATamC4jQ== + +"@eslint-community/regexpp@^4.6.1": version "4.8.0" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== @@ -495,10 +500,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.49.0": - version "8.49.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.49.0.tgz#86f79756004a97fa4df866835093f1df3d03c333" - integrity sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w== +"@eslint/js@8.50.0": + version "8.50.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" + integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== "@ethereum-waffle/chai@^3.4.4": version "3.4.4" @@ -2021,10 +2026,10 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== -"@types/json-schema@^7.0.9": - version "7.0.9" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" - integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== +"@types/json-schema@^7.0.12": + version "7.0.13" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" + integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== "@types/keyv@^3.1.4": version "3.1.4" @@ -2124,10 +2129,10 @@ resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-3.0.1.tgz#1254750a4fec4aff2ebec088ccd0bb02e91fedb4" integrity sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw== -"@types/semver@^7.3.12": - version "7.5.1" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367" - integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg== +"@types/semver@^7.5.0": + version "7.5.3" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04" + integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw== "@types/sinon-chai@^3.2.3", "@types/sinon-chai@^3.2.9": version "3.2.9" @@ -2157,123 +2162,90 @@ "@types/bn.js" "*" "@types/underscore" "*" -"@typescript-eslint/eslint-plugin@^5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" - integrity sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag== +"@typescript-eslint/eslint-plugin@^6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz#d98046e9f7102d49a93d944d413c6055c47fafd7" + integrity sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA== dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/type-utils" "5.62.0" - "@typescript-eslint/utils" "5.62.0" + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.7.3" + "@typescript-eslint/type-utils" "6.7.3" + "@typescript-eslint/utils" "6.7.3" + "@typescript-eslint/visitor-keys" "6.7.3" debug "^4.3.4" graphemer "^1.4.0" - ignore "^5.2.0" - natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/parser@^5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.1.tgz#4ce9633cc33fc70bc13786cb793c1a76fe5ad6bd" - integrity sha512-GReo3tjNBwR5RnRO0K2wDIDN31cM3MmDtgyQ85oAxAmC5K3j/g85IjP+cDfcqDsDDBf1HNKQAD0WqOYL8jXqUA== - dependencies: - "@typescript-eslint/scope-manager" "5.10.1" - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/typescript-estree" "5.10.1" - debug "^4.3.2" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" -"@typescript-eslint/scope-manager@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz#f0539c73804d2423506db2475352a4dec36cd809" - integrity sha512-Lyvi559Gvpn94k7+ElXNMEnXu/iundV5uFmCUNnftbFrUbAJ1WBoaGgkbOBm07jVZa682oaBU37ao/NGGX4ZDg== +"@typescript-eslint/parser@^6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.3.tgz#aaf40092a32877439e5957e18f2d6a91c82cc2fd" + integrity sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ== dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" + "@typescript-eslint/scope-manager" "6.7.3" + "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/typescript-estree" "6.7.3" + "@typescript-eslint/visitor-keys" "6.7.3" + debug "^4.3.4" -"@typescript-eslint/scope-manager@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" - integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== +"@typescript-eslint/scope-manager@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz#07e5709c9bdae3eaf216947433ef97b3b8b7d755" + integrity sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ== dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" + "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/visitor-keys" "6.7.3" -"@typescript-eslint/type-utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" - integrity sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew== +"@typescript-eslint/type-utils@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz#c2c165c135dda68a5e70074ade183f5ad68f3400" + integrity sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw== dependencies: - "@typescript-eslint/typescript-estree" "5.62.0" - "@typescript-eslint/utils" "5.62.0" + "@typescript-eslint/typescript-estree" "6.7.3" + "@typescript-eslint/utils" "6.7.3" debug "^4.3.4" - tsutils "^3.21.0" + ts-api-utils "^1.0.1" -"@typescript-eslint/types@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.1.tgz#dca9bd4cb8c067fc85304a31f38ec4766ba2d1ea" - integrity sha512-ZvxQ2QMy49bIIBpTqFiOenucqUyjTQ0WNLhBM6X1fh1NNlYAC6Kxsx8bRTY3jdYsYg44a0Z/uEgQkohbR0H87Q== +"@typescript-eslint/types@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.3.tgz#0402b5628a63f24f2dc9d4a678e9a92cc50ea3e9" + integrity sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw== -"@typescript-eslint/types@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" - integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== - -"@typescript-eslint/typescript-estree@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" - integrity sha512-PwIGnH7jIueXv4opcwEbVGDATjGPO1dx9RkUl5LlHDSe+FXxPwFL5W/qYd5/NHr7f6lo/vvTrAzd0KlQtRusJQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" - -"@typescript-eslint/typescript-estree@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" - integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== +"@typescript-eslint/typescript-estree@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz#ec5bb7ab4d3566818abaf0e4a8fa1958561b7279" + integrity sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g== dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" + "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/visitor-keys" "6.7.3" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" - integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" - eslint-scope "^5.1.1" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.1.tgz#29102de692f59d7d34ecc457ed59ab5fc558010b" - integrity sha512-NjQ0Xinhy9IL979tpoTRuLKxMc0zJC7QVSdeerXs2/QvOy2yRkzX5dRb10X5woNUdJgU8G3nYRDlI33sq1K4YQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - eslint-visitor-keys "^3.0.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.3.tgz#96c655816c373135b07282d67407cb577f62e143" + integrity sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.7.3" + "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/typescript-estree" "6.7.3" + semver "^7.5.4" -"@typescript-eslint/visitor-keys@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" - integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== +"@typescript-eslint/visitor-keys@6.7.3": + version "6.7.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz#83809631ca12909bd2083558d2f93f5747deebb2" + integrity sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg== dependencies: - "@typescript-eslint/types" "5.62.0" - eslint-visitor-keys "^3.3.0" + "@typescript-eslint/types" "6.7.3" + eslint-visitor-keys "^3.4.1" "@yarnpkg/lockfile@^1.1.0": version "1.1.0" @@ -5036,14 +5008,6 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" -eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - eslint-scope@^7.2.2: version "7.2.2" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" @@ -5052,20 +5016,20 @@ eslint-scope@^7.2.2: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.49.0: - version "8.49.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.49.0.tgz#09d80a89bdb4edee2efcf6964623af1054bf6d42" - integrity sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ== +eslint@^8.50.0: + version "8.50.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" + integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "8.49.0" + "@eslint/js" "8.50.0" "@humanwhocodes/config-array" "^0.11.11" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -5138,11 +5102,6 @@ estraverse@^1.9.1: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q= -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" @@ -6445,7 +6404,7 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.0, globby@^11.0.1, globby@^11.0.4, globby@^11.1.0: +globby@^11.0.0, globby@^11.0.1, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -8515,11 +8474,6 @@ napi-macros@~2.0.0: resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== -natural-compare-lite@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" - integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -9928,7 +9882,7 @@ semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: +semver@^7.3.2, semver@^7.3.4, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== @@ -10816,6 +10770,11 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= +ts-api-utils@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" + integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + ts-command-line-args@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.2.1.tgz#fd6913e542099012c0ffb2496126a8f38305c7d6" @@ -10893,7 +10852,7 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -tslib@^1.11.1, tslib@^1.8.1, tslib@^1.9.3: +tslib@^1.11.1, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -10913,13 +10872,6 @@ tsort@0.0.1: resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786" integrity sha1-4igPXoF/i/QnVlf9D5rr1E9aJ4Y= -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -11084,10 +11036,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@5.1.6: - version "5.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" - integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== +typescript@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== typewise-core@^1.2, typewise-core@^1.2.0: version "1.2.0" From 79e8497dcf4139bbcfd3cf3bf1418e1104392d6d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 27 Sep 2023 17:26:43 +0300 Subject: [PATCH 15/83] Remove shadowing --- .eslintrc.cjs | 6 ++---- migrations/deploy.ts | 2 +- test/NodeRotation.ts | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9db0d269..429c632e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -15,7 +15,7 @@ module.exports = { "plugins": ["@typescript-eslint"], "root": true, "rules": { - // "@typescript-eslint/no-shadow": "error", + "@typescript-eslint/no-shadow": "error", "lines-around-comment": [ "error", {"allowBlockStart": true} @@ -32,8 +32,6 @@ module.exports = { "padded-blocks": [ "error", "never" - ], - - "@typescript-eslint/no-shadow": "warn" + ] } }; diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 959db11a..dd2692b9 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -98,7 +98,7 @@ async function main() { contractArtifacts.push({address: contractManager.address, interface: contractManager.interface, contract: contractManagerName}) await verifyProxy(contractManagerName, contractManager.address, []); - for (const contract of contracts.filter(contract => contract != "ContractManager")) { + for (const contract of contracts.filter(contractName => contractName != "ContractManager")) { const contractFactory = await getContractFactory(contract); console.log("Deploy", contract); const proxy = await upgrades.deployProxy(contractFactory, getInitializerParameters(contract, contractManager.address), {unsafeAllowLinkedLibraries: true}); diff --git a/test/NodeRotation.ts b/test/NodeRotation.ts index 3fe4993e..b7b597f7 100644 --- a/test/NodeRotation.ts +++ b/test/NodeRotation.ts @@ -126,7 +126,7 @@ describe("NodeRotation", () => { await wallets.connect(owner).rechargeSchainWallet(schainHash, {value: ethers.utils.parseEther("1")}); chainNodes = (await schainsInternal.getNodesInGroup(schainHash)).map(id => { - const node = registeredNodes.find(node => node.id == id.toNumber()) + const node = registeredNodes.find(registeredNode => registeredNode.id == id.toNumber()) if (node === undefined) { throw new Error(`Can't find a node with id ${id.toString()}`) } @@ -149,9 +149,9 @@ describe("NodeRotation", () => { await skaleManager.nodeExit(exitingNode.id); const newChainNodesIds = (await schainsInternal.getNodesInGroup(schainHash)).map(id => id.toNumber()); - const enteringNodeId = newChainNodesIds.filter(id => chainNodes.find(node => node.id == id) === undefined)[0]; + const enteringNodeId = newChainNodesIds.filter(id => chainNodes.find(chainNode => chainNode.id == id) === undefined)[0]; - node = registeredNodes.find(node => node.id == enteringNodeId); + node = registeredNodes.find(registeredNode => registeredNode.id == enteringNodeId); if (node === undefined) { throw Error("Can't determine entering node"); } @@ -164,13 +164,13 @@ describe("NodeRotation", () => { let failingNode: RegisteredNode; fastBeforeEach(async () => { - let node = _.sample(chainNodes.filter(node => node !== exitingNode)) + let node = _.sample(chainNodes.filter(chainNode => chainNode !== exitingNode)) if (node === undefined) { throw new Error("Can't pick a node"); } failingNode = node; - node = _.sample(chainNodes.filter(node => ![exitingNode, failingNode].includes(node))); + node = _.sample(chainNodes.filter(chainNode => ![exitingNode, failingNode].includes(chainNode))); if (node === undefined) { throw new Error("Can't pick a node"); } From 047b2206fe7aaa8b20e516b93470d6690dae76cb Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 29 Sep 2023 17:11:12 +0300 Subject: [PATCH 16/83] Verify contracts after deployment --- migrations/deploy.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index dd2692b9..7517c87f 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -96,7 +96,6 @@ async function main() { console.log("Register", contractManagerName); await (await contractManager.setContractsAddress(contractManagerName, contractManager.address)).wait(); contractArtifacts.push({address: contractManager.address, interface: contractManager.interface, contract: contractManagerName}) - await verifyProxy(contractManagerName, contractManager.address, []); for (const contract of contracts.filter(contractName => contractName != "ContractManager")) { const contractFactory = await getContractFactory(contract); @@ -108,7 +107,6 @@ async function main() { const transaction = await contractManager.setContractsAddress(contractName, proxy.address); await transaction.wait(); contractArtifacts.push({address: proxy.address, interface: proxy.interface, contract}); - await verifyProxy(contract, proxy.address, []); if (contract === "SkaleManager") { try { @@ -128,7 +126,6 @@ async function main() { console.log("Register", skaleTokenName); await (await contractManager.setContractsAddress(skaleTokenName, skaleToken.address)).wait(); contractArtifacts.push({address: skaleToken.address, interface: skaleToken.interface, contract: skaleTokenName}); - await verify(skaleTokenName, skaleToken.address, [contractManager.address, []]); if (!production) { console.log("Do actions for non production deployment"); @@ -158,6 +155,14 @@ async function main() { await fs.writeFile(`data/skale-manager-${version}-${network.name}-abi.json`, JSON.stringify(outputObject, null, 4)); + console.log("Verify contracts"); + for (const artifact of contractArtifacts) { + if (artifact.contract === skaleTokenName) { + await verify(skaleTokenName, skaleToken.address, [contractManager.address, []]); + } else { + await verifyProxy(artifact.contract, artifact.address, []) + } + } console.log("Done"); } From e4e4e9f381844e8600a6b6d65cb90124e7e2c435 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 2 Oct 2023 19:50:57 +0300 Subject: [PATCH 17/83] Retry the deployment transaction if it fails --- migrations/deploy.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 7517c87f..7b9953d3 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -9,6 +9,8 @@ import { verifyProxy, getContractFactory, } from '@skalenetwork/upgrade-tools'; +import {Contract} from 'ethers'; +import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; function getInitializerParameters(contract: string, contractManagerAddress: string) { @@ -100,8 +102,30 @@ async function main() { for (const contract of contracts.filter(contractName => contractName != "ContractManager")) { const contractFactory = await getContractFactory(contract); console.log("Deploy", contract); - const proxy = await upgrades.deployProxy(contractFactory, getInitializerParameters(contract, contractManager.address), {unsafeAllowLinkedLibraries: true}); - await proxy.deployTransaction.wait(); + let attempts = 5; + let proxy: Contract | undefined = undefined; + while (attempts --> 0 && typeof proxy === "undefined") { + try { + proxy = await upgrades.deployProxy( + contractFactory, + getInitializerParameters(contract, contractManager.address), + { + unsafeAllowLinkedLibraries: true + } + ); + await proxy.deployTransaction.wait(); + } catch (e) { + if (e instanceof TransactionMinedTimeout) { + console.log(e); + console.log("Retrying"); + } else { + throw e; + } + } + } + if (!proxy) { + throw new Error(`Error during deployment of ${contract}`); + } const contractName = getNameInContractManager(contract); console.log("Register", contract, "as", contractName, "=>", proxy.address); const transaction = await contractManager.setContractsAddress(contractName, proxy.address); From eae18fece17aa5faee472cbbb1a8c67310d40156 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 13 Oct 2023 19:09:24 +0300 Subject: [PATCH 18/83] Fix issue with TimeHelpersWithDebug --- migrations/upgrade.ts | 37 +++++++++++++++++++++++++++++++++++-- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 836217ad..7a427ab8 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -4,6 +4,7 @@ import {ethers} from "hardhat"; import {Upgrader, AutoSubmitter} from "@skalenetwork/upgrade-tools"; import {skaleContracts, Instance} from "@skalenetwork/skale-contracts-ethers-v5"; import {SkaleManager} from "../typechain-types"; +import {Manifest, getImplementationAddress} from "@openzeppelin/upgrades-core"; async function getSkaleManagerInstance() { if (process.env.ABI) { @@ -62,11 +63,43 @@ class SkaleManagerUpgrader extends Upgrader { // initialize = async () => { }; } +async function timeHelpersWithDebugIsUsed(timeHelpersAddress: string) { + const implementationAddress = await getImplementationAddress(ethers.provider, timeHelpersAddress) + const manifest = await Manifest.forNetwork(ethers.provider); + const deployment = await manifest.getDeploymentFromAddress(implementationAddress); + const storageLayout = deployment.layout.storage; + return storageLayout.find(storageItem => storageItem.label === "_timeShift") !== undefined; +} + +async function prepareContractsList(instance: Instance) { + // If skale-manager is deployed not in production mode + // the smart contract TimeHelpers is replaced + // with the TimeHelpersWithDebug. + // TimeHelpersWithDebug is registered as TimeHelpers + // in the ContractManager. + // It causes an error in upgrade-tools v3 and higher + // because it uses a factory from TimeHelpers + // and address of TimeHelpersWithDebug + + // This function determines if TimeHelpersWithDebug is used + // and replaces TimeHelpers with TimeHelpersWithDebug + // in a list of smart contracts to upgrade if needed + + if (await timeHelpersWithDebugIsUsed(await instance.getContractAddress("TimeHelpers"))) { + const contractsWithDebug = contracts. + filter((contract) => contract !== "TimeHelpers"); + contractsWithDebug.push("TimeHelpersWithDebug"); + return contractsWithDebug; + } + return contracts; +} + async function main() { + const skaleManager = await getSkaleManagerInstance(); const upgrader = new SkaleManagerUpgrader( "1.9.3", - await getSkaleManagerInstance(), - contracts, + skaleManager, + await prepareContractsList(skaleManager) ); await upgrader.upgrade(); } diff --git a/package.json b/package.json index 819d982c..018a349f 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.3", "@openzeppelin/hardhat-upgrades": "^1.14.0", "@skalenetwork/skale-manager-interfaces": "2.0.0-develop.1", - "@skalenetwork/upgrade-tools": "^3.0.0-linter.33", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.34", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 7a246cf4..e90ef510 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1830,18 +1830,18 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@skalenetwork/skale-contracts-ethers-v5@0.1.0-develop.0": - version "0.1.0-develop.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts-ethers-v5/-/skale-contracts-ethers-v5-0.1.0-develop.0.tgz#fd1ab452c7851cdfc089c49d19a744a5f735dbd8" - integrity sha512-ckKbW4J1rFOfGGFaKtapbFvSJQQrEaamLnjbGOvjLNTqWOH7Vr/marqoHWANARvZUGpPUt5EzswzLpSfbNCF8A== +"@skalenetwork/skale-contracts-ethers-v5@^1.0.1-develop.0": + version "1.0.1-develop.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts-ethers-v5/-/skale-contracts-ethers-v5-1.0.1-develop.0.tgz#868ad040b20033a06270d75491d26f486c709d04" + integrity sha512-A0R7LjX2vsCqQ6u/4ujZetAA5EY7Czq3vKv8NIhoDjpwn6LKZrI6dwywmsgw3DZUNE+31md1TiQEIjiHWscibA== dependencies: - "@skalenetwork/skale-contracts" "0.1.0-develop.0" + "@skalenetwork/skale-contracts" "1.0.1-develop.0" ethers "^5.7.2" -"@skalenetwork/skale-contracts@0.1.0-develop.0": - version "0.1.0-develop.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-0.1.0-develop.0.tgz#c683da89c327f4299435c84e22751f2477d745aa" - integrity sha512-9LEYKC7hoaehqLukoU0qrgC3zxjWAbLGDRnjbZPdmAM19xOPTO6Gq0uzCCA7GNbe5EKI9hTLyiJVv0jouppUvQ== +"@skalenetwork/skale-contracts@1.0.1-develop.0": + version "1.0.1-develop.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-1.0.1-develop.0.tgz#4407ec4667cec27889263011f89badfd35d6ebf9" + integrity sha512-2IiRdso3ik4mOi6rX5mSMaKe3zgm13bMaUeez7ykN70xNDQteTCh0wSAE75ZK0g/dE5AGlfylW5H6lWeu3VMKQ== dependencies: axios "^1.4.0" @@ -1850,15 +1850,15 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-2.0.0-develop.1.tgz#fde4e8a40878b890f7e1b50dd8513a76eb1d2d46" integrity sha512-SYm407j/RQlcTUcnIWWhPc8wK1AYxMIVhUgRSGhLblZ+4UJQuHAs2rz0aOiovvVaE5Xg2OYNwtCOd1gLW3wCDw== -"@skalenetwork/upgrade-tools@^3.0.0-linter.33": - version "3.0.0-linter.33" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.33.tgz#b1a35905815b2b0b379c3baf1c55a226c0903354" - integrity sha512-UBQDyZTuNkTu/g4YFIbSyIjY9cBosAwZSmWAV7CoW8Cd7Qr3dTFEy9WynvPfLgp7RFviGGRa2RqoTYXqlIY4GA== +"@skalenetwork/upgrade-tools@^3.0.0-linter.34": + version "3.0.0-linter.34" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.34.tgz#536ace4e8bff587edefe0c5faf1a858a1e4f4bac" + integrity sha512-/5F1nUGTYOJ0rBJ6QNnXttFdgZru2761G9FyNO3UMc2y4WqM4/ShpSTz4P2GcpnblwKW7GWBRV0vWTeI9pmeaQ== dependencies: "@safe-global/api-kit" "^1.3.0" "@safe-global/protocol-kit" "^1.2.0" "@safe-global/safe-core-sdk-types" "^2.2.0" - "@skalenetwork/skale-contracts-ethers-v5" "0.1.0-develop.0" + "@skalenetwork/skale-contracts-ethers-v5" "^1.0.1-develop.0" axios "^1.4.0" ethereumjs-util "^7.1.4" From ca6e007d2057705166041ac196484d3fed5c2d21 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 19 Jun 2024 16:00:36 +0300 Subject: [PATCH 19/83] Fix deployment --- package.json | 1 + yarn.lock | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/package.json b/package.json index 6bd4781f..6067cf54 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ }, "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "<2.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.8", "@nomiclabs/hardhat-etherscan": "^3.1.8", "@typechain/ethers-v5": "^11.1.1", "@types/chai": "^4.3.6", diff --git a/yarn.lock b/yarn.lock index 168f4b55..b57a5416 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1332,6 +1332,21 @@ deep-eql "^4.0.1" ordinal "^1.0.3" +"@nomicfoundation/hardhat-verify@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.8.tgz#6a77dc03de990a1a3aa8e6dc073c393263dbf258" + integrity sha512-x/OYya7A2Kcz+3W/J78dyDHxr0ezU23DKTrRKfy5wDPCnePqnr79vm8EXqX3gYps6IjPBYyGPZ9K6E5BnrWx5Q== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@ethersproject/address" "^5.0.2" + cbor "^8.1.0" + chalk "^2.4.2" + debug "^4.1.1" + lodash.clonedeep "^4.5.0" + semver "^6.3.0" + table "^6.8.0" + undici "^5.14.0" + "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.1": version "0.1.1" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.1.tgz#4c858096b1c17fe58a474fe81b46815f93645c15" @@ -7936,6 +7951,11 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" From 2d0d4f4f672d1110cf15f058fcd2850e82f1a105 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 19 Jun 2024 17:26:06 +0300 Subject: [PATCH 20/83] Switch to ethers v6 --- gas/createSchain.ts | 2 +- gas/nodeRotation.ts | 2 +- hardhat.config.ts | 9 +- long-test/Treetest.ts | 2 +- long-test/createSchain.ts | 2 +- package.json | 12 +- test/Bounty.ts | 2 +- test/ConstantsHolder.ts | 2 +- test/ContractManager.ts | 2 +- test/NodesData.ts | 2 +- test/NodesFunctionality.ts | 2 +- test/Pricing.ts | 2 +- test/Schains.ts | 2 +- test/SchainsInternal.ts | 2 +- test/SkaleDKG.ts | 2 +- test/SkaleDkgFakeComplaint.ts | 2 +- test/SkaleManager.ts | 2 +- test/SkaleToken.ts | 2 +- test/SkaleVerifier.ts | 2 +- test/SlashingTable.ts | 2 +- test/SyncMananager.ts | 2 +- test/Wallets.ts | 2 +- test/delegation/Delegation.ts | 2 +- test/delegation/DelegationController.ts | 2 +- test/delegation/TokenState.ts | 2 +- test/delegation/ValidatorService.ts | 2 +- yarn.lock | 1031 ++++++++++++++++------- 27 files changed, 738 insertions(+), 362 deletions(-) diff --git a/gas/createSchain.ts b/gas/createSchain.ts index 52fec6c2..35587a1c 100644 --- a/gas/createSchain.ts +++ b/gas/createSchain.ts @@ -5,7 +5,7 @@ import {ContractManager, Schains, SkaleManager, ValidatorService} from "../typec import {deploySchains} from "../test/tools/deploy/schains"; import fs from 'fs'; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {Event, Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {fastBeforeEach} from "../test/tools/mocha"; diff --git a/gas/nodeRotation.ts b/gas/nodeRotation.ts index 9c17d0a5..c7132bef 100644 --- a/gas/nodeRotation.ts +++ b/gas/nodeRotation.ts @@ -15,7 +15,7 @@ import {deploySchains} from "../test/tools/deploy/schains"; import {deploySchainsInternalMock} from "../test/tools/deploy/test/schainsInternalMock"; import {deploySkaleDKGTester} from "../test/tools/deploy/test/skaleDKGTester"; import {skipTime} from "../test/tools/time"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {ethers} from "hardhat"; import {Event, Wallet} from "ethers"; import fs from 'fs'; diff --git a/hardhat.config.ts b/hardhat.config.ts index f8cd964b..b0f4279c 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,7 +5,7 @@ import "@openzeppelin/hardhat-upgrades"; import '@typechain/hardhat' import "solidity-coverage"; import * as dotenv from "dotenv" -import {utils, Wallet} from "ethers"; +import {Wallet, parseEther} from "ethers"; import {HardhatNetworkAccountUserConfig} from "hardhat/types/config"; dotenv.config(); @@ -14,7 +14,7 @@ task("erc1820", "Deploy ERC1820 contract", async (_, {ethers}) => { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { console.log("Deploy ERC1820 contract"); const [ owner,] = await ethers.getSigners(); - let transaction = await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.utils.parseEther("0.08")}); + let transaction = await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); await transaction.wait(); transaction = await ethers.provider.sendTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); await transaction.wait(); @@ -32,7 +32,7 @@ task("accounts", "Prints the list of accounts", async (_, {ethers}) => { function getAccounts() { const accounts: HardhatNetworkAccountUserConfig[] = []; - const defaultBalance = utils.parseEther("2000000").toString(); + const defaultBalance = parseEther("2000000").toString(); const n = 10; for (let i = 0; i < n; ++i) { @@ -105,7 +105,8 @@ const config: HardhatUserConfig = { externalArtifacts: [ 'node_modules/@openzeppelin/upgrades-core/artifacts/AdminUpgradeabilityProxy.json', 'node_modules/@openzeppelin/upgrades-core/artifacts/ProxyAdmin.json' - ] + ], + target: "ethers-v6" } }; diff --git a/long-test/Treetest.ts b/long-test/Treetest.ts index a5068435..16b9058a 100644 --- a/long-test/Treetest.ts +++ b/long-test/Treetest.ts @@ -19,7 +19,7 @@ import {deploySkaleDKGTester} from "../test/tools/deploy/test/skaleDKGTester"; import {deployNodes} from "../test/tools/deploy/nodes"; import {deployWallets} from "../test/tools/deploy/wallets"; import {skipTime} from "../test/tools/time"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {ethers} from "hardhat"; import {BigNumberish, BytesLike, Signer, Wallet} from "ethers"; import {assert} from "chai"; diff --git a/long-test/createSchain.ts b/long-test/createSchain.ts index 99f03f19..6db7f82c 100644 --- a/long-test/createSchain.ts +++ b/long-test/createSchain.ts @@ -6,7 +6,7 @@ import {ContractManager, Schains, SkaleManager, ValidatorService, SchainsInterna import {privateKeys} from "../test/tools/private-keys"; import {deploySchains} from "../test/tools/deploy/schains"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {Event, Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {SchainType} from "../test/tools/types"; diff --git a/package.json b/package.json index 6067cf54..aa8c02c9 100644 --- a/package.json +++ b/package.json @@ -40,23 +40,23 @@ "cspell": "npx cspell \"**/*\"" }, "dependencies": { - "@nomiclabs/hardhat-ethers": "^2.2.3", + "@nomicfoundation/hardhat-ethers": "^3.0.0", "@openzeppelin/contracts": "^4.9.3", "@openzeppelin/contracts-upgradeable": "^4.9.6", - "@openzeppelin/hardhat-upgrades": "^1.14.0", + "@openzeppelin/hardhat-upgrades": "^2.1.0", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", "@skalenetwork/upgrade-tools": "^3.0.0-linter.34", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", - "ethers": "^5.7.2", - "hardhat": "2.11.0 - 2.16.1" + "ethers": "^6.13.1", + "hardhat": "^2.22.5" }, "devDependencies": { - "@nomicfoundation/hardhat-chai-matchers": "<2.0.0", + "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-verify": "^2.0.8", "@nomiclabs/hardhat-etherscan": "^3.1.8", - "@typechain/ethers-v5": "^11.1.1", + "@typechain/ethers-v6": "^0.5.1", "@types/chai": "^4.3.6", "@types/chai-almost": "^1.0.1", "@types/chai-as-promised": "^7.1.6", diff --git a/test/Bounty.ts b/test/Bounty.ts index 4930e9db..45a817a4 100644 --- a/test/Bounty.ts +++ b/test/Bounty.ts @@ -21,10 +21,10 @@ import {deployValidatorService} from "./tools/deploy/delegation/validatorService import {deployDelegationPeriodManager} from "./tools/deploy/delegation/delegationPeriodManager"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; import {BigNumber} from "ethers"; import {deployPunisher} from "./tools/deploy/delegation/punisher"; import {fastBeforeEach} from "./tools/mocha"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/ConstantsHolder.ts b/test/ConstantsHolder.ts index 3fd06ba6..a836a4ec 100644 --- a/test/ConstantsHolder.ts +++ b/test/ConstantsHolder.ts @@ -6,7 +6,7 @@ import chai = require("chai"); import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; import {deployContractManager} from "./tools/deploy/contractManager"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/ContractManager.ts b/test/ContractManager.ts index 9bf1d54c..90274c77 100644 --- a/test/ContractManager.ts +++ b/test/ContractManager.ts @@ -3,7 +3,7 @@ import {ConstantsHolder, import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; import {deployContractManager} from "./tools/deploy/contractManager"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import chai from "chai"; import chaiAsPromised from "chai-as-promised"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/NodesData.ts b/test/NodesData.ts index e21f556f..95240ebf 100644 --- a/test/NodesData.ts +++ b/test/NodesData.ts @@ -11,7 +11,7 @@ import {deployValidatorService} from "./tools/deploy/delegation/validatorService import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {BigNumber, Wallet} from "ethers"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert} from "chai"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {stringKeccak256} from "./tools/hashes"; diff --git a/test/NodesFunctionality.ts b/test/NodesFunctionality.ts index 4bf47513..dbc54c67 100644 --- a/test/NodesFunctionality.ts +++ b/test/NodesFunctionality.ts @@ -17,7 +17,7 @@ import {deploySkaleToken} from "./tools/deploy/skaleToken"; import {deployDelegationController} from "./tools/deploy/delegation/delegationController"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {expect} from "chai"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/Pricing.ts b/test/Pricing.ts index 5426b4bc..a17429c5 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -23,7 +23,7 @@ import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; import {deployNodeRotation} from "./tools/deploy/nodeRotation"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {stringKeccak256} from "./tools/hashes"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/Schains.ts b/test/Schains.ts index a5f9e41e..05204052 100644 --- a/test/Schains.ts +++ b/test/Schains.ts @@ -25,7 +25,7 @@ import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; import {deploySkaleManager} from "./tools/deploy/skaleManager"; import {deployNodeRotation} from "./tools/deploy/nodeRotation"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert, expect} from "chai"; import {deployWallets} from "./tools/deploy/wallets"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/SchainsInternal.ts b/test/SchainsInternal.ts index 86aafb54..766c057b 100644 --- a/test/SchainsInternal.ts +++ b/test/SchainsInternal.ts @@ -12,7 +12,7 @@ import {deploySchainsInternalMock} from "./tools/deploy/test/schainsInternalMock import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; import {skipTime} from "./tools/time"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {expect} from "chai"; import {fastBeforeEach} from "./tools/mocha"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index 45417793..0ef44c6b 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -29,7 +29,7 @@ import {deployNodeRotation} from "./tools/deploy/nodeRotation"; import {deploySkaleManager} from "./tools/deploy/skaleManager"; import {deployWallets} from "./tools/deploy/wallets"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert, expect} from "chai"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; import {BytesLike, ContractTransaction, Wallet} from "ethers"; diff --git a/test/SkaleDkgFakeComplaint.ts b/test/SkaleDkgFakeComplaint.ts index 43b167dc..e0f54588 100644 --- a/test/SkaleDkgFakeComplaint.ts +++ b/test/SkaleDkgFakeComplaint.ts @@ -29,7 +29,7 @@ import {deploySkaleDKG} from "./tools/deploy/skaleDKG"; import {deploySkaleToken} from "./tools/deploy/skaleToken"; import {deploySlashingTable} from "./tools/deploy/slashingTable"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert} from "chai"; import {deployWallets} from "./tools/deploy/wallets"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; diff --git a/test/SkaleManager.ts b/test/SkaleManager.ts index 5c244eb6..abce7c5e 100644 --- a/test/SkaleManager.ts +++ b/test/SkaleManager.ts @@ -34,7 +34,7 @@ import {deployBounty} from "./tools/deploy/bounty"; import {BigNumber, ContractTransaction, Wallet} from "ethers"; import {deployTimeHelpers} from "./tools/deploy/delegation/timeHelpers"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {deployWallets} from "./tools/deploy/wallets"; import chaiAlmost from "chai-almost"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/SkaleToken.ts b/test/SkaleToken.ts index cdeaa055..7bdaa1de 100644 --- a/test/SkaleToken.ts +++ b/test/SkaleToken.ts @@ -11,7 +11,7 @@ import {deploySkaleToken} from "./tools/deploy/skaleToken"; import {deployReentrancyTester} from "./tools/deploy/test/reentrancyTester"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {expect} from "chai"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/SkaleVerifier.ts b/test/SkaleVerifier.ts index cb6259ab..aae20487 100644 --- a/test/SkaleVerifier.ts +++ b/test/SkaleVerifier.ts @@ -22,7 +22,7 @@ import {deploySkaleManager} from "./tools/deploy/skaleManager"; import {deployKeyStorage} from "./tools/deploy/keyStorage"; import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert} from "chai"; import {deploySchainsInternal} from "./tools/deploy/schainsInternal"; import {Wallet} from "ethers"; diff --git a/test/SlashingTable.ts b/test/SlashingTable.ts index 28809836..99cb5482 100644 --- a/test/SlashingTable.ts +++ b/test/SlashingTable.ts @@ -5,7 +5,7 @@ import chaiAsPromised from "chai-as-promised"; import * as chai from "chai"; import {deploySlashingTable} from "./tools/deploy/slashingTable"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {fastBeforeEach} from "./tools/mocha"; chai.should(); diff --git a/test/SyncMananager.ts b/test/SyncMananager.ts index edded024..f5268f26 100644 --- a/test/SyncMananager.ts +++ b/test/SyncMananager.ts @@ -4,7 +4,7 @@ import chaiAsPromised from "chai-as-promised"; import * as chai from "chai"; import {deploySyncManager} from "./tools/deploy/syncManager"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {expect} from "chai"; import {fastBeforeEach} from "./tools/mocha"; diff --git a/test/Wallets.ts b/test/Wallets.ts index cc31454f..ed196d59 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -17,7 +17,7 @@ import {deploySkaleDKGTester} from "./tools/deploy/test/skaleDKGTester"; import {SchainType} from "./tools/types"; import chaiAlmost from "chai-almost"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {ContractTransaction, Wallet} from "ethers"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; diff --git a/test/delegation/Delegation.ts b/test/delegation/Delegation.ts index 3b7de5e9..71c7fe36 100644 --- a/test/delegation/Delegation.ts +++ b/test/delegation/Delegation.ts @@ -31,7 +31,7 @@ import {deploySlashingTable} from "../tools/deploy/slashingTable"; import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDebug"; import {deploySkaleManager} from "../tools/deploy/skaleManager"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; import {assert, expect} from "chai"; import {getValidatorIdSignature} from "../tools/signatures"; diff --git a/test/delegation/DelegationController.ts b/test/delegation/DelegationController.ts index 4db6fdf4..47926637 100644 --- a/test/delegation/DelegationController.ts +++ b/test/delegation/DelegationController.ts @@ -15,7 +15,7 @@ import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDe import {State} from "../tools/types"; import {deployTimeHelpers} from "../tools/deploy/delegation/timeHelpers"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; import {expect, assert} from "chai"; import {makeSnapshot, applySnapshot} from "../tools/snapshot"; diff --git a/test/delegation/TokenState.ts b/test/delegation/TokenState.ts index ed3d0256..2505b004 100644 --- a/test/delegation/TokenState.ts +++ b/test/delegation/TokenState.ts @@ -14,7 +14,7 @@ import {deploySkaleToken} from "../tools/deploy/skaleToken"; import {State} from "../tools/types"; import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); diff --git a/test/delegation/ValidatorService.ts b/test/delegation/ValidatorService.ts index d515f9eb..513cc135 100644 --- a/test/delegation/ValidatorService.ts +++ b/test/delegation/ValidatorService.ts @@ -13,7 +13,7 @@ import {deploySkaleToken} from "../tools/deploy/skaleToken"; import {deploySkaleManager} from "../tools/deploy/skaleManager"; import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert} from "chai"; import {makeSnapshot, applySnapshot} from "../tools/snapshot"; import {getValidatorIdSignature} from "../tools/signatures"; diff --git a/yarn.lock b/yarn.lock index b57a5416..1debd198 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,6 +7,11 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@aws-crypto/sha256-js@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-js/-/sha256-js-1.2.2.tgz#02acd1a1fda92896fc5a28ec7c6e164644ea32fc" @@ -61,42 +66,6 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@chainsafe/as-sha256@^0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" - integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg== - -"@chainsafe/persistent-merkle-tree@^0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff" - integrity sha512-lLO3ihKPngXLTus/L7WHKaw9PnNJWizlOF1H9NNzHP6Xvh82vzg9F2bzkXhYIFshMZ2gTCEz8tq6STe7r5NDfQ== - dependencies: - "@chainsafe/as-sha256" "^0.3.1" - -"@chainsafe/persistent-merkle-tree@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz#2b4a62c9489a5739dedd197250d8d2f5427e9f63" - integrity sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw== - dependencies: - "@chainsafe/as-sha256" "^0.3.1" - -"@chainsafe/ssz@^0.10.0": - version "0.10.2" - resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.10.2.tgz#c782929e1bb25fec66ba72e75934b31fd087579e" - integrity sha512-/NL3Lh8K+0q7A3LsiFq09YXS9fPE+ead2rr7vM2QK8PLzrNsw3uqrif9bpRX5UxgeRjM+vYi+boCM3+GM4ovXg== - dependencies: - "@chainsafe/as-sha256" "^0.3.1" - "@chainsafe/persistent-merkle-tree" "^0.5.0" - -"@chainsafe/ssz@^0.9.2": - version "0.9.4" - resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497" - integrity sha512-77Qtg2N1ayqs4Bg/wvnWfg5Bta7iy7IRh8XqXh7oNMeP2HBbBwx8m6yTpA8p0EHItWPEBkgZd5S5/LSlp3GXuQ== - dependencies: - "@chainsafe/as-sha256" "^0.3.1" - "@chainsafe/persistent-merkle-tree" "^0.4.2" - case "^1.6.3" - "@cspell/cspell-bundled-dicts@7.3.8": version "7.3.8" resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-7.3.8.tgz#2d170f0c680555ebc8cfb3cebd764496cb9707bc" @@ -885,7 +854,7 @@ dependencies: "@ethersproject/logger" "^5.5.0" -"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.1", "@ethersproject/providers@^5.7.2": +"@ethersproject/providers@5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== @@ -1146,6 +1115,13 @@ dependencies: "@noble/hashes" "1.3.1" +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + "@noble/hashes@1.2.0", "@noble/hashes@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" @@ -1156,7 +1132,7 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== -"@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": +"@noble/hashes@1.3.2", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": version "1.3.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== @@ -1187,151 +1163,102 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nomicfoundation/ethereumjs-block@5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.1.tgz#6f89664f55febbd723195b6d0974773d29ee133d" - integrity sha512-u1Yioemi6Ckj3xspygu/SfFvm8vZEO8/Yx5a1QLzi6nVU0jz3Pg2OmHKJ5w+D9Ogk1vhwRiqEBAqcb0GVhCyHw== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-trie" "6.0.1" - "@nomicfoundation/ethereumjs-tx" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - ethereum-cryptography "0.1.3" - ethers "^5.7.1" +"@nomicfoundation/edr-darwin-arm64@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.4.0.tgz#bbb43f0e01f40839b0bd38c2c443cb6910ae955f" + integrity sha512-7+rraFk9tCqvfemv9Ita5vTlSBAeO/S5aDKOgGRgYt0JEKZlrX161nDW6UfzMPxWl9GOLEDUzCEaYuNmXseUlg== -"@nomicfoundation/ethereumjs-blockchain@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.1.tgz#80e0bd3535bfeb9baa29836b6f25123dab06a726" - integrity sha512-NhzndlGg829XXbqJEYrF1VeZhAwSPgsK/OB7TVrdzft3y918hW5KNd7gIZ85sn6peDZOdjBsAXIpXZ38oBYE5A== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.1" - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-ethash" "3.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-trie" "6.0.1" - "@nomicfoundation/ethereumjs-tx" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - abstract-level "^1.0.3" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - level "^8.0.0" - lru-cache "^5.1.1" - memory-level "^1.0.0" +"@nomicfoundation/edr-darwin-x64@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.4.0.tgz#b1ffcd9142418fd8498de34a7336b3f977907c86" + integrity sha512-+Hrc0mP9L6vhICJSfyGo/2taOToy1AIzVZawO3lU8Lf7oDQXfhQ4UkZnkWAs9SVu1eUwHUGGGE0qB8644piYgg== -"@nomicfoundation/ethereumjs-common@4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.1.tgz#4702d82df35b07b5407583b54a45bf728e46a2f0" - integrity sha512-OBErlkfp54GpeiE06brBW/TTbtbuBJV5YI5Nz/aB2evTDo+KawyEzPjBlSr84z/8MFfj8wS2wxzQX1o32cev5g== - dependencies: - "@nomicfoundation/ethereumjs-util" "9.0.1" - crc-32 "^1.2.0" +"@nomicfoundation/edr-linux-arm64-gnu@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.4.0.tgz#8173d16d4f6f2b3e82ba7096d2a1ea3619d8bfa7" + integrity sha512-4HUDMchNClQrVRfVTqBeSX92hM/3khCgpZkXP52qrnJPqgbdCxosOehlQYZ65wu0b/kaaZSyvACgvCLSQ5oSzQ== -"@nomicfoundation/ethereumjs-ethash@3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.1.tgz#65ca494d53e71e8415c9a49ef48bc921c538fc41" - integrity sha512-KDjGIB5igzWOp8Ik5I6QiRH5DH+XgILlplsHR7TEuWANZA759G6krQ6o8bvj+tRUz08YygMQu/sGd9mJ1DYT8w== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - abstract-level "^1.0.3" - bigint-crypto-utils "^3.0.23" - ethereum-cryptography "0.1.3" +"@nomicfoundation/edr-linux-arm64-musl@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.4.0.tgz#b1ce293a7c3e0d9f70391e1aef1a82b83b997567" + integrity sha512-D4J935ZRL8xfnP3zIFlCI9jXInJ0loDUkCTLeCEbOf2uuDumWDghKNQlF1itUS+EHaR1pFVBbuwqq8hVK0dASg== -"@nomicfoundation/ethereumjs-evm@2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.1.tgz#f35681e203363f69ce2b3d3bf9f44d4e883ca1f1" - integrity sha512-oL8vJcnk0Bx/onl+TgQOQ1t/534GKFaEG17fZmwtPFeH8S5soiBYPCLUrvANOl4sCp9elYxIMzIiTtMtNNN8EQ== - dependencies: - "@ethersproject/providers" "^5.7.1" - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-tx" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - mcl-wasm "^0.7.1" - rustbn.js "~0.2.0" +"@nomicfoundation/edr-linux-x64-gnu@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.4.0.tgz#4c12c4e4bfd3d837f5663ad7cbf7cb6d5634ef83" + integrity sha512-6x7HPy+uN5Cb9N77e2XMmT6+QSJ+7mRbHnhkGJ8jm4cZvWuj2Io7npOaeHQ3YHK+TiQpTnlbkjoOIpEwpY3XZA== -"@nomicfoundation/ethereumjs-rlp@5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.1.tgz#0b30c1cf77d125d390408e391c4bb5291ef43c28" - integrity sha512-xtxrMGa8kP4zF5ApBQBtjlSbN5E2HI8m8FYgVSYAnO6ssUoY5pVPGy2H8+xdf/bmMa22Ce8nWMH3aEW8CcqMeQ== +"@nomicfoundation/edr-linux-x64-musl@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.4.0.tgz#8842004aa1a47c504f10863687da28b65dca7baa" + integrity sha512-3HFIJSXgyubOiaN4MWGXx2xhTnhwlJk0PiSYNf9+L/fjBtcRkb2nM910ZJHTvqCb6OT98cUnaKuAYdXIW2amgw== -"@nomicfoundation/ethereumjs-statemanager@2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.1.tgz#8824a97938db4471911e2d2f140f79195def5935" - integrity sha512-B5ApMOnlruVOR7gisBaYwFX+L/AP7i/2oAahatssjPIBVDF6wTX1K7Qpa39E/nzsH8iYuL3krkYeUFIdO3EMUQ== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - ethers "^5.7.1" - js-sdsl "^4.1.4" +"@nomicfoundation/edr-win32-x64-msvc@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.4.0.tgz#29d8bbb2edf9912a95f5453855cf17cdcb269957" + integrity sha512-CP4GsllEfXEz+lidcGYxKe5rDJ60TM5/blB5z/04ELVvw6/CK9eLcYeku7HV0jvV7VE6dADYKSdQyUkvd0El+A== -"@nomicfoundation/ethereumjs-trie@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.1.tgz#662c55f6b50659fd4b22ea9f806a7401cafb7717" - integrity sha512-A64It/IMpDVODzCgxDgAAla8jNjNtsoQZIzZUfIV5AY6Coi4nvn7+VReBn5itlxMiL2yaTlQr9TRWp3CSI6VoA== +"@nomicfoundation/edr@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.4.0.tgz#4895ecb6ef321136db837458949c37cce4a29459" + integrity sha512-T96DMSogO8TCdbKKctvxfsDljbhFOUKWc9fHJhSeUh71EEho2qR4951LKQF7t7UWEzguVYh/idQr5L/E3QeaMw== + dependencies: + "@nomicfoundation/edr-darwin-arm64" "0.4.0" + "@nomicfoundation/edr-darwin-x64" "0.4.0" + "@nomicfoundation/edr-linux-arm64-gnu" "0.4.0" + "@nomicfoundation/edr-linux-arm64-musl" "0.4.0" + "@nomicfoundation/edr-linux-x64-gnu" "0.4.0" + "@nomicfoundation/edr-linux-x64-musl" "0.4.0" + "@nomicfoundation/edr-win32-x64-msvc" "0.4.0" + +"@nomicfoundation/ethereumjs-common@4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb" + integrity sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg== dependencies: - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - "@types/readable-stream" "^2.3.13" - ethereum-cryptography "0.1.3" - readable-stream "^3.6.0" + "@nomicfoundation/ethereumjs-util" "9.0.4" -"@nomicfoundation/ethereumjs-tx@5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.1.tgz#7629dc2036b4a33c34e9f0a592b43227ef4f0c7d" - integrity sha512-0HwxUF2u2hrsIM1fsasjXvlbDOq1ZHFV2dd1yGq8CA+MEYhaxZr8OTScpVkkxqMwBcc5y83FyPl0J9MZn3kY0w== - dependencies: - "@chainsafe/ssz" "^0.9.2" - "@ethersproject/providers" "^5.7.2" - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - ethereum-cryptography "0.1.3" +"@nomicfoundation/ethereumjs-rlp@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz#66c95256fc3c909f6fb18f6a586475fc9762fa30" + integrity sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw== -"@nomicfoundation/ethereumjs-util@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.1.tgz#530cda8bae33f8b5020a8f199ed1d0a2ce48ec89" - integrity sha512-TwbhOWQ8QoSCFhV/DDfSmyfFIHjPjFBj957219+V3jTZYZ2rf9PmDtNOeZWAE3p3vlp8xb02XGpd0v6nTUPbsA== +"@nomicfoundation/ethereumjs-tx@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz#b0ceb58c98cc34367d40a30d255d6315b2f456da" + integrity sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw== dependencies: - "@chainsafe/ssz" "^0.10.0" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-rlp" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-vm@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.1.tgz#7d035e0993bcad10716c8b36e61dfb87fa3ca05f" - integrity sha512-rArhyn0jPsS/D+ApFsz3yVJMQ29+pVzNZ0VJgkzAZ+7FqXSRtThl1C1prhmlVr3YNUlfpZ69Ak+RUT4g7VoOuQ== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.1" - "@nomicfoundation/ethereumjs-blockchain" "7.0.1" - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-evm" "2.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-statemanager" "2.0.1" - "@nomicfoundation/ethereumjs-trie" "6.0.1" - "@nomicfoundation/ethereumjs-tx" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - debug "^4.3.3" +"@nomicfoundation/ethereumjs-util@9.0.4": + version "9.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.4.tgz#84c5274e82018b154244c877b76bc049a4ed7b38" + integrity sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q== + dependencies: + "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" - mcl-wasm "^0.7.1" - rustbn.js "~0.2.0" -"@nomicfoundation/hardhat-chai-matchers@<2.0.0": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-1.0.6.tgz#72a2e312e1504ee5dd73fe302932736432ba96bc" - integrity sha512-f5ZMNmabZeZegEfuxn/0kW+mm7+yV7VNDxLpMOMGXWFJ2l/Ct3QShujzDRF9cOkK9Ui/hbDeOWGZqyQALDXVCQ== +"@nomicfoundation/hardhat-chai-matchers@^2.0.0": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.7.tgz#89d90b2d77a00f6fd8fe42eabe40a82b5e065075" + integrity sha512-RQfsiTwdf0SP+DtuNYvm4921X6VirCQq0Xyh+mnuGlTwEFSPZ/o27oQC+l+3Y/l48DDU7+ZcYBR+Fp+Rp94LfQ== dependencies: - "@ethersproject/abi" "^5.1.2" "@types/chai-as-promised" "^7.1.3" chai-as-promised "^7.1.1" deep-eql "^4.0.1" ordinal "^1.0.3" +"@nomicfoundation/hardhat-ethers@^3.0.0": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.6.tgz#e8ba7f9719de360c03501b85dae4999bb3a7e1c5" + integrity sha512-/xzkFQAaHQhmIAYOQmvHBPwL+NkwLzT9gRZBsgWUYeV+E6pzXsBQsHfRYbAZ3XEYare+T7S+5Tg/1KDJgepSkA== + dependencies: + debug "^4.1.1" + lodash.isequal "^4.5.0" + "@nomicfoundation/hardhat-verify@^2.0.8": version "2.0.8" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.8.tgz#6a77dc03de990a1a3aa8e6dc073c393263dbf258" @@ -1413,11 +1340,6 @@ "@nomicfoundation/solidity-analyzer-win32-ia32-msvc" "0.1.1" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.1" -"@nomiclabs/hardhat-ethers@^2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0" - integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg== - "@nomiclabs/hardhat-etherscan@^3.1.8": version "3.1.8" resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.8.tgz#3c12ee90b3733e0775e05111146ef9418d4f5a38" @@ -1552,10 +1474,21 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.3.tgz#00d7a8cf35a475b160b3f0293a6403c511099364" integrity sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg== -"@openzeppelin/defender-base-client@^1.46.0": - version "1.47.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/defender-base-client/-/defender-base-client-1.47.0.tgz#f9d47f4cf0a75b4e4e5139dec780a3f26f5e2019" - integrity sha512-y9dDm+gX0MHHEn17W7f7oO3X083JAVMk3YcuXHavSE7kjiCLoFOaZ23joYqoHeaccL10nGt7KOOzZ0sh9iJHTQ== +"@openzeppelin/defender-admin-client@^1.52.0": + version "1.54.6" + resolved "https://registry.yarnpkg.com/@openzeppelin/defender-admin-client/-/defender-admin-client-1.54.6.tgz#935374ff54f087048c127e4852f8aefe5b2ac894" + integrity sha512-P4lxJDySrekWNuPa7FeyW/UmuxnuIXIAGYr5gZnmnMHRsYNaw+XfgkiCDfoGtjEyJbXYxXttYF6iAZhWQPdf1g== + dependencies: + "@openzeppelin/defender-base-client" "1.54.6" + axios "^1.4.0" + ethers "^5.7.2" + lodash "^4.17.19" + node-fetch "^2.6.0" + +"@openzeppelin/defender-base-client@1.54.6", "@openzeppelin/defender-base-client@^1.52.0": + version "1.54.6" + resolved "https://registry.yarnpkg.com/@openzeppelin/defender-base-client/-/defender-base-client-1.54.6.tgz#b65a90dba49375ac1439d638832382344067a0b9" + integrity sha512-PTef+rMxkM5VQ7sLwLKSjp2DBakYQd661ZJiSRywx+q/nIpm3B/HYGcz5wPZCA5O/QcEP6TatXXDoeMwimbcnw== dependencies: amazon-cognito-identity-js "^6.0.1" async-retry "^1.3.3" @@ -1563,42 +1496,52 @@ lodash "^4.17.19" node-fetch "^2.6.0" -"@openzeppelin/hardhat-upgrades@^1.14.0": - version "1.28.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-1.28.0.tgz#6361f313a8a879d8a08a5e395acf0933bc190950" - integrity sha512-7sb/Jf+X+uIufOBnmHR0FJVWuxEs2lpxjJnLNN6eCJCP8nD0v+Ot5lTOW2Qb/GFnh+fLvJtEkhkowz4ZQ57+zQ== +"@openzeppelin/defender-sdk-base-client@^1.13.4", "@openzeppelin/defender-sdk-base-client@^1.8.0": + version "1.13.4" + resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.13.4.tgz#51b25d46bb766e7a107b9a87ca623fae3ad5a8c3" + integrity sha512-fZjDxdL5WBt6kjKN8j6WlfIsggZKv37W1KoRkT0XwYv7Jslmr22i2qUs8ZreAzATD3ESYQs7YlO7ge0ElqdOKg== + dependencies: + amazon-cognito-identity-js "^6.3.6" + async-retry "^1.3.3" + +"@openzeppelin/defender-sdk-deploy-client@^1.8.0": + version "1.13.4" + resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-1.13.4.tgz#f5f6997774d7ea8c5ea9be5d4b0ead041270f671" + integrity sha512-1SbdImpjCYmjpDgK7Bff4vak29r/aECabVuQi5TB+7TdbOuRdVxDHu7vFhEpt3yrcPKW1joaNiUNDEc/noUsNQ== dependencies: - "@openzeppelin/defender-base-client" "^1.46.0" - "@openzeppelin/platform-deploy-client" "^0.8.0" - "@openzeppelin/upgrades-core" "^1.27.0" + "@openzeppelin/defender-sdk-base-client" "^1.13.4" + axios "^1.6.8" + lodash "^4.17.21" + +"@openzeppelin/hardhat-upgrades@^2.1.0": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-2.5.1.tgz#cc7db363807751a02ea1b1fa2f25d34c03384234" + integrity sha512-wRwq9f2PqlfIdNGFApsqRpqptqy98exSFp8SESb6Brgw4L07sExySInNJhscM/tWVSnR1Qnuws9Ck6Fs5zIxvg== + dependencies: + "@openzeppelin/defender-admin-client" "^1.52.0" + "@openzeppelin/defender-base-client" "^1.52.0" + "@openzeppelin/defender-sdk-base-client" "^1.8.0" + "@openzeppelin/defender-sdk-deploy-client" "^1.8.0" + "@openzeppelin/upgrades-core" "^1.31.2" chalk "^4.1.0" debug "^4.1.1" + ethereumjs-util "^7.1.5" proper-lockfile "^4.1.1" + undici "^5.14.0" -"@openzeppelin/platform-deploy-client@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/platform-deploy-client/-/platform-deploy-client-0.8.0.tgz#af6596275a19c283d6145f0128cc1247d18223c1" - integrity sha512-POx3AsnKwKSV/ZLOU/gheksj0Lq7Is1q2F3pKmcFjGZiibf+4kjGxr4eSMrT+2qgKYZQH1ZLQZ+SkbguD8fTvA== - dependencies: - "@ethersproject/abi" "^5.6.3" - "@openzeppelin/defender-base-client" "^1.46.0" - axios "^0.21.2" - lodash "^4.17.19" - node-fetch "^2.6.0" - -"@openzeppelin/upgrades-core@^1.27.0": - version "1.27.3" - resolved "https://registry.yarnpkg.com/@openzeppelin/upgrades-core/-/upgrades-core-1.27.3.tgz#d5578e3a3ccd18a61fc585945be67951480238b5" - integrity sha512-IqlSMUkno1XKF4L46aUqZ4BqHxj4dF0BRGrFcKeG2Q0vrsKoazhY67JG9bO+wMYG4zxl6jgmG0bd5ef9HLcLmw== +"@openzeppelin/upgrades-core@^1.31.2": + version "1.34.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/upgrades-core/-/upgrades-core-1.34.1.tgz#660301692e706c7e701395467267128cc43c1de9" + integrity sha512-LV3hHm60htmP3HJjn2VoGqXNPn1RLFSSInRyXNbm15Z2oWKGxOfAWSC4+okRckum0yVB5g3k4/SEyqjsJRB07A== dependencies: - cbor "^8.0.0" + cbor "^9.0.0" chalk "^4.1.0" compare-versions "^6.0.0" debug "^4.1.1" ethereumjs-util "^7.0.3" minimist "^1.2.7" proper-lockfile "^4.1.1" - solidity-ast "^0.4.15" + solidity-ast "^0.4.51" "@resolver-engine/core@^0.3.3": version "0.3.3" @@ -1908,14 +1851,6 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== -"@typechain/ethers-v5@^11.1.1": - version "11.1.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-11.1.1.tgz#23a358135a302140cf89a186592464dd6bbf1f98" - integrity sha512-D9WyUrCJ4Z5Gg8T00HWLpuqn1CqSDXlCiUOOpLaWoCbnZrE2jSIOUwR9blBZNo6LE5058e3niVu6xk205Et7tg== - dependencies: - lodash "^4.17.15" - ts-essentials "^7.0.1" - "@typechain/ethers-v5@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz#cd3ca1590240d587ca301f4c029b67bfccd08810" @@ -1923,6 +1858,14 @@ dependencies: ethers "^5.0.2" +"@typechain/ethers-v6@^0.5.1": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz#42fe214a19a8b687086c93189b301e2b878797ea" + integrity sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA== + dependencies: + lodash "^4.17.15" + ts-essentials "^7.0.1" + "@typechain/hardhat@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-7.0.0.tgz#ffa7465328150e793007fee616ae7b76ed20784d" @@ -2061,6 +2004,11 @@ dependencies: undici-types "~5.25.1" +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@^12.12.6": version "12.20.42" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.42.tgz#2f021733232c2130c26f9eabbdd3bfd881774733" @@ -2078,14 +2026,6 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.3.tgz#a3c65525b91fca7da00ab1a3ac2b5a2a4afbffbf" integrity sha512-QzSuZMBuG5u8HqYz01qtMdg/Jfctlnvj1z/lYnIDXs/golxw0fxtRAHd9KrzjR7Yxz1qVeI00o0kiO3PmVdJ9w== -"@types/readable-stream@^2.3.13": - version "2.3.15" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae" - integrity sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ== - dependencies: - "@types/node" "*" - safe-buffer "~5.1.1" - "@types/resolve@^0.0.8": version "0.0.8" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" @@ -2236,19 +2176,12 @@ abbrev@1.0.x: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" integrity sha1-kbR5JYinc4wl813W9jdSovh3YTU= -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - abortcontroller-polyfill@^1.7.5: version "1.7.5" resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== -abstract-level@1.0.3, abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: +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== @@ -2339,6 +2272,11 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + aes-js@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" @@ -2390,11 +2328,29 @@ amazon-cognito-identity-js@^6.0.1: isomorphic-unfetch "^3.0.0" js-cookie "^2.2.1" +amazon-cognito-identity-js@^6.3.6: + version "6.3.12" + resolved "https://registry.yarnpkg.com/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.12.tgz#af73df033094ad4c679c19cf6122b90058021619" + integrity sha512-s7NKDZgx336cp+oDeUtB2ZzT8jWJp/v2LWuYl+LQtMEODe22RF1IJ4nRiDATp+rp1pTffCZcm44Quw4jx2bqNg== + dependencies: + "@aws-crypto/sha256-js" "1.2.2" + buffer "4.9.2" + fast-base64-decode "^1.0.0" + isomorphic-unfetch "^3.0.0" + js-cookie "^2.2.1" + amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= +ansi-align@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" + integrity sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w== + dependencies: + string-width "^4.1.0" + ansi-colors@3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" @@ -2551,6 +2507,14 @@ array-buffer-byte-length@^1.0.0: call-bind "^1.0.2" is-array-buffer "^3.0.1" +array-buffer-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz#1e5583ec16763540a27ae52eed99ff899223568f" + integrity sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg== + dependencies: + call-bind "^1.0.5" + is-array-buffer "^3.0.4" + array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -2571,6 +2535,18 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.findlast@^1.2.2: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz#3e4fbcb30a15a7f5bf64cf2faae22d139c2e4904" + integrity sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + es-shim-unscopables "^1.0.2" + array.prototype.reduce@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/array.prototype.reduce/-/array.prototype.reduce-1.0.5.tgz#6b20b0daa9d9734dd6bc7ea66b5bbce395471eac" @@ -2594,6 +2570,20 @@ arraybuffer.prototype.slice@^1.0.1: is-array-buffer "^3.0.2" is-shared-array-buffer "^1.0.2" +arraybuffer.prototype.slice@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz#097972f4255e41bc3425e37dc3f6421cf9aefde6" + integrity sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A== + dependencies: + array-buffer-byte-length "^1.0.1" + call-bind "^1.0.5" + define-properties "^1.2.1" + es-abstract "^1.22.3" + es-errors "^1.2.1" + get-intrinsic "^1.2.3" + is-array-buffer "^3.0.4" + is-shared-array-buffer "^1.0.2" + asn1.js@^4.10.1: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" @@ -2708,6 +2698,13 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +available-typed-arrays@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" + integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== + dependencies: + possible-typed-array-names "^1.0.0" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -2718,13 +2715,6 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== -axios@^0.21.2: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - axios@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" @@ -2734,6 +2724,15 @@ axios@^1.4.0: form-data "^4.0.0" proxy-from-env "^1.1.0" +axios@^1.6.8: + version "1.7.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.2.tgz#b625db8a7051fbea61c35a3cbb3a1daa7b9c7621" + integrity sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -3302,11 +3301,6 @@ bech32@1.1.4: resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== -bigint-crypto-utils@^3.0.23: - version "3.3.0" - resolved "https://registry.yarnpkg.com/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz#72ad00ae91062cf07f2b1def9594006c279c1d77" - integrity sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg== - bignumber.js@^9.0.0, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" @@ -3392,6 +3386,20 @@ body-parser@^1.16.0: raw-body "2.4.2" type-is "~1.6.18" +boxen@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" + integrity sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ== + dependencies: + ansi-align "^3.0.0" + camelcase "^6.2.0" + chalk "^4.1.0" + cli-boxes "^2.2.1" + string-width "^4.2.2" + type-fest "^0.20.2" + widest-line "^3.1.0" + wrap-ansi "^7.0.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -3435,16 +3443,6 @@ brorand@^1.0.1, brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= -browser-level@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browser-level/-/browser-level-1.0.1.tgz#36e8c3183d0fe1c405239792faaab5f315871011" - integrity sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ== - dependencies: - abstract-level "^1.0.2" - catering "^2.1.1" - module-error "^1.0.2" - run-parallel-limit "^1.1.0" - browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" @@ -3691,6 +3689,17 @@ call-bind@^1.0.0, call-bind@^1.0.2, call-bind@~1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + callsites@^3.0.0, callsites@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -3706,7 +3715,7 @@ camelcase@^5.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0: +camelcase@^6.0.0, camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -3724,28 +3733,30 @@ cardinal@^2.1.1: ansicolors "~0.3.2" redeyed "~2.1.0" -case@^1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" - integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== - caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -catering@^2.0.0, catering@^2.1.0, catering@^2.1.1: +catering@^2.0.0, catering@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== -cbor@^8.0.0, cbor@^8.1.0: +cbor@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== dependencies: nofilter "^3.1.0" +cbor@^9.0.0: + version "9.0.2" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-9.0.2.tgz#536b4f2d544411e70ec2b19a2453f10f83cd9fdb" + integrity sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ== + dependencies: + nofilter "^3.1.0" + chai-almost@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/chai-almost/-/chai-almost-1.0.1.tgz#43d026cf3be79a1cd513cf15af840a81243a4b60" @@ -3900,17 +3911,6 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -classic-level@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.3.0.tgz#5e36680e01dc6b271775c093f2150844c5edd5c8" - integrity sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg== - dependencies: - abstract-level "^1.0.2" - catering "^2.1.0" - module-error "^1.0.1" - napi-macros "^2.2.2" - node-gyp-build "^4.3.0" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -3931,6 +3931,11 @@ clear-module@^4.1.2: parent-module "^2.0.0" resolve-from "^5.0.0" +cli-boxes@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" + integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== + cli-progress@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.12.0.tgz#807ee14b66bcc086258e444ad0f19e7d42577942" @@ -4452,6 +4457,33 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-view-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" + integrity sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz#90721ca95ff280677eb793749fce1011347669e2" + integrity sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + is-data-view "^1.0.1" + +data-view-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz#5e0bbfb4828ed2d1b9b400cd8a7d119bca0ff18a" + integrity sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-data-view "^1.0.1" + death@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" @@ -4471,7 +4503,7 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: +debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -4575,6 +4607,15 @@ deferred-leveldown@~4.0.0: abstract-leveldown "~5.0.0" inherits "^2.0.3" +define-data-property@^1.0.1, define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + define-properties@^1.1.2, define-properties@^1.1.4, define-properties@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5" @@ -4590,6 +4631,15 @@ define-properties@^1.1.3: dependencies: object-keys "^1.0.12" +define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== + dependencies: + define-data-property "^1.0.1" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -4927,11 +4977,82 @@ es-abstract@^1.19.1: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2: + version "1.23.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0" + integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A== + dependencies: + array-buffer-byte-length "^1.0.1" + arraybuffer.prototype.slice "^1.0.3" + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + data-view-buffer "^1.0.1" + data-view-byte-length "^1.0.1" + data-view-byte-offset "^1.0.0" + es-define-property "^1.0.0" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + es-set-tostringtag "^2.0.3" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.4" + get-symbol-description "^1.0.2" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + has-proto "^1.0.3" + has-symbols "^1.0.3" + hasown "^2.0.2" + internal-slot "^1.0.7" + is-array-buffer "^3.0.4" + is-callable "^1.2.7" + is-data-view "^1.0.1" + is-negative-zero "^2.0.3" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.3" + is-string "^1.0.7" + is-typed-array "^1.1.13" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.5" + regexp.prototype.flags "^1.5.2" + safe-array-concat "^1.1.2" + safe-regex-test "^1.0.3" + string.prototype.trim "^1.2.9" + string.prototype.trimend "^1.0.8" + string.prototype.trimstart "^1.0.8" + typed-array-buffer "^1.0.2" + typed-array-byte-length "^1.0.1" + typed-array-byte-offset "^1.0.2" + typed-array-length "^1.0.6" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.15" + es-array-method-boxes-properly@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.2.1, es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-object-atoms@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.0.0.tgz#ddb55cd47ac2e240701260bc2a8e31ecb643d941" + integrity sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw== + dependencies: + es-errors "^1.3.0" + es-set-tostringtag@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" @@ -4941,6 +5062,22 @@ es-set-tostringtag@^2.0.1: has "^1.0.3" has-tostringtag "^1.0.0" +es-set-tostringtag@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz#8bb60f0a440c2e4281962428438d58545af39777" + integrity sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ== + dependencies: + get-intrinsic "^1.2.4" + has-tostringtag "^1.0.2" + hasown "^2.0.1" + +es-shim-unscopables@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763" + integrity sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw== + dependencies: + hasown "^2.0.0" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -5554,7 +5691,7 @@ ethereumjs-wallet@0.6.5: utf8 "^3.0.0" uuid "^3.3.2" -ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.1, ethers@^5.7.2: +ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -5590,6 +5727,19 @@ ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.1, ethers@^5.7.2: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" +ethers@^6.13.1: + version "6.13.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.1.tgz#2b9f9c7455cde9d38b30fe6589972eb083652961" + integrity sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.17.1" + ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -5614,11 +5764,6 @@ event-emitter@^0.3.5: d "1" es5-ext "~0.10.14" -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - eventemitter3@4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" @@ -5980,7 +6125,7 @@ flow-stoplight@^1.0.0: resolved "https://registry.yarnpkg.com/flow-stoplight/-/flow-stoplight-1.0.0.tgz#4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b" integrity sha1-SiksW8/4s5+mzAyxqFPYbyfu/3s= -follow-redirects@^1.12.1, follow-redirects@^1.14.0, follow-redirects@^1.15.0: +follow-redirects@^1.12.1, follow-redirects@^1.15.0, follow-redirects@^1.15.6: version "1.15.6" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== @@ -6136,6 +6281,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + function.prototype.name@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" @@ -6146,6 +6296,16 @@ function.prototype.name@^1.1.5: es-abstract "^1.19.0" functions-have-names "^1.2.2" +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" + functional-red-black-tree@^1.0.1, functional-red-black-tree@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" @@ -6253,6 +6413,17 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: has-proto "^1.0.1" has-symbols "^1.0.3" +get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -6295,6 +6466,15 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +get-symbol-description@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.2.tgz#533744d5aa20aca4e079c8e5daf7fd44202821f5" + integrity sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg== + dependencies: + call-bind "^1.0.5" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -6571,31 +6751,25 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" -"hardhat@2.11.0 - 2.16.1": - version "2.16.1" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.16.1.tgz#fd2288ce44f6846a70ba332b3d8158522447262a" - integrity sha512-QpBjGXFhhSYoYBGEHyoau/A63crZOP+i3GbNxzLGkL6IklzT+piN14+wGnINNCg5BLSKisQI/RAySPzaWRcx/g== +hardhat@^2.22.5: + version "2.22.5" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.5.tgz#7e1a4311fa9e34a1cfe337784eae06706f6469a5" + integrity sha512-9Zq+HonbXCSy6/a13GY1cgHglQRfh4qkzmj1tpPlhxJDwNVnhxlReV6K7hCWFKlOrV13EQwsdcD0rjcaQKWRZw== dependencies: "@ethersproject/abi" "^5.1.2" "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/ethereumjs-block" "5.0.1" - "@nomicfoundation/ethereumjs-blockchain" "7.0.1" - "@nomicfoundation/ethereumjs-common" "4.0.1" - "@nomicfoundation/ethereumjs-evm" "2.0.1" - "@nomicfoundation/ethereumjs-rlp" "5.0.1" - "@nomicfoundation/ethereumjs-statemanager" "2.0.1" - "@nomicfoundation/ethereumjs-trie" "6.0.1" - "@nomicfoundation/ethereumjs-tx" "5.0.1" - "@nomicfoundation/ethereumjs-util" "9.0.1" - "@nomicfoundation/ethereumjs-vm" "7.0.1" + "@nomicfoundation/edr" "^0.4.0" + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-tx" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" "@nomicfoundation/solidity-analyzer" "^0.1.0" "@sentry/node" "^5.18.1" "@types/bn.js" "^5.1.0" "@types/lru-cache" "^5.1.0" - abort-controller "^3.0.0" adm-zip "^0.4.16" aggregate-error "^3.0.0" ansi-escapes "^4.3.0" + boxen "^5.1.2" chalk "^2.4.2" chokidar "^3.4.0" ci-info "^2.0.0" @@ -6670,11 +6844,23 @@ has-property-descriptors@^1.0.0: dependencies: get-intrinsic "^1.1.1" +has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + has-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== +has-proto@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + has-symbol-support-x@^1.4.1: version "1.4.2" resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" @@ -6704,6 +6890,13 @@ has-tostringtag@^1.0.0: dependencies: has-symbols "^1.0.2" +has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== + dependencies: + has-symbols "^1.0.3" + has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" @@ -6767,6 +6960,13 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + he@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" @@ -6976,6 +7176,15 @@ internal-slot@^1.0.5: has "^1.0.3" side-channel "^1.0.4" +internal-slot@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" + integrity sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g== + dependencies: + es-errors "^1.3.0" + hasown "^2.0.0" + side-channel "^1.0.4" + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -7036,6 +7245,14 @@ is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: get-intrinsic "^1.2.0" is-typed-array "^1.1.10" +is-array-buffer@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.4.tgz#7a1f92b3d61edd2bc65d24f130530ea93d7fae98" + integrity sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -7111,6 +7328,13 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-data-view@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-data-view/-/is-data-view-1.0.1.tgz#4b4d3a511b70f3dc26d42c03ca9ca515d847759f" + integrity sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w== + dependencies: + is-typed-array "^1.1.13" + is-date-object@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" @@ -7214,6 +7438,11 @@ is-negative-zero@^2.0.1, is-negative-zero@^2.0.2: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== +is-negative-zero@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" + integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== + is-number-object@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" @@ -7290,6 +7519,13 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" +is-shared-array-buffer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz#1237f1cba059cdb62431d378dcc37d9680181688" + integrity sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg== + dependencies: + call-bind "^1.0.7" + is-stream@^1.0.0, is-stream@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -7316,6 +7552,13 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: dependencies: which-typed-array "^1.1.11" +is-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.13.tgz#d6c5ca56df62334959322d7d7dd1cca50debe229" + integrity sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw== + dependencies: + which-typed-array "^1.1.14" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -7423,11 +7666,6 @@ js-cookie@^2.2.1: resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== -js-sdsl@^4.1.4: - version "4.4.2" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.2.tgz#2e3c031b1f47d3aca8b775532e3ebb0818e7f847" - integrity sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w== - js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" @@ -7839,14 +8077,6 @@ level-ws@^1.0.0: readable-stream "^2.2.8" xtend "^4.0.1" -level@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/level/-/level-8.0.0.tgz#41b4c515dabe28212a3e881b61c161ffead14394" - integrity sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ== - dependencies: - browser-level "^1.0.1" - classic-level "^1.2.0" - leveldown@6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/leveldown/-/leveldown-6.1.0.tgz#7ab1297706f70c657d1a72b31b40323aa612b9ee" @@ -7956,6 +8186,11 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" @@ -8083,11 +8318,6 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -mcl-wasm@^0.7.1: - version "0.7.9" - resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" - integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -8126,15 +8356,6 @@ memdown@~3.0.0: ltgt "~2.2.0" safe-buffer "~5.1.1" -memory-level@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/memory-level/-/memory-level-1.0.0.tgz#7323c3fd368f9af2f71c3cd76ba403a17ac41692" - integrity sha512-UXzwewuWeHBz5krr7EvehKcmLFNoXxGcvuYhC41tRnkrTbJohtS7kVn9akmgirtRygg+f7Yjsfi8Uu5SGSQ4Og== - dependencies: - abstract-level "^1.0.0" - functional-red-black-tree "^1.0.1" - module-error "^1.0.1" - memorystream@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" @@ -8427,7 +8648,7 @@ mock-fs@^4.1.0: resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== -module-error@^1.0.1, module-error@^1.0.2: +module-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/module-error/-/module-error-1.0.2.tgz#8d1a48897ca883f47a45816d4fb3e3c6ba404d86" integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== @@ -8519,11 +8740,6 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -napi-macros@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.2.2.tgz#817fef20c3e0e40a963fbf7b37d1600bd0201044" - integrity sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g== - napi-macros@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" @@ -8700,6 +8916,11 @@ object-inspect@^1.12.3: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== +object-inspect@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + object-is@^1.0.1: version "1.1.5" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac" @@ -8760,6 +8981,16 @@ object.assign@^4.1.4: has-symbols "^1.0.3" object-keys "^1.1.1" +object.assign@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" + integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== + dependencies: + call-bind "^1.0.5" + define-properties "^1.2.1" + has-symbols "^1.0.3" + object-keys "^1.1.1" + object.getownpropertydescriptors@^2.0.3: version "2.1.6" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.6.tgz#5e5c384dd209fa4efffead39e3a0512770ccc312" @@ -9219,6 +9450,11 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= +possible-typed-array-names@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" + integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== + postinstall-postinstall@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" @@ -9639,6 +9875,16 @@ regexp.prototype.flags@^1.5.0: define-properties "^1.2.0" functions-have-names "^1.2.3" +regexp.prototype.flags@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" + integrity sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw== + dependencies: + call-bind "^1.0.6" + define-properties "^1.2.1" + es-errors "^1.3.0" + set-function-name "^2.0.1" + regexpu-core@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" @@ -9839,13 +10085,6 @@ rlp@^2.0.0, rlp@^2.2.1, rlp@^2.2.2, rlp@^2.2.3, rlp@^2.2.4: dependencies: bn.js "^5.2.0" -run-parallel-limit@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz#be80e936f5768623a38a963262d6bef8ff11e7ba" - integrity sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw== - dependencies: - queue-microtask "^1.2.2" - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -9868,6 +10107,16 @@ safe-array-concat@^1.0.0: has-symbols "^1.0.3" isarray "^2.0.5" +safe-array-concat@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.2.tgz#81d77ee0c4e8b863635227c721278dd524c20edb" + integrity sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q== + dependencies: + call-bind "^1.0.7" + get-intrinsic "^1.2.4" + has-symbols "^1.0.3" + isarray "^2.0.5" + safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -9894,6 +10143,15 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" +safe-regex-test@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377" + integrity sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-regex "^1.1.4" + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -10031,6 +10289,28 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +set-function-name@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" + integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.2" + set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" @@ -10244,10 +10524,12 @@ solhint@3.6.2: optionalDependencies: prettier "^2.8.3" -solidity-ast@^0.4.15: - version "0.4.29" - resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.29.tgz#faa06b93467501cf7069436c8a9255dd0a9a195c" - integrity sha512-sp4+lbgZPQJLBNFWoLiRb/NXZOhqAEPK9AIOh5htKOTx72w5j9Bu5eQl0jcUc5wiyCqsgpFWLCGfgu3edkSWog== +solidity-ast@^0.4.51: + version "0.4.56" + resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.56.tgz#94fe296f12e8de1a3bed319bc06db8d05a113d7a" + integrity sha512-HgmsA/Gfklm/M8GFbCX/J1qkVH0spXHgALCNZ8fA8x5X+MFdn/8CP2gr5OVyXjXw6RZTPC/Sxl2RUDQOXyNMeA== + dependencies: + array.prototype.findlast "^1.2.2" solidity-coverage@^0.8.4: version "0.8.4" @@ -10476,7 +10758,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -10494,6 +10776,16 @@ string.prototype.trim@^1.2.7: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trim@^1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz#b6fa326d72d2c78b6df02f7759c73f8f6274faa4" + integrity sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.0" + es-object-atoms "^1.0.0" + string.prototype.trim@~1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.5.tgz#a587bcc8bfad8cb9829a577f5de30dd170c1682c" @@ -10520,6 +10812,15 @@ string.prototype.trimend@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trimend@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz#3651b8513719e8a9f48de7f2f77640b26652b229" + integrity sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + string.prototype.trimstart@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" @@ -10537,6 +10838,15 @@ string.prototype.trimstart@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trimstart@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde" + integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-object-atoms "^1.0.0" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -10914,6 +11224,11 @@ ts-node@10.9.1, ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.11.1, tslib@^1.8.1, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -11068,6 +11383,15 @@ typed-array-buffer@^1.0.0: get-intrinsic "^1.2.1" is-typed-array "^1.1.10" +typed-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" + integrity sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + is-typed-array "^1.1.13" + typed-array-byte-length@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" @@ -11078,6 +11402,17 @@ typed-array-byte-length@^1.0.0: has-proto "^1.0.1" is-typed-array "^1.1.10" +typed-array-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz#d92972d3cff99a3fa2e765a28fcdc0f1d89dec67" + integrity sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + typed-array-byte-offset@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" @@ -11089,6 +11424,18 @@ typed-array-byte-offset@^1.0.0: has-proto "^1.0.1" is-typed-array "^1.1.10" +typed-array-byte-offset@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz#f9ec1acb9259f395093e4567eb3c28a580d02063" + integrity sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + typed-array-length@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" @@ -11098,6 +11445,18 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" +typed-array-length@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.6.tgz#57155207c76e64a3457482dfdc1c9d1d3c4c73a3" + integrity sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + possible-typed-array-names "^1.0.0" + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -12008,6 +12367,17 @@ which-typed-array@^1.1.10, which-typed-array@^1.1.11, which-typed-array@^1.1.2: gopd "^1.0.1" has-tostringtag "^1.0.0" +which-typed-array@^1.1.14, which-typed-array@^1.1.15: + version "1.1.15" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.15.tgz#264859e9b11a649b388bfaaf4f767df1f779b38d" + integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.2" + which@1.3.1, which@^1.1.1, which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -12124,6 +12494,11 @@ ws@8.13.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== + ws@^3.0.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" From 25158f6d65470c715dd1ac637a2fda34e9dd8c0b Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 19 Jun 2024 17:56:43 +0300 Subject: [PATCH 21/83] Fix createSchain test --- gas/createSchain.ts | 34 ++++---- gas/nodeRotation.ts | 20 ++--- long-test/Treetest.ts | 4 +- long-test/createSchain.ts | 6 +- scripts/generateAbi.ts | 2 +- test/NodeRotation.ts | 6 +- test/NodesData.ts | 2 +- test/NodesFunctionality.ts | 4 +- test/Pricing.ts | 6 +- test/Schains.ts | 118 +++++++++++++-------------- test/SchainsInternal.ts | 12 +-- test/SkaleDKG.ts | 36 ++++---- test/SkaleDkgFakeComplaint.ts | 8 +- test/SkaleManager.ts | 36 ++++---- test/SkaleVerifier.ts | 6 +- test/Wallets.ts | 32 ++++---- test/delegation/Delegation.ts | 26 +++--- test/tools/deploy/contractManager.ts | 2 +- test/tools/signatures.ts | 8 +- 19 files changed, 183 insertions(+), 185 deletions(-) diff --git a/gas/createSchain.ts b/gas/createSchain.ts index 35587a1c..cd48bcf4 100644 --- a/gas/createSchain.ts +++ b/gas/createSchain.ts @@ -6,24 +6,19 @@ import {deploySchains} from "../test/tools/deploy/schains"; import fs from 'fs'; import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; -import {Event, Wallet} from "ethers"; +import {ContractTransactionReceipt, EventLog, HDNodeWallet, Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {fastBeforeEach} from "../test/tools/mocha"; import {SchainType} from "../test/tools/types"; -import {TypedEvent} from "../typechain-types/common"; -import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; -function findEvent(events: Event[] | undefined, eventName: string) { - if (events) { - const target = events.find((event) => event.event === eventName); - if (target) { - return target as TargetEvent; - } else { - throw new Error("Event was not emitted"); +function findEvent(receipt: ContractTransactionReceipt | null, eventName: string) { + if (receipt) { + const log = receipt.logs.find((event) => event instanceof EventLog && event.eventName === eventName); + if (log) { + return log as EventLog; } - } else { - throw new Error("Event was not emitted"); } + throw new Error("Event was not emitted"); } describe("createSchains", () => { @@ -50,8 +45,8 @@ describe("createSchains", () => { const validatorId = await validatorService.getValidatorId(validator.address); await validatorService.disableWhitelist(); const maxNodesAmount = 1000; - const etherAmount = ethers.utils.parseEther("10"); - const nodeAddresses: Wallet[] = []; + const etherAmount = ethers.parseEther("10"); + const nodeAddresses: HDNodeWallet[] = []; await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); const gasLimit = 12e6; @@ -72,8 +67,11 @@ describe("createSchains", () => { const nodesAmount = nodeId + 1; if (nodesAmount >= 16) { - const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${nodeId}`, owner.address, ethers.constants.AddressZero, [])).wait(); - const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${nodeId}`, owner.address, ethers.ZeroAddress, [])).wait(); + if (!result) { + throw new Error("addSchainByFoundation was not mined"); + } + const nodeInGroup = findEvent(result, "SchainNodes").args?.nodesInGroup; console.log("Nodes in Schain:"); const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { @@ -87,8 +85,8 @@ describe("createSchains", () => { } measurements.push({nodesAmount, gasUsed: result.gasUsed}); - console.log("create schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); - if (result.gasUsed.toNumber() > gasLimit) { + console.log("create schain on", nodesAmount, "nodes:\t", result.gasUsed, "gu"); + if (result.gasUsed > gasLimit) { break; } } diff --git a/gas/nodeRotation.ts b/gas/nodeRotation.ts index c7132bef..c117db20 100644 --- a/gas/nodeRotation.ts +++ b/gas/nodeRotation.ts @@ -57,7 +57,7 @@ describe("nodeRotation", () => { before(async () => { [owner, validator] = await ethers.getSigners(); node = new Wallet(String(privateKeys[3])).connect(ethers.provider); - await owner.sendTransaction({value: ethers.utils.parseEther("1"), to: node.address}); + await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); contractManager = await deployContractManager(); schainsInternal = await deploySchainsInternalMock(contractManager); @@ -101,7 +101,7 @@ describe("nodeRotation", () => { const numberOfSchains = 64; for (let schainNumber = 0; schainNumber < numberOfSchains; schainNumber++) { - const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.constants.AddressZero, [])).wait(); + const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.ZeroAddress, [])).wait(); await skaleDKG.setSuccessfulDKGPublic(stringKeccak256(`schain-${schainNumber}`)); console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); } @@ -173,7 +173,7 @@ describe("nodeRotation", () => { } for (let schainNumber = 0; schainNumber < numberOfSchains; schainNumber++) { - const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.constants.AddressZero, [])).wait(); + const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.ZeroAddress, [])).wait(); const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; console.log("Nodes in Schain:"); const setOfNodes = new Set(); @@ -206,8 +206,8 @@ describe("nodeRotation", () => { for(let test = 1; test <= numberOfSchains; ++test) { it(`should exit schain #${test}`, async () => { - if ((await node.getBalance()).lt(ethers.utils.parseEther("0.1"))) { - await owner.sendTransaction({value: ethers.utils.parseEther("1"), to: node.address}); + if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } const estimatedGas = await skaleManager.estimateGas.nodeExit(leavingNode); @@ -255,8 +255,8 @@ describe("nodeRotation", () => { }); beforeEach(async () => { - if ((await node.getBalance()).lt(ethers.utils.parseEther("0.1"))) { - await owner.sendTransaction({value: ethers.utils.parseEther("1"), to: node.address}); + if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } await skaleManager.connect(node).createNode( @@ -273,7 +273,7 @@ describe("nodeRotation", () => { ++nodeId; nodesAmount = nodeId; if (nodesAmount >= 16) { - const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${nodeId}`, owner.address, ethers.constants.AddressZero, [])).wait(); + const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${nodeId}`, owner.address, ethers.ZeroAddress, [])).wait(); await skaleDKG.setSuccessfulDKGPublic(stringKeccak256(`schain-${nodeId}`)); console.log("create schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); @@ -297,8 +297,8 @@ describe("nodeRotation", () => { const gas = []; await nodes.initExit(leavingNode); for (let i = 0; i < schainHashes.length; i++) { - if ((await node.getBalance()).lt(ethers.utils.parseEther("0.1"))) { - await owner.sendTransaction({value: ethers.utils.parseEther("1"), to: node.address}); + if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } const estimatedGas = await skaleManager.connect(node).estimateGas.nodeExit(leavingNode); console.log("Estimated gas on nodeExit", estimatedGas.toString()); diff --git a/long-test/Treetest.ts b/long-test/Treetest.ts index 16b9058a..95a6e6dc 100644 --- a/long-test/Treetest.ts +++ b/long-test/Treetest.ts @@ -86,7 +86,7 @@ async function checkTreeAndSpaceToNodes(nodes: Nodes) { } async function createSchain(schains: Schains, typeOfSchain: SchainType, name: string, owner: Signer) { - await schains.addSchainByFoundation(0, typeOfSchain, 0, name, await owner.getAddress(), ethers.constants.AddressZero, []); + await schains.addSchainByFoundation(0, typeOfSchain, 0, name, await owner.getAddress(), ethers.ZeroAddress, []); console.log("Schain", name, "with type", typeOfSchain, "created"); } @@ -234,7 +234,7 @@ describe("Tree test", () => { node = new Wallet(String(privateKeys[2])).connect(ethers.provider); - await owner.sendTransaction({to: node.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: node.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); diff --git a/long-test/createSchain.ts b/long-test/createSchain.ts index 6db7f82c..3b51f245 100644 --- a/long-test/createSchain.ts +++ b/long-test/createSchain.ts @@ -40,7 +40,7 @@ describe("Schain creation test", () => { beforeEach(async () => { [owner, validator] = await ethers.getSigners(); nodeAddress = new Wallet(String(privateKeys[2])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); schainsInternal = await deploySchainsInternalMock(contractManager); @@ -74,7 +74,7 @@ describe("Schain creation test", () => { const type = SchainType.MEDIUM; console.log(type); for (let try1 = 0; try1 < 32; try1++) { - const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}${try1}`, owner.address, ethers.constants.AddressZero, [])).wait(); + const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}${try1}`, owner.address, ethers.ZeroAddress, [])).wait(); const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { @@ -119,7 +119,7 @@ describe("Schain creation test", () => { for(let tries = 0; tries < 200; tries++) { const type = Math.floor(Math.random() * 2) + 1; console.log(type); - const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}`, owner.address, ethers.constants.AddressZero, [])).wait(); + const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}`, owner.address, ethers.ZeroAddress, [])).wait(); const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { diff --git a/scripts/generateAbi.ts b/scripts/generateAbi.ts index ae0a7974..4c6b4e54 100644 --- a/scripts/generateAbi.ts +++ b/scripts/generateAbi.ts @@ -26,7 +26,7 @@ async function main() { if (Object.keys(librariesRequirements).includes(contractName)) { const libraries: Libraries = {}; for(const library of librariesRequirements[contractName]) { - libraries[library] = ethers.constants.AddressZero; + libraries[library] = ethers.ZeroAddress; } factory = await ethers.getContractFactory(contractName, {libraries}); } else { diff --git a/test/NodeRotation.ts b/test/NodeRotation.ts index baffcc36..e3656beb 100644 --- a/test/NodeRotation.ts +++ b/test/NodeRotation.ts @@ -75,7 +75,7 @@ describe("NodeRotation", () => { const totalNumberOfNodes = 20; const registeredNodes: RegisteredNode[] = []; - const nodeBalance = ethers.utils.parseEther("10000"); + const nodeBalance = ethers.parseEther("10000"); fastBeforeEach(async () => { for (const index of Array.from(Array(totalNumberOfNodes).keys())) { @@ -117,13 +117,13 @@ describe("NodeRotation", () => { typeOfSchain: schainType, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); await skaleDKG.setSuccessfulDKGPublic(schainHash); - await wallets.connect(owner).rechargeSchainWallet(schainHash, {value: ethers.utils.parseEther("1")}); + await wallets.connect(owner).rechargeSchainWallet(schainHash, {value: ethers.parseEther("1")}); chainNodes = (await schainsInternal.getNodesInGroup(schainHash)).map(id => { const node = registeredNodes.find(registeredNode => registeredNode.id == id.toNumber()) diff --git a/test/NodesData.ts b/test/NodesData.ts index 95240ebf..cde15fbd 100644 --- a/test/NodesData.ts +++ b/test/NodesData.ts @@ -36,7 +36,7 @@ describe("NodesData", () => { nodeAddress = new Wallet(String(privateKeys[2])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); nodes = await deployNodes(contractManager); diff --git a/test/NodesFunctionality.ts b/test/NodesFunctionality.ts index dbc54c67..ad8abf5e 100644 --- a/test/NodesFunctionality.ts +++ b/test/NodesFunctionality.ts @@ -46,8 +46,8 @@ describe("NodesFunctionality", () => { nodeAddress = new Wallet(String(privateKeys[2])).connect(ethers.provider); nodeAddress2 = new Wallet(String(privateKeys[3])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); - await owner.sendTransaction({to: nodeAddress2.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress2.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); nodes = await deployNodes(contractManager); diff --git a/test/Pricing.ts b/test/Pricing.ts index a17429c5..04605e8c 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -90,9 +90,9 @@ describe("Pricing", () => { describe("on initialized contracts", () => { fastBeforeEach(async () => { - await schainsInternal.initializeSchain("BobSchain", holder.address, ethers.constants.AddressZero, 10, 2); - await schainsInternal.initializeSchain("DavidSchain", holder.address, ethers.constants.AddressZero, 10, 4); - await schainsInternal.initializeSchain("JacobSchain", holder.address, ethers.constants.AddressZero, 10, 8); + await schainsInternal.initializeSchain("BobSchain", holder.address, ethers.ZeroAddress, 10, 2); + await schainsInternal.initializeSchain("DavidSchain", holder.address, ethers.ZeroAddress, 10, 4); + await schainsInternal.initializeSchain("JacobSchain", holder.address, ethers.ZeroAddress, 10, 8); await nodes.createNode( nodeAddress1.address, { diff --git a/test/Schains.ts b/test/Schains.ts index 05204052..59dc0182 100644 --- a/test/Schains.ts +++ b/test/Schains.ts @@ -69,10 +69,10 @@ describe("Schains", () => { nodeAddress3 = new Wallet(String(privateKeys[5])).connect(ethers.provider); nodeAddress4 = new Wallet(String(privateKeys[0])).connect(ethers.provider); - await richGuy1.sendTransaction({to: nodeAddress1.address, value: ethers.utils.parseEther("10000")}); - await richGuy2.sendTransaction({to: nodeAddress2.address, value: ethers.utils.parseEther("10000")}); - await richGuy3.sendTransaction({to: nodeAddress3.address, value: ethers.utils.parseEther("10000")}); - await richGuy4.sendTransaction({to: nodeAddress4.address, value: ethers.utils.parseEther("10000")}); + await richGuy1.sendTransaction({to: nodeAddress1.address, value: ethers.parseEther("10000")}); + await richGuy2.sendTransaction({to: nodeAddress2.address, value: ethers.parseEther("10000")}); + await richGuy3.sendTransaction({to: nodeAddress3.address, value: ethers.parseEther("10000")}); + await richGuy4.sendTransaction({to: nodeAddress4.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); @@ -123,7 +123,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -131,7 +131,7 @@ describe("Schains", () => { }); it("should not allow everyone to create schains as the foundation", async () => { - await schains.addSchainByFoundation(5, SchainType.SMALL, 0, "d2", ethers.constants.AddressZero, ethers.constants.AddressZero, []) + await schains.addSchainByFoundation(5, SchainType.SMALL, 0, "d2", ethers.ZeroAddress, ethers.ZeroAddress, []) .should.be.eventually.rejectedWith("Sender is not authorized to create schain"); }) @@ -146,7 +146,7 @@ describe("Schains", () => { typeOfSchain: 6, // wrong type nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -173,7 +173,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "Mainnet", // wrong name - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -192,7 +192,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "", // wrong name - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -211,7 +211,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -245,7 +245,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -261,7 +261,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -304,7 +304,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -367,7 +367,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -793,7 +793,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -822,7 +822,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -844,7 +844,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -870,7 +870,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -892,7 +892,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -910,7 +910,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -949,7 +949,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -971,7 +971,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -993,7 +993,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1015,7 +1015,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d5", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1041,7 +1041,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [ { name: "one", @@ -1085,7 +1085,7 @@ describe("Schains", () => { it("should allow the foundation to create schain without tokens", async () => { const schainCreator = holder; await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), schainCreator.address); - await schains.connect(schainCreator).addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, "d2", ethers.constants.AddressZero, ethers.constants.AddressZero, []); + await schains.connect(schainCreator).addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, "d2", ethers.ZeroAddress, ethers.ZeroAddress, []); const sChains = await schainsInternal.getSchains(); sChains.length.should.be.equal(1); @@ -1111,7 +1111,7 @@ describe("Schains", () => { it("should assign schain creator on different address", async () => { await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); - await schains.addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, "d2", holder.address, ethers.constants.AddressZero, []); + await schains.addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, "d2", holder.address, ethers.ZeroAddress, []); const sChains = await schainsInternal.getSchains(); sChains.length.should.be.equal(1); @@ -1167,7 +1167,7 @@ describe("Schains", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1190,7 +1190,7 @@ describe("Schains", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1206,7 +1206,7 @@ describe("Schains", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1215,7 +1215,7 @@ describe("Schains", () => { it("should assign schain creator on different address and create small schain", async () => { await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), holder.address); - await schains.connect(holder).addSchainByFoundation(5, SchainType.SMALL, 0, "d2", ethers.constants.AddressZero, ethers.constants.AddressZero, []); + await schains.connect(holder).addSchainByFoundation(5, SchainType.SMALL, 0, "d2", ethers.ZeroAddress, ethers.ZeroAddress, []); const sChains = await schainsInternal.getSchains(); sChains.length.should.be.equal(1); @@ -1226,7 +1226,7 @@ describe("Schains", () => { it("should assign schain creator on different address and create medium schain", async () => { await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), holder.address); - await schains.connect(holder).addSchainByFoundation(5, SchainType.MEDIUM, 0, "d2", ethers.constants.AddressZero, ethers.constants.AddressZero, []); + await schains.connect(holder).addSchainByFoundation(5, SchainType.MEDIUM, 0, "d2", ethers.ZeroAddress, ethers.ZeroAddress, []); const sChains = await schainsInternal.getSchains(); sChains.length.should.be.equal(1); @@ -1237,7 +1237,7 @@ describe("Schains", () => { it("should assign schain creator on different address and create large schain", async () => { await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), holder.address); - await schains.connect(holder).addSchainByFoundation(5, SchainType.LARGE, 0, "d2", ethers.constants.AddressZero, ethers.constants.AddressZero, []); + await schains.connect(holder).addSchainByFoundation(5, SchainType.LARGE, 0, "d2", ethers.ZeroAddress, ethers.ZeroAddress, []); const sChains = await schainsInternal.getSchains(); sChains.length.should.be.equal(1); @@ -1282,7 +1282,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1307,7 +1307,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1364,7 +1364,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1399,7 +1399,7 @@ describe("Schains", () => { typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1434,7 +1434,7 @@ describe("Schains", () => { typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1468,7 +1468,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1487,7 +1487,7 @@ describe("Schains", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1535,7 +1535,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1554,7 +1554,7 @@ describe("Schains", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1650,7 +1650,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1669,7 +1669,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1953,7 +1953,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1970,7 +1970,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1987,7 +1987,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2277,7 +2277,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2296,7 +2296,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2315,7 +2315,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2334,7 +2334,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2449,7 +2449,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2468,7 +2468,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2487,7 +2487,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2506,7 +2506,7 @@ describe("Schains", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2872,7 +2872,7 @@ describe("Schains", () => { typeOfSchain: schainType, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3042,7 +3042,7 @@ describe("Schains", () => { typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3142,7 +3142,7 @@ describe("Schains", () => { typeOfSchain: schainType, nonce: 0, name: schain2Name, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3161,7 +3161,7 @@ describe("Schains", () => { typeOfSchain: schainType, nonce: 0, name: schain3Name, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) diff --git a/test/SchainsInternal.ts b/test/SchainsInternal.ts index 766c057b..d3d6b3c7 100644 --- a/test/SchainsInternal.ts +++ b/test/SchainsInternal.ts @@ -36,7 +36,7 @@ describe("SchainsInternal", () => { [owner, holder] = await ethers.getSigners(); nodeAddress = new Wallet(String(privateKeys[1])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); nodes = await deployNodes(contractManager); @@ -58,7 +58,7 @@ describe("SchainsInternal", () => { }); it("should initialize schain", async () => { - await schainsInternal.initializeSchain("TestSchain", holder.address, ethers.constants.AddressZero, 5, 5); + await schainsInternal.initializeSchain("TestSchain", holder.address, ethers.ZeroAddress, 5, 5); const schain = await schainsInternal.schains(stringKeccak256("TestSchain")); schain.name.should.be.equal("TestSchain"); @@ -91,13 +91,13 @@ describe("SchainsInternal", () => { const generation1Name = "Generation 1"; const generation0Hash = stringKeccak256(generation0Name); const generation1Hash = stringKeccak256(generation1Name); - await schainsInternal.initializeSchain(generation0Name, holder.address, ethers.constants.AddressZero, 5, 5); + await schainsInternal.initializeSchain(generation0Name, holder.address, ethers.ZeroAddress, 5, 5); (await schainsInternal.getGeneration(generation0Hash)).should.be.equal(generation); await schainsInternal.newGeneration(); generation = generation.add(1); - await schainsInternal.initializeSchain(generation1Name, holder.address, ethers.constants.AddressZero, 5, 5); + await schainsInternal.initializeSchain(generation1Name, holder.address, ethers.ZeroAddress, 5, 5); (await schainsInternal.getGeneration(generation1Hash)).should.be.equal(generation); }); @@ -110,7 +110,7 @@ describe("SchainsInternal", () => { const schainNameHash = stringKeccak256("TestSchain"); fastBeforeEach(async () => { - await schainsInternal.initializeSchain("TestSchain", holder.address, ethers.constants.AddressZero, 5, 5); + await schainsInternal.initializeSchain("TestSchain", holder.address, ethers.ZeroAddress, 5, 5); await nodes.createNode(nodeAddress.address, { port: 8545, @@ -160,7 +160,7 @@ describe("SchainsInternal", () => { await schainsInternal.createGroupForSchain(schainNameHash, 1, 2); for (const schainName of newSchainNames) { - await schainsInternal.initializeSchain(schainName, owner.address, ethers.constants.AddressZero, 5, 5); + await schainsInternal.initializeSchain(schainName, owner.address, ethers.ZeroAddress, 5, 5); } }); diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index 0ef44c6b..4cd48a73 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -40,7 +40,7 @@ import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); -const weiTolerance = ethers.utils.parseEther("0.002").toNumber(); +const weiTolerance = ethers.parseEther("0.002").toNumber(); async function reimbursed(transaction: ContractTransaction, operation?: string) { const receipt = await transaction.wait(); @@ -91,8 +91,8 @@ describe("SkaleDKG", () => { nodeAddress1 = new Wallet(String(privateKeys[1])).connect(ethers.provider); nodeAddress2 = new Wallet(String(privateKeys[2])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress1.address, value: ethers.utils.parseEther("10000")}); - await owner.sendTransaction({to: nodeAddress2.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress1.address, value: ethers.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress2.address, value: ethers.parseEther("10000")}); validators = [ { @@ -376,7 +376,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ))).wait(); @@ -398,7 +398,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -419,7 +419,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -448,7 +448,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -471,7 +471,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1440,7 +1440,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1462,7 +1462,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1625,7 +1625,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1647,7 +1647,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1857,7 +1857,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1972,7 +1972,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2328,7 +2328,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2411,7 +2411,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2559,7 +2559,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2634,7 +2634,7 @@ describe("SkaleDKG", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "New16NodeSchain1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) diff --git a/test/SkaleDkgFakeComplaint.ts b/test/SkaleDkgFakeComplaint.ts index e0f54588..92ccf86e 100644 --- a/test/SkaleDkgFakeComplaint.ts +++ b/test/SkaleDkgFakeComplaint.ts @@ -560,8 +560,8 @@ describe("SkaleDkgFakeComplaint", () => { nodeAddress1 = new Wallet(String(privateKeys[1])).connect(ethers.provider); nodeAddress2 = new Wallet(String(privateKeys[2])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress1.address, value: ethers.utils.parseEther("10000")}); - await owner.sendTransaction({to: nodeAddress2.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress1.address, value: ethers.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress2.address, value: ethers.parseEther("10000")}); validators = [ { @@ -655,7 +655,7 @@ describe("SkaleDkgFakeComplaint", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -678,7 +678,7 @@ describe("SkaleDkgFakeComplaint", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); diff --git a/test/SkaleManager.ts b/test/SkaleManager.ts index abce7c5e..afd529e9 100644 --- a/test/SkaleManager.ts +++ b/test/SkaleManager.ts @@ -81,8 +81,8 @@ describe("SkaleManager", () => { validator = new Wallet(String(privateKeys[1])).connect(ethers.provider); nodeAddress = new Wallet(String(privateKeys[4])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); - await owner.sendTransaction({to: validator.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); + await owner.sendTransaction({to: validator.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); @@ -224,7 +224,7 @@ describe("SkaleManager", () => { getPublicKey(nodeAddress), // public key "d2", // name "some.domain.name"); - await wallets.rechargeValidatorWallet(validatorId, {value: ethers.utils.parseEther('5.0')}); + await wallets.rechargeValidatorWallet(validatorId, {value: ethers.parseEther('5.0')}); }); it("should fail to init exiting of someone else's node", async () => { @@ -459,7 +459,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -482,7 +482,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -499,7 +499,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -523,7 +523,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -542,7 +542,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -584,7 +584,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -646,7 +646,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -665,7 +665,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -687,7 +687,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -703,7 +703,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -752,7 +752,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -776,7 +776,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.MEDIUM, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -799,7 +799,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.LARGE, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -822,7 +822,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "d5", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -845,7 +845,7 @@ describe("SkaleManager", () => { typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d6", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) diff --git a/test/SkaleVerifier.ts b/test/SkaleVerifier.ts index aae20487..3d5a30e0 100644 --- a/test/SkaleVerifier.ts +++ b/test/SkaleVerifier.ts @@ -55,7 +55,7 @@ describe("SkaleVerifier", () => { [validator1, owner] = await ethers.getSigners(); nodeAddress = new Wallet(String(privateKeys[0])).connect(ethers.provider); - await owner.sendTransaction({to: nodeAddress.address, value: ethers.utils.parseEther("10000")}); + await owner.sendTransaction({to: nodeAddress.address, value: ethers.parseEther("10000")}); contractManager = await deployContractManager(); constantsHolder = await deployConstantsHolder(contractManager); @@ -260,7 +260,7 @@ describe("SkaleVerifier", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "Bob", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -327,7 +327,7 @@ describe("SkaleVerifier", () => { typeOfSchain: SchainType.TEST, nonce: 0, name: "Bob", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); diff --git a/test/Wallets.ts b/test/Wallets.ts index ed196d59..dfbd6905 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -76,10 +76,10 @@ describe("Wallets", () => { const balanceRichGuy2 = await richGuy2.getBalance(); const balanceRichGuy3 = await richGuy3.getBalance(); const balanceRichGuy4 = await richGuy4.getBalance(); - await richGuy1.sendTransaction({to: nodeAddress1.address, value: balanceRichGuy1.sub(ethers.utils.parseEther("1"))}); - await richGuy2.sendTransaction({to: nodeAddress2.address, value: balanceRichGuy2.sub(ethers.utils.parseEther("1"))}); - await richGuy3.sendTransaction({to: nodeAddress3.address, value: balanceRichGuy3.sub(ethers.utils.parseEther("1"))}); - await richGuy4.sendTransaction({to: nodeAddress4.address, value: balanceRichGuy4.sub(ethers.utils.parseEther("1"))}); + await richGuy1.sendTransaction({to: nodeAddress1.address, value: balanceRichGuy1.sub(ethers.parseEther("1"))}); + await richGuy2.sendTransaction({to: nodeAddress2.address, value: balanceRichGuy2.sub(ethers.parseEther("1"))}); + await richGuy3.sendTransaction({to: nodeAddress3.address, value: balanceRichGuy3.sub(ethers.parseEther("1"))}); + await richGuy4.sendTransaction({to: nodeAddress4.address, value: balanceRichGuy4.sub(ethers.parseEther("1"))}); contractManager = await deployContractManager(); wallets = await deployWallets(contractManager); @@ -109,10 +109,10 @@ describe("Wallets", () => { const balanceNode2 = await nodeAddress2.getBalance(); const balanceNode3 = await nodeAddress3.getBalance(); const balanceNode4 = await nodeAddress4.getBalance(); - await nodeAddress1.sendTransaction({to: richGuy1.address, value: balanceNode1.sub(ethers.utils.parseEther("1"))}); - await nodeAddress2.sendTransaction({to: richGuy2.address, value: balanceNode2.sub(ethers.utils.parseEther("1"))}); - await nodeAddress3.sendTransaction({to: richGuy2.address, value: balanceNode3.sub(ethers.utils.parseEther("1"))}); - await nodeAddress4.sendTransaction({to: richGuy2.address, value: balanceNode4.sub(ethers.utils.parseEther("1"))}); + await nodeAddress1.sendTransaction({to: richGuy1.address, value: balanceNode1.sub(ethers.parseEther("1"))}); + await nodeAddress2.sendTransaction({to: richGuy2.address, value: balanceNode2.sub(ethers.parseEther("1"))}); + await nodeAddress3.sendTransaction({to: richGuy2.address, value: balanceNode3.sub(ethers.parseEther("1"))}); + await nodeAddress4.sendTransaction({to: richGuy2.address, value: balanceNode4.sub(ethers.parseEther("1"))}); }); beforeEach(async () => { @@ -124,13 +124,13 @@ describe("Wallets", () => { }); it("should revert if someone sends ETH to contract Wallets", async() => { - const amount = ethers.utils.parseEther("1.0"); + const amount = ethers.parseEther("1.0"); await owner.sendTransaction({to: wallets.address, value: amount}) .should.be.eventually.rejectedWith("Validator address does not exist"); }); it("should recharge validator wallet sending ETH to contract Wallets", async() => { - const amount = ethers.utils.parseEther("1.0"); + const amount = ethers.parseEther("1.0"); (await wallets.getValidatorBalance(validator1Id)).toNumber().should.be.equal(0); await validator1.sendTransaction({to: wallets.address, value: amount}); (await wallets.getValidatorBalance(validator1Id)).should.be.equal(amount); @@ -217,10 +217,10 @@ describe("Wallets", () => { await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address) - await schains.addSchainByFoundation(0, SchainType.TEST, 0, schain1Name, validator1.address, ethers.constants.AddressZero, []); + await schains.addSchainByFoundation(0, SchainType.TEST, 0, schain1Name, validator1.address, ethers.ZeroAddress, []); await skaleDKG.setSuccessfulDKGPublic(schain1Id); - await schains.addSchainByFoundation(0, SchainType.TEST, 0, schain2Name, validator2.address, ethers.constants.AddressZero, []); + await schains.addSchainByFoundation(0, SchainType.TEST, 0, schain2Name, validator2.address, ethers.ZeroAddress, []); await skaleDKG.setSuccessfulDKGPublic(schain2Id); }); @@ -230,7 +230,7 @@ describe("Wallets", () => { it("should automatically recharge wallet after creating schain by foundation", async () => { const amount = 1e9; - await schains.addSchainByFoundation(0, SchainType.TEST, 0, "schain-3", validator2.address, ethers.constants.AddressZero, [], {value: amount.toString()}); + await schains.addSchainByFoundation(0, SchainType.TEST, 0, "schain-3", validator2.address, ethers.ZeroAddress, [], {value: amount.toString()}); const schainBalance = await wallets.getSchainBalance(stringKeccak256("schain-3")); amount.should.be.equal(schainBalance.toNumber()); }); @@ -246,14 +246,14 @@ describe("Wallets", () => { }); it("should recharge schain wallet sending ETH to contract Wallets", async() => { - const amount = ethers.utils.parseEther("1.0"); + const amount = ethers.parseEther("1.0"); (await wallets.getSchainBalance(schain1Id)).toNumber().should.be.equal(0); await validator1.sendTransaction({to: wallets.address, value: amount}); (await wallets.getSchainBalance(schain1Id)).should.be.equal(amount); }); describe("when validators and schains wallets are recharged", () => { - const initialBalance = ethers.utils.parseEther("1"); + const initialBalance = ethers.parseEther("1"); let snapshotWithNodesAndSchains: number; @@ -298,7 +298,7 @@ describe("Wallets", () => { const validatorBalance = await wallets.getValidatorBalance(validator1Id); initialBalance.sub(spentValue).sub(validatorBalance).toNumber() - .should.be.almost(0, ethers.utils.parseEther(tolerance.toString()).toNumber()); + .should.be.almost(0, ethers.parseEther(tolerance.toString()).toNumber()); }); }); }); diff --git a/test/delegation/Delegation.ts b/test/delegation/Delegation.ts index 71c7fe36..689a122b 100644 --- a/test/delegation/Delegation.ts +++ b/test/delegation/Delegation.ts @@ -62,7 +62,7 @@ describe("Delegation", () => { let punisher: Punisher; let nodes: Nodes; - const defaultAmount = ethers.utils.parseEther("100"); + const defaultAmount = ethers.parseEther("100"); const month = 60 * 60 * 24 * 31; interface IValidator { @@ -139,7 +139,7 @@ describe("Delegation", () => { account: Wallet.createRandom().connect(ethers.provider) }); } - const etherAmount = ethers.utils.parseEther("5000"); + const etherAmount = ethers.parseEther("5000"); for (const newValidator of validators) { await holder1.sendTransaction({to: newValidator.account.address, value: etherAmount}); await validatorService.connect(newValidator.account).registerValidator("Validator", "Good Validator", 150, 0); @@ -189,7 +189,7 @@ describe("Delegation", () => { account: Wallet.createRandom().connect(ethers.provider) }); } - const etherAmount = ethers.utils.parseEther("5000"); + const etherAmount = ethers.parseEther("5000"); for (const newValidator of validators) { await holder1.sendTransaction({to: newValidator.account.address, value: etherAmount}); await validatorService.connect(newValidator.account).registerValidator("Validator", "Good Validator", 150, 0); @@ -435,26 +435,26 @@ describe("Delegation", () => { it("should not pay bounty for slashed tokens", async () => { const timeHelpersWithDebug = await deployTimeHelpersWithDebug(contractManager); await contractManager.setContractsAddress("TimeHelpers", timeHelpersWithDebug.address); - await skaleToken.mint(holder1.address, ethers.utils.parseEther("10000"), "0x", "0x"); - await skaleToken.mint(holder2.address, ethers.utils.parseEther("10000"), "0x", "0x"); + await skaleToken.mint(holder1.address, ethers.parseEther("10000"), "0x", "0x"); + await skaleToken.mint(holder2.address, ethers.parseEther("10000"), "0x", "0x"); - await constantsHolder.setMSR(ethers.utils.parseEther("2000")); + await constantsHolder.setMSR(ethers.parseEther("2000")); const slashingTable: SlashingTable = await deploySlashingTable(contractManager); const PENALTY_SETTER_ROLE = await slashingTable.PENALTY_SETTER_ROLE(); await slashingTable.grantRole(PENALTY_SETTER_ROLE, owner.address); - await slashingTable.setPenalty("FailedDKG", ethers.utils.parseEther("10000")); + await slashingTable.setPenalty("FailedDKG", ethers.parseEther("10000")); await constantsHolder.setLaunchTimestamp((await currentTime()) - 4 * month); - await delegationController.connect(holder1).delegate(validatorId, ethers.utils.parseEther("10000"), 2, "First delegation"); + await delegationController.connect(holder1).delegate(validatorId, ethers.parseEther("10000"), 2, "First delegation"); const delegationId1 = 0; await delegationController.connect(validator).acceptPendingDelegation(delegationId1); await timeHelpersWithDebug.skipTime(month); (await delegationController.getState(delegationId1)).should.be.equal(State.DELEGATED); - const bounty = ethers.utils.parseEther("1"); + const bounty = ethers.parseEther("1"); for (let i = 0; i < 5; ++i) { await skaleManagerMock.payBounty(validatorId, bounty); } @@ -466,14 +466,14 @@ describe("Delegation", () => { balance.should.be.equal(bounty.mul(5).mul(85).div(100)); await skaleToken.connect(bountyAddress).transfer(holder1.address, balance); - await punisher.slash(validatorId, ethers.utils.parseEther("10000")); + await punisher.slash(validatorId, ethers.parseEther("10000")); (await skaleToken.callStatic.getAndUpdateSlashedAmount(holder1.address)).toString() - .should.be.equal(ethers.utils.parseEther("10000")); + .should.be.equal(ethers.parseEther("10000")); (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toString() .should.be.equal("0"); - await delegationController.connect(holder2).delegate(validatorId, ethers.utils.parseEther("10000"), 2, "Second delegation"); + await delegationController.connect(holder2).delegate(validatorId, ethers.parseEther("10000"), 2, "Second delegation"); const delegationId2 = 1; await delegationController.connect(validator).acceptPendingDelegation(delegationId2); @@ -508,7 +508,7 @@ describe("Delegation", () => { for (let i = 0; i < holdersAmount; ++i) { holders.push(Wallet.createRandom().connect(ethers.provider)); } - const etherAmount = ethers.utils.parseEther("5000"); + const etherAmount = ethers.parseEther("5000"); await constantsHolder.setLaunchTimestamp(0); diff --git a/test/tools/deploy/contractManager.ts b/test/tools/deploy/contractManager.ts index 7f0b550c..c8ab4380 100644 --- a/test/tools/deploy/contractManager.ts +++ b/test/tools/deploy/contractManager.ts @@ -4,7 +4,7 @@ import {ContractManager} from "../../../typechain-types"; export async function deployContractManager() { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { const owner = (await ethers.getSigners())[0]; - await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.utils.parseEther("0.08")}); + await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); await ethers.provider.sendTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); } const contractFactory = await ethers.getContractFactory("ContractManager"); diff --git a/test/tools/signatures.ts b/test/tools/signatures.ts index c69abee2..0478971b 100644 --- a/test/tools/signatures.ts +++ b/test/tools/signatures.ts @@ -1,4 +1,4 @@ -import {BigNumberish, BytesLike, Signer, Wallet} from "ethers"; +import {BigNumberish, BytesLike, Signer, BaseWallet} from "ethers"; import {ethers} from "hardhat"; import {ec} from "elliptic"; @@ -15,9 +15,9 @@ export async function getValidatorIdSignature(validatorId: BigNumberish, signer: ); } -export function getPublicKey(wallet: Wallet): [BytesLike, BytesLike] { +export function getPublicKey(wallet: BaseWallet): [BytesLike, BytesLike] { const publicKey = secp256k1EC.keyFromPrivate(wallet.privateKey.slice(2)).getPublic(); - const pubA = ethers.utils.hexZeroPad(ethers.utils.hexlify(publicKey.getX().toBuffer()), 32); - const pubB = ethers.utils.hexZeroPad(ethers.utils.hexlify(publicKey.getY().toBuffer()), 32); + const pubA = ethers.utils.hexZeroPad(ethers.hexlify(publicKey.getX().toBuffer()), 32); + const pubB = ethers.utils.hexZeroPad(ethers.hexlify(publicKey.getY().toBuffer()), 32); return [pubA, pubB]; } From 96eeb580bd630258e8108121506970086549d9bb Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 20 Jun 2024 18:20:28 +0300 Subject: [PATCH 22/83] Fix nodeRotation --- gas/createSchain.ts | 2 +- gas/nodeRotation.ts | 81 ++++++++++++++++++++++----------------------- tsconfig.json | 2 +- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/gas/createSchain.ts b/gas/createSchain.ts index cd48bcf4..de9bfa7c 100644 --- a/gas/createSchain.ts +++ b/gas/createSchain.ts @@ -11,7 +11,7 @@ import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {fastBeforeEach} from "../test/tools/mocha"; import {SchainType} from "../test/tools/types"; -function findEvent(receipt: ContractTransactionReceipt | null, eventName: string) { +export function findEvent(receipt: ContractTransactionReceipt | null, eventName: string) { if (receipt) { const log = receipt.logs.find((event) => event instanceof EventLog && event.eventName === eventName); if (log) { diff --git a/gas/nodeRotation.ts b/gas/nodeRotation.ts index c117db20..c9bf3d3d 100644 --- a/gas/nodeRotation.ts +++ b/gas/nodeRotation.ts @@ -17,7 +17,7 @@ import {deploySkaleDKGTester} from "../test/tools/deploy/test/skaleDKGTester"; import {skipTime} from "../test/tools/time"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {ethers} from "hardhat"; -import {Event, Wallet} from "ethers"; +import {Wallet} from "ethers"; import fs from 'fs'; import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {stringKeccak256} from "../test/tools/hashes"; @@ -25,21 +25,8 @@ import {fastBeforeEach} from "../test/tools/mocha"; import {SchainType} from "../test/tools/types"; import {applySnapshot, makeSnapshot} from "../test/tools/snapshot"; import {deployNodes} from "../test/tools/deploy/nodes"; -import {TypedEvent} from "../typechain-types/common"; -import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; - -function findEvent(events: Event[] | undefined, eventName: string) { - if (events) { - const target = events.find((event) => event.event === eventName); - if (target) { - return target as TargetEvent; - } else { - throw new Error("Event was not emitted"); - } - } else { - throw new Error("Event was not emitted"); - } -} +import {findEvent} from "./createSchain"; + describe("nodeRotation", () => { let owner: SignerWithAddress; @@ -61,14 +48,14 @@ describe("nodeRotation", () => { contractManager = await deployContractManager(); schainsInternal = await deploySchainsInternalMock(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal.getAddress()); skaleDKG = await deploySkaleDKGTester(contractManager); validatorService = await deployValidatorService(contractManager); skaleManager = await deploySkaleManager(contractManager); schains = await deploySchains(contractManager); nodes = await deployNodes(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG.getAddress()); await validatorService.grantRole(await validatorService.VALIDATOR_MANAGER_ROLE(), owner.address); await nodes.grantRole(await nodes.NODE_MANAGER_ROLE(), owner.address); @@ -103,7 +90,7 @@ describe("nodeRotation", () => { for (let schainNumber = 0; schainNumber < numberOfSchains; schainNumber++) { const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.ZeroAddress, [])).wait(); await skaleDKG.setSuccessfulDKGPublic(stringKeccak256(`schain-${schainNumber}`)); - console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); + console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result?.gasUsed, "gu"); } await skaleManager.connect(node).createNode( @@ -124,16 +111,19 @@ describe("nodeRotation", () => { const gas = []; await nodes.initExit(rotIndex); for (let i = 0; i < schainHashes.length; i++) { - const estimatedGas = await skaleManager.connect(node).estimateGas.nodeExit(rotIndex); + const estimatedGas = await skaleManager.connect(node).nodeExit.estimateGas(rotIndex); console.log("Estimated gas on nodeExit", estimatedGas.toString()); const overrides = { gasLimit: estimatedGas } const result = await (await skaleManager.connect(node).nodeExit(rotIndex, overrides)).wait(); + if (!result) { + throw new Error(); + } // console.log("Gas limit was:", result); - console.log(`${i + 1}`, "Rotation on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); - gas.push(result.gasUsed.toNumber()); - if (result.gasUsed.toNumber() > gasLimit) { + console.log(`${i + 1}`, "Rotation on", nodesAmount, "nodes:\t", result?.gasUsed, "gu"); + gas.push(result?.gasUsed); + if (result?.gasUsed > gasLimit) { break; } await skaleDKG.setSuccessfulDKGPublic( @@ -174,7 +164,7 @@ describe("nodeRotation", () => { for (let schainNumber = 0; schainNumber < numberOfSchains; schainNumber++) { const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.ZeroAddress, [])).wait(); - const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const nodeInGroup = findEvent(result, "SchainNodes").args?.nodesInGroup; console.log("Nodes in Schain:"); const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { @@ -187,7 +177,7 @@ describe("nodeRotation", () => { console.log(nodeOfSchain.toNumber()); } await skaleDKG.setSuccessfulDKGPublic(stringKeccak256(`schain-${schainNumber}`)); - console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); + console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result?.gasUsed, "gu"); } await skaleManager.connect(node).createNode( @@ -206,20 +196,23 @@ describe("nodeRotation", () => { for(let test = 1; test <= numberOfSchains; ++test) { it(`should exit schain #${test}`, async () => { - if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + if (await ethers.provider.getBalance(node) < ethers.parseEther("0.1")) { await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } - const estimatedGas = await skaleManager.estimateGas.nodeExit(leavingNode); + const estimatedGas = await skaleManager.nodeExit.estimateGas(leavingNode); const overrides = { - gasLimit: Math.ceil(estimatedGas.toNumber() * 1.1) + gasLimit: estimatedGas * 11n / 10n } console.log("Estimated gas on nodeExit", overrides.gasLimit); const result = await (await skaleManager.connect(node).nodeExit(leavingNode, overrides)).wait(); + if (!result) { + throw new Error(); + } // console.log("Gas limit was:", result); - console.log(`${test}`, "Rotation on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); - gas.push(result.gasUsed.toNumber()); - if (result.gasUsed.toNumber() > gasLimit) { + console.log(`${test}`, "Rotation on", nodesAmount, "nodes:\t", result.gasUsed, "gu"); + gas.push(result.gasUsed); + if (result.gasUsed > gasLimit) { return; } await skaleDKG.setSuccessfulDKGPublic( @@ -238,7 +231,7 @@ describe("nodeRotation", () => { const maxNodesAmount = 200; const gasLimit = 12e6; - const measurementsSchainCreation: {nodesAmount: number, gasUsed:number}[] = []; + const measurementsSchainCreation: {nodesAmount: number, gasUsed: bigint}[] = []; const measurementsRotation = []; const activeNodes: number[] = []; @@ -255,7 +248,7 @@ describe("nodeRotation", () => { }); beforeEach(async () => { - if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + if (await ethers.provider.getBalance(node) < ethers.parseEther("0.1")) { await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } @@ -274,11 +267,14 @@ describe("nodeRotation", () => { nodesAmount = nodeId; if (nodesAmount >= 16) { const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${nodeId}`, owner.address, ethers.ZeroAddress, [])).wait(); + if (!result) { + throw new Error(); + } await skaleDKG.setSuccessfulDKGPublic(stringKeccak256(`schain-${nodeId}`)); - console.log("create schain on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); + console.log("create schain on", nodesAmount, "nodes:\t", result.gasUsed, "gu"); - measurementsSchainCreation.push({nodesAmount, gasUsed: result.gasUsed.toNumber()}); - if (result.gasUsed.toNumber() > gasLimit) { + measurementsSchainCreation.push({nodesAmount, gasUsed: result.gasUsed}); + if (result.gasUsed > gasLimit) { return; } } @@ -297,19 +293,22 @@ describe("nodeRotation", () => { const gas = []; await nodes.initExit(leavingNode); for (let i = 0; i < schainHashes.length; i++) { - if ((await node.getBalance()).lt(ethers.parseEther("0.1"))) { + if (await ethers.provider.getBalance(node) < ethers.parseEther("0.1")) { await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } - const estimatedGas = await skaleManager.connect(node).estimateGas.nodeExit(leavingNode); + const estimatedGas = await skaleManager.connect(node).nodeExit.estimateGas(leavingNode); console.log("Estimated gas on nodeExit", estimatedGas.toString()); const overrides = { gasLimit: estimatedGas } const result = await (await skaleManager.connect(node).nodeExit(leavingNode, overrides)).wait(); + if (!result) { + throw new Error(); + } // console.log("Gas limit was:", result); - console.log(`${i + 1}`, "Rotation on", nodesAmount, "nodes:\t", result.gasUsed.toNumber(), "gu"); - gas.push(result.gasUsed.toNumber()); - if (result.gasUsed.toNumber() > gasLimit) { + console.log(`${i + 1}`, "Rotation on", nodesAmount, "nodes:\t", result.gasUsed, "gu"); + gas.push(result.gasUsed); + if (result.gasUsed > gasLimit) { break; } await skaleDKG.setSuccessfulDKGPublic( diff --git a/tsconfig.json b/tsconfig.json index 2ca1d5a0..a60f4c43 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2018", + "target": "es2020", "module": "commonjs", "strict": true, "esModuleInterop": true, From 3f536f6a1d65d0c24343836903928b8ee0b757eb Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 20 Jun 2024 18:22:43 +0300 Subject: [PATCH 23/83] Fix hardhat.config.ts --- hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index b0f4279c..3be32612 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -16,7 +16,7 @@ task("erc1820", "Deploy ERC1820 contract", async (_, {ethers}) => { const [ owner,] = await ethers.getSigners(); let transaction = await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); await transaction.wait(); - transaction = await ethers.provider.sendTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); + transaction = await ethers.provider.broadcastTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); await transaction.wait(); } }); From 7406569e5446e05d3f179fd9c580689734e96482 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 20 Jun 2024 18:27:57 +0300 Subject: [PATCH 24/83] Fix Treetest --- long-test/Treetest.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/long-test/Treetest.ts b/long-test/Treetest.ts index 95a6e6dc..46c2c57b 100644 --- a/long-test/Treetest.ts +++ b/long-test/Treetest.ts @@ -52,11 +52,11 @@ async function getIndexInSpaceMap(nodes: Nodes, nodeId: number) { return res.indexInSpaceMap.toString(); } -async function getSpaceToNodes(nodes: Nodes, space: number, index: number) { - return (await nodes.spaceToNodes(space.toString(), index.toString())).toString(); +async function getSpaceToNodes(nodes: Nodes, space: bigint, index: number) { + return (await nodes.spaceToNodes(space, index)).toString(); } -async function checkSpaceToNodes(nodes: Nodes, space: number, length: number) { +async function checkSpaceToNodes(nodes: Nodes, space: bigint, length: bigint) { for (let i = 0; i < length; i++) { const posNode = await getSpaceToNodes(nodes, space, i); const freeSpace = await getFreeSpaceOfNode(nodes, parseInt(posNode, 10)); @@ -66,21 +66,21 @@ async function checkSpaceToNodes(nodes: Nodes, space: number, length: number) { } } -async function countNodesWithFreeSpace(nodes: Nodes, freeSpace: number) { - return (await nodes.countNodesWithFreeSpace(freeSpace.toString())).toString(); +async function countNodesWithFreeSpace(nodes: Nodes, freeSpace: bigint) { + return await nodes.countNodesWithFreeSpace(freeSpace); } -async function checkTreeAndSpaceToNodesPart(nodes: Nodes, space: number) { +async function checkTreeAndSpaceToNodesPart(nodes: Nodes, space: bigint) { const countNodes = await countNodesWithFreeSpace(nodes, space); - const countNodesPlus = (space === 128 ? "0" : await countNodesWithFreeSpace(nodes, space + 1)); - await checkSpaceToNodes(nodes, space, parseInt(countNodes, 10) - parseInt(countNodesPlus, 10)); + const countNodesPlus = (space === 128n ? 0n : await countNodesWithFreeSpace(nodes, space + 1n)); + await checkSpaceToNodes(nodes, space, countNodes - countNodesPlus); } async function checkTreeAndSpaceToNodes(nodes: Nodes) { - const numberOfActiveNodes = (await nodes.numberOfActiveNodes()).toString(); - const nodesInTree = await countNodesWithFreeSpace(nodes, 0); + const numberOfActiveNodes = await nodes.numberOfActiveNodes(); + const nodesInTree = await countNodesWithFreeSpace(nodes, 0n); assert(numberOfActiveNodes === nodesInTree, "Incorrect number of active nodes and nodes in tree"); - for (let i = 0; i <= 128; i++) { + for (let i = 0n; i <= 128; i++) { await checkTreeAndSpaceToNodesPart(nodes, i); } } @@ -240,7 +240,7 @@ describe("Tree test", () => { contractManager = await deployContractManager(); schainsInternal = await deploySchainsInternalMock(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); skaleDKG = await deploySkaleDKGTester(contractManager); nodes = await deployNodes(contractManager); @@ -249,7 +249,7 @@ describe("Tree test", () => { skaleManager = await deploySkaleManager(contractManager); schains = await deploySchains(contractManager); nodeRotation = await deployNodeRotation(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); await validatorService.connect(validator).registerValidator("Validator", "D2", 0, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); From 929ef47601afc9226cfbadcc9f1316c59df5c172 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 20 Jun 2024 18:30:08 +0300 Subject: [PATCH 25/83] Fix createSchain --- long-test/createSchain.ts | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/long-test/createSchain.ts b/long-test/createSchain.ts index 3b51f245..13a7542b 100644 --- a/long-test/createSchain.ts +++ b/long-test/createSchain.ts @@ -7,24 +7,11 @@ import {privateKeys} from "../test/tools/private-keys"; import {deploySchains} from "../test/tools/deploy/schains"; import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; -import {Event, Wallet} from "ethers"; +import {Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; import {SchainType} from "../test/tools/types"; -import {TypedEvent} from "../typechain-types/common"; -import {SchainNodesEvent} from "../typechain-types/artifacts/@skalenetwork/skale-manager-interfaces/ISchains"; +import {findEvent} from "../gas/createSchain"; -function findEvent(events: Event[] | undefined, eventName: string) { - if (events) { - const target = events.find((event) => event.event === eventName); - if (target) { - return target as TargetEvent; - } else { - throw new Error("Event was not emitted"); - } - } else { - throw new Error("Event was not emitted"); - } -} describe("Schain creation test", () => { let owner: SignerWithAddress; @@ -44,7 +31,7 @@ describe("Schain creation test", () => { contractManager = await deployContractManager(); schainsInternal = await deploySchainsInternalMock(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); validatorService = await deployValidatorService(contractManager); skaleManager = await deploySkaleManager(contractManager); schains = await deploySchains(contractManager); @@ -75,7 +62,7 @@ describe("Schain creation test", () => { console.log(type); for (let try1 = 0; try1 < 32; try1++) { const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}${try1}`, owner.address, ethers.ZeroAddress, [])).wait(); - const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const nodeInGroup = findEvent(result, "SchainNodes").args?.nodesInGroup; const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { if (!setOfNodes.has(nodeOfSchain.toNumber())) { @@ -86,12 +73,12 @@ describe("Schain creation test", () => { } console.log(nodeOfSchain.toNumber()); } - console.log(`create schain-${tries}${try1}`, result.gasUsed.toNumber(), "gu"); + console.log(`create schain-${tries}${try1}`, result?.gasUsed, "gu"); } for (let try2 = 0; try2 < 32; try2++) { const resDel = await (await skaleManager.deleteSchain(`schain-${tries}${try2}`)).wait(); - console.log(`delete schain-${tries}${try2}`, resDel.gasUsed.toNumber(), "gu"); + console.log(`delete schain-${tries}${try2}`, resDel?.gasUsed, "gu"); } } }); @@ -120,7 +107,7 @@ describe("Schain creation test", () => { const type = Math.floor(Math.random() * 2) + 1; console.log(type); const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}`, owner.address, ethers.ZeroAddress, [])).wait(); - const nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const nodeInGroup = findEvent(result, "SchainNodes").args?.nodesInGroup; const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { if (!setOfNodes.has(nodeOfSchain.toNumber())) { @@ -132,9 +119,9 @@ describe("Schain creation test", () => { console.log(nodeOfSchain.toNumber()); } - console.log(`create schain-${tries}`, result.gasUsed.toNumber(), "gu"); + console.log(`create schain-${tries}`, result?.gasUsed, "gu"); const resDel = await (await skaleManager.deleteSchain(`schain-${tries}`)).wait(); - console.log(`delete schain-${tries}`, resDel.gasUsed.toNumber(), "gu"); + console.log(`delete schain-${tries}`, resDel?.gasUsed, "gu"); } }); }); From 2a7eac7a5448ea4397677c68cf47287c5bcac2fd Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 20 Jun 2024 18:40:19 +0300 Subject: [PATCH 26/83] Fix deploy --- migrations/deploy.ts | 29 ++++++++++++++--------------- package.json | 2 +- yarn.lock | 37 ++++++++++++++++++++++++++----------- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 7b9953d3..ec44f764 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -1,5 +1,4 @@ import {promises as fs} from 'fs'; -import {Interface} from "ethers/lib/utils"; import {ethers, upgrades, network, run} from "hardhat"; import {ContractManager, SkaleManager, SkaleToken} from "../typechain-types"; import { @@ -9,11 +8,11 @@ import { verifyProxy, getContractFactory, } from '@skalenetwork/upgrade-tools'; -import {Contract} from 'ethers'; +import {AddressLike, Contract, Interface} from 'ethers'; import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; -function getInitializerParameters(contract: string, contractManagerAddress: string) { +function getInitializerParameters(contract: string, contractManagerAddress: AddressLike) { if (["TimeHelpers", "Decryption", "ECDH"].includes(contract)) { return undefined; } else if (["TimeHelpersWithDebug"].includes(contract)) { @@ -93,11 +92,11 @@ async function main() { const contractManagerName = "ContractManager"; console.log("Deploy", contractManagerName); const contractManagerFactory = await ethers.getContractFactory(contractManagerName); - const contractManager = (await upgrades.deployProxy(contractManagerFactory, [])) as ContractManager; - await contractManager.deployTransaction.wait(); + const contractManager = await upgrades.deployProxy(contractManagerFactory, []); + await contractManager.waitForDeployment(); console.log("Register", contractManagerName); - await (await contractManager.setContractsAddress(contractManagerName, contractManager.address)).wait(); - contractArtifacts.push({address: contractManager.address, interface: contractManager.interface, contract: contractManagerName}) + await (await contractManager.setContractsAddress(contractManagerName, contractManager)).wait(); + contractArtifacts.push({address: await contractManager.getAddress(), interface: contractManager.interface, contract: contractManagerName}) for (const contract of contracts.filter(contractName => contractName != "ContractManager")) { const contractFactory = await getContractFactory(contract); @@ -108,12 +107,12 @@ async function main() { try { proxy = await upgrades.deployProxy( contractFactory, - getInitializerParameters(contract, contractManager.address), + getInitializerParameters(contract, contractManager), { unsafeAllowLinkedLibraries: true } ); - await proxy.deployTransaction.wait(); + await proxy.waitForDeployment(); } catch (e) { if (e instanceof TransactionMinedTimeout) { console.log(e); @@ -130,12 +129,12 @@ async function main() { console.log("Register", contract, "as", contractName, "=>", proxy.address); const transaction = await contractManager.setContractsAddress(contractName, proxy.address); await transaction.wait(); - contractArtifacts.push({address: proxy.address, interface: proxy.interface, contract}); + contractArtifacts.push({address: await proxy.getAddress(), interface: proxy.interface, contract}); if (contract === "SkaleManager") { try { console.log(`Set version ${version}`) - await (await (proxy as SkaleManager).setVersion(version)).wait(); + await (await proxy.setVersion(version)).wait(); } catch { console.log("Failed to set skale-manager version"); } @@ -145,11 +144,11 @@ async function main() { const skaleTokenName = "SkaleToken"; console.log("Deploy", skaleTokenName); const skaleTokenFactory = await ethers.getContractFactory(skaleTokenName); - const skaleToken = await skaleTokenFactory.deploy(contractManager.address, []) as SkaleToken; - await skaleToken.deployTransaction.wait(); + const skaleToken = await skaleTokenFactory.deploy(contractManager.address, []); + await skaleToken.waitForDeployment(); console.log("Register", skaleTokenName); await (await contractManager.setContractsAddress(skaleTokenName, skaleToken.address)).wait(); - contractArtifacts.push({address: skaleToken.address, interface: skaleToken.interface, contract: skaleTokenName}); + contractArtifacts.push({address: await skaleToken.getAddress(), interface: skaleToken.interface, contract: skaleTokenName}); if (!production) { console.log("Do actions for non production deployment"); @@ -182,7 +181,7 @@ async function main() { console.log("Verify contracts"); for (const artifact of contractArtifacts) { if (artifact.contract === skaleTokenName) { - await verify(skaleTokenName, skaleToken.address, [contractManager.address, []]); + await verify(skaleTokenName, await skaleToken.getAddress(), [contractManager.address, []]); } else { await verifyProxy(artifact.contract, artifact.address, []) } diff --git a/package.json b/package.json index aa8c02c9..8c54d3b2 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@nomicfoundation/hardhat-ethers": "^3.0.0", "@openzeppelin/contracts": "^4.9.3", "@openzeppelin/contracts-upgradeable": "^4.9.6", - "@openzeppelin/hardhat-upgrades": "^2.1.0", + "@openzeppelin/hardhat-upgrades": "^3.1.1", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", "@skalenetwork/upgrade-tools": "^3.0.0-linter.34", "@typechain/hardhat": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 1debd198..3894c559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1496,7 +1496,7 @@ lodash "^4.17.19" node-fetch "^2.6.0" -"@openzeppelin/defender-sdk-base-client@^1.13.4", "@openzeppelin/defender-sdk-base-client@^1.8.0": +"@openzeppelin/defender-sdk-base-client@^1.10.0", "@openzeppelin/defender-sdk-base-client@^1.13.4": version "1.13.4" resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.13.4.tgz#51b25d46bb766e7a107b9a87ca623fae3ad5a8c3" integrity sha512-fZjDxdL5WBt6kjKN8j6WlfIsggZKv37W1KoRkT0XwYv7Jslmr22i2qUs8ZreAzATD3ESYQs7YlO7ge0ElqdOKg== @@ -1504,7 +1504,7 @@ amazon-cognito-identity-js "^6.3.6" async-retry "^1.3.3" -"@openzeppelin/defender-sdk-deploy-client@^1.8.0": +"@openzeppelin/defender-sdk-deploy-client@^1.10.0": version "1.13.4" resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-1.13.4.tgz#f5f6997774d7ea8c5ea9be5d4b0ead041270f671" integrity sha512-1SbdImpjCYmjpDgK7Bff4vak29r/aECabVuQi5TB+7TdbOuRdVxDHu7vFhEpt3yrcPKW1joaNiUNDEc/noUsNQ== @@ -1513,23 +1513,33 @@ axios "^1.6.8" lodash "^4.17.21" -"@openzeppelin/hardhat-upgrades@^2.1.0": - version "2.5.1" - resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-2.5.1.tgz#cc7db363807751a02ea1b1fa2f25d34c03384234" - integrity sha512-wRwq9f2PqlfIdNGFApsqRpqptqy98exSFp8SESb6Brgw4L07sExySInNJhscM/tWVSnR1Qnuws9Ck6Fs5zIxvg== +"@openzeppelin/defender-sdk-network-client@^1.10.0": + version "1.13.4" + resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-network-client/-/defender-sdk-network-client-1.13.4.tgz#98ba517bb32810d0f76b5f64a83f42ad4ca182bb" + integrity sha512-m76WQzqFET4jtFgA74V6Ui4czRoTvBy7leS+BbsIxoKX+NGODhs78y5zq7jSxsLu3c2iY69rujRkzj0Z+sCiiQ== + dependencies: + "@openzeppelin/defender-sdk-base-client" "^1.13.4" + axios "^1.6.8" + lodash "^4.17.21" + +"@openzeppelin/hardhat-upgrades@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.1.1.tgz#3dcb47233355d06ec6080463ed06c15187a6fd25" + integrity sha512-CejZfBX6ROh+bZfsImoaWDftNgrZz4CffpPzEDTCRpN980ShJlA2+zsb/bFM5Z3ucy+6BfJx4W/dn9BTkn7AOA== dependencies: "@openzeppelin/defender-admin-client" "^1.52.0" "@openzeppelin/defender-base-client" "^1.52.0" - "@openzeppelin/defender-sdk-base-client" "^1.8.0" - "@openzeppelin/defender-sdk-deploy-client" "^1.8.0" - "@openzeppelin/upgrades-core" "^1.31.2" + "@openzeppelin/defender-sdk-base-client" "^1.10.0" + "@openzeppelin/defender-sdk-deploy-client" "^1.10.0" + "@openzeppelin/defender-sdk-network-client" "^1.10.0" + "@openzeppelin/upgrades-core" "^1.32.0" chalk "^4.1.0" debug "^4.1.1" ethereumjs-util "^7.1.5" proper-lockfile "^4.1.1" - undici "^5.14.0" + undici "^6.11.1" -"@openzeppelin/upgrades-core@^1.31.2": +"@openzeppelin/upgrades-core@^1.32.0": version "1.34.1" resolved "https://registry.yarnpkg.com/@openzeppelin/upgrades-core/-/upgrades-core-1.34.1.tgz#660301692e706c7e701395467267128cc43c1de9" integrity sha512-LV3hHm60htmP3HJjn2VoGqXNPn1RLFSSInRyXNbm15Z2oWKGxOfAWSC4+okRckum0yVB5g3k4/SEyqjsJRB07A== @@ -11553,6 +11563,11 @@ undici@^5.14.0: dependencies: busboy "^1.6.0" +undici@^6.11.1: + version "6.19.2" + resolved "https://registry.yarnpkg.com/undici/-/undici-6.19.2.tgz#231bc5de78d0dafb6260cf454b294576c2f3cd31" + integrity sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA== + unfetch@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be" From 8e1df52ee888633ba425d5c3ff10cf777d5862e4 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 25 Jun 2024 15:35:08 +0300 Subject: [PATCH 27/83] Upgrade upgrade-tools --- package.json | 2 +- yarn.lock | 664 ++++++--------------------------------------------- 2 files changed, 74 insertions(+), 592 deletions(-) diff --git a/package.json b/package.json index 8c54d3b2..b1cdb89d 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.6", "@openzeppelin/hardhat-upgrades": "^3.1.1", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", - "@skalenetwork/upgrade-tools": "^3.0.0-linter.34", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.36", "@typechain/hardhat": "^7.0.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 3894c559..d89b89cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -515,44 +515,6 @@ patch-package "^6.2.2" postinstall-postinstall "^2.1.0" -"@ethereumjs/common@2.5.0": - version "2.5.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.5.0.tgz#ec61551b31bef7a69d1dc634d8932468866a4268" - integrity sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.1" - -"@ethereumjs/common@^2.5.0": - version "2.6.5" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - -"@ethereumjs/rlp@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" - integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== - -"@ethereumjs/tx@3.3.2": - version "3.3.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.2.tgz#348d4624bf248aaab6c44fec2ae67265efe3db00" - integrity sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog== - dependencies: - "@ethereumjs/common" "^2.5.0" - ethereumjs-util "^7.1.2" - -"@ethereumjs/util@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.1.0.tgz#299df97fb6b034e0577ce9f94c7d9d1004409ed4" - integrity sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA== - dependencies: - "@ethereumjs/rlp" "^4.0.1" - ethereum-cryptography "^2.0.0" - micro-ftch "^0.3.1" - "@ethersproject/abi@5.0.0-beta.153": version "5.0.0-beta.153" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz#43a37172b33794e4562999f6e2d555b7599a8eee" @@ -568,7 +530,7 @@ "@ethersproject/properties" ">=5.0.0-beta.131" "@ethersproject/strings" ">=5.0.0-beta.130" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -710,7 +672,7 @@ dependencies: "@ethersproject/bignumber" "^5.5.0" -"@ethersproject/contracts@5.7.0", "@ethersproject/contracts@^5.7.0": +"@ethersproject/contracts@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== @@ -937,7 +899,7 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/solidity@5.7.0", "@ethersproject/solidity@^5.7.0": +"@ethersproject/solidity@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== @@ -967,7 +929,7 @@ "@ethersproject/constants" "^5.5.0" "@ethersproject/logger" "^5.5.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -1108,13 +1070,6 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@noble/curves@1.1.0", "@noble/curves@~1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" - integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== - dependencies: - "@noble/hashes" "1.3.1" - "@noble/curves@1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" @@ -1127,16 +1082,16 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== -"@noble/hashes@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" - integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== - -"@noble/hashes@1.3.2", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": +"@noble/hashes@1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== +"@noble/hashes@^1.3.3": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -1590,48 +1545,42 @@ path-browserify "^1.0.0" url "^0.11.0" -"@safe-global/api-kit@^1.3.0": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@safe-global/api-kit/-/api-kit-1.3.1.tgz#108f5ba2f3770354abcec91225cc1ae21ee417a8" - integrity sha512-JKvCNs8p+42+N8pV2MIqoXlBLckTe5CKboVT7t9mTluuA66i5W8+Kr+B5j9D//EIU5vO7iSOOIYnJuA2ck4XRQ== +"@safe-global/api-kit@^2.4.1": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@safe-global/api-kit/-/api-kit-2.4.2.tgz#9f297bcf95fe11501ce30065367d6085cbd92d84" + integrity sha512-a5VW3SyUP6VEP1MPks3X6QGUOUq4nfepP00g4g01h6a5cjk4PMjbzPBGPYocLPwkyP7skLOn/r8WJn0tUN9eiA== dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@safe-global/safe-core-sdk-types" "^2.3.0" - node-fetch "^2.6.6" + "@safe-global/protocol-kit" "^4.0.2" + "@safe-global/safe-core-sdk-types" "^5.0.2" + ethers "^6.13.1" + node-fetch "^2.7.0" -"@safe-global/protocol-kit@^1.2.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@safe-global/protocol-kit/-/protocol-kit-1.3.0.tgz#fb84a3797a4afc74ac7fc218e796037d6e3cc3cc" - integrity sha512-zBhwHpaUggywmnR1Xm5RV22DpyjmVWYP3pnOl4rcf9LAc1k7IVmw6WIt2YVhHRaWGxVYMd4RitJX8Dx2+8eLZQ== +"@safe-global/protocol-kit@^4.0.1", "@safe-global/protocol-kit@^4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@safe-global/protocol-kit/-/protocol-kit-4.0.2.tgz#5555e65359eeb5d210608aaa1ab889df15c14150" + integrity sha512-csmBR22XY0Sgx2Q6WSdRiAPj5UlR3FxrMeoAqUbV7kCzT7SVXBwrsRqLjiW2+B59Dgcxs6fR8aLjl7maweBPXw== dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/solidity" "^5.7.0" - "@safe-global/safe-deployments" "^1.26.0" + "@noble/hashes" "^1.3.3" + "@safe-global/safe-core-sdk-types" "^5.0.2" + "@safe-global/safe-deployments" "^1.37.0" + abitype "^1.0.2" ethereumjs-util "^7.1.5" - semver "^7.5.4" - web3 "^1.8.1" - web3-core "^1.8.1" - web3-utils "^1.8.1" - zksync-web3 "^0.14.3" + ethers "^6.13.1" + semver "^7.6.2" -"@safe-global/safe-core-sdk-types@^2.2.0", "@safe-global/safe-core-sdk-types@^2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@safe-global/safe-core-sdk-types/-/safe-core-sdk-types-2.3.0.tgz#e3be109e58a2d224d1b89052563b04f3efed4bec" - integrity sha512-dU0KkDV1KJNf11ajbUjWiSi4ygdyWfhk1M50lTJWUdCn1/2Bsb/hICM8LoEk6DCoFumxaoCet02SmYakXsW2CA== +"@safe-global/safe-core-sdk-types@^5.0.1", "@safe-global/safe-core-sdk-types@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@safe-global/safe-core-sdk-types/-/safe-core-sdk-types-5.0.2.tgz#9552f5793581333c81676986b3eb19697e1c6627" + integrity sha512-UK2WL9nXN/8ez4Upx1D0KhtNXwkEjuV5O2XDem4Jchw5IBCLJnLowUBgEq8Tw4xdB7x2rw72VFAJXYZ/iY4qYw== dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/contracts" "^5.7.0" - "@safe-global/safe-deployments" "^1.26.0" - web3-core "^1.8.1" - web3-utils "^1.8.1" + abitype "^1.0.2" -"@safe-global/safe-deployments@^1.26.0": - version "1.27.0" - resolved "https://registry.yarnpkg.com/@safe-global/safe-deployments/-/safe-deployments-1.27.0.tgz#e074d88543d084764b8bef7e3bddd238ac0d6819" - integrity sha512-Fj6NW2JwSrC3vFIiheTRBGTAdZJSUtXk4rTkZgGoO8MnFM+pWU2pJU2rWzH3EYOXvrndxT2UxsiUIkTbmB2hkw== +"@safe-global/safe-deployments@^1.37.0": + version "1.37.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-deployments/-/safe-deployments-1.37.0.tgz#3fc33fe03abcf404e261f3d5988791dd0a979558" + integrity sha512-OInLNWC9EPem/eOsvPdlq4Gt/08Nfhslm9z6T92Jvjmcu6hs85vjfnDP1NrzwcOmsCarATU5NH2bTITd9VNCPw== dependencies: - semver "^7.3.7" + semver "^7.6.0" "@scure/base@~1.1.0": version "1.1.1" @@ -1647,15 +1596,6 @@ "@noble/secp256k1" "~1.7.0" "@scure/base" "~1.1.0" -"@scure/bip32@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.1.tgz#7248aea723667f98160f593d621c47e208ccbb10" - integrity sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A== - dependencies: - "@noble/curves" "~1.1.0" - "@noble/hashes" "~1.3.1" - "@scure/base" "~1.1.0" - "@scure/bip39@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" @@ -1664,14 +1604,6 @@ "@noble/hashes" "~1.2.0" "@scure/base" "~1.1.0" -"@scure/bip39@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" - integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== - dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@sentry/core@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3" @@ -1745,11 +1677,6 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== -"@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== - "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -1764,18 +1691,18 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@skalenetwork/skale-contracts-ethers-v5@^1.0.1-develop.0": - version "1.0.1-develop.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts-ethers-v5/-/skale-contracts-ethers-v5-1.0.1-develop.0.tgz#868ad040b20033a06270d75491d26f486c709d04" - integrity sha512-A0R7LjX2vsCqQ6u/4ujZetAA5EY7Czq3vKv8NIhoDjpwn6LKZrI6dwywmsgw3DZUNE+31md1TiQEIjiHWscibA== +"@skalenetwork/skale-contracts-ethers-v6@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts-ethers-v6/-/skale-contracts-ethers-v6-1.0.0.tgz#2ec9e1e6113c0b0e0e7abaa492702baa9d647148" + integrity sha512-V9sttSFsntgQiQouxnL/Mr2pLQWX7hXy4fmM8d9x2UFfSbLCVXJth/n0YzEGSxEzjSN5IPvOBRJ4kdxyGauTUg== dependencies: - "@skalenetwork/skale-contracts" "1.0.1-develop.0" - ethers "^5.7.2" + "@skalenetwork/skale-contracts" "1.0.0" + ethers "^6.7.1" -"@skalenetwork/skale-contracts@1.0.1-develop.0": - version "1.0.1-develop.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-1.0.1-develop.0.tgz#4407ec4667cec27889263011f89badfd35d6ebf9" - integrity sha512-2IiRdso3ik4mOi6rX5mSMaKe3zgm13bMaUeez7ykN70xNDQteTCh0wSAE75ZK0g/dE5AGlfylW5H6lWeu3VMKQ== +"@skalenetwork/skale-contracts@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-contracts/-/skale-contracts-1.0.0.tgz#0135e67086714eebd7f936100714c3bcc89384df" + integrity sha512-uTvjAlfFL6XRa9p0ogcXO3k9w6bm1UCHRbtKsfb5VrnqQKcCsJoJ9sX55Rcj1YNVy4Dy2E5H8NFVhGUUp0rwtQ== dependencies: axios "^1.4.0" @@ -1784,15 +1711,15 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.0.0-develop.2.tgz#100508cda8a675b62a28a76c7e526617240ffd0c" integrity sha512-ua92l+QAfPymtWn8lLpoFUyZ1t4I5ae1RCHEU96aSfkA6hVqxiXCRXJzbcDJR0HPtvOmbgF/iKc/LXtCEe9rvA== -"@skalenetwork/upgrade-tools@^3.0.0-linter.34": - version "3.0.0-linter.34" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.34.tgz#536ace4e8bff587edefe0c5faf1a858a1e4f4bac" - integrity sha512-/5F1nUGTYOJ0rBJ6QNnXttFdgZru2761G9FyNO3UMc2y4WqM4/ShpSTz4P2GcpnblwKW7GWBRV0vWTeI9pmeaQ== +"@skalenetwork/upgrade-tools@^3.0.0-linter.36": + version "3.0.0-linter.36" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.36.tgz#144f23d5fc624bfe19dfd87c21f2606dd5ae425b" + integrity sha512-A726bU01F+otZn9pjypHHIXGB/bZHW3nGhtuYrk8uE7PO3bvhnERjNXh/bxZFqVvF3aUGxEzeoWZYHpviBqO+w== dependencies: - "@safe-global/api-kit" "^1.3.0" - "@safe-global/protocol-kit" "^1.2.0" - "@safe-global/safe-core-sdk-types" "^2.2.0" - "@skalenetwork/skale-contracts-ethers-v5" "^1.0.1-develop.0" + "@safe-global/api-kit" "^2.4.1" + "@safe-global/protocol-kit" "^4.0.1" + "@safe-global/safe-core-sdk-types" "^5.0.1" + "@skalenetwork/skale-contracts-ethers-v6" "^1.0.0" axios "^1.4.0" ethereumjs-util "^7.1.4" @@ -1817,13 +1744,6 @@ dependencies: defer-to-connect "^1.0.1" -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - "@trufflesuite/bigint-buffer@1.1.10": version "1.1.10" resolved "https://registry.yarnpkg.com/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz#a1d9ca22d3cad1a138b78baaf15543637a3e1692" @@ -1883,7 +1803,7 @@ dependencies: fs-extra "^9.1.0" -"@types/bn.js@*", "@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": +"@types/bn.js@*", "@types/bn.js@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== @@ -1897,16 +1817,6 @@ dependencies: "@types/node" "*" -"@types/cacheable-request@^6.0.2": - version "6.0.3" - resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183" - integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== - dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "^3.1.4" - "@types/node" "*" - "@types/responselike" "^1.0.0" - "@types/chai-almost@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/chai-almost/-/chai-almost-1.0.1.tgz#e8a2de03b53c22e9a2dd2c85ef98bde5f19b685c" @@ -1955,23 +1865,11 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/http-cache-semantics@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" - integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== - "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/keyv@^3.1.4": - version "3.1.4" - resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6" - integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== - dependencies: - "@types/node" "*" - "@types/lru-cache@5.1.1", "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" @@ -2043,13 +1941,6 @@ dependencies: "@types/node" "*" -"@types/responselike@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" - integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== - dependencies: - "@types/node" "*" - "@types/secp256k1@^4.0.1": version "4.0.3" resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz#1b8e55d8e00f08ee7220b4d59a6abe89c37a901c" @@ -2186,10 +2077,10 @@ abbrev@1.0.x: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" integrity sha1-kbR5JYinc4wl813W9jdSovh3YTU= -abortcontroller-polyfill@^1.7.5: - version "1.7.5" - resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" - integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== +abitype@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.4.tgz#a817ff44860e8a84e9a37ed22aa9b738dbb51dba" + integrity sha512-UivtYZOGJGE8rsrM/N5vdRkUpqEZVmuTumfTuolm7m/6O09wprd958rx8kUBwVAAAhQDveGAgD0GJdBuR8s6tw== abstract-level@1.0.3: version "1.0.3" @@ -3652,11 +3543,6 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz#0330a543471c61faa4e9035db583aad753b36385" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - cacheable-request@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" @@ -3670,19 +3556,6 @@ cacheable-request@^6.0.0: normalize-url "^4.1.0" responselike "^1.0.2" -cacheable-request@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.4.tgz#7a33ebf08613178b403635be7b899d3e69bbe817" - integrity sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - cachedown@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cachedown/-/cachedown-1.0.0.tgz#d43f036e4510696b31246d7db31ebf0f7ac32d15" @@ -4238,14 +4111,6 @@ cosmiconfig@^8.0.0: parse-json "^5.0.0" path-type "^4.0.0" -crc-32@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.1.tgz#436d2bcaad27bcb6bd073a2587139d3024a16460" - integrity sha512-Dn/xm/1vFFgs3nfrpEVScHoIslO9NZRITWGz/1E/St6u4xw99vfZzVkW0OSnzx2h9egej9xwMCEut6sqwokM/w== - dependencies: - exit-on-epipe "~1.0.1" - printj "~1.3.1" - create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -4290,13 +4155,6 @@ cross-fetch@^2.1.0, cross-fetch@^2.1.1: node-fetch "2.6.1" whatwg-fetch "2.0.4" -cross-fetch@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983" - integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g== - dependencies: - node-fetch "^2.6.12" - cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -4549,13 +4407,6 @@ decompress-response@^3.2.0, decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" -decompress-response@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" - integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== - dependencies: - mimic-response "^3.1.0" - deep-eql@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-2.0.2.tgz#b1bac06e56f0a76777686d50c9feb75c2ed7679a" @@ -4597,11 +4448,6 @@ defer-to-connect@^1.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== -defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - deferred-leveldown@~1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" @@ -5116,11 +4962,6 @@ es6-iterator@^2.0.3: es5-ext "^0.10.35" es6-symbol "^3.1.1" -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - es6-symbol@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" @@ -5474,16 +5315,6 @@ ethereum-cryptography@^1.0.3: "@scure/bip32" "1.1.5" "@scure/bip39" "1.1.1" -ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz#18fa7108622e56481157a5cb7c01c0c6a672eb67" - integrity sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug== - dependencies: - "@noble/curves" "1.1.0" - "@noble/hashes" "1.3.1" - "@scure/bip32" "1.3.1" - "@scure/bip39" "1.2.1" - ethereum-waffle@^3.4.4: version "3.4.4" resolved "https://registry.yarnpkg.com/ethereum-waffle/-/ethereum-waffle-3.4.4.tgz#1378b72040697857b7f5e8f473ca8f97a37b5840" @@ -5637,7 +5468,7 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-util@^7.0.2, ethereumjs-util@^7.0.3, ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.2, ethereumjs-util@^7.1.4, ethereumjs-util@^7.1.5: +ethereumjs-util@^7.0.2, ethereumjs-util@^7.0.3, ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.4, ethereumjs-util@^7.1.5: version "7.1.5" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== @@ -5737,7 +5568,7 @@ ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.2: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" -ethers@^6.13.1: +ethers@^6.13.1, ethers@^6.7.1: version "6.13.1" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.1.tgz#2b9f9c7455cde9d38b30fe6589972eb083652961" integrity sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A== @@ -5792,11 +5623,6 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -exit-on-epipe@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692" - integrity sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw== - expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -6157,11 +5983,6 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -6463,11 +6284,6 @@ get-stream@^5.1.0: dependencies: pump "^3.0.0" -get-stream@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - get-symbol-description@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" @@ -6660,25 +6476,6 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -got@12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/got/-/got-12.1.0.tgz#099f3815305c682be4fd6b0ee0726d8e4c6b0af4" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - got@9.6.0: version "9.6.0" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" @@ -7055,14 +6852,6 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -http2-wrapper@^2.1.10: - version "2.2.0" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.0.tgz#b80ad199d216b7d3680195077bd7b9060fa9d7f3" - integrity sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - https-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" @@ -7424,13 +7213,6 @@ is-function@^1.0.1: resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== -is-generator-function@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" - integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== - dependencies: - has-tostringtag "^1.0.0" - is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" @@ -7555,7 +7337,7 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: dependencies: has-symbols "^1.0.2" -is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: +is-typed-array@^1.1.10, is-typed-array@^1.1.9: version "1.1.12" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== @@ -7893,7 +7675,7 @@ keyv@^3.0.0: dependencies: json-buffer "3.0.0" -keyv@^4.0.0, keyv@^4.5.3: +keyv@^4.5.3: version "4.5.3" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== @@ -8270,11 +8052,6 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lru-cache@5.1.1, lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -8413,11 +8190,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micro-ftch@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" - integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== - micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -8487,11 +8259,6 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== -mimic-response@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" - integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== - min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -8822,7 +8589,7 @@ node-fetch@^2.6.0, node-fetch@^2.6.1: dependencies: whatwg-url "^5.0.0" -node-fetch@^2.6.12, node-fetch@^2.6.6, node-fetch@^2.7.0: +node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -8879,11 +8646,6 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -9040,13 +8802,6 @@ oboe@2.1.4: dependencies: http-https "^1.0.0" -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" - integrity sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA== - dependencies: - http-https "^1.0.0" - on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -9132,11 +8887,6 @@ p-cancelable@^1.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw== -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -9500,11 +9250,6 @@ prettier@^2.1.2, prettier@^2.3.1, prettier@^2.8.3: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -printj@~1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/printj/-/printj-1.3.1.tgz#9af6b1d55647a1587ac44f4c1654a4b95b8e12cb" - integrity sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg== - private@^0.1.6, private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -9684,11 +9429,6 @@ queue-microtask@^1.2.2, queue-microtask@^1.2.3: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== - randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.0.6, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -9984,11 +9724,6 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== - resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -10032,13 +9767,6 @@ responselike@^1.0.2: dependencies: lowercase-keys "^1.0.0" -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" - resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -10242,6 +9970,11 @@ semver@^7.3.2, semver@^7.3.4, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semve dependencies: lru-cache "^6.0.0" +semver@^7.6.0, semver@^7.6.2: + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + semver@~5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -11709,17 +11442,6 @@ util.promisify@^1.0.0: has-symbols "^1.0.1" object.getownpropertydescriptors "^2.1.1" -util@^0.12.5: - version "0.12.5" - resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" - integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== - dependencies: - inherits "^2.0.3" - is-arguments "^1.0.4" - is-generator-function "^1.0.7" - is-typed-array "^1.1.3" - which-typed-array "^1.1.2" - utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" @@ -11740,11 +11462,6 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== - v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" @@ -11787,15 +11504,6 @@ vscode-uri@^3.0.8: resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f" integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw== -web3-bzz@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.10.2.tgz#482dfddcc5f65d5877b37cc20775725220b4ad87" - integrity sha512-vLOfDCj6198Qc7esDrCKeFA/M3ZLbowsaHQ0hIL4NmIHoq7lU8aSRTa5AI+JBh8cKN1gVryJsuW2ZCc5bM4I4Q== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - web3-bzz@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.2.11.tgz#41bc19a77444bd5365744596d778b811880f707f" @@ -11806,14 +11514,6 @@ web3-bzz@1.2.11: swarm-js "^0.1.40" underscore "1.9.1" -web3-core-helpers@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.10.2.tgz#bd47686c0e74ef4475713c581f9306a035ce8a74" - integrity sha512-1JfaNtox6/ZYJHNoI+QVc2ObgwEPeGF+YdxHZQ7aF5605BmlwM1Bk3A8xv6mg64jIRvEq1xX6k9oG6x7p1WgXQ== - dependencies: - web3-eth-iban "1.10.2" - web3-utils "1.10.2" - web3-core-helpers@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.2.11.tgz#84c681ed0b942c0203f3b324a245a127e8c67a99" @@ -11823,17 +11523,6 @@ web3-core-helpers@1.2.11: web3-eth-iban "1.2.11" web3-utils "1.2.11" -web3-core-method@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.10.2.tgz#4adf3f8c8d0776f0f320e583b791955c41037971" - integrity sha512-gG6ES+LOuo01MJHML4gnEt702M8lcPGMYZoX8UjZzmEebGrPYOY9XccpCrsFgCeKgQzM12SVnlwwpMod1+lcLg== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.10.2" - web3-core-promievent "1.10.2" - web3-core-subscriptions "1.10.2" - web3-utils "1.10.2" - web3-core-method@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.2.11.tgz#f880137d1507a0124912bf052534f168b8d8fbb6" @@ -11846,13 +11535,6 @@ web3-core-method@1.2.11: web3-core-subscriptions "1.2.11" web3-utils "1.2.11" -web3-core-promievent@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.10.2.tgz#13b380b69ee05c5bf075836be64c2f3b8bdc1a5f" - integrity sha512-Qkkb1dCDOU8dZeORkcwJBQRAX+mdsjx8LqFBB+P4W9QgwMqyJ6LXda+y1XgyeEVeKEmY1RCeTq9Y94q1v62Sfw== - dependencies: - eventemitter3 "4.0.4" - web3-core-promievent@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.2.11.tgz#51fe97ca0ddec2f99bf8c3306a7a8e4b094ea3cf" @@ -11860,17 +11542,6 @@ web3-core-promievent@1.2.11: dependencies: eventemitter3 "4.0.4" -web3-core-requestmanager@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.10.2.tgz#f5b1264c6470c033f08e21210b0af0c23497c68a" - integrity sha512-nlLeNJUu6fR+ZbJr2k9Du/nN3VWwB4AJPY4r6nxUODAmykgJq57T21cLP/BEk6mbiFQYGE9TrrPhh4qWxQEtAw== - dependencies: - util "^0.12.5" - web3-core-helpers "1.10.2" - web3-providers-http "1.10.2" - web3-providers-ipc "1.10.2" - web3-providers-ws "1.10.2" - web3-core-requestmanager@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.2.11.tgz#fe6eb603fbaee18530293a91f8cf26d8ae28c45a" @@ -11882,14 +11553,6 @@ web3-core-requestmanager@1.2.11: web3-providers-ipc "1.2.11" web3-providers-ws "1.2.11" -web3-core-subscriptions@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.10.2.tgz#d325483141ab1406241d6707b86fd6944e4b7ea6" - integrity sha512-MiWcKjz4tco793EPPPLc/YOJmYUV3zAfxeQH/UVTfBejMfnNvmfwKa2SBKfPIvKQHz/xI5bV2TF15uvJEucU7w== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.2" - web3-core-subscriptions@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.2.11.tgz#beca908fbfcb050c16f45f3f0f4c205e8505accd" @@ -11899,19 +11562,6 @@ web3-core-subscriptions@1.2.11: underscore "1.9.1" web3-core-helpers "1.2.11" -web3-core@1.10.2, web3-core@^1.8.1: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.10.2.tgz#464a15335b3adecc4a1cdd53c89b995769059f03" - integrity sha512-qTn2UmtE8tvwMRsC5pXVdHxrQ4uZ6jiLgF5DRUVtdi7dPUmX18Dp9uxKfIfhGcA011EAn8P6+X7r3pvi2YRxBw== - dependencies: - "@types/bn.js" "^5.1.1" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.10.2" - web3-core-method "1.10.2" - web3-core-requestmanager "1.10.2" - web3-utils "1.10.2" - web3-core@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.2.11.tgz#1043cacc1becb80638453cc5b2a14be9050288a7" @@ -11925,14 +11575,6 @@ web3-core@1.2.11: web3-core-requestmanager "1.2.11" web3-utils "1.2.11" -web3-eth-abi@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.10.2.tgz#65db4af1acb0b72cb9d10cd6f045a8bcdb270b1b" - integrity sha512-pY4fQUio7W7ZRSLf+vsYkaxJqaT/jHcALZjIxy+uBQaYAJ3t6zpQqMZkJB3Dw7HUODRJ1yI0NPEFGTnkYf/17A== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.10.2" - web3-eth-abi@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.2.11.tgz#a887494e5d447c2926d557a3834edd66e17af9b0" @@ -11942,22 +11584,6 @@ web3-eth-abi@1.2.11: underscore "1.9.1" web3-utils "1.2.11" -web3-eth-accounts@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.10.2.tgz#5ce9e4de0f84a88e72801810b98cc25164956404" - integrity sha512-6/HhCBYAXN/f553/SyxS9gY62NbLgpD1zJpENcvRTDpJN3Znvli1cmpl5Q3ZIUJkvHnG//48EWfWh0cbb3fbKQ== - dependencies: - "@ethereumjs/common" "2.5.0" - "@ethereumjs/tx" "3.3.2" - "@ethereumjs/util" "^8.1.0" - eth-lib "0.2.8" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.10.2" - web3-core-helpers "1.10.2" - web3-core-method "1.10.2" - web3-utils "1.10.2" - web3-eth-accounts@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.2.11.tgz#a9e3044da442d31903a7ce035a86d8fa33f90520" @@ -11975,20 +11601,6 @@ web3-eth-accounts@1.2.11: web3-core-method "1.2.11" web3-utils "1.2.11" -web3-eth-contract@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.10.2.tgz#9114c52ba5ca5859f3403abea69a13f8678828ad" - integrity sha512-CZLKPQRmupP/+OZ5A/CBwWWkBiz5B/foOpARz0upMh1yjb0dEud4YzRW2gJaeNu0eGxDLsWVaXhUimJVGYprQw== - dependencies: - "@types/bn.js" "^5.1.1" - web3-core "1.10.2" - web3-core-helpers "1.10.2" - web3-core-method "1.10.2" - web3-core-promievent "1.10.2" - web3-core-subscriptions "1.10.2" - web3-eth-abi "1.10.2" - web3-utils "1.10.2" - web3-eth-contract@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.2.11.tgz#917065902bc27ce89da9a1da26e62ef663663b90" @@ -12004,20 +11616,6 @@ web3-eth-contract@1.2.11: web3-eth-abi "1.2.11" web3-utils "1.2.11" -web3-eth-ens@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.10.2.tgz#5708e1830ab261b139882cc43662afb3a733112e" - integrity sha512-kTQ42UdNHy4BQJHgWe97bHNMkc3zCMBKKY7t636XOMxdI/lkRdIjdE5nQzt97VjQvSVasgIWYKRAtd8aRaiZiQ== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.10.2" - web3-core-helpers "1.10.2" - web3-core-promievent "1.10.2" - web3-eth-abi "1.10.2" - web3-eth-contract "1.10.2" - web3-utils "1.10.2" - web3-eth-ens@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.2.11.tgz#26d4d7f16d6cbcfff918e39832b939edc3162532" @@ -12033,14 +11631,6 @@ web3-eth-ens@1.2.11: web3-eth-contract "1.2.11" web3-utils "1.2.11" -web3-eth-iban@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.10.2.tgz#f8e668034834c5be038adeb14c39b923e9257558" - integrity sha512-y8+Ii2XXdyHQMFNL2NWpBnXe+TVJ4ryvPlzNhObRRnIo4O4nLIXS010olLDMayozDzoUlmzCmBZJYc9Eev1g7A== - dependencies: - bn.js "^5.2.1" - web3-utils "1.10.2" - web3-eth-iban@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.2.11.tgz#f5f73298305bc7392e2f188bf38a7362b42144ef" @@ -12049,18 +11639,6 @@ web3-eth-iban@1.2.11: bn.js "^4.11.9" web3-utils "1.2.11" -web3-eth-personal@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.10.2.tgz#a281cc1cecb2f3243ac0467c075a1579fa562901" - integrity sha512-+vEbJsPUJc5J683y0c2aN645vXC+gPVlFVCQu4IjPvXzJrAtUfz26+IZ6AUOth4fDJPT0f1uSLS5W2yrUdw9BQ== - dependencies: - "@types/node" "^12.12.6" - web3-core "1.10.2" - web3-core-helpers "1.10.2" - web3-core-method "1.10.2" - web3-net "1.10.2" - web3-utils "1.10.2" - web3-eth-personal@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.2.11.tgz#a38b3942a1d87a62070ce0622a941553c3d5aa70" @@ -12073,24 +11651,6 @@ web3-eth-personal@1.2.11: web3-net "1.2.11" web3-utils "1.2.11" -web3-eth@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.10.2.tgz#46baa0d8a1203b425f77ac2cf823fbb73666fcb9" - integrity sha512-s38rhrntyhGShmXC4R/aQtfkpcmev9c7iZwgb9CDIBFo7K8nrEJvqIOyajeZTxnDIiGzTJmrHxiKSadii5qTRg== - dependencies: - web3-core "1.10.2" - web3-core-helpers "1.10.2" - web3-core-method "1.10.2" - web3-core-subscriptions "1.10.2" - web3-eth-abi "1.10.2" - web3-eth-accounts "1.10.2" - web3-eth-contract "1.10.2" - web3-eth-ens "1.10.2" - web3-eth-iban "1.10.2" - web3-eth-personal "1.10.2" - web3-net "1.10.2" - web3-utils "1.10.2" - web3-eth@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.2.11.tgz#4c81fcb6285b8caf544058fba3ae802968fdc793" @@ -12110,15 +11670,6 @@ web3-eth@1.2.11: web3-net "1.2.11" web3-utils "1.2.11" -web3-net@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.10.2.tgz#77f39dea930619035d3bf99969941870f2f0c550" - integrity sha512-w9i1t2z7dItagfskhaCKwpp6W3ylUR88gs68u820y5f8yfK5EbPmHc6c2lD8X9ZrTnmDoeOpIRCN/RFPtZCp+g== - dependencies: - web3-core "1.10.2" - web3-core-method "1.10.2" - web3-utils "1.10.2" - web3-net@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.2.11.tgz#eda68ef25e5cdb64c96c39085cdb74669aabbe1b" @@ -12154,16 +11705,6 @@ web3-provider-engine@14.2.1: xhr "^2.2.0" xtend "^4.0.1" -web3-providers-http@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.2.tgz#8bd54b5bc5bcc50612fd52af65bd773f926045f7" - integrity sha512-G8abKtpkyKGpRVKvfjIF3I4O/epHP7mxXWN8mNMQLkQj1cjMFiZBZ13f+qI77lNJN7QOf6+LtNdKrhsTGU72TA== - dependencies: - abortcontroller-polyfill "^1.7.5" - cross-fetch "^4.0.0" - es6-promise "^4.2.8" - web3-core-helpers "1.10.2" - web3-providers-http@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.2.11.tgz#1cd03442c61670572d40e4dcdf1faff8bd91e7c6" @@ -12172,14 +11713,6 @@ web3-providers-http@1.2.11: web3-core-helpers "1.2.11" xhr2-cookies "1.1.0" -web3-providers-ipc@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.10.2.tgz#4314a04c1d68f5d1cb2d047d027db97c85f921f7" - integrity sha512-lWbn6c+SgvhLymU8u4Ea/WOVC0Gqs7OJUvauejWz+iLycxeF0xFNyXnHVAi42ZJDPVI3vnfZotafoxcNNL7Sug== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.10.2" - web3-providers-ipc@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.2.11.tgz#d16d6c9be1be6e0b4f4536c4acc16b0f4f27ef21" @@ -12189,15 +11722,6 @@ web3-providers-ipc@1.2.11: underscore "1.9.1" web3-core-helpers "1.2.11" -web3-providers-ws@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.10.2.tgz#00bf6e00080dd82b8ad7fbed657a6d20ecc532de" - integrity sha512-3nYSiP6grI5GvpkSoehctSywfCTodU21VY8bUtXyFHK/IVfDooNtMpd5lVIMvXVAlaxwwrCfjebokaJtKH2Iag== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.2" - websocket "^1.0.32" - web3-providers-ws@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.2.11.tgz#a1dfd6d9778d840561d9ec13dd453046451a96bb" @@ -12208,16 +11732,6 @@ web3-providers-ws@1.2.11: web3-core-helpers "1.2.11" websocket "^1.0.31" -web3-shh@1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.10.2.tgz#2a41e1a308de5320d1f17080765206b727aa669e" - integrity sha512-UP0Kc3pHv9uULFu0+LOVfPwKBSJ6B+sJ5KflF7NyBk6TvNRxlpF3hUhuaVDCjjB/dDUR6T0EQeg25FA2uzJbag== - dependencies: - web3-core "1.10.2" - web3-core-method "1.10.2" - web3-core-subscriptions "1.10.2" - web3-net "1.10.2" - web3-shh@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.2.11.tgz#f5d086f9621c9a47e98d438010385b5f059fd88f" @@ -12228,20 +11742,6 @@ web3-shh@1.2.11: web3-core-subscriptions "1.2.11" web3-net "1.2.11" -web3-utils@1.10.2, web3-utils@^1.8.1: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.2.tgz#361103d28a94d5e2a87ba15d776a62c33303eb44" - integrity sha512-TdApdzdse5YR+5GCX/b/vQnhhbj1KSAtfrDtRW7YS0kcWp1gkJsN62gw6GzCaNTeXookB7UrLtmDUuMv65qgow== - dependencies: - "@ethereumjs/util" "^8.1.0" - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereum-cryptography "^2.1.2" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - web3-utils@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.2.11.tgz#af1942aead3fb166ae851a985bed8ef2c2d95a82" @@ -12295,19 +11795,6 @@ web3@1.2.11: web3-shh "1.2.11" web3-utils "1.2.11" -web3@^1.8.1: - version "1.10.2" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.10.2.tgz#5b7e165b396fb0bea501cef4d5ce754aebad5b73" - integrity sha512-DAtZ3a3ruPziE80uZ3Ob0YDZxt6Vk2un/F5BcBrxO70owJ9Z1Y2+loZmbh1MoAmoLGjA/SUSHeUtid3fYmBaog== - dependencies: - web3-bzz "1.10.2" - web3-core "1.10.2" - web3-eth "1.10.2" - web3-eth-personal "1.10.2" - web3-net "1.10.2" - web3-shh "1.10.2" - web3-utils "1.10.2" - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -12325,7 +11812,7 @@ websocket@1.0.32: utf-8-validate "^5.0.2" yaeti "^0.0.6" -websocket@^1.0.31, websocket@^1.0.32: +websocket@^1.0.31: version "1.0.34" resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== @@ -12371,7 +11858,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which-typed-array@^1.1.10, which-typed-array@^1.1.11, which-typed-array@^1.1.2: +which-typed-array@^1.1.10, which-typed-array@^1.1.11: version "1.1.11" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a" integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew== @@ -12727,8 +12214,3 @@ yocto-queue@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== - -zksync-web3@^0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9" - integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ== From 4c7e2dcc2d39b2827b0c760eb53112982a72a651 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 25 Jun 2024 15:44:17 +0300 Subject: [PATCH 28/83] Fix submitTransactions --- migrations/submitTransactions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migrations/submitTransactions.ts b/migrations/submitTransactions.ts index d2c520ed..b1d96efb 100644 --- a/migrations/submitTransactions.ts +++ b/migrations/submitTransactions.ts @@ -1,5 +1,4 @@ import {createMultiSendTransaction} from "@skalenetwork/upgrade-tools"; -import {UnsignedTransaction} from "ethers"; import {promises as fs} from "fs"; async function main() { @@ -20,7 +19,7 @@ async function main() { if (!privateKey.startsWith("0x")) { privateKey = "0x" + privateKey; } - const safeTransactions = JSON.parse(await fs.readFile(process.env.TRANSACTIONS, "utf-8")) as UnsignedTransaction[]; + const safeTransactions = JSON.parse(await fs.readFile(process.env.TRANSACTIONS, "utf-8")); await createMultiSendTransaction(safe, safeTransactions); console.log("Done"); From c519dfdb58dfa232808371c72d5ef8cc727d801a Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 25 Jun 2024 15:55:34 +0300 Subject: [PATCH 29/83] Fix upgrade --- migrations/upgrade.ts | 9 +++++---- package.json | 2 +- yarn.lock | 21 +++++---------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 1f21331a..3268bfbe 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -2,9 +2,10 @@ import chalk from "chalk"; import {contracts} from "./deploy"; import {ethers} from "hardhat"; import {Upgrader, AutoSubmitter} from "@skalenetwork/upgrade-tools"; -import {skaleContracts, Instance} from "@skalenetwork/skale-contracts-ethers-v5"; +import {skaleContracts, Instance} from "@skalenetwork/skale-contracts-ethers-v6"; import {SkaleManager} from "../typechain-types"; import {Manifest, getImplementationAddress} from "@openzeppelin/upgrades-core"; +import {Transaction} from "ethers"; async function getSkaleManagerInstance() { if (process.env.ABI) { @@ -52,10 +53,10 @@ class SkaleManagerUpgrader extends Upgrader { setVersion = async (newVersion: string) => { const skaleManager = await this.getSkaleManager(); - this.transactions.push({ - to: skaleManager.address, + this.transactions.push(Transaction.from({ + to: await skaleManager.getAddress(), data: skaleManager.interface.encodeFunctionData("setVersion", [newVersion]) - }); + })); } // deployNewContracts = () => { }; diff --git a/package.json b/package.json index b1cdb89d..0d4b065e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@openzeppelin/hardhat-upgrades": "^3.1.1", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", "@skalenetwork/upgrade-tools": "^3.0.0-linter.36", - "@typechain/hardhat": "^7.0.0", + "@typechain/hardhat": "^9.1.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", "ethers": "^6.13.1", diff --git a/yarn.lock b/yarn.lock index d89b89cd..733069ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1796,10 +1796,10 @@ lodash "^4.17.15" ts-essentials "^7.0.1" -"@typechain/hardhat@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-7.0.0.tgz#ffa7465328150e793007fee616ae7b76ed20784d" - integrity sha512-XB79i5ewg9Met7gMVGfgVkmypicbnI25T5clJBEooMoW2161p4zvKFpoS2O+lBppQyMrPIZkdvl2M3LMDayVcA== +"@typechain/hardhat@^9.1.0": + version "9.1.0" + resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-9.1.0.tgz#6985015f01dfb37ef2ca8a29c742d05890351ddc" + integrity sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA== dependencies: fs-extra "^9.1.0" @@ -2218,18 +2218,7 @@ ajv@^8.0.1: require-from-string "^2.0.2" uri-js "^4.2.2" -amazon-cognito-identity-js@^6.0.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.1.tgz#d9a4c1a92f4b059330df8ea075f65106d2605409" - integrity sha512-PxBdufgS8uZShrcIFAsRjmqNXsh/4fXOWUGQOUhKLHWWK1pcp/y+VeFF48avXIWefM8XwsT3JlN6m9J2eHt4LA== - dependencies: - "@aws-crypto/sha256-js" "1.2.2" - buffer "4.9.2" - fast-base64-decode "^1.0.0" - isomorphic-unfetch "^3.0.0" - js-cookie "^2.2.1" - -amazon-cognito-identity-js@^6.3.6: +amazon-cognito-identity-js@^6.0.1, amazon-cognito-identity-js@^6.3.6: version "6.3.12" resolved "https://registry.yarnpkg.com/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.12.tgz#af73df033094ad4c679c19cf6122b90058021619" integrity sha512-s7NKDZgx336cp+oDeUtB2ZzT8jWJp/v2LWuYl+LQtMEODe22RF1IJ4nRiDATp+rp1pTffCZcm44Quw4jx2bqNg== From ddb1546552bf9f404308b7d77e6e5aa850eb2c6c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:13:47 +0300 Subject: [PATCH 30/83] Fix dependencies --- package.json | 5 ++-- yarn.lock | 66 ++++++++++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 0d4b065e..a627e408 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@nomicfoundation/hardhat-ethers": "^3.0.0", "@openzeppelin/contracts": "^4.9.3", "@openzeppelin/contracts-upgradeable": "^4.9.6", - "@openzeppelin/hardhat-upgrades": "^3.1.1", + "@openzeppelin/hardhat-upgrades": "^3.2.0", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", "@skalenetwork/upgrade-tools": "^3.0.0-linter.36", "@typechain/hardhat": "^9.1.0", @@ -60,10 +60,11 @@ "@types/chai": "^4.3.6", "@types/chai-almost": "^1.0.1", "@types/chai-as-promised": "^7.1.6", + "@types/debug": "^4.1.12", "@types/elliptic": "^6.4.15", "@types/minimist": "^1.2.0", "@types/mocha": "^9.1.1", - "@types/node": "^20.8.7", + "@types/node": "^20.14.8", "@types/sinon-chai": "^3.2.9", "@types/underscore": "^1.11.15", "@typescript-eslint/eslint-plugin": "^5.62.0", diff --git a/yarn.lock b/yarn.lock index 733069ee..e9545d8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1429,28 +1429,6 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.3.tgz#00d7a8cf35a475b160b3f0293a6403c511099364" integrity sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg== -"@openzeppelin/defender-admin-client@^1.52.0": - version "1.54.6" - resolved "https://registry.yarnpkg.com/@openzeppelin/defender-admin-client/-/defender-admin-client-1.54.6.tgz#935374ff54f087048c127e4852f8aefe5b2ac894" - integrity sha512-P4lxJDySrekWNuPa7FeyW/UmuxnuIXIAGYr5gZnmnMHRsYNaw+XfgkiCDfoGtjEyJbXYxXttYF6iAZhWQPdf1g== - dependencies: - "@openzeppelin/defender-base-client" "1.54.6" - axios "^1.4.0" - ethers "^5.7.2" - lodash "^4.17.19" - node-fetch "^2.6.0" - -"@openzeppelin/defender-base-client@1.54.6", "@openzeppelin/defender-base-client@^1.52.0": - version "1.54.6" - resolved "https://registry.yarnpkg.com/@openzeppelin/defender-base-client/-/defender-base-client-1.54.6.tgz#b65a90dba49375ac1439d638832382344067a0b9" - integrity sha512-PTef+rMxkM5VQ7sLwLKSjp2DBakYQd661ZJiSRywx+q/nIpm3B/HYGcz5wPZCA5O/QcEP6TatXXDoeMwimbcnw== - dependencies: - amazon-cognito-identity-js "^6.0.1" - async-retry "^1.3.3" - axios "^1.4.0" - lodash "^4.17.19" - node-fetch "^2.6.0" - "@openzeppelin/defender-sdk-base-client@^1.10.0", "@openzeppelin/defender-sdk-base-client@^1.13.4": version "1.13.4" resolved "https://registry.yarnpkg.com/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.13.4.tgz#51b25d46bb766e7a107b9a87ca623fae3ad5a8c3" @@ -1477,13 +1455,11 @@ axios "^1.6.8" lodash "^4.17.21" -"@openzeppelin/hardhat-upgrades@^3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.1.1.tgz#3dcb47233355d06ec6080463ed06c15187a6fd25" - integrity sha512-CejZfBX6ROh+bZfsImoaWDftNgrZz4CffpPzEDTCRpN980ShJlA2+zsb/bFM5Z3ucy+6BfJx4W/dn9BTkn7AOA== +"@openzeppelin/hardhat-upgrades@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.2.0.tgz#09ae9b48e2fca876ddff9b5ee20ac6629392872e" + integrity sha512-xybXIHQIZK2a1HH7ukMToRbIcU9LHfL49gtB0KYptY6f/r9lqrFOupN8aOBueRZW4Ymhc6HGL9bvj7u7t5lDdQ== dependencies: - "@openzeppelin/defender-admin-client" "^1.52.0" - "@openzeppelin/defender-base-client" "^1.52.0" "@openzeppelin/defender-sdk-base-client" "^1.10.0" "@openzeppelin/defender-sdk-deploy-client" "^1.10.0" "@openzeppelin/defender-sdk-network-client" "^1.10.0" @@ -1850,6 +1826,13 @@ dependencies: "@types/node" "*" +"@types/debug@^4.1.12": + version "4.1.12" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" + integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== + dependencies: + "@types/ms" "*" + "@types/elliptic@^6.4.15": version "6.4.15" resolved "https://registry.yarnpkg.com/@types/elliptic/-/elliptic-6.4.15.tgz#992ae323fd04ab03d884da7122e5dac1665c75ff" @@ -1897,6 +1880,11 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4" integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== +"@types/ms@*": + version "0.7.34" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" + integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== + "@types/node-fetch@^2.5.5": version "2.5.12" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66" @@ -1905,7 +1893,7 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@^20.8.7": +"@types/node@*": version "20.8.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.7.tgz#ad23827850843de973096edfc5abc9e922492a25" integrity sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ== @@ -1922,6 +1910,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.42.tgz#2f021733232c2130c26f9eabbdd3bfd881774733" integrity sha512-aI3/oo5DzyiI5R/xAhxxRzfZlWlsbbqdgxfTPkqu/Zt+23GXiJvMCyPJT4+xKSXOnLqoL8jJYMLTwvK2M3a5hw== +"@types/node@^20.14.8": + version "20.14.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.8.tgz#45c26a2a5de26c3534a9504530ddb3b27ce031ac" + integrity sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA== + dependencies: + undici-types "~5.26.4" + "@types/pbkdf2@^3.0.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" @@ -2218,7 +2213,7 @@ ajv@^8.0.1: require-from-string "^2.0.2" uri-js "^4.2.2" -amazon-cognito-identity-js@^6.0.1, amazon-cognito-identity-js@^6.3.6: +amazon-cognito-identity-js@^6.3.6: version "6.3.12" resolved "https://registry.yarnpkg.com/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.12.tgz#af73df033094ad4c679c19cf6122b90058021619" integrity sha512-s7NKDZgx336cp+oDeUtB2ZzT8jWJp/v2LWuYl+LQtMEODe22RF1IJ4nRiDATp+rp1pTffCZcm44Quw4jx2bqNg== @@ -5521,7 +5516,7 @@ ethereumjs-wallet@0.6.5: utf8 "^3.0.0" uuid "^3.3.2" -ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.2: +ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -7987,7 +7982,7 @@ lodash@4.17.20: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4: +lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -8571,7 +8566,7 @@ node-fetch@2.6.1: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== -node-fetch@^2.6.0, node-fetch@^2.6.1: +node-fetch@^2.6.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -11278,6 +11273,11 @@ undici-types@~5.25.1: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.25.3.tgz#e044115914c85f0bcbb229f346ab739f064998c3" integrity sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + undici@^5.14.0: version "5.22.1" resolved "https://registry.yarnpkg.com/undici/-/undici-5.22.1.tgz#877d512effef2ac8be65e695f3586922e1a57d7b" From 09a9a204e41606e3ef7e60e1a87e11095211c518 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:15:43 +0300 Subject: [PATCH 31/83] Fix generateAbi --- scripts/generateAbi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generateAbi.ts b/scripts/generateAbi.ts index 4c6b4e54..39e10d22 100644 --- a/scripts/generateAbi.ts +++ b/scripts/generateAbi.ts @@ -3,7 +3,7 @@ import {contracts} from "../migrations/deploy"; import {ethers} from "hardhat"; import {getAbi, getVersion} from '@skalenetwork/upgrade-tools'; import {ContractFactory} from 'ethers'; -import {Libraries} from '@nomiclabs/hardhat-ethers/types'; +import {Libraries} from '@nomicfoundation/hardhat-ethers/types' async function main() { const allContracts = contracts.concat(["SkaleToken", "TimeHelpersWithDebug"]) From 6a4ffe0da115bccd3eb380fca6accb65d1c74e2b Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:42:58 +0300 Subject: [PATCH 32/83] Fix bounty --- test/Bounty.ts | 98 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/test/Bounty.ts b/test/Bounty.ts index 45a817a4..41efbffd 100644 --- a/test/Bounty.ts +++ b/test/Bounty.ts @@ -21,7 +21,6 @@ import {deployValidatorService} from "./tools/deploy/delegation/validatorService import {deployDelegationPeriodManager} from "./tools/deploy/delegation/delegationPeriodManager"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; import {ethers} from "hardhat"; -import {BigNumber} from "ethers"; import {deployPunisher} from "./tools/deploy/delegation/punisher"; import {fastBeforeEach} from "./tools/mocha"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; @@ -30,12 +29,12 @@ chai.should(); chai.use(chaiAsPromised); function getBountyForEpoch(epoch: number) { - const bountyForFirst6Years = [385000000, 346500000, 308000000, 269500000, 231000000, 192500000]; + const bountyForFirst6Years = [385000000n, 346500000n, 308000000n, 269500000n, 231000000n, 192500000n]; const year = Math.floor(epoch / 12); if (year < 6) { - return bountyForFirst6Years[year] / 12; + return bountyForFirst6Years[year] / 12n; } else { - return bountyForFirst6Years[5] / 2 ** (Math.floor((year - 6) / 3) + 1); + return bountyForFirst6Years[5] / 2n ** BigInt(Math.floor((year - 6) / 3) + 1); } } @@ -51,7 +50,6 @@ describe("Bounty", () => { let bountyContract: BountyV2; let nodes: NodesMock; - const ten18 = BigNumber.from(10).pow(18); const day = 60 * 60 * 24; fastBeforeEach(async () => { @@ -61,13 +59,13 @@ describe("Bounty", () => { constantsHolder = await deployConstantsHolder(contractManager); bountyContract = await deployBounty(contractManager); nodes = await deployNodesMock(contractManager); - await contractManager.setContractsAddress("Nodes", nodes.address); + await contractManager.setContractsAddress("Nodes", nodes); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); const BOUNTY_REDUCTION_MANAGER_ROLE = await bountyContract.BOUNTY_REDUCTION_MANAGER_ROLE(); - await bountyContract.grantRole(BOUNTY_REDUCTION_MANAGER_ROLE, owner.address); + await bountyContract.grantRole(BOUNTY_REDUCTION_MANAGER_ROLE, owner); const CONSTANTS_HOLDER_MANAGER_ROLE = await constantsHolder.CONSTANTS_HOLDER_MANAGER_ROLE(); - await constantsHolder.grantRole(CONSTANTS_HOLDER_MANAGER_ROLE, owner.address); + await constantsHolder.grantRole(CONSTANTS_HOLDER_MANAGER_ROLE, owner); }); it("should allow only owner to call enableBountyReduction", async() => { @@ -98,21 +96,21 @@ describe("Bounty", () => { delegationController = await deployDelegationController(contractManager); validatorService = await deployValidatorService(contractManager); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); - await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner.address); + await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner); await skipTimeToDate(1, 11); - await skaleToken.mint(validator.address, ten18.mul(validatorAmount).toString(), "0x", "0x"); + await skaleToken.mint(validator, ethers.parseEther(validatorAmount.toString()), "0x", "0x"); await validatorService.connect(validator).registerValidator("Validator", "", 150, 1e6 + 1); await validatorService.enableValidator(validatorId); - await delegationController.connect(validator).delegate(validatorId, ten18.mul(validatorAmount).toString(), 2, ""); + await delegationController.connect(validator).delegate(validatorId, ethers.parseEther(validatorAmount.toString()), 2, ""); await delegationController.connect(validator).acceptPendingDelegation(0); await nextMonth(contractManager); }); async function calculateBounty(nodeId: number) { - const estimate = (await bountyContract.estimateBounty(nodeId)).div(ten18).toNumber(); - const bounty = (await bountyContract.callStatic.calculateBounty(nodeId)).div(ten18).toNumber(); + const estimate = BigInt(ethers.formatEther(await bountyContract.estimateBounty(nodeId))); + const bounty = BigInt(ethers.formatEther(await bountyContract.calculateBounty.staticCall(nodeId))); bounty.should.be.almost(estimate); await bountyContract.calculateBounty(nodeId); await nodes.changeNodeLastRewardDate(nodeId); @@ -125,21 +123,21 @@ describe("Bounty", () => { fastBeforeEach(async () => { const delegationPeriodManager = await deployDelegationPeriodManager(contractManager); const DELEGATION_PERIOD_SETTER_ROLE = await delegationPeriodManager.DELEGATION_PERIOD_SETTER_ROLE(); - await delegationPeriodManager.grantRole(DELEGATION_PERIOD_SETTER_ROLE, owner.address); + await delegationPeriodManager.grantRole(DELEGATION_PERIOD_SETTER_ROLE, owner); await skipTimeToDate(1, 11); - await skaleToken.mint(validator2.address, ten18.mul(validator2Amount).toString(), "0x", "0x"); + await skaleToken.mint(validator2, ethers.parseEther(validator2Amount.toString()), "0x", "0x"); await validatorService.connect(validator2).registerValidator("Validator", "", 150, 1e6 + 1); await validatorService.enableValidator(validator2Id); await delegationPeriodManager.setDelegationPeriod(12, 200); - await delegationController.connect(validator2).delegate(validator2Id, ten18.mul(validator2Amount).toString(), 12, ""); + await delegationController.connect(validator2).delegate(validator2Id, ethers.parseEther(validator2Amount.toString()), 12, ""); await delegationController.connect(validator2).acceptPendingDelegation(1); await nextMonth(contractManager); await skipTimeToDate(1, 0); // Jan 1st await constantsHolder.setLaunchTimestamp(await currentTime()); - await constantsHolder.setMSR(ten18.mul(validator2Amount).toString()); + await constantsHolder.setMSR(ethers.parseEther(validator2Amount.toString())); }); it("should pay bounty proportionally to effective validator's stake", async () => { @@ -150,15 +148,15 @@ describe("Bounty", () => { const bounty0 = await calculateBounty(0) + await calculateBounty(1); const bounty1 = await calculateBounty(2); bounty0.should.be.equal(bounty1); - bounty0.should.be.almost(getBountyForEpoch(0) / 2); + bounty0.should.be.almost(getBountyForEpoch(0) / 2n); }); it("should process nodes adding and removing, delegation and undelegation and slashing", async () => { - await skaleToken.mint(validator.address, ten18.mul(10e6).toString(), "0x", "0x"); - await skaleToken.mint(validator2.address, ten18.mul(10e6).toString(), "0x", "0x"); + await skaleToken.mint(validator, ethers.parseEther("10e6"), "0x", "0x"); + await skaleToken.mint(validator2, ethers.parseEther("10e6"), "0x", "0x"); const punisher = await deployPunisher(contractManager); - await contractManager.setContractsAddress("SkaleDKG", contractManager.address); // for testing - const million = ten18.mul(1e6).toString(); + await contractManager.setContractsAddress("SkaleDKG", contractManager); // for testing + const million = ethers.parseEther("1e6"); // Jan 1st // console.log("ts: current", new Date(await currentTime() * 1000)); @@ -276,7 +274,7 @@ describe("Bounty", () => { await delegationController.connect(validator).delegate(validatorId, million, 2, ""); await delegationController.connect(validator).acceptPendingDelegation(4); - await constantsHolder.setMSR(ten18.mul(1.5e6).toString()); + await constantsHolder.setMSR(ethers.parseEther("1.5e6").toString()); let bounty = await calculateBounty(0); bounty.should.be.almost(getBountyForEpoch(0) + getBountyForEpoch(1)); @@ -350,9 +348,9 @@ describe("Bounty", () => { await delegationController.connect(validator).delegate(validatorId, million, 2, ""); await delegationController.connect(validator).acceptPendingDelegation(5); - let effectiveDelegated1 = 0.5e6 * 100 + 0.5e6 * 200; - let effectiveDelegated2 = 1e6 * 100 + 0.5e6 * 200; - let totalBounty = 0; + let effectiveDelegated1 = BigInt(0.5e6 * 100 + 0.5e6 * 200); + let effectiveDelegated2 = BigInt(1e6 * 100 + 0.5e6 * 200); + let totalBounty = 0n; let bountyLeft = getBountyForEpoch(2); bounty = await calculateBounty(0); @@ -441,9 +439,9 @@ describe("Bounty", () => { await delegationController.connect(validator2).delegate(validator2Id, million, 2, ""); await delegationController.connect(validator2).acceptPendingDelegation(6); - effectiveDelegated1 = 1.5e6 * 100 + 0.5e6 * 200; + effectiveDelegated1 = BigInt(1.5e6 * 100 + 0.5e6 * 200); bountyLeft += getBountyForEpoch(3) - totalBounty; - totalBounty = 0; + totalBounty = 0n; bounty = await calculateBounty(0); bounty.should.be.almost(bountyLeft * effectiveDelegated2 / (effectiveDelegated1 + effectiveDelegated2)); @@ -514,18 +512,20 @@ describe("Bounty", () => { await delegationController.connect(validator2).requestUndelegation(1); - effectiveDelegated2 = 2e6 * 100 + 0.5e6 * 200; + effectiveDelegated2 = BigInt(2e6 * 100 + 0.5e6 * 200); bountyLeft += getBountyForEpoch(4) - totalBounty; - totalBounty = 0; + totalBounty = 0n; effectiveDelegated1.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] - .div(ten18) - .toNumber()); + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) + ); effectiveDelegated2.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] - .div(ten18) - .toNumber()); + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] + ) + ); await bountyContract.calculateBounty(0) .should.be.eventually.rejectedWith("Transaction is sent too early"); @@ -561,17 +561,19 @@ describe("Bounty", () => { // 0: Apr 28th // 3: May 1st - await punisher.slash(validator2Id, ten18.mul(1.25e6).toString()); - effectiveDelegated2 = 1e6 * 100 + 0.25e6 * 200; + await punisher.slash(validator2Id, ethers.parseEther("1.25e6")); + effectiveDelegated2 = BigInt(1e6 * 100 + 0.25e6 * 200); effectiveDelegated1.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] - .div(ten18) - .toNumber()); + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) + ); effectiveDelegated2.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] - .div(ten18) - .toNumber()); + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] + ) + ); bounty = await calculateBounty(0); bounty.should.be.almost(0); // stake is too small @@ -613,7 +615,7 @@ describe("Bounty", () => { // 3: May 29th bountyLeft += getBountyForEpoch(5) - totalBounty; - totalBounty = 0; + totalBounty = 0n; await nodes.removeNode(0); await bountyContract.calculateBounty(1) @@ -683,9 +685,9 @@ describe("Bounty", () => { // nodes: // 3: May 29th - effectiveDelegated2 = 0.5e6 * 100 + 0.25e6 * 200; + effectiveDelegated2 = BigInt(0.5e6 * 100 + 0.25e6 * 200); bountyLeft += getBountyForEpoch(5) - totalBounty; - totalBounty = 0; + totalBounty = 0n; bounty = await calculateBounty(1); bounty.should.be.almost(bountyLeft * effectiveDelegated1 / (effectiveDelegated1 + effectiveDelegated2), 3); From 0980c4e697d585b3e8e804c9f00e29c49b58573e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:43:46 +0300 Subject: [PATCH 33/83] Fix constants holder --- test/ConstantsHolder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/ConstantsHolder.ts b/test/ConstantsHolder.ts index a836a4ec..90e29273 100644 --- a/test/ConstantsHolder.ts +++ b/test/ConstantsHolder.ts @@ -105,19 +105,19 @@ describe("ConstantsHolder", () => { await constantsHolder.connect(user).setRotationDelay(13) .should.be.eventually.rejectedWith("CONSTANTS_HOLDER_MANAGER_ROLE is required"); await constantsHolder.setRotationDelay(13); - (await constantsHolder.rotationDelay()).toNumber() + (await constantsHolder.rotationDelay()) .should.be.equal(13); }); it("should set proof-of-use lockup period", async () => { await constantsHolder.setProofOfUseLockUpPeriod(13); - (await constantsHolder.proofOfUseLockUpPeriodDays()).toNumber() + (await constantsHolder.proofOfUseLockUpPeriodDays()) .should.be.equal(13); }); it("should set proof-of-use delegation percentage", async () => { await constantsHolder.setProofOfUseDelegationPercentage(13); - (await constantsHolder.proofOfUseDelegationPercentage()).toNumber() + (await constantsHolder.proofOfUseDelegationPercentage()) .should.be.equal(13); }); From 78fe7bed1733e2324640a46fc71e35747835759f Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:45:45 +0300 Subject: [PATCH 34/83] Fix contract manager --- test/ContractManager.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/ContractManager.ts b/test/ContractManager.ts index 90274c77..ee570043 100644 --- a/test/ContractManager.ts +++ b/test/ContractManager.ts @@ -26,10 +26,10 @@ describe("ContractManager", () => { it("Should add a right contract address (ConstantsHolder) to the register", async () => { const simpleContractName = "Constants"; - await contractManager.connect(user).setContractsAddress(simpleContractName, constantsHolder.address) + await contractManager.connect(user).setContractsAddress(simpleContractName, constantsHolder) .should.be.eventually.rejectedWith("Ownable: caller is not the owner"); - await contractManager.setContractsAddress(simpleContractName, constantsHolder.address); + await contractManager.setContractsAddress(simpleContractName, constantsHolder); - (await contractManager.getContract("ConstantsHolder")).should.be.equal(constantsHolder.address); + (await contractManager.getContract("ConstantsHolder")).should.be.equal(constantsHolder); }); }); From 58c27927a60dacc79e5e77f4ca254613b0c6da8c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:52:36 +0300 Subject: [PATCH 35/83] Fix ECDH --- test/ECDH.ts | 175 +++++++++++++++++++++++++-------------------------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/test/ECDH.ts b/test/ECDH.ts index aadbb4b8..47a31ecc 100644 --- a/test/ECDH.ts +++ b/test/ECDH.ts @@ -5,7 +5,6 @@ import {ec} from "elliptic"; const secp256k1Curve = new ec("secp256k1"); -import {BigNumber} from "ethers"; import {deployECDH} from "./tools/deploy/ecdh"; import {deployContractManager} from "./tools/deploy/contractManager"; import {fastBeforeEach} from "./tools/mocha"; @@ -13,10 +12,10 @@ import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); -const n = BigNumber.from("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"); -const gx = BigNumber.from("0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798"); -const gy = BigNumber.from("0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8"); -const n2 = BigNumber.from("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"); +const n = BigInt("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"); +const gx = BigInt("0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798"); +const gy = BigInt("0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8"); +const n2 = BigInt("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"); describe("ECDH", () => { let ecdh: ECDH; @@ -38,7 +37,7 @@ describe("ECDH", () => { }); it("Should Add one big numbers with one small", async () => { - const x1 = n.sub(1); + const x1 = n - 1n; const z1 = 1; const x2 = 2; const z2 = 1; @@ -48,12 +47,12 @@ describe("ECDH", () => { }); it("Should Add two big numbers", async () => { - const x1 = n.sub(1); + const x1 = n - 1n; const z1 = 1; - const x2 = n.sub(2); + const x2 = n - 2n; const z2 = 1; const result = await ecdh.jAdd(x1, z1, x2, z2); - result.x3.should.be.equal(n.sub(3)); + result.x3.should.be.equal(n - 3n); result.z3.should.be.equal(1); }); @@ -63,14 +62,14 @@ describe("ECDH", () => { const x2 = 4; const z2 = 5; const result = await ecdh.jSub(x1, z1, x2, z2); - result.x3.should.be.equal(n.sub(2)); + result.x3.should.be.equal(n - 2n); result.z3.should.be.equal(15); }); it("Should Subtract one big numbers with one small", async () => { const x1 = 2; const z1 = 1; - const x2 = n.sub(1); + const x2 = n - 1n; const z2 = 1; const result = await ecdh.jSub(x1, z1, x2, z2); result.x3.should.be.equal(3); @@ -78,19 +77,19 @@ describe("ECDH", () => { }); it("Should Subtract two big numbers", async () => { - const x1 = n.sub(2); + const x1 = n - 2n; const z1 = 1; - const x2 = n.sub(1); + const x2 = n - 1n; const z2 = 1; const result = await ecdh.jSub(x1, z1, x2, z2); - result.x3.should.be.equal( n.sub(1)); + result.x3.should.be.equal( n - 1n); result.z3.should.be.equal(1); }); it("Should Subtract two same numbers", async () => { - const x1 = n.sub(16); + const x1 = n - 16n; const z1 = 1; - const x2 = n.sub(16); + const x2 = n - 16n; const z2 = 1; const result = await ecdh.jSub(x1, z1, x2, z2); result.x3.should.be.equal(0); @@ -108,19 +107,19 @@ describe("ECDH", () => { }); it("Should Multiply one big numbers with one small", async () => { - const x1 = n.sub(1); + const x1 = n - 1n; const z1 = 1; const x2 = 2; const z2 = 1; const result = await ecdh.jMul(x1, z1, x2, z2); - result.x3.should.be.equal( n.sub(2)); + result.x3.should.be.equal( n - 2n); result.z3.should.be.equal(1); }); it("Should Multiply two big numbers", async () => { - const x1 = n.sub(2); + const x1 = n - 2n; const z1 = 1; - const x2 = n.sub(3); + const x2 = n - 3n; const z2 = 1; const result = await ecdh.jMul(x1, z1, x2, z2); result.x3.should.be.equal(6); @@ -148,23 +147,23 @@ describe("ECDH", () => { }); it("Should Divide one big numbers with one small", async () => { - const x1 = n.sub(1); + const x1 = n - 1n; const z1 = 1; const x2 = 2; const z2 = 1; const result = await ecdh.jDiv(x1, z1, x2, z2); - result.x3.should.be.equal(n.sub(1)); + result.x3.should.be.equal(n - 1n); result.z3.should.be.equal(2); }); it("Should Divide two big numbers", async () => { - const x1 = n.sub(2); + const x1 = n - 2n; const z1 = 1; - const x2 = n.sub(3); + const x2 = n - 3n; const z2 = 1; const result = await ecdh.jDiv(x1, z1, x2, z2); - result.x3.should.be.equal(n.sub(2)); - result.z3.should.be.equal(n.sub(3)); + result.x3.should.be.equal(n - 2n); + result.z3.should.be.equal(n - 3n); }); it("Should Divide one is zero", async () => { @@ -197,7 +196,7 @@ describe("ECDH", () => { }); it("Should Calculate inverse -1", async () => { - const d = n.sub(1); + const d = n - 1n; const result = await ecdh.inverse(d); const result1 = await ecdh.jMul(d, 1, result, 1); result1.x3.should.be.equal(1); @@ -205,7 +204,7 @@ describe("ECDH", () => { }); it("Should Calculate inverse -2", async () => { - const d = n.sub(1); + const d = n - 1n; const result = await ecdh.inverse(d); const result1 = await ecdh.jMul(d, 1, result, 1); result1.x3.should.be.equal(1); @@ -213,65 +212,65 @@ describe("ECDH", () => { }); it("Should Calculate inverse big number", async () => { - const d = BigNumber.from("0xf167a208bea79bc52668c016aff174622837f780ab60f59dfed0a8e66bb7c2ad"); + const d = BigInt("0xf167a208bea79bc52668c016aff174622837f780ab60f59dfed0a8e66bb7c2ad"); const result = await ecdh.inverse(d); const result1 = await ecdh.jMul(d, 1, result, 1); result1.x3.should.be.equal(1); result1.z3.should.be.equal(1); }); it("Should double gx,gy", async () => { - let ln = gx.mul(gx).mul(3); - let ld = gy.mul(2); + let ln = gx * gx * 3n; + let ld = gy * 2n; - ln = ln.mod(n); - ld = ld.mod(n); + ln = ln % n; + ld = ld % n; - let x2ccN = ln.mul(ln); - let x2ccD = ld.mul(ld); + let x2ccN = ln * ln; + let x2ccD = ld * ld; - x2ccN = x2ccN.sub(gx.mul(2).mul(x2ccD)); + x2ccN = x2ccN - (gx * 2n * x2ccD); - x2ccN = x2ccN.mod(n); - if (x2ccN.lt(0)) { - x2ccN = x2ccN.add(n); + x2ccN = x2ccN % n; + if (x2ccN < 0n) { + x2ccN = x2ccN + n; } - x2ccD = x2ccD.mod(n); - if (x2ccD.lt(0)) { - x2ccD = x2ccD.add(n); + x2ccD = x2ccD % n; + if (x2ccD < 0n) { + x2ccD = x2ccD + n; } let y2ccN; - y2ccN = gx.mul(x2ccD).mul(ln); - y2ccN = y2ccN.sub( x2ccN.mul(ln) ); - y2ccN = y2ccN.sub( gy.mul(x2ccD).mul(ld) ); + y2ccN = gx * x2ccD * ln; + y2ccN = y2ccN - x2ccN * ln; + y2ccN = y2ccN - gy * x2ccD * ld; let y2ccD; - y2ccD = x2ccD.mul(ld); + y2ccD = x2ccD * ld; - y2ccN = y2ccN.mod(n); - if (y2ccN.lt(0)) { - y2ccN = y2ccN.add(n); + y2ccN = y2ccN % n; + if (y2ccN < 0n) { + y2ccN = y2ccN + n; } - y2ccD = y2ccD.mod(n); - if (y2ccD.lt(0)) { - y2ccD = y2ccD.add(n); + y2ccD = y2ccD % n; + if (y2ccD < 0n) { + y2ccD = y2ccD + n; } - let ccD = y2ccD.mul(x2ccD); - x2ccN = x2ccN.mul(y2ccD); - y2ccN = y2ccN.mul(x2ccD); + let ccD = y2ccD * x2ccD; + x2ccN = x2ccN * y2ccD; + y2ccN = y2ccN * x2ccD; - x2ccN = x2ccN.mod(n); - if (x2ccN.lt(0)) { - x2ccN = x2ccN.add(n); + x2ccN = x2ccN % n; + if (x2ccN < 0n) { + x2ccN = x2ccN + n; } - y2ccN = y2ccN.mod(n); - if (y2ccN.lt(0)) { - y2ccN = y2ccN.add(n); + y2ccN = y2ccN % n; + if (y2ccN < 0n) { + y2ccN = y2ccN + n; } - ccD = ccD.mod(n); - if (ccD.lt(0)) { - ccD = ccD.add(n); + ccD = ccD % n; + if (ccD < 0n) { + ccD = ccD + n; } const result = await ecdh.ecDouble(gx, gy, 1); @@ -280,21 +279,21 @@ describe("ECDH", () => { const z2 = result.z3; const result1 = await ecdh.inverse(z2); - x2 = x2.mul(result1).mod(n); - y2 = y2.mul(result1).mod(n); + x2 = x2 * result1 % n; + y2 = y2 * result1 % n; x2.should.be.equal("89565891926547004231252920425935692360644145829622209833684329913297188986597"); y2.should.be.equal("12158399299693830322967808612713398636155367887041628176798871954788371653930"); }); it("Add EC", async () => { - const x2 = BigNumber.from("89565891926547004231252920425935692360644145829622209833684329913297188986597"); - const y2 = BigNumber.from("12158399299693830322967808612713398636155367887041628176798871954788371653930"); + const x2 = BigInt("89565891926547004231252920425935692360644145829622209833684329913297188986597"); + const y2 = BigInt("12158399299693830322967808612713398636155367887041628176798871954788371653930"); const result = await ecdh.ecAdd(gx, gy, 1, x2, y2, 1); let x3 = result.x3; let y3 = result.y3; const z3 = result.z3; const result1 = await ecdh.inverse(z3); - x3 = x3.mul(result1).mod(n); - y3 = y3.mul(result1).mod(n); + x3 = x3 * result1 % n; + y3 = y3 * result1 % n; x3.should.be.equal("112711660439710606056748659173929673102114977341539408544630613555209775888121"); y3.should.be.equal("25583027980570883691656905877401976406448868254816295069919888960541586679410"); }); @@ -313,11 +312,11 @@ describe("ECDH", () => { let y3c = result2.y3; const z3c = result2.z3; const result3 = await ecdh.inverse(z3); - x3 = x3.mul(result3).mod(n); - y3 = y3.mul(result3).mod(n); + x3 = x3 * result3 % n; + y3 = y3 * result3 % n; const result4 = await ecdh.inverse(z3c); - x3c = x3c.mul(result4).mod(n); - y3c = y3c.mul(result4).mod(n); + x3c = x3c * result4 % n; + y3c = y3c * result4 % n; x3.should.be.equal(x3c); y3.should.be.equal(y3c); }); @@ -325,9 +324,9 @@ describe("ECDH", () => { it("Should create a valid public key", async () => { const key = secp256k1Curve.genKeyPair(); const priv = key.getPrivate(); - const d = BigNumber.from("0x" + priv.toString(16)); - const pubX = BigNumber.from("0x" + key.getPublic().getX().toString(16)); - const pubY = BigNumber.from("0x" + key.getPublic().getY().toString(16)); + const d = BigInt("0x" + priv.toString(16)); + const pubX = BigInt("0x" + key.getPublic().getX().toString(16)); + const pubY = BigInt("0x" + key.getPublic().getY().toString(16)); const result = await ecdh.publicKey(d); const pubXCalc = result[0]; const pubYCalc = result[1]; @@ -338,12 +337,12 @@ describe("ECDH", () => { it("Key derived in both directions should be the same", async () => { const key1 = secp256k1Curve.genKeyPair(); const key2 = secp256k1Curve.genKeyPair(); - const d1 = BigNumber.from("0x" + key1.getPrivate().toString(16)); - const d2 = BigNumber.from("0x" + key2.getPrivate().toString(16)); - const pub1X = BigNumber.from("0x" + key1.getPublic().getX().toString(16)); - const pub1Y = BigNumber.from("0x" + key1.getPublic().getY().toString(16)); - const pub2X = BigNumber.from("0x" + key2.getPublic().getX().toString(16)); - const pub2Y = BigNumber.from("0x" + key2.getPublic().getY().toString(16)); + const d1 = BigInt("0x" + key1.getPrivate().toString(16)); + const d2 = BigInt("0x" + key2.getPrivate().toString(16)); + const pub1X = BigInt("0x" + key1.getPublic().getX().toString(16)); + const pub1Y = BigInt("0x" + key1.getPublic().getY().toString(16)); + const pub2X = BigInt("0x" + key2.getPublic().getX().toString(16)); + const pub2Y = BigInt("0x" + key2.getPublic().getY().toString(16)); const result = await ecdh.deriveKey(d1, pub2X, pub2Y); const k12x = result[0]; const k12y = result[1]; @@ -360,8 +359,8 @@ describe("ECDH", () => { it("Should follow associative property", async () => { const key1 = secp256k1Curve.genKeyPair(); const key2 = secp256k1Curve.genKeyPair(); - const d1 = BigNumber.from("0x" + key1.getPrivate().toString(16)); - const d2 = BigNumber.from("0x" + key2.getPrivate().toString(16)); + const d1 = BigInt("0x" + key1.getPrivate().toString(16)); + const d2 = BigInt("0x" + key2.getPrivate().toString(16)); let add12X; let add12Y; const result = await ecdh.publicKey(d1); @@ -370,7 +369,7 @@ describe("ECDH", () => { const result1 = await ecdh.publicKey(d2); const pub2X = result1.qx; const pub2Y = result1.qy; - const d12 = (d1.add(d2)).mod(n2); + const d12 = (d1 + d2) % n2; const result2 = await ecdh.publicKey(d12); const pub12X = result2.qx; const pub12Y = result2.qy; @@ -379,8 +378,8 @@ describe("ECDH", () => { add12Y = result3.y3; const result4 = await ecdh.inverse(result3[2]); - add12X = add12X.mul(result4).mod(n); - add12Y = add12Y.mul(result4).mod(n); + add12X = add12X * result4 % n; + add12Y = add12Y * result4 % n; pub12X.should.be.equal(add12X); pub12Y.should.be.equal(add12Y); }); From d77f14a93725100d36ac2d1d835db77e7c50224e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 26 Jun 2024 17:59:25 +0300 Subject: [PATCH 36/83] Fix node rotation --- test/NodeRotation.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/NodeRotation.ts b/test/NodeRotation.ts index e3656beb..f34e0be1 100644 --- a/test/NodeRotation.ts +++ b/test/NodeRotation.ts @@ -3,8 +3,8 @@ import {fastBeforeEach} from "./tools/mocha"; import {ConstantsHolder, NodeRotation, Nodes, Schains, SchainsInternal, SkaleDKGTester, SkaleManager, ValidatorService, Wallets} from "../typechain-types"; import {deployNodes} from "./tools/deploy/nodes"; import {deployContractManager} from "./tools/deploy/contractManager"; -import {Wallet} from "ethers"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {HDNodeWallet, Wallet} from "ethers"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {deploySkaleManager} from "./tools/deploy/skaleManager"; import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; @@ -28,7 +28,7 @@ describe("NodeRotation", () => { let owner: SignerWithAddress; let validator: SignerWithAddress; - let validatorId: number; + let validatorId: bigint; let constantsHolder: ConstantsHolder; let nodeRotation: NodeRotation; @@ -48,29 +48,29 @@ describe("NodeRotation", () => { nodeRotation = await deployNodeRotation(contractManager); nodes = await deployNodes(contractManager); skaleDKG = await deploySkaleDKGTester(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); skaleManager = await deploySkaleManager(contractManager); schains = await deploySchains(contractManager); schainsInternal = await deploySchainsInternal(contractManager); wallets = await deployWallets(contractManager); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); - await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner.address); + await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner); const CONSTANTS_HOLDER_MANAGER_ROLE = await constantsHolder.CONSTANTS_HOLDER_MANAGER_ROLE(); - await constantsHolder.grantRole(CONSTANTS_HOLDER_MANAGER_ROLE, owner.address); + await constantsHolder.grantRole(CONSTANTS_HOLDER_MANAGER_ROLE, owner); const NODE_MANAGER_ROLE = await nodes.NODE_MANAGER_ROLE(); - await nodes.grantRole(NODE_MANAGER_ROLE, owner.address); + await nodes.grantRole(NODE_MANAGER_ROLE, owner); await validatorService.connect(validator).registerValidator("D2", "D2 is even", 0, 0); - validatorId = (await validatorService.getValidatorId(validator.address)).toNumber(); + validatorId = await validatorService.getValidatorId(validator); await validatorService.enableValidator(validatorId); await constantsHolder.setMSR(0); }) describe("when nodes are registered", () => { type RegisteredNode = { - id: number; - wallet: Wallet; + id: bigint; + wallet: HDNodeWallet; } const totalNumberOfNodes = 20; @@ -80,10 +80,10 @@ describe("NodeRotation", () => { fastBeforeEach(async () => { for (const index of Array.from(Array(totalNumberOfNodes).keys())) { const nodeWallet = Wallet.createRandom().connect(ethers.provider); - await owner.sendTransaction({to: nodeWallet.address, value: nodeBalance}); + await owner.sendTransaction({to: nodeWallet, value: nodeBalance}); const signature = await getValidatorIdSignature(validatorId, nodeWallet); - await validatorService.connect(validator).linkNodeAddress(nodeWallet.address, signature); + await validatorService.connect(validator).linkNodeAddress(nodeWallet, signature); const hexIndex = ("0" + index.toString(16)).slice(-2); await skaleManager.connect(nodeWallet).createNode( @@ -94,7 +94,7 @@ describe("NodeRotation", () => { getPublicKey(nodeWallet), // public key "D2-" + hexIndex, // name "some.domain.name"); - registeredNodes.push({id: index, wallet: nodeWallet}) + registeredNodes.push({id: BigInt(index), wallet: nodeWallet}) } }) @@ -108,9 +108,9 @@ describe("NodeRotation", () => { const deposit = await schains.getSchainPrice(schainType, 5); await schains.addSchain( - owner.address, + owner, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -126,7 +126,7 @@ describe("NodeRotation", () => { await wallets.connect(owner).rechargeSchainWallet(schainHash, {value: ethers.parseEther("1")}); chainNodes = (await schainsInternal.getNodesInGroup(schainHash)).map(id => { - const node = registeredNodes.find(registeredNode => registeredNode.id == id.toNumber()) + const node = registeredNodes.find(registeredNode => registeredNode.id == id) if (node === undefined) { throw new Error(`Can't find a node with id ${id.toString()}`) } @@ -148,7 +148,7 @@ describe("NodeRotation", () => { await nodes.initExit(exitingNode.id); await skaleManager.nodeExit(exitingNode.id); - const newChainNodesIds = (await schainsInternal.getNodesInGroup(schainHash)).map(id => id.toNumber()); + const newChainNodesIds = (await schainsInternal.getNodesInGroup(schainHash)).map(id => id); const enteringNodeId = newChainNodesIds.filter(id => chainNodes.find(chainNode => chainNode.id == id) === undefined)[0]; node = registeredNodes.find(registeredNode => registeredNode.id == enteringNodeId); @@ -216,10 +216,10 @@ describe("NodeRotation", () => { it("a node that fails DKG after node exit " + "should have finish_ts 1 sec bigger than a leaving node", async () => { - const exitingNodeFinishTs = (await nodeRotation.getLeavingHistory(exitingNode.id))[0].finishedRotation.toNumber(); - const failingNodeFinishTs = (await nodeRotation.getLeavingHistory(failingNode.id))[0].finishedRotation.toNumber(); + const exitingNodeFinishTs = (await nodeRotation.getLeavingHistory(exitingNode.id))[0].finishedRotation; + const failingNodeFinishTs = (await nodeRotation.getLeavingHistory(failingNode.id))[0].finishedRotation; - failingNodeFinishTs.should.be.equal(exitingNodeFinishTs + 1); + failingNodeFinishTs.should.be.equal(exitingNodeFinishTs + 1n); }) }); }) From 02350d6c4adb741c00e741cd3bed8f3cb379ce53 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:30:38 +0300 Subject: [PATCH 37/83] Fix nodes data --- test/NodesData.ts | 57 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/test/NodesData.ts b/test/NodesData.ts index cde15fbd..527fd325 100644 --- a/test/NodesData.ts +++ b/test/NodesData.ts @@ -9,7 +9,7 @@ import {deployContractManager} from "./tools/deploy/contractManager"; import {deployNodes} from "./tools/deploy/nodes"; import {deployValidatorService} from "./tools/deploy/delegation/validatorService"; import {deploySkaleManagerMock} from "./tools/deploy/test/skaleManagerMock"; -import {BigNumber, Wallet} from "ethers"; +import {Wallet} from "ethers"; import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert} from "chai"; @@ -124,7 +124,10 @@ describe("NodesData", () => { it("should change node last reward date", async () => { await skipTime(5); const res = await(await nodes.changeNodeLastRewardDate(0)).wait(); - const currentTimeLocal = BigNumber.from((await ethers.provider.getBlock(res.blockNumber)).timestamp); + if (!res?.blockNumber) { + throw new Error(); + } + const currentTimeLocal = (await ethers.provider.getBlock(res.blockNumber))?.timestamp; (await nodes.nodes(0))[5].should.be.equal(currentTimeLocal); (await nodes.getNodeLastRewardDate(0)).should.be.equal(currentTimeLocal); @@ -215,68 +218,68 @@ describe("NodesData", () => { it("should return Node status", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.initExit(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 1); + assert.equal(status, 1n); }); it("should set node status In Maintenance from node address", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(nodeAddress).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); }); it("should set node status From In Maintenance from node address", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(nodeAddress).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); await nodes.connect(nodeAddress).removeNodeFromInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); }); it("should set node status In Maintenance from validator address", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(validator).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); }); it("should set node status From In Maintenance from validator address", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(validator).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); await nodes.connect(validator).removeNodeFromInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); }); it("should set node status In Maintenance from NODE_MANAGER_ROLE", async () => { const NODE_MANAGER_ROLE = await nodes.NODE_MANAGER_ROLE(); await nodes.grantRole(NODE_MANAGER_ROLE, admin.address); let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(admin).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); }); @@ -285,48 +288,48 @@ describe("NodesData", () => { const NODE_MANAGER_ROLE = await nodes.NODE_MANAGER_ROLE(); await nodes.grantRole(NODE_MANAGER_ROLE, admin.address); let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.connect(admin).setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); await nodes.connect(admin).removeNodeFromInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); }); it("should set node status In Maintenance from owner", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); }); it("should set node status From In Maintenance from owner", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.setNodeInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 3); + assert.equal(status, 3n); const boolStatus = await nodes.isNodeInMaintenance(0); assert.equal(boolStatus, true); await nodes.removeNodeFromInMaintenance(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); }); it("should node set node status In Maintenance from Leaving or Left", async () => { let status = await nodes.getNodeStatus(0); - assert.equal(status, 0); + assert.equal(status, 0n); await nodes.initExit(0); status = await nodes.getNodeStatus(0); - assert.equal(status, 1); + assert.equal(status, 1n); await nodes.setNodeInMaintenance(0).should.be.eventually.rejectedWith("Node is not Active"); await nodes.completeExit(0); await nodes.setNodeInMaintenance(0).should.be.eventually.rejectedWith("Node is not Active"); @@ -336,7 +339,7 @@ describe("NodesData", () => { const numberOfActiveNodes = await nodes.numberOfActiveNodes(); await nodes.setNodeInMaintenance(0); const numberOfActiveNodesAfter = await nodes.numberOfActiveNodes(); - assert.equal(numberOfActiveNodesAfter.toNumber(), numberOfActiveNodes.toNumber()-1); + assert.equal(numberOfActiveNodesAfter, numberOfActiveNodes - 1n); }); describe("when node is registered", () => { From 3db639aaad10d63cf5f0ea2b8d5f97f223680069 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:31:19 +0300 Subject: [PATCH 38/83] Fix nodes functionality --- test/NodesFunctionality.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/NodesFunctionality.ts b/test/NodesFunctionality.ts index ad8abf5e..cf5a0c16 100644 --- a/test/NodesFunctionality.ts +++ b/test/NodesFunctionality.ts @@ -57,7 +57,7 @@ describe("NodesFunctionality", () => { delegationController = await deployDelegationController(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); // await contractManager.setContractsAddress("Nodes", nodes.address); await validatorService.connect(validator).registerValidator("Validator", "D2", 0, 0); From 9a58e971a63f15aace83745fff4f6c5a60c7885f Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:36:24 +0300 Subject: [PATCH 39/83] Fix pricing --- test/Pricing.ts | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/test/Pricing.ts b/test/Pricing.ts index 04605e8c..d5a5aea5 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -70,7 +70,7 @@ describe("Pricing", () => { nodeRotation = await deployNodeRotation(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); await validatorService.connect(validator).registerValidator("Validator", "D2", 0, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); @@ -164,25 +164,25 @@ describe("Pricing", () => { }); async function getLoadCoefficient() { - const numberOfNodes = (await nodes.getNumberOfNodes()).toNumber(); - let sumNode = 0; + const numberOfNodes = await nodes.getNumberOfNodes(); + let sumNode = 0n; for (let i = 0; i < numberOfNodes; i++) { if (await nodes.isNodeActive(i)) { const getActiveSchains = await schainsInternal.getActiveSchains(i); for (const schain of getActiveSchains) { const partOfNode = await schainsInternal.getSchainsPartOfNode(schain); const isNodeLeft = await nodes.isNodeLeft(i); - if (partOfNode !== 0 && !isNodeLeft) { + if (partOfNode !== 0n && !isNodeLeft) { sumNode += partOfNode; } } } } - return sumNode / (128 * (await nodes.getNumberOnlineNodes()).toNumber()); + return sumNode / (128n * await nodes.getNumberOnlineNodes()); } it("should check load percentage of network", async () => { - const newLoadPercentage = Math.floor(await getLoadCoefficient() * 100); + const newLoadPercentage = await getLoadCoefficient() * 100n; const loadPercentage = await pricing.getTotalLoadPercentage(); loadPercentage.should.be.equal(newLoadPercentage); }); @@ -207,27 +207,27 @@ describe("Pricing", () => { }); describe("change price when changing the number of nodes", () => { - let oldPrice: number; - let lastUpdated: number; + let oldPrice: bigint; + let lastUpdated: bigint; fastBeforeEach(async () => { await pricing.initNodes(); - oldPrice = (await pricing.price()).toNumber(); - lastUpdated = (await pricing.lastUpdated()).toNumber() + oldPrice = await pricing.price(); + lastUpdated = await pricing.lastUpdated(); }); - async function getPrice(secondSincePreviousUpdate: number) { - const MIN_PRICE = (await constants.MIN_PRICE()).toNumber(); - const ADJUSTMENT_SPEED = (await constants.ADJUSTMENT_SPEED()).toNumber(); - const OPTIMAL_LOAD_PERCENTAGE = (await constants.OPTIMAL_LOAD_PERCENTAGE()).toNumber(); - const COOLDOWN_TIME = (await constants.COOLDOWN_TIME()).toNumber(); + async function getPrice(secondSincePreviousUpdate: bigint) { + const MIN_PRICE = await constants.MIN_PRICE(); + const ADJUSTMENT_SPEED = await constants.ADJUSTMENT_SPEED(); + const OPTIMAL_LOAD_PERCENTAGE = await constants.OPTIMAL_LOAD_PERCENTAGE(); + const COOLDOWN_TIME = await constants.COOLDOWN_TIME(); - const priceChangeSpeed = ADJUSTMENT_SPEED * (oldPrice / MIN_PRICE) * (await getLoadCoefficient() * 100 - OPTIMAL_LOAD_PERCENTAGE); + const priceChangeSpeed = ADJUSTMENT_SPEED * (oldPrice / MIN_PRICE) * (await getLoadCoefficient() * 100n - OPTIMAL_LOAD_PERCENTAGE); let price = oldPrice + priceChangeSpeed * secondSincePreviousUpdate / COOLDOWN_TIME; if (price < MIN_PRICE) { price = MIN_PRICE; } - return Math.floor(price); + return price; } it("should change price when new active node has been added", async () => { @@ -242,13 +242,13 @@ describe("Pricing", () => { name: "vadim", domainName: "some.domain.name" }); - const MINUTES_PASSED = 2; - await skipTime(lastUpdated + MINUTES_PASSED * 60 - await currentTime()); + const MINUTES_PASSED = 2n; + await skipTime(lastUpdated + MINUTES_PASSED * 60n - BigInt(await currentTime())); await pricing.adjustPrice(); - const receivedPrice = (await pricing.price()).toNumber(); + const receivedPrice = await pricing.price(); - const correctPrice = await getPrice((await pricing.lastUpdated()).toNumber() - lastUpdated); + const correctPrice = await getPrice(await pricing.lastUpdated() - lastUpdated); receivedPrice.should.be.equal(correctPrice); oldPrice.should.be.above(receivedPrice); @@ -258,10 +258,10 @@ describe("Pricing", () => { // search non full node to rotate let nodeToExit = -1; let numberOfSchains = 0; - for (let i = 0; i < (await nodes.getNumberOfNodes()).toNumber(); i++) { + for (let i = 0; i < await nodes.getNumberOfNodes(); i++) { if (await nodes.isNodeActive(i)) { const getActiveSchains = await schainsInternal.getActiveSchains(i); - let totalPartOfNode = 0; + let totalPartOfNode = 0n; numberOfSchains = 0; for (const schain of getActiveSchains) { const partOfNode = await schainsInternal.getSchainsPartOfNode(schain); @@ -281,13 +281,13 @@ describe("Pricing", () => { } await nodes.completeExit(nodeToExit); - const MINUTES_PASSED = 2; - await skipTime(lastUpdated + MINUTES_PASSED * 60 - await currentTime()); + const MINUTES_PASSED = 2n; + await skipTime(lastUpdated + MINUTES_PASSED * 60n - BigInt(await currentTime())); await pricing.adjustPrice(); - const receivedPrice = (await pricing.price()).toNumber(); + const receivedPrice = await pricing.price(); - const correctPrice = await getPrice((await pricing.lastUpdated()).toNumber() - lastUpdated); + const correctPrice = await getPrice(await pricing.lastUpdated() - lastUpdated); receivedPrice.should.be.equal(correctPrice); oldPrice.should.be.below(receivedPrice); @@ -306,13 +306,13 @@ describe("Pricing", () => { domainName: "some.domain.name" }); - const MINUTES_PASSED = 30; - await skipTime(lastUpdated + MINUTES_PASSED * 60 - await currentTime()); + const MINUTES_PASSED = 30n; + await skipTime(lastUpdated + MINUTES_PASSED * 60n - BigInt(await currentTime())); await pricing.adjustPrice(); - const receivedPrice = (await pricing.price()).toNumber(); + const receivedPrice = await pricing.price(); - const correctPrice = await getPrice((await pricing.lastUpdated()).toNumber() - lastUpdated); + const correctPrice = await getPrice(await pricing.lastUpdated() - lastUpdated); receivedPrice.should.be.equal(correctPrice); oldPrice.should.be.above(receivedPrice); From 1b464334208fa2fa9924ac999c7e2ca6db19f7bb Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:43:12 +0300 Subject: [PATCH 40/83] Fix schains --- test/Schains.ts | 204 ++++++++++++++++++++++++------------------------ 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/test/Schains.ts b/test/Schains.ts index 59dc0182..d03230b8 100644 --- a/test/Schains.ts +++ b/test/Schains.ts @@ -11,7 +11,7 @@ import {ConstantsHolder, ValidatorService, NodeRotation, Wallets} from "../typechain-types"; -import {BigNumber, Wallet} from "ethers"; +import {Wallet} from "ethers"; import {skipTime, currentTime} from "./tools/time"; import {privateKeys} from "./tools/private-keys"; import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; @@ -81,11 +81,11 @@ describe("Schains", () => { // await contractManager.setContractsAddress("Nodes", nodes.address); schainsInternal = await deploySchainsInternalMock(contractManager); schainsInternal2 = await deploySchainsInternal(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); schains = await deploySchains(contractManager); validatorService = await deployValidatorService(contractManager); skaleDKG = await deploySkaleDKGTester(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); skaleManager = await deploySkaleManager(contractManager); nodeRotation = await deployNodeRotation(contractManager); wallets = await deployWallets(contractManager); @@ -116,7 +116,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, 5, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -139,7 +139,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, 5, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -157,7 +157,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, 5, - ethers.utils.defaultAbiCoder.encode(["uint", "uint8", "uint16"], [5, 6, 0]) + ethers.AbiCoder.defaultAbiCoder().encode(["uint", "uint8", "uint16"], [5, 6, 0]) ).should.be.eventually.rejected; }); @@ -166,7 +166,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -185,7 +185,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -204,7 +204,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -238,7 +238,7 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -254,7 +254,7 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -297,7 +297,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -360,7 +360,7 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -502,9 +502,9 @@ describe("Schains", () => { } const schainName = "d2"; - const schainHash = ethers.utils.solidityKeccak256(["string"], [schainName]); + const schainHash = ethers.solidityPackedKeccak256(["string"], [schainName]); await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); - await schains.addSchainByFoundation(5, SchainType.TEST, 0, schainName, schains.address, owner.address, []); + await schains.addSchainByFoundation(5, SchainType.TEST, 0, schainName, schains, owner.address, []); await skaleDKG.setSuccessfulDKGPublic(schainHash); await skaleManager.connect(nodeAddress1).createNode( @@ -589,9 +589,9 @@ describe("Schains", () => { } const schainName = "d2"; - const schainHash = ethers.utils.solidityKeccak256(["string"], [schainName]); + const schainHash = ethers.solidityPackedKeccak256(["string"], [schainName]); await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); - await schains.addSchainByFoundation(5, SchainType.TEST, 0, schainName, schains.address, owner.address, []); + await schains.addSchainByFoundation(5, SchainType.TEST, 0, schainName, schains, owner.address, []); await wallets.connect(owner).rechargeSchainWallet(stringKeccak256("d2"), {value: 1e20.toString()}); const verificationVector = [{ @@ -786,7 +786,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -815,7 +815,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -837,7 +837,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -863,7 +863,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -885,7 +885,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -903,7 +903,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -942,7 +942,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -964,7 +964,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -986,7 +986,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1008,7 +1008,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1034,7 +1034,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1102,11 +1102,11 @@ describe("Schains", () => { const fallbackMock = await (await ethers.getContractFactory("FallbackMock")).deploy(fallbackGasUsage); await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), holder.address); await skaleManager.grantRole(await skaleManager.SCHAIN_REMOVAL_ROLE(), holder.address); - await schains.connect(holder).addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, schainName, fallbackMock.address, holder.address, []); + await schains.connect(holder).addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, schainName, fallbackMock, holder.address, []); await wallets.rechargeSchainWallet(schainHash, {value: amountInWei}) - await ethers.provider.getBalance(fallbackMock.address).should.be.eventually.equal(0); + await ethers.provider.getBalance(fallbackMock).should.be.eventually.equal(0); await skaleManager.connect(holder).deleteSchainByRoot(schainName); - await ethers.provider.getBalance(fallbackMock.address).should.be.eventually.equal(amountInWei); + await ethers.provider.getBalance(fallbackMock).should.be.eventually.equal(amountInWei); }); it("should assign schain creator on different address", async () => { @@ -1122,15 +1122,15 @@ describe("Schains", () => { it("should store originator address if schain owner is a smart contract", async () => { const schainName = "d2"; - const schainHash = ethers.utils.solidityKeccak256(["string"], [schainName]); + const schainHash = ethers.solidityPackedKeccak256(["string"], [schainName]); await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); - await schains.addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, schainName, schains.address, owner.address, []); + await schains.addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, schainName, schains, owner.address, []); await schainsInternal.getSchainOriginator(schainHash).should.be.eventually.equal(owner.address); }); it("should not store originator address if schain owner is not a smart contract", async () => { const schainName = "d2"; - const schainHash = ethers.utils.solidityKeccak256(["string"], [schainName]); + const schainHash = ethers.solidityPackedKeccak256(["string"], [schainName]); await schains.grantRole(await schains.SCHAIN_CREATOR_ROLE(), owner.address); await schains.addSchainByFoundation(5, SchainType.MEDIUM_TEST, 0, schainName, owner.address, owner.address, []); await schainsInternal.getSchainOriginator(schainHash) @@ -1160,7 +1160,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1183,7 +1183,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1199,7 +1199,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1267,7 +1267,7 @@ describe("Schains", () => { "D2-" + hexIndex, // name "some.domain.name"); } - await contractManager.setContractsAddress("SchainsInternal", schainsInternal2.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal2); }); it("should check node addresses after schain creation", async () => { @@ -1275,7 +1275,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1300,7 +1300,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1357,7 +1357,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1392,7 +1392,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1427,7 +1427,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1461,7 +1461,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1480,7 +1480,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1528,7 +1528,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1547,7 +1547,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1603,7 +1603,7 @@ describe("Schains", () => { it("of test schain", async () => { const price = await schains.getSchainPrice(4, 5); - const correctPrice = BigNumber.from("1000000000000000000"); + const correctPrice = 1000000000000000000n; price.should.be.equal(correctPrice); }); @@ -1621,9 +1621,9 @@ describe("Schains", () => { }); describe("when 4 nodes, 2 schains and 2 additional nodes created", () => { - const ACTIVE = 0; - const LEAVING = 1; - const LEFT = 2; + const ACTIVE = 0n; + const LEAVING = 1n; + const LEFT = 2n; let nodeStatus; fastBeforeEach(async () => { @@ -1643,7 +1643,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1662,7 +1662,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1705,9 +1705,9 @@ describe("Schains", () => { await schainsInternal.getNodesInGroup(stringKeccak256("d3")); await nodes.initExit(0); await skaleManager.connect(nodeAddress1).nodeExit(0); - const leavingTimeOfNode = (await nodeRotation.getLeavingHistory(0))[0].finishedRotation.toNumber(); - const _12hours = 43200; - assert.equal(await currentTime(), leavingTimeOfNode-_12hours); + const leavingTimeOfNode = (await nodeRotation.getLeavingHistory(0))[0].finishedRotation; + const _12hours = 43200n; + assert.equal(BigInt(await currentTime()), leavingTimeOfNode -_12hours); const rotatedSchain = (await nodeRotation.getLeavingHistory(0))[0].schainHash; const rotationForRotatedSchain = await nodeRotation.getRotation(rotatedSchain); rotationForRotatedSchain.newNodeIndex.should.be.not.equal(0); @@ -1772,7 +1772,7 @@ describe("Schains", () => { let zeroPositionD3 = 0; let iter = 0; for (const nodeIndex of arrayD3) { - if (nodeIndex.toNumber() === 0) { + if (nodeIndex === 0n) { zeroPositionD3 = iter; } iter++; @@ -1781,18 +1781,18 @@ describe("Schains", () => { let exist5 = false; iter = 0; for (const nodeIndex of newArrayD3) { - if (nodeIndex.toNumber() === 4) { + if (nodeIndex === 4n) { exist4 = true; } - if (nodeIndex.toNumber() === 5) { + if (nodeIndex === 5n) { exist5 = true; } iter++; } assert.equal(exist4 && exist5, false); assert.equal( - (exist5 && newArrayD3[zeroPositionD3].toNumber() === 5) || - (exist4 && newArrayD3[zeroPositionD3].toNumber() === 4), + (exist5 && newArrayD3[zeroPositionD3] === 5n) || + (exist4 && newArrayD3[zeroPositionD3] === 4n), true ); await skaleDKG.setSuccessfulDKGPublic( @@ -1803,7 +1803,7 @@ describe("Schains", () => { let zeroPositionD2 = 0; iter = 0; for (const nodeIndex of arrayD2) { - if (nodeIndex.toNumber() === 0) { + if (nodeIndex === 0n) { zeroPositionD2 = iter; } iter++; @@ -1812,18 +1812,18 @@ describe("Schains", () => { exist5 = false; iter = 0; for (const nodeIndex of newArrayD2) { - if (nodeIndex.toNumber() === 4) { + if (nodeIndex === 4n) { exist4 = true; } - if (nodeIndex.toNumber() === 5) { + if (nodeIndex === 5n) { exist5 = true; } iter++; } assert.equal(exist4 && exist5, false); assert.equal( - (exist5 && newArrayD2[zeroPositionD2].toNumber() === 5) || - (exist4 && newArrayD2[zeroPositionD2].toNumber() === 4), + (exist5 && newArrayD2[zeroPositionD2] === 5n) || + (exist4 && newArrayD2[zeroPositionD2] === 4n), true ); await skaleDKG.setSuccessfulDKGPublic( @@ -1836,7 +1836,7 @@ describe("Schains", () => { let onePositionD3 = 0; iter = 0; for (const nodeIndex of arrayD3) { - if (nodeIndex.toNumber() === 1) { + if (nodeIndex === 1n) { onePositionD3 = iter; } iter++; @@ -1845,18 +1845,18 @@ describe("Schains", () => { exist5 = false; iter = 0; for (const nodeIndex of newNewArrayD3) { - if (nodeIndex.toNumber() === 4 && iter !== zeroPositionD3) { + if (nodeIndex === 4n && iter !== zeroPositionD3) { exist4 = true; } - if (nodeIndex.toNumber() === 5 && iter !== zeroPositionD3) { + if (nodeIndex === 5n && iter !== zeroPositionD3) { exist5 = true; } iter++; } assert.equal(exist4 && exist5, false); assert.equal( - (exist5 && newNewArrayD3[onePositionD3].toNumber() === 5) || - (exist4 && newNewArrayD3[onePositionD3].toNumber() === 4), + (exist5 && newNewArrayD3[onePositionD3] === 5n) || + (exist4 && newNewArrayD3[onePositionD3] === 4n), true ); await skaleDKG.setSuccessfulDKGPublic( @@ -1867,7 +1867,7 @@ describe("Schains", () => { let onePositionD2 = 0; iter = 0; for (const nodeIndex of arrayD2) { - if (nodeIndex.toNumber() === 1) { + if (nodeIndex === 1n) { onePositionD2 = iter; } iter++; @@ -1876,18 +1876,18 @@ describe("Schains", () => { exist5 = false; iter = 0; for (const nodeIndex of newNewArrayD2) { - if (nodeIndex.toNumber() === 4 && iter !== zeroPositionD2) { + if (nodeIndex === 4n && iter !== zeroPositionD2) { exist4 = true; } - if (nodeIndex.toNumber() === 5 && iter !== zeroPositionD2) { + if (nodeIndex === 5n && iter !== zeroPositionD2) { exist5 = true; } iter++; } assert.equal(exist4 && exist5, false); assert.equal( - (exist5 && newNewArrayD2[onePositionD2].toNumber() === 5) || - (exist4 && newNewArrayD2[onePositionD2].toNumber() === 4), + (exist5 && newNewArrayD2[onePositionD2] === 5n) || + (exist4 && newNewArrayD2[onePositionD2] === 4n), true ); await skaleDKG.setSuccessfulDKGPublic( @@ -1946,7 +1946,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1963,7 +1963,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1980,7 +1980,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1996,7 +1996,7 @@ describe("Schains", () => { stringKeccak256("d4"), ); const nodesInGroupBN = await schainsInternal.getNodesInGroup(stringKeccak256("d4")); - const nodeInGroup = nodesInGroupBN.map((value: BigNumber) => value.toNumber())[0]; + const nodeInGroup = nodesInGroupBN.map((value: bigint) => value)[0]; await nodes.initExit(nodeInGroup); await skaleManager.connect(nodeAddress1).nodeExit(nodeInGroup); }); @@ -2270,7 +2270,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2289,7 +2289,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2308,7 +2308,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2327,7 +2327,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2442,7 +2442,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2461,7 +2461,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2480,7 +2480,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2499,7 +2499,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2714,16 +2714,16 @@ describe("Schains", () => { } const rotDelay = await constantsHolder.rotationDelay(); - const tenSecDelta = 10; + const tenSecDelta = 10n; - await skipTime(rotDelay.toNumber() - tenSecDelta); + await skipTime(rotDelay - tenSecDelta); for (const schainHash of Array.from(schainHashes).reverse()) { (await nodeRotation.isRotationInProgress(schainHash)).should.be.true; (await nodeRotation.isNewNodeFound(schainHash)).should.be.false; } - await skipTime(tenSecDelta + 1); + await skipTime(tenSecDelta + 1n); for (const schainHash of Array.from(schainHashes).reverse()) { (await nodeRotation.isRotationInProgress(schainHash)).should.be.false; @@ -2745,7 +2745,7 @@ describe("Schains", () => { } } - await skipTime(rotDelay.toNumber() + 1); + await skipTime(rotDelay + 1n); for (const schainHash of Array.from(schainHashes).reverse()) { (await nodeRotation.isRotationInProgress(schainHash)).should.be.false; @@ -2771,7 +2771,7 @@ describe("Schains", () => { } } - await skipTime(rotDelay.toNumber() + 1); + await skipTime(rotDelay + 1n); for (const schainHash of Array.from(schainHashes).reverse()) { (await nodeRotation.isRotationInProgress(schainHash)).should.be.false; @@ -2865,7 +2865,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -3035,7 +3035,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -3061,7 +3061,7 @@ describe("Schains", () => { "some.domain.name"); const rotIndex2 = 1; await nodes.initExit(rotIndex2); - while(await nodes.getNodeStatus(rotIndex2) !== 2) { + while(await nodes.getNodeStatus(rotIndex2) !== 2n) { await skaleManager.connect(nodeAddress1).nodeExit(rotIndex2); } await skaleDKG.setSuccessfulDKGPublic( @@ -3113,7 +3113,7 @@ describe("Schains", () => { await nodes.isNodeLeft(leavingNodeIndex).should.eventually.be.true; - const numberOfNodes = (await nodes.getNumberOfNodes()).toNumber(); + const numberOfNodes = (await nodes.getNumberOfNodes()); for(let i = 0; i < numberOfNodes; i++) { if (i !== leavingNodeIndex) { expect((await nodes.spaceOfNodes(i)).freeSpace).to.be.equal(128); @@ -3135,7 +3135,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: lifetime, @@ -3154,7 +3154,7 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: lifetime, @@ -3199,11 +3199,11 @@ describe("Schains", () => { const [ slots ] = await schainsInternal.schainTypes(schainType); - const numberOfNodes = (await nodes.getNumberOfNodes()).toNumber(); + const numberOfNodes = await nodes.getNumberOfNodes(); for(let i = 0; i < numberOfNodes; i++) { if (i !== leavingNodeIndex) { - const numberOfSchains = (await schainsInternal.getActiveSchains(i)).length; - expect((await nodes.spaceOfNodes(i)).freeSpace).to.be.equal(128 - numberOfSchains * slots); + const numberOfSchains = BigInt((await schainsInternal.getActiveSchains(i)).length); + expect((await nodes.spaceOfNodes(i)).freeSpace).to.be.equal(128n - numberOfSchains * slots); } } }); From 69699bda2a14930d690089d003ca061cac0c5924 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:44:38 +0300 Subject: [PATCH 41/83] Fix schains internal --- test/SchainsInternal.ts | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/SchainsInternal.ts b/test/SchainsInternal.ts index d3d6b3c7..938879de 100644 --- a/test/SchainsInternal.ts +++ b/test/SchainsInternal.ts @@ -44,9 +44,9 @@ describe("SchainsInternal", () => { validatorService = await deployValidatorService(contractManager); // contract must be set in contractManager for proper work of allow modifier - await contractManager.setContractsAddress("Schains", nodes.address); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); - await contractManager.setContractsAddress("SkaleManager", nodes.address); + await contractManager.setContractsAddress("Schains", nodes); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); + await contractManager.setContractsAddress("SkaleManager", nodes); await validatorService.connect(holder).registerValidator("D2", "D2 is even", 0, 0); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); @@ -75,7 +75,7 @@ describe("SchainsInternal", () => { const generationAfter = await schainsInternal.currentGeneration(); - generationBefore.add(1).should.be.equal(generationAfter); + (generationBefore + 1n).should.be.equal(generationAfter); }); it("should allow to switch generation only to generation manager", async () => { @@ -95,7 +95,7 @@ describe("SchainsInternal", () => { (await schainsInternal.getGeneration(generation0Hash)).should.be.equal(generation); await schainsInternal.newGeneration(); - generation = generation.add(1); + generation = generation + 1n; await schainsInternal.initializeSchain(generation1Name, holder.address, ethers.ZeroAddress, 5, 5); (await schainsInternal.getGeneration(generation1Hash)).should.be.equal(generation); @@ -131,7 +131,7 @@ describe("SchainsInternal", () => { }); it("should be able to add schain to node", async () => { - await schainsInternal.addSchainForNode(nodes.address, 0, schainNameHash); + await schainsInternal.addSchainForNode(nodes, 0, schainNameHash); await schainsInternal.getSchainHashesForNode(0).should.eventually.deep.equal([schainNameHash]); }); @@ -182,7 +182,7 @@ describe("SchainsInternal", () => { it("should check group", async () => { const res = await schainsInternal.getNodesInGroup(schainNameHash); res.length.should.be.equal(1); - res[0].toNumber().should.be.equal(0); + res[0].should.be.equal(0); }); it("should delete group", async () => { @@ -198,24 +198,24 @@ describe("SchainsInternal", () => { }); it("should add another schain to the node and remove first correctly", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); await schainsInternal.removeSchainForNode(nodeIndex, 0); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.getSchainHashesForNode(nodeIndex).should.eventually.be.deep.equal( [newSchainHashes[1], newSchainHashes[0]], ); }); it("should add a hole after deleting", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 1); (await schainsInternal.holesForNodes(nodeIndex, 0)).should.be.equal(1); }); it("should add another hole after deleting", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 1); await schainsInternal.removeSchainForNode(nodeIndex, 0); (await schainsInternal.holesForNodes(nodeIndex, 0)).should.be.equal(0); @@ -223,8 +223,8 @@ describe("SchainsInternal", () => { }); it("should add another hole after deleting different order", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 0); await schainsInternal.removeSchainForNode(nodeIndex, 1); (await schainsInternal.holesForNodes(nodeIndex, 0)).should.be.equal(0); @@ -232,11 +232,11 @@ describe("SchainsInternal", () => { }); it("should add schain in a hole", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 0); await schainsInternal.removeSchainForNode(nodeIndex, 1); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[2]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[2]); (await schainsInternal.holesForNodes(nodeIndex, 0)).should.be.equal(0); await schainsInternal.getSchainHashesForNode(nodeIndex).should.eventually.be.deep.equal( [ @@ -248,12 +248,12 @@ describe("SchainsInternal", () => { }); it("should add second schain in a hole", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 0); await schainsInternal.removeSchainForNode(nodeIndex, 1); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[2]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[3]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[2]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[3]); await schainsInternal.getSchainHashesForNode(nodeIndex).should.eventually.be.deep.equal( [ newSchainHashes[3], @@ -264,13 +264,13 @@ describe("SchainsInternal", () => { }); it("should add third schain like new", async () => { - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[0]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[1]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[0]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[1]); await schainsInternal.removeSchainForNode(nodeIndex, 0); await schainsInternal.removeSchainForNode(nodeIndex, 1); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[2]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[3]); - await schainsInternal.addSchainForNode(nodes.address, nodeIndex, newSchainHashes[4]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[2]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[3]); + await schainsInternal.addSchainForNode(nodes, nodeIndex, newSchainHashes[4]); await schainsInternal.getSchainHashesForNode(nodeIndex).should.eventually.be.deep.equal( [ newSchainHashes[3], From d7844693096d7ddc2b7449939667bfdfc8c6362d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:57:07 +0300 Subject: [PATCH 42/83] Fix skale dkg --- test/SkaleDKG.ts | 107 +++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 46 deletions(-) diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index 4cd48a73..19da5ff9 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -32,7 +32,7 @@ import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert, expect} from "chai"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; -import {BytesLike, ContractTransaction, Wallet} from "ethers"; +import {BytesLike, ContractTransaction, ContractTransactionResponse, Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {stringKeccak256} from "./tools/hashes"; import {schainParametersType, SchainType} from "./tools/types"; @@ -40,16 +40,19 @@ import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); -const weiTolerance = ethers.parseEther("0.002").toNumber(); +const weiTolerance = ethers.parseEther("0.002"); -async function reimbursed(transaction: ContractTransaction, operation?: string) { +async function reimbursed(transaction: ContractTransactionResponse, operation?: string) { const receipt = await transaction.wait(); + if (!receipt) { + throw new Error(); + } const sender = transaction.from; const balanceBefore = await ethers.provider.getBalance(sender, receipt.blockNumber - 1); const balanceAfter = await ethers.provider.getBalance(sender, receipt.blockNumber); - if (balanceAfter.lt(balanceBefore)) { - const shortageEth = balanceBefore.sub(balanceAfter); - const shortageGas = shortageEth.div(receipt.effectiveGasPrice); + if (balanceAfter < balanceBefore) { + const shortageEth = balanceBefore - balanceAfter; + const shortageGas = shortageEth / receipt.gasPrice; console.log("Reimbursement failed.") console.log(`${shortageGas.toString()} gas units was not reimbursed`); @@ -117,7 +120,7 @@ describe("SkaleDKG", () => { skaleManager = await deploySkaleManager(contractManager); wallets = await deployWallets(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner.address); @@ -369,7 +372,7 @@ describe("SkaleDKG", () => { const res = await (await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -382,7 +385,7 @@ describe("SkaleDKG", () => { ))).wait(); assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true); - (await skaleDKG.getChannelStartedBlock(stringKeccak256("d2"))).should.be.equal(res.blockNumber); + (await skaleDKG.getChannelStartedBlock(stringKeccak256("d2"))).should.be.equal(res?.blockNumber); }); it("should create schain and reopen a DKG channel", async () => { @@ -391,7 +394,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -412,7 +415,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -441,7 +444,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -457,14 +460,14 @@ describe("SkaleDKG", () => { schainName = "d2"; await wallets.connect(owner).rechargeSchainWallet(stringKeccak256(schainName), {value: 1e20.toString()}); let index = 3; - while (nodesInGroup[0].eq(1)) { + while (nodesInGroup[0] == 1n) { await schains.deleteSchainByRoot(schainName); schainName = `d${index}`; index++; await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1225,11 +1228,11 @@ describe("SkaleDKG", () => { await reimbursed(response); - (await skaleToken.callStatic.getAndUpdateLockedAmount(validator2.address)).toNumber() + (await skaleToken.getAndUpdateLockedAmount.staticCall(validator2.address)) .should.be.equal(delegatedAmount); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(validator2.address)).toNumber() + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(validator2.address)) .should.be.equal(delegatedAmount - failedDkgPenalty); - (await skaleToken.callStatic.getAndUpdateSlashedAmount(validator2.address)).toNumber() + (await skaleToken.getAndUpdateSlashedAmount.staticCall(validator2.address)) .should.be.equal(failedDkgPenalty); }); @@ -1385,14 +1388,14 @@ describe("SkaleDKG", () => { await expect(response).to.emit(skaleDKG, "BadGuy").withArgs(0); await reimbursed(response); - const leavingTimeOfNode = (await nodeRotation.getLeavingHistory(0))[0].finishedRotation.toNumber(); - assert.equal(await currentTime(), leavingTimeOfNode); + const leavingTimeOfNode = (await nodeRotation.getLeavingHistory(0))[0].finishedRotation; + assert.equal(BigInt(await currentTime()), leavingTimeOfNode); - (await skaleToken.callStatic.getAndUpdateLockedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateLockedAmount.staticCall(validator1.address)) .should.be.equal(delegatedAmount); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(validator1.address)) .should.be.equal(delegatedAmount - failedDkgPenalty); - (await skaleToken.callStatic.getAndUpdateSlashedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateSlashedAmount.staticCall(validator1.address)) .should.be.equal(failedDkgPenalty); }); @@ -1416,11 +1419,11 @@ describe("SkaleDKG", () => { await expect(response).to.emit(skaleDKG, "BadGuy").withArgs(0); await reimbursed(response); - (await skaleToken.callStatic.getAndUpdateLockedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateLockedAmount.staticCall(validator1.address)) .should.be.equal(delegatedAmount); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(validator1.address)) .should.be.equal(delegatedAmount - failedDkgPenalty); - (await skaleToken.callStatic.getAndUpdateSlashedAmount(validator1.address)).toNumber() + (await skaleToken.getAndUpdateSlashedAmount.staticCall(validator1.address)) .should.be.equal(failedDkgPenalty); }); }); @@ -1433,7 +1436,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1448,14 +1451,14 @@ describe("SkaleDKG", () => { let nodesInGroup = await schainsInternal.getNodesInGroup(stringKeccak256("d2")); schainName = "d2"; let index = 3; - while (nodesInGroup[0].eq(1)) { + while (nodesInGroup[0] == 1n) { await schains.deleteSchainByRoot(schainName); schainName = `d${index}`; index++; await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1513,11 +1516,14 @@ describe("SkaleDKG", () => { 0 ); const resComplaint = await complaintBadData.wait(); + if(!resComplaint) { + throw new Error(); + } await reimbursed(complaintBadData, "Complaint bad data"); assert( await skaleDKG.getComplaintStartedTime(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resComplaint.blockNumber)).timestamp.toString() + (await ethers.provider.getBlock(resComplaint.blockNumber))?.timestamp.toString() ); await reimbursed( @@ -1543,11 +1549,15 @@ describe("SkaleDKG", () => { await responseTx.should.emit(skaleDKG, "NewGuy").withArgs(2); await responseTx.should.emit(skaleDKG, "FailedDKG").withArgs(stringKeccak256(schainName)); - const blockNumber = (await responseTx.wait()).blockNumber; - const timestamp = (await ethers.provider.getBlock(blockNumber)).timestamp; + const receipt = await responseTx.wait() + if (!receipt) { + throw new Error(); + } + const blockNumber = receipt.blockNumber; + const timestamp = (await ethers.provider.getBlock(blockNumber))?.timestamp; assert.equal((await skaleDKG.getNumberOfBroadcasted(stringKeccak256(schainName))).toString(), "0"); - assert.equal((await skaleDKG.getChannelStartedTime(stringKeccak256(schainName))).toString(), timestamp.toString()); + assert.equal((await skaleDKG.getChannelStartedTime(stringKeccak256(schainName))).toString(), timestamp?.toString()); rotCounter = await nodeRotation.getRotation(stringKeccak256(schainName)); assert.equal(rotCounter.rotationCounter.toString(), "1"); @@ -1618,7 +1628,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1633,14 +1643,14 @@ describe("SkaleDKG", () => { let nodesInGroup = await schainsInternal.getNodesInGroup(stringKeccak256("d2")); schainName = "d2"; let index = 3; - while (nodesInGroup[0].eq(1)) { + while (nodesInGroup[0] === 1n) { await schains.deleteSchainByRoot(schainName); schainName = `d${index}`; index++; await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1685,9 +1695,10 @@ describe("SkaleDKG", () => { encryptedSecretKeyContributions[indexes[1]], rotCounter.rotationCounter )).wait(); + assert(res); assert( await skaleDKG.getAlrightStartedTime(stringKeccak256(schainName)), - (await ethers.provider.getBlock(res.blockNumber)).timestamp.toString() + (await ethers.provider.getBlock(res.blockNumber))?.timestamp.toString() ); let numOfCompleted = await skaleDKG.getNumberOfCompleted(stringKeccak256(schainName)); assert(numOfCompleted, "0"); @@ -1704,13 +1715,14 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 )).wait(); + assert(resSuccess); numOfCompleted = await skaleDKG.getNumberOfCompleted(stringKeccak256(schainName)); assert(numOfCompleted, "2"); assert( await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resSuccess.blockNumber)).timestamp.toString() + (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp.toString() ); const comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256(schainName)); @@ -1767,7 +1779,7 @@ describe("SkaleDKG", () => { assert( await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resSuccess.blockNumber)).timestamp.toString() + (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp.toString() ); await skaleDKG.connect(validators[0].nodeAddress).alright( @@ -1850,7 +1862,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -1965,7 +1977,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2265,7 +2277,7 @@ describe("SkaleDKG", () => { await expect(complaint).to.emit(skaleDKG, "ComplaintError").withArgs("One complaint is already sent"); await reimbursed(complaint); - if (accusedNode.eq(1)) { + if (accusedNode === 1n) { indexToSend = 1; } else { indexToSend = 0; @@ -2291,14 +2303,17 @@ describe("SkaleDKG", () => { verificationVectorMultiplicationNew, secretKeyContributions )).wait(); + assert(resPreResp); const responseTx = await skaleDKG.connect(validators[indexToSend].nodeAddress).response( stringKeccak256("New16NodeSchain"), accusedNode, secretNumbers[indexes[indexToSend]], multipliedShares[indexes[indexToSend]] ); + const receipt = await responseTx.wait(); + assert(receipt); await responseTx.should.emit(skaleDKG, "BadGuy").withArgs(accusedNode); - assert.isAtMost((await responseTx.wait()).gasUsed.toNumber() + resPreResp.gasUsed.toNumber(), 10000000); + assert(receipt.gasUsed + resPreResp.gasUsed >= 10000000); }); it("16 nodes schain test with incorrect complaint and deleting Schain", async () => { @@ -2321,7 +2336,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2404,7 +2419,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2552,7 +2567,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -2627,7 +2642,7 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, From a5605e1a619412069b47118269f8634ebd8a2db1 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 16:59:29 +0300 Subject: [PATCH 43/83] Fix skale dkg fake complaint --- test/SkaleDkgFakeComplaint.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/SkaleDkgFakeComplaint.ts b/test/SkaleDkgFakeComplaint.ts index 92ccf86e..d741b08c 100644 --- a/test/SkaleDkgFakeComplaint.ts +++ b/test/SkaleDkgFakeComplaint.ts @@ -587,7 +587,7 @@ describe("SkaleDkgFakeComplaint", () => { wallets = await deployWallets(contractManager); nodeRotation = await deployNodeRotation(contractManager); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); const PENALTY_SETTER_ROLE = await slashingTable.PENALTY_SETTER_ROLE(); await slashingTable.grantRole(PENALTY_SETTER_ROLE, owner.address); @@ -648,7 +648,7 @@ describe("SkaleDkgFakeComplaint", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -664,14 +664,14 @@ describe("SkaleDkgFakeComplaint", () => { schainName = "d2"; await wallets.connect(owner).rechargeSchainWallet(stringKeccak256(schainName), {value: 1e20.toString()}); let index = 3; - while (!(nodesInGroup[0].eq(0) && nodesInGroup[1].eq(1) && nodesInGroup[2].eq(2))) { + while (!(nodesInGroup[0] === 0n && nodesInGroup[1] === 1n && nodesInGroup[2] === 2n)) { await schains.deleteSchainByRoot(schainName); schainName = `d${index}`; index++; await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, From c3226709df6f541854a4e3ab6bf73a21132f664e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 17:16:07 +0300 Subject: [PATCH 44/83] Fix skale manager --- test/SkaleManager.ts | 159 ++++++++++++++++++++++--------------------- test/tools/time.ts | 6 +- 2 files changed, 88 insertions(+), 77 deletions(-) diff --git a/test/SkaleManager.ts b/test/SkaleManager.ts index afd529e9..5401a14c 100644 --- a/test/SkaleManager.ts +++ b/test/SkaleManager.ts @@ -31,7 +31,7 @@ import {deploySkaleManager} from "./tools/deploy/skaleManager"; import {deploySkaleToken} from "./tools/deploy/skaleToken"; import {skipTime, currentTime, nextMonth} from "./tools/time"; import {deployBounty} from "./tools/deploy/bounty"; -import {BigNumber, ContractTransaction, Wallet} from "ethers"; +import {ContractTransactionResponse, Wallet} from "ethers"; import {deployTimeHelpers} from "./tools/deploy/delegation/timeHelpers"; import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; @@ -44,10 +44,13 @@ import {schainParametersType, SchainType} from "./tools/types"; chai.should(); chai.use(chaiAsPromised); -async function ethSpent(response: ContractTransaction) { +async function ethSpent(response: ContractTransactionResponse) { const receipt = await response.wait(); - if (receipt.effectiveGasPrice) { - return receipt.effectiveGasPrice.mul(receipt.gasUsed); + if(!receipt) { + throw new Error(); + } + if (receipt.gasPrice) { + return receipt.gasPrice * receipt.gasUsed; } else { throw new ReferenceError("gasPrice is undefined"); } @@ -97,8 +100,8 @@ describe("SkaleManager", () => { delegationPeriodManager = await deployDelegationPeriodManager(contractManager); distributor = await deployDistributor(contractManager); skaleDKG = await deploySkaleDKGTester(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); bountyContract = await deployBounty(contractManager); wallets = await deployWallets(contractManager); @@ -150,18 +153,16 @@ describe("SkaleManager", () => { describe("when validator has delegated SKALE tokens", () => { const validatorId = 1; - const day = 60 * 60 * 24; + const day = BigInt(60 * 60 * 24); const delegatedAmount = 1e7; fastBeforeEach(async () => { await validatorService.connect(validator).registerValidator("D2", "D2 is even", 150, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); const signature = await nodeAddress.signMessage( - ethers.utils.arrayify( - ethers.utils.solidityKeccak256( - ["uint"], - [validatorIndex] - ) + ethers.solidityPackedKeccak256( + ["uint"], + [validatorIndex] ) ); await validatorService.connect(validator).linkNodeAddress(nodeAddress.address, signature); @@ -274,27 +275,27 @@ describe("SkaleManager", () => { const minNodeBalance = await constantsHolder.minNodeBalance(); await nodeAddress.sendTransaction({ to: owner.address, - value: (await nodeAddress.getBalance()).sub(minNodeBalance) + value: await ethers.provider.getBalance(nodeAddress) - minNodeBalance }); await nextMonth(contractManager); - await skipTime((await bountyContract.nodeCreationWindowSeconds()).toNumber()); + await skipTime(await bountyContract.nodeCreationWindowSeconds()); const spentValue = await ethSpent(await skaleManager.connect(nodeAddress).getBounty(0, {gasLimit: 2e6})); - const balance = await nodeAddress.getBalance(); - balance.add(spentValue).should.be.least(minNodeBalance); - balance.add(spentValue).should.be.closeTo(minNodeBalance, 1e13); + const balance = await ethers.provider.getBalance(nodeAddress); + (balance + spentValue).should.be.least(minNodeBalance); + (balance + spentValue).should.be.closeTo(minNodeBalance, 1e13); }); it("should pay bounty if Node is In Leaving state", async () => { await nodesContract.initExit(0); await nextMonth(contractManager); - await skipTime((await bountyContract.nodeCreationWindowSeconds()).toNumber()) + await skipTime(await bountyContract.nodeCreationWindowSeconds()) await skaleManager.connect(nodeAddress).getBounty(0); }); it("should pay bounty if Node is In Maintenance state", async () => { await nodesContract.connect(validator).setNodeInMaintenance(0); await nextMonth(contractManager); - await skipTime((await bountyContract.nodeCreationWindowSeconds()).toNumber()) + await skipTime(await bountyContract.nodeCreationWindowSeconds()) await skaleManager.connect(nodeAddress).getBounty(0); }); @@ -302,7 +303,7 @@ describe("SkaleManager", () => { await nodesContract.initExit(0); await nodesContract.completeExit(0); await nextMonth(contractManager); - await skipTime((await bountyContract.nodeCreationWindowSeconds()).toNumber()) + await skipTime(await bountyContract.nodeCreationWindowSeconds()) await skaleManager.connect(nodeAddress).getBounty(0).should.be.eventually.rejectedWith("The node must not be in Left state"); }); @@ -312,7 +313,7 @@ describe("SkaleManager", () => { await nodesContract.setNodeIncompliant(nodeIndex); await nextMonth(contractManager); - await skipTime((await bountyContract.nodeCreationWindowSeconds()).toNumber()) + await skipTime(await bountyContract.nodeCreationWindowSeconds()) await skaleManager.connect(nodeAddress).getBounty(nodeIndex).should.be.eventually.rejectedWith("The node is incompliant"); }); @@ -324,38 +325,44 @@ describe("SkaleManager", () => { const timeLimit = 300 * 1000; const start = Date.now(); - const launch = (await constantsHolder.launchTimestamp()).toNumber(); - const launchMonth = (await timeHelpers.timestampToMonth(launch)).toNumber(); - const ten18 = BigNumber.from(10).pow(18); + const launch = await constantsHolder.launchTimestamp(); + const launchMonth = await timeHelpers.timestampToMonth(launch); const schedule = [ - 385000000, - 346500000, - 308000000, - 269500000, - 231000000, - 192500000 + 385000000n, + 346500000n, + 308000000n, + 269500000n, + 231000000n, + 192500000n ] - for (let bounty = schedule[schedule.length - 1] / 2; bounty > 1; bounty /= 2) { + for (let bounty = schedule[schedule.length - 1] / 2n; bounty > 1; bounty /= 2n) { for (let i = 0; i < 3; ++i) { schedule.push(bounty); } } - let mustBePaid = BigNumber.from(0); + let mustBePaid = 0n; await nextMonth(contractManager); for (let year = 0; year < schedule.length && (Date.now() - start) < 0.9 * timeLimit; ++year) { - for (let monthIndex = 0; monthIndex < 12; ++monthIndex) { - const monthEnd = (await timeHelpers.monthToTimestamp(launchMonth + 12 * year + monthIndex + 1)).toNumber(); + for (let monthIndex = 0n; monthIndex < 12; ++monthIndex) { + const monthEnd = await timeHelpers.monthToTimestamp(launchMonth + BigInt(12 * year) + monthIndex + 1n); if (await currentTime() < monthEnd) { await skipTime(monthEnd - await currentTime() - day); await skaleManager.connect(nodeAddress).getBounty(0); } } - const bountyWasPaid = await skaleToken.balanceOf(distributor.address); - mustBePaid = mustBePaid.add(Math.floor(schedule[year])); + const bountyWasPaid = await skaleToken.balanceOf(distributor); + mustBePaid = mustBePaid + schedule[year]; + + const abs = (value: bigint) => { + if (value < 0) { + return - value; + } + return value; + } - bountyWasPaid.div(ten18).sub(mustBePaid).abs().toNumber().should.be.lessThan(35); // 35 because of rounding errors in JS + abs(BigInt(ethers.formatEther(bountyWasPaid)) - mustBePaid).should.be.lessThan(35); // 35 because of rounding errors in JS } }); }); @@ -425,7 +432,7 @@ describe("SkaleManager", () => { "some.domain.name"); } - const schainHash = ethers.utils.solidityKeccak256(["string"], ["d2"]); + const schainHash = ethers.solidityPackedKeccak256(["string"], ["d2"]); if (schainHash) { d2SchainHash = schainHash; } @@ -450,9 +457,9 @@ describe("SkaleManager", () => { it("should create schain", async () => { await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -473,9 +480,9 @@ describe("SkaleManager", () => { await constantsHolder.setMinimalSchainLifetime(SECONDS_TO_YEAR); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -490,9 +497,9 @@ describe("SkaleManager", () => { await constantsHolder.setMinimalSchainLifetime(4); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -511,12 +518,12 @@ describe("SkaleManager", () => { it("should not allow to create schain if certain date has not reached", async () => { - const unreachableDate = BigNumber.from(2).pow(256).sub(1); + const unreachableDate = 2n ** 256n - 1n; await constantsHolder.setSchainCreationTimeStamp(unreachableDate); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 4, @@ -533,9 +540,9 @@ describe("SkaleManager", () => { describe("when schain is created", () => { fastBeforeEach(async () => { await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -575,9 +582,9 @@ describe("SkaleManager", () => { describe("when another schain is created", () => { fastBeforeEach(async () => { await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -625,8 +632,8 @@ describe("SkaleManager", () => { "some.domain.name"); } - d2SchainHash = ethers.utils.solidityKeccak256(["string"], ["d2"]); - d3SchainHash = ethers.utils.solidityKeccak256(["string"], ["d3"]); + d2SchainHash = ethers.solidityPackedKeccak256(["string"], ["d2"]); + d3SchainHash = ethers.solidityPackedKeccak256(["string"], ["d3"]); }); describe("when developer has SKALE tokens", () => { @@ -637,9 +644,9 @@ describe("SkaleManager", () => { it("should create 2 medium schains", async () => { const price = await schains.getSchainPrice(3, 5) await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -656,9 +663,9 @@ describe("SkaleManager", () => { schain1[0].should.be.equal("d2"); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -678,9 +685,9 @@ describe("SkaleManager", () => { describe("when schains are created", () => { fastBeforeEach(async () => { await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -694,9 +701,9 @@ describe("SkaleManager", () => { ); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -743,9 +750,9 @@ describe("SkaleManager", () => { let price = await schains.getSchainPrice(1, 5); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -758,7 +765,7 @@ describe("SkaleManager", () => { ) ); - let schain1 = await schainsInternal.schains(ethers.utils.solidityKeccak256(["string"], ["d2"])); + let schain1 = await schainsInternal.schains(ethers.solidityPackedKeccak256(["string"], ["d2"])); schain1[0].should.be.equal("d2"); await skaleManager.connect(developer).deleteSchain("d2"); @@ -767,9 +774,9 @@ describe("SkaleManager", () => { price = await schains.getSchainPrice(2, 5); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -782,7 +789,7 @@ describe("SkaleManager", () => { ) ); - schain1 = await schainsInternal.schains(ethers.utils.solidityKeccak256(["string"], ["d3"])); + schain1 = await schainsInternal.schains(ethers.solidityPackedKeccak256(["string"], ["d3"])); schain1[0].should.be.equal("d3"); await skaleManager.connect(developer).deleteSchain("d3"); @@ -790,9 +797,9 @@ describe("SkaleManager", () => { (await schainsInternal.numberOfSchains()).should.be.equal(0); price = await schains.getSchainPrice(3, 5); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -805,7 +812,7 @@ describe("SkaleManager", () => { ) ); - schain1 = await schainsInternal.schains(ethers.utils.solidityKeccak256(["string"], ["d4"])); + schain1 = await schainsInternal.schains(ethers.solidityPackedKeccak256(["string"], ["d4"])); schain1[0].should.be.equal("d4"); await skaleManager.connect(developer).deleteSchain("d4"); @@ -813,9 +820,9 @@ describe("SkaleManager", () => { (await schainsInternal.numberOfSchains()).should.be.equal(0); price = await schains.getSchainPrice(4, 5); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -828,7 +835,7 @@ describe("SkaleManager", () => { ) ); - schain1 = await schainsInternal.schains(ethers.utils.solidityKeccak256(["string"], ["d5"])); + schain1 = await schainsInternal.schains(ethers.solidityPackedKeccak256(["string"], ["d5"])); schain1[0].should.be.equal("d5"); await skaleManager.connect(developer).deleteSchain("d5"); @@ -836,9 +843,9 @@ describe("SkaleManager", () => { (await schainsInternal.numberOfSchains()).should.be.equal(0); price = await schains.getSchainPrice(5, 5); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -851,7 +858,7 @@ describe("SkaleManager", () => { ) ); - schain1 = await schainsInternal.schains(ethers.utils.solidityKeccak256(["string"], ["d6"])); + schain1 = await schainsInternal.schains(ethers.solidityPackedKeccak256(["string"], ["d6"])); schain1[0].should.be.equal("d6"); await skaleManager.connect(developer).deleteSchain("d6"); diff --git a/test/tools/time.ts b/test/tools/time.ts index befe603c..23347e8e 100644 --- a/test/tools/time.ts +++ b/test/tools/time.ts @@ -22,7 +22,11 @@ export async function skipTimeToDate(day: number, monthIndex: number) { } export async function currentTime() { - return (await ethers.provider.getBlock("latest")).timestamp; + const latestBlock = await ethers.provider.getBlock("latest"); + if (latestBlock) { + return BigInt(latestBlock.timestamp); + } + throw new Error("Can't get latest block"); } export const months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]; From 3c3095c996205e29f0b67f7ede265957c3968ed8 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 17:20:44 +0300 Subject: [PATCH 45/83] Fix skale token --- test/SkaleToken.ts | 61 +++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/test/SkaleToken.ts b/test/SkaleToken.ts index 7bdaa1de..d6308dcb 100644 --- a/test/SkaleToken.ts +++ b/test/SkaleToken.ts @@ -1,4 +1,3 @@ -import {BigNumber} from "ethers"; import {ContractManager, SkaleToken, SkaleTokenInternalTester} from "../typechain-types"; @@ -40,7 +39,7 @@ describe("SkaleToken", () => { skaleToken = await deploySkaleToken(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); const premined = "5000000000000000000000000000"; // 5e9 * 1e18 await skaleToken.mint(owner.address, premined, "0x", "0x"); @@ -58,12 +57,12 @@ describe("SkaleToken", () => { it("should have the correct decimal level", async () => { const decimals = await skaleToken.DECIMALS(); - expect(decimals.toNumber()).to.be.equal(18); + expect(decimals).to.be.equal(18); }); it("should return the capitalization of tokens for the Contract", async () => { const cap = await skaleToken.CAP(); - toWei(TOKEN_CAP).should.be.equal(cap); + ethers.parseEther(TOKEN_CAP.toString()).should.be.equal(cap); }); it("owner should be equal owner", async () => { @@ -72,24 +71,24 @@ describe("SkaleToken", () => { it("the owner should have all the tokens when the Contract is created", async () => { const balance = await skaleToken.balanceOf(owner.address); - balance.should.be.equal(toWei(TOTAL_SUPPLY)); + balance.should.be.equal(ethers.parseEther(TOTAL_SUPPLY.toString())); }); it("should return the total supply of tokens for the Contract", async () => { const supply = await skaleToken.totalSupply(); - supply.should.be.equal(toWei(TOTAL_SUPPLY)); + supply.should.be.equal(ethers.parseEther(TOTAL_SUPPLY.toString())); }); it("any account should have the tokens transferred to it", async () => { - const amount = toWei(10); + const amount = ethers.parseEther("10"); await skaleToken.transfer(holder.address, amount); const balance = await skaleToken.balanceOf(holder.address); balance.should.be.equal(amount); }); it("should not let someone transfer tokens they do not have", async () => { - await skaleToken.transfer(holder.address, toWei(10)); - await skaleToken.connect(holder).transfer(receiver.address, toWei(20)).should.be.eventually.rejected; + await skaleToken.transfer(holder.address, ethers.parseEther("10")); + await skaleToken.connect(holder).transfer(receiver.address, ethers.parseEther("20")).should.be.eventually.rejected; }); it("an address that has no tokens should return a balance of zero", async () => { @@ -99,11 +98,11 @@ describe("SkaleToken", () => { it("an owner address should have more than 0 tokens", async () => { const balance = await skaleToken.balanceOf(owner.address); - balance.should.be.equal(toWei(5000000000)); + balance.should.be.equal(ethers.parseEther("5000000000")); }); it("should emit a Transfer Event", async () => { - const amount = toWei(10); + const amount = ethers.parseEther("10"); await expect( skaleToken.transfer(holder.address, amount) ).to.emit(skaleToken, 'Transfer') @@ -111,14 +110,14 @@ describe("SkaleToken", () => { }); it("allowance should return the amount I allow them to transfer", async () => { - const amount = toWei(99); + const amount = ethers.parseEther("99"); await skaleToken.approve(holder.address, amount); const remaining = await skaleToken.allowance(owner.address, holder.address); amount.should.be.equal(remaining); }); it("allowance should return the amount another allows a third account to transfer", async () => { - const amount = toWei(98); + const amount = ethers.parseEther("98"); await skaleToken.connect(holder).approve(receiver.address, amount); const remaining = await skaleToken.allowance(holder.address, receiver.address); amount.should.be.equal(remaining); @@ -130,7 +129,7 @@ describe("SkaleToken", () => { }); it("should emit an Approval event when the approve method is successfully called", async () => { - const amount = toWei(97); + const amount = ethers.parseEther("97"); await expect(skaleToken.approve(holder.address, amount)) .to.emit(skaleToken, 'Approval') .withArgs(owner.address, holder.address, amount); @@ -150,11 +149,11 @@ describe("SkaleToken", () => { }); it("the account funds are being transferred from should have sufficient funds", async () => { - const balance99 = toWei(99); + const balance99 = ethers.parseEther("99"); await skaleToken.transfer(accountWith99.address, balance99); const balance = await skaleToken.balanceOf(accountWith99.address); balance99.should.be.equal(balance); - const amount = toWei(100); + const amount = ethers.parseEther("100"); await skaleToken.connect(accountWith99).approve(receiver.address, amount); await skaleToken.connect(receiver).transferFrom(accountWith99.address, receiver.address, amount).should.be.eventually.rejected; @@ -165,24 +164,24 @@ describe("SkaleToken", () => { remaining.should.be.equal(0); const holderBalance = await skaleToken.balanceOf(holder.address); holderBalance.should.be.equal(0); - const amount = toWei(101); + const amount = ethers.parseEther("101"); await skaleToken.connect(nilAddress).transferFrom(owner.address, nilAddress.address, amount).should.be.eventually.rejected; }); it("an authorized accounts allowance should go down when transferFrom is called", async () => { - const amount = toWei(15); + const amount = ethers.parseEther("15"); await skaleToken.approve(holder.address, amount); let allowance = await skaleToken.allowance(owner.address, holder.address); amount.should.be.equal(allowance); - await skaleToken.connect(holder).transferFrom(owner.address, holder.address, toWei(7)); + await skaleToken.connect(holder).transferFrom(owner.address, holder.address, ethers.parseEther("7")); allowance = await skaleToken.allowance(owner.address, holder.address); - toWei(8).should.be.equal(allowance); + ethers.parseEther("8").should.be.equal(allowance); }); it("should emit a Transfer event when transferFrom is called", async () => { - const amount = toWei(17); + const amount = ethers.parseEther("17"); await skaleToken.approve(holder.address, amount); await expect(skaleToken.connect(holder).transferFrom(owner.address, holder.address, amount)) @@ -191,14 +190,14 @@ describe("SkaleToken", () => { }); it("should emit a Minted Event", async () => { - const amount = toWei(10); + const amount = ethers.parseEther("10"); await expect(skaleToken.mint(owner.address, amount, "0x", "0x")) .to.emit(skaleToken, "Minted") .withArgs(owner.address, owner.address, amount, "0x", "0x"); }); it("should emit a Burned Event", async () => { - const amount = toWei(10); + const amount = ethers.parseEther("10"); await expect(skaleToken.burn(amount, "0x")) .to.emit(skaleToken, "Burned") .withArgs(owner.address, owner.address, amount, "0x", "0x"); @@ -211,11 +210,11 @@ describe("SkaleToken", () => { const reentrancyTester = await deployReentrancyTester(contractManager); await reentrancyTester.prepareToReentrancyCheck(); - await skaleToken.connect(holder).transfer(reentrancyTester.address, amount) + await skaleToken.connect(holder).transfer(reentrancyTester, amount) .should.be.eventually.rejectedWith("ReentrancyGuard: reentrant call"); - (await skaleToken.balanceOf(holder.address)).toNumber().should.be.equal(amount); - (await skaleToken.balanceOf(skaleToken.address)).toNumber().should.be.equal(0); + (await skaleToken.balanceOf(holder.address)).should.be.equal(amount); + (await skaleToken.balanceOf(skaleToken)).should.be.equal(0); }); it("should not allow to delegate burned tokens", async () => { @@ -230,19 +229,15 @@ describe("SkaleToken", () => { await validatorService.enableValidator(validatorId); await reentrancyTester.prepareToBurningAttack(); - const amount = toWei(1); - await skaleToken.mint(reentrancyTester.address, amount, "0x", "0x"); + const amount = ethers.parseEther("1"); + await skaleToken.mint(reentrancyTester, amount, "0x", "0x"); await reentrancyTester.burningAttack() .should.be.eventually.rejectedWith("Token should be unlocked for transferring"); }); it("should parse call data correctly", async () => { const skaleTokenInternalTesterFactory = await ethers.getContractFactory("SkaleTokenInternalTester"); - const skaleTokenInternalTester = await skaleTokenInternalTesterFactory.deploy(contractManager.address, []) as SkaleTokenInternalTester; + const skaleTokenInternalTester = await skaleTokenInternalTesterFactory.deploy(contractManager, []); await skaleTokenInternalTester.getMsgData().should.be.eventually.equal(skaleTokenInternalTester.interface.encodeFunctionData("getMsgData")); }); }); - -function toWei(count: number): BigNumber { - return BigNumber.from(count).mul(BigNumber.from(10).pow(18)); -} From 18f4371f6802c042f283acb35ae5a9156421b471 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 17:22:15 +0300 Subject: [PATCH 46/83] Fix skale verifier --- test/SkaleVerifier.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/SkaleVerifier.ts b/test/SkaleVerifier.ts index 3d5a30e0..1b5a26d4 100644 --- a/test/SkaleVerifier.ts +++ b/test/SkaleVerifier.ts @@ -69,8 +69,8 @@ describe("SkaleVerifier", () => { await deploySchainsInternal(contractManager); skaleManager = await deploySkaleManager(contractManager); skaleDKG = await deploySkaleDKGTester(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); await validatorService.connect(validator1).registerValidator("D2", "D2 is even", 0, 0); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); @@ -253,7 +253,7 @@ describe("SkaleVerifier", () => { await schains.connect(validator1).addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -320,7 +320,7 @@ describe("SkaleVerifier", () => { await schains.connect(validator1).addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, @@ -414,9 +414,9 @@ describe("SkaleVerifier", () => { const rotDelay = await constantsHolder.rotationDelay(); - const tenSecDelta = 10; + const tenSecDelta = 10n; - await skipTime(rotDelay.toNumber() - tenSecDelta); + await skipTime(rotDelay - tenSecDelta); res = await schains.verifySchainSignature( "2968563502518615975252640488966295157676313493262034332470965194448741452860", From c49e8f2e80705a18b38346aa8d8f25b4571086c7 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 17:22:47 +0300 Subject: [PATCH 47/83] Fix sync manager --- test/SyncMananager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SyncMananager.ts b/test/SyncMananager.ts index f5268f26..4efdcc35 100644 --- a/test/SyncMananager.ts +++ b/test/SyncMananager.ts @@ -91,7 +91,7 @@ describe("SyncManager", () => { await syncManager.addIPRange(ipRanges[0].name, ipRanges[0].startIP, ipRanges[0].endIP); await syncManager.addIPRange(ipRanges[1].name, ipRanges[1].startIP, ipRanges[1].endIP); - const ipRangesNumber = (await syncManager.getIPRangesNumber()).toNumber(); + const ipRangesNumber = await syncManager.getIPRangesNumber(); for (let i = 0; i < ipRangesNumber; i++) { const {startIP, endIP} = await syncManager.getIPRangeByIndex(i); expect(startIP).to.be.equal(ipRanges[i].startIP); From e1edaf82ab1cfd1e1524aadf0149e1aef0a6a15e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 27 Jun 2024 17:29:44 +0300 Subject: [PATCH 48/83] Fix wallets --- test/Wallets.ts | 102 ++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/test/Wallets.ts b/test/Wallets.ts index dfbd6905..a1e522f7 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -18,7 +18,7 @@ import {SchainType} from "./tools/types"; import chaiAlmost from "chai-almost"; import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; -import {ContractTransaction, Wallet} from "ethers"; +import {ContractTransactionResponse, Wallet} from "ethers"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {stringKeccak256} from "./tools/hashes"; @@ -28,10 +28,10 @@ import {deployConstantsHolder} from "./tools/deploy/constantsHolder"; chai.should(); chai.use(chaiAsPromised); -async function ethSpent(response: ContractTransaction) { +async function ethSpent(response: ContractTransactionResponse) { const receipt = await response.wait(); - if (receipt.effectiveGasPrice) { - return receipt.effectiveGasPrice.mul(receipt.gasUsed); + if (receipt && receipt.gasPrice) { + return receipt.gasPrice * receipt.gasUsed; } else { throw new ReferenceError("gasPrice is undefined"); } @@ -72,14 +72,14 @@ describe("Wallets", () => { nodeAddress2 = new Wallet(String(privateKeys[1])).connect(ethers.provider); nodeAddress3 = new Wallet(String(privateKeys[3])).connect(ethers.provider); nodeAddress4 = new Wallet(String(privateKeys[4])).connect(ethers.provider); - const balanceRichGuy1 = await richGuy1.getBalance(); - const balanceRichGuy2 = await richGuy2.getBalance(); - const balanceRichGuy3 = await richGuy3.getBalance(); - const balanceRichGuy4 = await richGuy4.getBalance(); - await richGuy1.sendTransaction({to: nodeAddress1.address, value: balanceRichGuy1.sub(ethers.parseEther("1"))}); - await richGuy2.sendTransaction({to: nodeAddress2.address, value: balanceRichGuy2.sub(ethers.parseEther("1"))}); - await richGuy3.sendTransaction({to: nodeAddress3.address, value: balanceRichGuy3.sub(ethers.parseEther("1"))}); - await richGuy4.sendTransaction({to: nodeAddress4.address, value: balanceRichGuy4.sub(ethers.parseEther("1"))}); + const balanceRichGuy1 = await ethers.provider.getBalance(richGuy1); + const balanceRichGuy2 = await ethers.provider.getBalance(richGuy2); + const balanceRichGuy3 = await ethers.provider.getBalance(richGuy3); + const balanceRichGuy4 = await ethers.provider.getBalance(richGuy4); + await richGuy1.sendTransaction({to: nodeAddress1.address, value: balanceRichGuy1 - ethers.parseEther("1")}); + await richGuy2.sendTransaction({to: nodeAddress2.address, value: balanceRichGuy2 - ethers.parseEther("1")}); + await richGuy3.sendTransaction({to: nodeAddress3.address, value: balanceRichGuy3 - ethers.parseEther("1")}); + await richGuy4.sendTransaction({to: nodeAddress4.address, value: balanceRichGuy4 - ethers.parseEther("1")}); contractManager = await deployContractManager(); wallets = await deployWallets(contractManager); @@ -90,7 +90,7 @@ describe("Wallets", () => { nodes = await deployNodes(contractManager); constantsHolder = await deployConstantsHolder(contractManager); - await contractManager.setContractsAddress("SkaleDKG", skaleDKG.address); + await contractManager.setContractsAddress("SkaleDKG", skaleDKG); await validatorService.connect(validator1).registerValidator("Validator 1", "", 0, 0); await validatorService.connect(validator2).registerValidator("Validator 2", "", 0, 0); @@ -105,14 +105,14 @@ describe("Wallets", () => { }); after(async () => { - const balanceNode1 = await nodeAddress1.getBalance(); - const balanceNode2 = await nodeAddress2.getBalance(); - const balanceNode3 = await nodeAddress3.getBalance(); - const balanceNode4 = await nodeAddress4.getBalance(); - await nodeAddress1.sendTransaction({to: richGuy1.address, value: balanceNode1.sub(ethers.parseEther("1"))}); - await nodeAddress2.sendTransaction({to: richGuy2.address, value: balanceNode2.sub(ethers.parseEther("1"))}); - await nodeAddress3.sendTransaction({to: richGuy2.address, value: balanceNode3.sub(ethers.parseEther("1"))}); - await nodeAddress4.sendTransaction({to: richGuy2.address, value: balanceNode4.sub(ethers.parseEther("1"))}); + const balanceNode1 = await ethers.provider.getBalance(nodeAddress1); + const balanceNode2 = await ethers.provider.getBalance(nodeAddress2); + const balanceNode3 = await ethers.provider.getBalance(nodeAddress3); + const balanceNode4 = await ethers.provider.getBalance(nodeAddress4); + await nodeAddress1.sendTransaction({to: richGuy1.address, value: balanceNode1 - ethers.parseEther("1")}); + await nodeAddress2.sendTransaction({to: richGuy2.address, value: balanceNode2 - ethers.parseEther("1")}); + await nodeAddress3.sendTransaction({to: richGuy2.address, value: balanceNode3 - ethers.parseEther("1")}); + await nodeAddress4.sendTransaction({to: richGuy2.address, value: balanceNode4 - ethers.parseEther("1")}); }); beforeEach(async () => { @@ -125,35 +125,35 @@ describe("Wallets", () => { it("should revert if someone sends ETH to contract Wallets", async() => { const amount = ethers.parseEther("1.0"); - await owner.sendTransaction({to: wallets.address, value: amount}) + await owner.sendTransaction({to: wallets, value: amount}) .should.be.eventually.rejectedWith("Validator address does not exist"); }); it("should recharge validator wallet sending ETH to contract Wallets", async() => { const amount = ethers.parseEther("1.0"); - (await wallets.getValidatorBalance(validator1Id)).toNumber().should.be.equal(0); - await validator1.sendTransaction({to: wallets.address, value: amount}); + (await wallets.getValidatorBalance(validator1Id)).should.be.equal(0); + await validator1.sendTransaction({to: wallets, value: amount}); (await wallets.getValidatorBalance(validator1Id)).should.be.equal(amount); }); it("should recharge validator wallet", async() => { const amount = 1e9; - (await wallets.getValidatorBalance(validator1Id)).toNumber().should.be.equal(0); - (await wallets.getValidatorBalance(validator2Id)).toNumber().should.be.equal(0); + (await wallets.getValidatorBalance(validator1Id)).should.be.equal(0); + (await wallets.getValidatorBalance(validator2Id)).should.be.equal(0); await wallets.rechargeValidatorWallet(validator1Id, {value: amount.toString()}); - (await wallets.getValidatorBalance(validator1Id)).toNumber().should.be.equal(amount); - (await wallets.getValidatorBalance(validator2Id)).toNumber().should.be.equal(0); + (await wallets.getValidatorBalance(validator1Id)).should.be.equal(amount); + (await wallets.getValidatorBalance(validator2Id)).should.be.equal(0); }); it("should withdraw from validator wallet", async() => { - const amount = 1e9; + const amount = BigInt(1e9); await wallets.rechargeValidatorWallet(validator1Id, {value: amount}); - const validator1Balance = await validator1.getBalance(); + const validator1Balance = await ethers.provider.getBalance(validator1); const tx = await wallets.connect(validator1).withdrawFundsFromValidatorWallet(amount); - const validator1BalanceAfterWithdraw = await validator1.getBalance(); - validator1BalanceAfterWithdraw.should.be.equal(validator1Balance.add(amount).sub(await ethSpent(tx))); + const validator1BalanceAfterWithdraw = await ethers.provider.getBalance(validator1); + validator1BalanceAfterWithdraw.should.be.equal(validator1Balance + amount - await ethSpent(tx)); await wallets.connect(validator2).withdrawFundsFromValidatorWallet(amount).should.be.eventually.rejectedWith("Balance is too low"); await wallets.withdrawFundsFromValidatorWallet(amount).should.be.eventually.rejectedWith("Validator address does not exist"); }); @@ -232,23 +232,23 @@ describe("Wallets", () => { const amount = 1e9; await schains.addSchainByFoundation(0, SchainType.TEST, 0, "schain-3", validator2.address, ethers.ZeroAddress, [], {value: amount.toString()}); const schainBalance = await wallets.getSchainBalance(stringKeccak256("schain-3")); - amount.should.be.equal(schainBalance.toNumber()); + amount.should.be.equal(schainBalance); }); it("should recharge schain wallet", async() => { const amount = 1e9; - (await wallets.getSchainBalance(schain1Id)).toNumber().should.be.equal(0); - (await wallets.getSchainBalance(schain2Id)).toNumber().should.be.equal(0); + (await wallets.getSchainBalance(schain1Id)).should.be.equal(0); + (await wallets.getSchainBalance(schain2Id)).should.be.equal(0); await wallets.rechargeSchainWallet(schain1Id, {value: amount.toString()}); - (await wallets.getSchainBalance(schain1Id)).toNumber().should.be.equal(amount); - (await wallets.getSchainBalance(schain2Id)).toNumber().should.be.equal(0); + (await wallets.getSchainBalance(schain1Id)).should.be.equal(amount); + (await wallets.getSchainBalance(schain2Id)).should.be.equal(0); }); it("should recharge schain wallet sending ETH to contract Wallets", async() => { const amount = ethers.parseEther("1.0"); - (await wallets.getSchainBalance(schain1Id)).toNumber().should.be.equal(0); - await validator1.sendTransaction({to: wallets.address, value: amount}); + (await wallets.getSchainBalance(schain1Id)).should.be.equal(0); + await validator1.sendTransaction({to: wallets, value: amount}); (await wallets.getSchainBalance(schain1Id)).should.be.equal(amount); }); @@ -270,35 +270,35 @@ describe("Wallets", () => { }); it("should move ETH to schain owner after schain termination", async () => { - let balanceBefore = await validator1.getBalance(); + let balanceBefore = await ethers.provider.getBalance(validator1); const result = await skaleManager.connect(validator1).deleteSchain(schain1Name); - let balance = await validator1.getBalance(); - const expectedBalance = balanceBefore.sub(await ethSpent(result)).add(initialBalance); + let balance = await ethers.provider.getBalance(validator1); + const expectedBalance = balanceBefore - await ethSpent(result) + initialBalance; balance.should.be.equal(expectedBalance); - balanceBefore = await validator2.getBalance(); + balanceBefore = await ethers.provider.getBalance(validator2); await skaleManager.deleteSchainByRoot(schain2Name); - balance = await validator2.getBalance(); - balance.should.be.equal(balanceBefore.add(initialBalance)); + balance = await ethers.provider.getBalance(validator2); + balance.should.be.equal(balanceBefore + initialBalance); }); it("should reimburse gas for node exit", async() => { const minNodeBalance = await constantsHolder.minNodeBalance(); await nodeAddress1.sendTransaction({ to: owner.address, - value: (await nodeAddress1.getBalance()).sub(minNodeBalance) + value: await ethers.provider.getBalance(nodeAddress1) - minNodeBalance }); await nodes.initExit(0); const response = await skaleManager.connect(nodeAddress1).nodeExit(0, {gasLimit: 2e6}); - const balance = await nodeAddress1.getBalance(); + const balance = await ethers.provider.getBalance(nodeAddress1); const spentValue = await ethSpent(response); - balance.add(spentValue).should.be.least(minNodeBalance); - balance.add(spentValue).should.be.closeTo(minNodeBalance, 1e13); + (balance + spentValue).should.be.least(minNodeBalance); + (balance + spentValue).should.be.closeTo(minNodeBalance, 1e13); const validatorBalance = await wallets.getValidatorBalance(validator1Id); - initialBalance.sub(spentValue).sub(validatorBalance).toNumber() - .should.be.almost(0, ethers.parseEther(tolerance.toString()).toNumber()); + (initialBalance - spentValue - validatorBalance) + .should.be.almost(0, Number(ethers.parseEther(tolerance.toString()))); }); }); }); From cb4488b820b1dddc075b830ace8dcbfe0ef862af Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 2 Jul 2024 17:44:19 +0300 Subject: [PATCH 49/83] Fix delegations --- test/delegation/Delegation.ts | 192 +++++++++++++++++----------------- 1 file changed, 97 insertions(+), 95 deletions(-) diff --git a/test/delegation/Delegation.ts b/test/delegation/Delegation.ts index 689a122b..49ce0223 100644 --- a/test/delegation/Delegation.ts +++ b/test/delegation/Delegation.ts @@ -13,7 +13,7 @@ import {ConstantsHolder, import {currentTime, nextMonth, skipTimeToDate} from "../tools/time"; -import {BigNumber, Wallet} from "ethers"; +import {HDNodeWallet, Wallet} from "ethers"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; import {deployConstantsHolder} from "../tools/deploy/constantsHolder"; @@ -40,7 +40,7 @@ import {fastBeforeEach} from "../tools/mocha"; chai.should(); chai.use(chaiAsPromised); -const allowedDelegationPeriods = [2, 6, 12]; +const allowedDelegationPeriods = [2n, 6n, 12n]; describe("Delegation", () => { let owner: SignerWithAddress; @@ -63,11 +63,11 @@ describe("Delegation", () => { let nodes: Nodes; const defaultAmount = ethers.parseEther("100"); - const month = 60 * 60 * 24 * 31; + const month = BigInt(60 * 60 * 24 * 31); interface IValidator { id: number; - account: Wallet + account: HDNodeWallet } fastBeforeEach(async () => { @@ -76,7 +76,7 @@ describe("Delegation", () => { contractManager = await deployContractManager(); skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); skaleToken = await deploySkaleToken(contractManager); delegationController = await deployDelegationController(contractManager); @@ -89,7 +89,7 @@ describe("Delegation", () => { nodes = await deployNodes(contractManager); // contract must be set in contractManager for proper work of allow modifier - await contractManager.setContractsAddress("SkaleDKG", nodes.address); + await contractManager.setContractsAddress("SkaleDKG", nodes); // each test will start from Nov 10 await skipTimeToDate(10, 10); @@ -107,30 +107,30 @@ describe("Delegation", () => { it("should allow owner to remove locker", async () => { const lockerMockFactory = await ethers.getContractFactory("LockerMock"); const lockerMock = await lockerMockFactory.deploy(); - await contractManager.setContractsAddress("D2", lockerMock.address); + await contractManager.setContractsAddress("D2", lockerMock); await tokenState.connect(validator).addLocker("D2") .should.be.eventually.rejectedWith("LOCKER_MANAGER_ROLE is required"); await tokenState.addLocker("D2"); // TODO: consider on transfer optimization. Locker are turned of for non delegated wallets - // (await tokenState.getAndUpdateLockedAmount.call(owner)).toNumber().should.be.equal(13); + // (await tokenState.getAndUpdateLockedAmount.call(owner)).should.be.equal(13); await tokenState.connect(validator).removeLocker("D2") .should.be.eventually.rejectedWith("LOCKER_MANAGER_ROLE is required"); await tokenState.removeLocker("D2"); - (await tokenState.callStatic.getAndUpdateLockedAmount(owner.address)).toNumber().should.be.equal(0); + (await tokenState.getAndUpdateLockedAmount.staticCall(owner.address)).should.be.equal(0); }); it("should allow owner to set new delegation period", async () => { await delegationPeriodManager.connect(validator).setDelegationPeriod(13, 13) .should.be.eventually.rejectedWith("DELEGATION_PERIOD_SETTER_ROLE is required"); await delegationPeriodManager.setDelegationPeriod(13, 13); - (await delegationPeriodManager.stakeMultipliers(13)).toNumber() + (await delegationPeriodManager.stakeMultipliers(13)) .should.be.equal(13); }); it("should check limit of validators", async () => { await skaleToken.mint(holder1.address, defaultAmount, "0x", "0x"); - const validatorsLimit = (await constantsHolder.limitValidatorsPerDelegator()).toNumber(); + const validatorsLimit = Number(await constantsHolder.limitValidatorsPerDelegator()); const validatorsAmount = validatorsLimit + 1; const validators: IValidator[] = []; for (let i = 0; i < validatorsAmount; ++i) { @@ -180,7 +180,7 @@ describe("Delegation", () => { it("should check limit of validators when delegations was not accepted", async () => { await skaleToken.mint(holder1.address, defaultAmount, "0x", "0x"); - const validatorsLimit = (await constantsHolder.limitValidatorsPerDelegator()).toNumber(); + const validatorsLimit = Number(await constantsHolder.limitValidatorsPerDelegator()); const validatorsAmount = validatorsLimit + 1; const validators: IValidator[] = []; for (let i = 0; i < validatorsAmount; ++i) { @@ -235,9 +235,9 @@ describe("Delegation", () => { }); describe("when holders have tokens and validator is registered", () => { - let validatorId: number; + let validatorId: bigint; fastBeforeEach(async () => { - validatorId = 1; + validatorId = 1n; await skaleToken.mint(holder1.address, defaultAmount.toString(), "0x", "0x"); await skaleToken.mint(holder2.address, defaultAmount.toString(), "0x", "0x"); await skaleToken.mint(holder3.address, defaultAmount.toString(), "0x", "0x"); @@ -248,7 +248,7 @@ describe("Delegation", () => { await delegationPeriodManager.setDelegationPeriod(6, 150); }); - for (let delegationPeriod = 1; delegationPeriod <= 18; ++delegationPeriod) { + for (let delegationPeriod = 1n; delegationPeriod <= 18; ++delegationPeriod) { it(`should check ${delegationPeriod} month${delegationPeriod > 1 ? "s" : ""} delegation period availability`, async () => { await delegationPeriodManager.isDelegationPeriodAllowed(delegationPeriod) .should.be.eventually.equal(allowedDelegationPeriods.includes(delegationPeriod)); @@ -266,8 +266,8 @@ describe("Delegation", () => { const delegation = await delegationController.delegations(requestId); assert.equal(holder1.address, delegation.holder); - assert.equal(validatorId, delegation.validatorId.toNumber()); - assert.equal(delegationPeriod, delegation.delegationPeriod.toNumber()); + assert.equal(validatorId, delegation.validatorId); + assert.equal(delegationPeriod, delegation.delegationPeriod); assert.equal("D2 is even", delegation.info); }); @@ -311,8 +311,8 @@ describe("Delegation", () => { await skaleToken.connect(holder2).transferFrom(holder1.address, holder2.address, 1); await skaleToken.connect(holder1).send(holder2.address, 1, "0x"); - const balance = BigNumber.from(await skaleToken.balanceOf(holder1.address)); - const correctBalance = BigNumber.from(defaultAmount.toString()).sub(3); + const balance = await skaleToken.balanceOf(holder1.address); + const correctBalance = defaultAmount - 3n; balance.should.be.deep.equal(correctBalance); }); @@ -324,7 +324,7 @@ describe("Delegation", () => { it("should extend delegation period if undelegation request was not sent", async () => { - await skipTimeToDate(1, (11 + delegationPeriod) % 12); + await skipTimeToDate(1, Number((11n + delegationPeriod) % 12n)); await skaleToken.connect(holder1).transfer(holder2.address, 1) .should.be.eventually.rejectedWith("Token should be unlocked for transferring"); @@ -336,7 +336,7 @@ describe("Delegation", () => { await delegationController.connect(holder1).requestUndelegation(requestId); - await skipTimeToDate(27, (11 + delegationPeriod + delegationPeriod - 1) % 12); + await skipTimeToDate(27, Number((11n + delegationPeriod + delegationPeriod - 1n) % 12n)); await skaleToken.connect(holder1).transfer(holder2.address, 1) .should.be.eventually.rejectedWith("Token should be unlocked for transferring"); @@ -347,7 +347,7 @@ describe("Delegation", () => { await skaleToken.connect(holder1).send(holder2.address, 1, "0x") .should.be.eventually.rejectedWith("Token should be unlocked for transferring"); - await skipTimeToDate(1, (11 + delegationPeriod + delegationPeriod) % 12); + await skipTimeToDate(1, Number((11n + delegationPeriod + delegationPeriod) % 12n)); await skaleToken.connect(holder1).transfer(holder2.address, 1); await skaleToken.connect(holder1).approve(holder2.address, 1); @@ -384,7 +384,7 @@ describe("Delegation", () => { await nextMonth(contractManager); - const bondAmount = await validatorService.callStatic.getAndUpdateBondAmount(validatorId); + const bondAmount = await validatorService.getAndUpdateBondAmount.staticCall(validatorId); assert.equal(defaultAmount.toString(), bondAmount.toString()); }); @@ -399,8 +399,8 @@ describe("Delegation", () => { await nextMonth(contractManager); - const bondAmount = await validatorService.callStatic.getAndUpdateBondAmount(validatorId); - assert.equal(18, bondAmount.toNumber()); + const bondAmount = await validatorService.getAndUpdateBondAmount.staticCall(validatorId); + assert.equal(18n, bondAmount); }); it("should bond equals zero for validator if she delegated to another validator", async () =>{ @@ -419,22 +419,22 @@ describe("Delegation", () => { await delegationController.connect(validator2).acceptPendingDelegation(1); await nextMonth(contractManager); - const bondAmount1 = await validatorService.callStatic.getAndUpdateBondAmount(validator1Id); - let bondAmount2 = await validatorService.callStatic.getAndUpdateBondAmount(validator2Id); - assert.equal(bondAmount1.toNumber(), 0); - assert.equal(bondAmount2.toNumber(), 200); + const bondAmount1 = await validatorService.getAndUpdateBondAmount.staticCall(validator1Id); + let bondAmount2 = await validatorService.getAndUpdateBondAmount.staticCall(validator2Id); + assert.equal(bondAmount1, 0n); + assert.equal(bondAmount2, 200n); await delegationController.connect(validator2).delegate( validator2Id, 200, 2, "D2 is even"); await delegationController.connect(validator2).acceptPendingDelegation(2); await nextMonth(contractManager); - bondAmount2 = await validatorService.callStatic.getAndUpdateBondAmount(validator2Id); - assert.equal(bondAmount2.toNumber(), 400); + bondAmount2 = await validatorService.getAndUpdateBondAmount.staticCall(validator2Id); + assert.equal(bondAmount2, 400n); }); it("should not pay bounty for slashed tokens", async () => { const timeHelpersWithDebug = await deployTimeHelpersWithDebug(contractManager); - await contractManager.setContractsAddress("TimeHelpers", timeHelpersWithDebug.address); + await contractManager.setContractsAddress("TimeHelpers", timeHelpersWithDebug); await skaleToken.mint(holder1.address, ethers.parseEther("10000"), "0x", "0x"); await skaleToken.mint(holder2.address, ethers.parseEther("10000"), "0x", "0x"); @@ -445,7 +445,7 @@ describe("Delegation", () => { await slashingTable.grantRole(PENALTY_SETTER_ROLE, owner.address); await slashingTable.setPenalty("FailedDKG", ethers.parseEther("10000")); - await constantsHolder.setLaunchTimestamp((await currentTime()) - 4 * month); + await constantsHolder.setLaunchTimestamp((await currentTime()) - 4n * month); await delegationController.connect(holder1).delegate(validatorId, ethers.parseEther("10000"), 2, "First delegation"); const delegationId1 = 0; @@ -463,14 +463,14 @@ describe("Delegation", () => { await distributor.connect(holder1).withdrawBounty(validatorId, bountyAddress.address); let balance = (await skaleToken.balanceOf(bountyAddress.address)).toString(); - balance.should.be.equal(bounty.mul(5).mul(85).div(100)); + balance.should.be.equal(bounty * 5n * 85n / 100n); await skaleToken.connect(bountyAddress).transfer(holder1.address, balance); await punisher.slash(validatorId, ethers.parseEther("10000")); - (await skaleToken.callStatic.getAndUpdateSlashedAmount(holder1.address)).toString() + (await skaleToken.getAndUpdateSlashedAmount.staticCall(holder1.address)).toString() .should.be.equal(ethers.parseEther("10000")); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toString() + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(holder1.address)).toString() .should.be.equal("0"); await delegationController.connect(holder2).delegate(validatorId, ethers.parseEther("10000"), 2, "Second delegation"); @@ -493,7 +493,7 @@ describe("Delegation", () => { await distributor.connect(holder2).withdrawBounty(validatorId, bountyAddress.address); balance = (await skaleToken.balanceOf(bountyAddress.address)).toString(); - balance.should.be.equal(bounty.mul(5).mul(85).div(100)); + balance.should.be.equal(bounty * 5n * 85n / 100n); await skaleToken.connect(bountyAddress).transfer(holder2.address, balance); }); @@ -504,7 +504,7 @@ describe("Delegation", () => { holdersAmount = 10; } const delegatedAmount = 1e7; - const holders: Wallet[] = []; + const holders: HDNodeWallet[] = []; for (let i = 0; i < holdersAmount; ++i) { holders.push(Wallet.createRandom().connect(ethers.provider)); } @@ -530,20 +530,20 @@ describe("Delegation", () => { for (const holder of holders) { await distributor.connect(holder).withdrawBounty(validatorId, holder.address); - (await skaleToken.balanceOf(holder.address)).toNumber().should.be.equal(delegatedAmount * 2); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder.address)) - .toNumber().should.be.equal(delegatedAmount); + (await skaleToken.balanceOf(holder.address)).should.be.equal(delegatedAmount * 2); + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(holder.address)) + .should.be.equal(delegatedAmount); - const balance = await holder.getBalance(); - const gas = 21 * 1e3; - const gasPrice = 20 * 1e9; + const balance = await ethers.provider.getBalance(holder); + const gas = BigInt(21 * 1e3); + const gasPrice = BigInt(20 * 1e9); await holder.sendTransaction({ to: holder1.address, gasLimit: gas, gasPrice, - value: balance.sub(gas * gasPrice) + value: balance - (gas * gasPrice) }); - (await holder.getBalance()).toNumber().should.be.equal(0); + (await ethers.provider.getBalance(holder)).should.be.equal(0); } }); @@ -589,13 +589,13 @@ describe("Delegation", () => { // holder3: ~37% // TODO: Validator should get 17 (not 15) because of rounding errors - (await distributor.connect(validator).callStatic.getEarnedFeeAmount())[0].toNumber().should.be.equal(15); - (await distributor.connect(holder1).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(25); - (await distributor.connect(holder2).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(28); - (await distributor.connect(holder3).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(31); + (await distributor.connect(validator).getEarnedFeeAmount.staticCall())[0].should.be.equal(15); + (await distributor.connect(holder1).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(25); + (await distributor.connect(holder2).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(28); + (await distributor.connect(holder3).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(31); await distributor.connect(validator).withdrawFee(bountyAddress.address) .should.be.eventually.rejectedWith("Fee is locked"); @@ -605,23 +605,23 @@ describe("Delegation", () => { await nextMonth(contractManager, 3); await distributor.connect(validator).withdrawFee(bountyAddress.address); - (await distributor.connect(validator).callStatic.getEarnedFeeAmount())[0].toNumber().should.be.equal(0); + (await distributor.connect(validator).getEarnedFeeAmount.staticCall())[0].should.be.equal(0); await distributor.connect(validator).withdrawFee(validator.address); - (await distributor.connect(validator).callStatic.getEarnedFeeAmount())[0].toNumber().should.be.equal(0); + (await distributor.connect(validator).getEarnedFeeAmount.staticCall())[0].should.be.equal(0); - (await skaleToken.balanceOf(bountyAddress.address)).toNumber().should.be.equal(15); + (await skaleToken.balanceOf(bountyAddress.address)).should.be.equal(15); await distributor.connect(holder1).withdrawBounty(validatorId, bountyAddress.address); - (await distributor.connect(holder1).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(0); + (await distributor.connect(holder1).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(0); await distributor.connect(holder2).withdrawBounty(validatorId, holder2.address); - (await distributor.connect(holder2).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(0); + (await distributor.connect(holder2).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(0); - (await skaleToken.balanceOf(bountyAddress.address)).toNumber().should.be.equal(15 + 25); + (await skaleToken.balanceOf(bountyAddress.address)).should.be.equal(15 + 25); - const balance = (await skaleToken.balanceOf(holder2.address)).toString(); - balance.should.be.equal(BigNumber.from(defaultAmount.toString()).add(28).toString()); + const balance = await skaleToken.balanceOf(holder2.address); + balance.should.be.equal(defaultAmount + 28n); }); describe("Slashing", () => { @@ -637,56 +637,56 @@ describe("Delegation", () => { // holder2: $3e6 // holder3: $5e6 - (await tokenState.callStatic.getAndUpdateLockedAmount(holder1.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder1.address)) .should.be.equal(delegatedAmount1); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder1.address)).toNumber().should.be.equal(delegatedAmount1 - 1 * slashesNumber); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder1.address)).should.be.equal(delegatedAmount1 - 1 * slashesNumber); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder2.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder2.address)) .should.be.equal(delegatedAmount2); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder2.address)).toNumber().should.be.equal(delegatedAmount2 - 2 * slashesNumber); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder2.address)).should.be.equal(delegatedAmount2 - 2 * slashesNumber); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder3.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder3.address)) .should.be.equal(delegatedAmount3); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder3.address)).toNumber().should.be.equal(delegatedAmount3 - 3 * slashesNumber); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder3.address)).should.be.equal(delegatedAmount3 - 3 * slashesNumber); }); it("should not lock more tokens than were delegated", async () => { await punisher.slash(validatorId, 10 * (delegatedAmount1 + delegatedAmount2 + delegatedAmount3)); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder1.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder1.address)) .should.be.equal(delegatedAmount1); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder1.address)).toNumber().should.be.equal(0); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder1.address)).should.be.equal(0); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder2.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder2.address)) .should.be.equal(delegatedAmount2); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder2.address)).toNumber().should.be.equal(0); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder2.address)).should.be.equal(0); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder3.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder3.address)) .should.be.equal(delegatedAmount3); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder3.address)).toNumber().should.be.equal(0); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder3.address)).should.be.equal(0); }); it("should allow to return slashed tokens back", async () => { await punisher.slash(validatorId, 10); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder3.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder3.address)) .should.be.equal(delegatedAmount3); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder3.address)).toNumber().should.be.equal(delegatedAmount3 - 5); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder3.address)).should.be.equal(delegatedAmount3 - 5); await delegationController.processAllSlashes(holder3.address); await punisher.forgive(holder3.address, 3); - (await tokenState.callStatic.getAndUpdateLockedAmount(holder3.address)).toNumber() + (await tokenState.getAndUpdateLockedAmount.staticCall(holder3.address)) .should.be.equal(delegatedAmount3 - 3); - (await delegationController.callStatic.getAndUpdateDelegatedAmount( - holder3.address)).toNumber().should.be.equal(delegatedAmount3 - 5); + (await delegationController.getAndUpdateDelegatedAmount.staticCall( + holder3.address)).should.be.equal(delegatedAmount3 - 5); }); it("should allow only FORGIVER_ROLE to return slashed tokens", async() => { @@ -718,13 +718,13 @@ describe("Delegation", () => { await nextMonth(contractManager); - (await distributor.connect(validator).callStatic.getEarnedFeeAmount())[0].toNumber().should.be.equal(15); - (await distributor.connect(holder1).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(85); - (await distributor.connect(holder2).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(0); - (await distributor.connect(holder3).callStatic.getAndUpdateEarnedBountyAmount( - validatorId))[0].toNumber().should.be.equal(0); + (await distributor.connect(validator).getEarnedFeeAmount.staticCall())[0].should.be.equal(15); + (await distributor.connect(holder1).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(85); + (await distributor.connect(holder2).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(0); + (await distributor.connect(holder3).getAndUpdateEarnedBountyAmount.staticCall( + validatorId))[0].should.be.equal(0); }); it("should reduce delegated amount immediately after slashing", async () => { @@ -732,7 +732,7 @@ describe("Delegation", () => { await punisher.slash(validatorId, 1); - (await delegationController.connect(holder1).callStatic.getAndUpdateDelegatedAmount(holder1.address)).toNumber() + (await delegationController.connect(holder1).getAndUpdateDelegatedAmount.staticCall(holder1.address)) .should.be.equal(delegatedAmount1 - 1); }); @@ -742,11 +742,13 @@ describe("Delegation", () => { // make owner balance non zero to do not affect transfer costs await skaleToken.mint(owner.address, 1, "0x", "0x"); let tx = await (await skaleToken.connect(validator).transfer(owner.address, 1)).wait(); + assert(tx); const gasUsedBeforeSlashing = tx.gasUsed; for (let i = 0; i < 10; ++i) { await punisher.slash(validatorId, 1); } tx = await (await skaleToken.connect(validator).transfer(owner.address, 1)).wait(); + assert(tx); tx.gasUsed.should.be.equal(gasUsedBeforeSlashing); }); }); From 0c0df740977789096037065fb9dca02235a72b4c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 2 Jul 2024 17:53:57 +0300 Subject: [PATCH 50/83] Fix delegation controller --- test/delegation/DelegationController.ts | 36 ++++++++++++------------- test/tools/time.ts | 19 ++++++++++--- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/test/delegation/DelegationController.ts b/test/delegation/DelegationController.ts index 47926637..063c552f 100644 --- a/test/delegation/DelegationController.ts +++ b/test/delegation/DelegationController.ts @@ -36,7 +36,7 @@ describe("DelegationController", () => { let delegationController: DelegationController; let validatorService: ValidatorService; - const month = 60 * 60 * 24 * 31; + const month = BigInt(60 * 60 * 24 * 31); let snapshot: number; @@ -49,7 +49,7 @@ describe("DelegationController", () => { validatorService = await deployValidatorService(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner.address); }); @@ -63,18 +63,18 @@ describe("DelegationController", () => { }); describe("when arguments for delegation initialized", () => { - let validatorId: number; + let validatorId: bigint; let amount: number; - let delegationPeriod: number; + let delegationPeriod: bigint; let info: string; let delegationId: number; let cleanContracts: number; before(async () => { cleanContracts = await makeSnapshot(); - validatorId = 1; + validatorId = 1n; amount = 100; - delegationPeriod = 2; + delegationPeriod = 2n; info = "VERY NICE"; await validatorService.connect(validator).registerValidator( "ValidatorName", @@ -101,13 +101,13 @@ describe("DelegationController", () => { }); it("should reject delegation if request doesn't meet allowed delegation period", async () => { - delegationPeriod = 4; + delegationPeriod = 4n; await delegationController.connect(holder1).delegate(validatorId, amount, delegationPeriod, info) .should.be.eventually.rejectedWith("This delegation period is not allowed"); }); it("should reject delegation if holder doesn't have enough unlocked tokens for delegation", async () => { - delegationPeriod = 2; + delegationPeriod = 2n; amount = 101; await delegationController.connect(holder1).delegate(validatorId, amount, delegationPeriod, info) .should.be.eventually.rejectedWith("Token holder does not have enough tokens to delegate"); @@ -124,8 +124,8 @@ describe("DelegationController", () => { delegationId = 0; const delegation = await delegationController.delegations(delegationId); assert.equal(holder1.address, delegation.holder); - assert.equal(validatorId, delegation.validatorId.toNumber()); - assert.equal(delegationPeriod, delegation.delegationPeriod.toNumber()); + assert.equal(validatorId, delegation.validatorId); + assert.equal(delegationPeriod, delegation.delegationPeriod); assert.equal("VERY NICE", delegation.info); }); @@ -224,7 +224,7 @@ describe("DelegationController", () => { it("should allow for QA team to test delegation pipeline immediately", async () => { const timeHelpersWithDebug = await deployTimeHelpersWithDebug(contractManager); - await contractManager.setContractsAddress("TimeHelpers", timeHelpersWithDebug.address); + await contractManager.setContractsAddress("TimeHelpers", timeHelpersWithDebug); await delegationController.connect(validator).acceptPendingDelegation(delegationId); (await delegationController.getState(delegationId)).should.be.equal(State.ACCEPTED); @@ -266,7 +266,7 @@ describe("DelegationController", () => { await nextMonth(contractManager, delegationPeriod); (await delegationController.getState(delegationId)).should.be.equal(State.COMPLETED); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toNumber().should.be.equal(0); + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(holder1.address)).should.be.equal(0); }); it("should not allow everyone to request undelegation", async () => { @@ -284,14 +284,14 @@ describe("DelegationController", () => { await nextMonth(contractManager, delegationPeriod); (await delegationController.getState(delegationId)).should.be.equal(State.DELEGATED); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toNumber().should.be.equal(amount); + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(holder1.address)).should.be.equal(amount); }); it("should not allow holder to request undelegation at the last moment", async () => { const timeHelpers = await deployTimeHelpers(contractManager); - const currentEpoch = (await timeHelpers.getCurrentMonth()).toNumber(); - const delegationEndTimestamp = (await timeHelpers.monthToTimestamp(currentEpoch + delegationPeriod)).toNumber(); - const twoDays = 2 * 24 * 60 * 60; + const currentEpoch = (await timeHelpers.getCurrentMonth()); + const delegationEndTimestamp = (await timeHelpers.monthToTimestamp(currentEpoch + delegationPeriod)); + const twoDays = BigInt(2 * 24 * 60 * 60); // skip time 2 days before delegation end await skipTime(delegationEndTimestamp - twoDays - await currentTime()); @@ -300,7 +300,7 @@ describe("DelegationController", () => { .should.be.eventually.rejectedWith("Undelegation requests must be sent 3 days before the end of delegation period"); (await delegationController.getState(delegationId)).should.be.equal(State.DELEGATED); - await skipTime(twoDays * 2); + await skipTime(twoDays * 2n); await delegationController.connect(validator).requestUndelegation(delegationId); (await delegationController.getState(delegationId)).should.be.equal(State.UNDELEGATION_REQUESTED); @@ -308,7 +308,7 @@ describe("DelegationController", () => { await nextMonth(contractManager, delegationPeriod); (await delegationController.getState(delegationId)).should.be.equal(State.COMPLETED); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toNumber().should.be.equal(0); + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(holder1.address)).should.be.equal(0); }); }); }); diff --git a/test/tools/time.ts b/test/tools/time.ts index 23347e8e..cd9291ce 100644 --- a/test/tools/time.ts +++ b/test/tools/time.ts @@ -2,6 +2,7 @@ import {ethers} from "hardhat"; import {ContractManager} from "../../typechain-types"; import {deployTimeHelpers} from "./deploy/delegation/timeHelpers"; import {BigNumberish} from "ethers"; +import { assert } from "console"; export async function skipTime(seconds: BigNumberish) { @@ -11,7 +12,11 @@ export async function skipTime(seconds: BigNumberish) { } export async function skipTimeToDate(day: number, monthIndex: number) { - const timestamp = (await ethers.provider.getBlock("latest")).timestamp; + const block = await ethers.provider.getBlock("latest"); + if (!block) { + throw new Error(); + } + const timestamp = block.timestamp; const now = new Date(timestamp * 1000); const targetTime = new Date(Date.UTC(now.getFullYear(), monthIndex, day)); while (targetTime < now) { @@ -32,20 +37,26 @@ export async function currentTime() { export const months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]; export async function isLeapYear() { - const timestamp = await currentTime(); + const timestamp = Number(await currentTime()); const now = new Date(timestamp * 1000); return now.getFullYear() % 4 === 0; } -export async function nextMonth(contractManager: ContractManager, monthsAmount = 1) { +export async function nextMonth(contractManager: ContractManager, monthsAmount: BigNumberish = 1) { const timeHelpers = await deployTimeHelpers(contractManager); const currentEpoch = await timeHelpers.getCurrentMonth(); - await skipTime((await timeHelpers.monthToTimestamp(currentEpoch.add(monthsAmount))).toNumber() - await currentTime()) + await skipTime(await timeHelpers.monthToTimestamp(currentEpoch + BigInt(monthsAmount)) - await currentTime()); } export async function getTransactionTimestamp(transactionHash: string) { const receipt = await ethers.provider.getTransactionReceipt(transactionHash); + if (!receipt) { + throw new Error(); + } const blockNumber = receipt.blockNumber; const block = await ethers.provider.getBlock(blockNumber); + if (!block) { + throw new Error(); + } return block.timestamp; } From 3d1792ebb0b0728b67377c5e968d2afe5e386475 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 14:38:55 +0300 Subject: [PATCH 51/83] Fix partial differences --- test/delegation/PartialDifferences.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/delegation/PartialDifferences.ts b/test/delegation/PartialDifferences.ts index 13928328..97c01a7f 100644 --- a/test/delegation/PartialDifferences.ts +++ b/test/delegation/PartialDifferences.ts @@ -30,7 +30,7 @@ describe("PartialDifferences", () => { await partialDifferencesTester.createSequence(); let sequence = await partialDifferencesTester.latestSequence(); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 1)).toNumber().should.be.equal(0); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 1)).should.be.equal(0); await partialDifferencesTester.reduceSequence(sequence, 1, 2, 2); await partialDifferencesTester.addToSequence(sequence, 5e7, 1); @@ -40,19 +40,19 @@ describe("PartialDifferences", () => { await partialDifferencesTester.addToSequence(sequence, 1e7, 4); await partialDifferencesTester.addToSequence(sequence, 1e7, 4); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 1)).toNumber().should.be.equal(5e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 2)).toNumber().should.be.equal(5e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 3)).toNumber().should.be.equal(2e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 4)).toNumber().should.be.equal(5e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 5)).toNumber().should.be.equal(0); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 1)).should.be.equal(5e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 2)).should.be.equal(5e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 3)).should.be.equal(2e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 4)).should.be.equal(5e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 5)).should.be.equal(0); await partialDifferencesTester.reduceSequence(sequence, 1, 2, 2); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 1)).toNumber().should.be.equal(5e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 2)).toNumber().should.be.equal(25e6); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 3)).toNumber().should.be.equal(1e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 4)).toNumber().should.be.equal(4e7); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 5)).toNumber().should.be.equal(0); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 1)).should.be.equal(5e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 2)).should.be.equal(25e6); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 3)).should.be.equal(1e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 4)).should.be.equal(4e7); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 5)).should.be.equal(0); await partialDifferencesTester.createSequence(); sequence = await partialDifferencesTester.latestSequence(); @@ -60,6 +60,6 @@ describe("PartialDifferences", () => { await partialDifferencesTester.addToSequence(sequence, 1, 1); await partialDifferencesTester.getAndUpdateSequenceItem(sequence, 1); await partialDifferencesTester.reduceSequence(sequence, 1, 2, 1); - (await partialDifferencesTester.callStatic.getAndUpdateSequenceItem(sequence, 1)).toNumber().should.be.equal(0); + (await partialDifferencesTester.getAndUpdateSequenceItem.staticCall(sequence, 1)).should.be.equal(0); }); -}); \ No newline at end of file +}); From b3930e5f37617d07c87e0b1f7b13242999f57415 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 14:44:33 +0300 Subject: [PATCH 52/83] Fix time helpers --- test/delegation/TimeHelpers.ts | 95 +++++++++++++++++----------------- test/tools/hashes.ts | 4 +- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/test/delegation/TimeHelpers.ts b/test/delegation/TimeHelpers.ts index 43b33822..c43eaa07 100644 --- a/test/delegation/TimeHelpers.ts +++ b/test/delegation/TimeHelpers.ts @@ -6,6 +6,7 @@ import chaiAsPromised from "chai-as-promised"; import {deployTimeHelpersWithDebug} from "../tools/deploy/test/timeHelpersWithDebug"; import {currentTime} from "../tools/time"; import {makeSnapshot, applySnapshot} from "../tools/snapshot"; +import {bigintAbs} from "../tools/math"; chai.should(); chai.use(chaiAsPromised); @@ -40,124 +41,124 @@ describe("TimeHelpers", () => { .should.be.eventually.rejectedWith("Timestamp is too far in the past"); (await timeHelpers.timestampToMonth((new Date("2020-02-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(1); + .should.be.equal(1); (await timeHelpers.timestampToMonth((new Date("2020-02-29T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(1); + .should.be.equal(1); (await timeHelpers.timestampToMonth((new Date("2020-03-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(2); + .should.be.equal(2); (await timeHelpers.timestampToMonth((new Date("2020-03-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(2); + .should.be.equal(2); (await timeHelpers.timestampToMonth((new Date("2020-04-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(3); + .should.be.equal(3); (await timeHelpers.timestampToMonth((new Date("2020-04-30T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(3); + .should.be.equal(3); (await timeHelpers.timestampToMonth((new Date("2020-05-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(4); + .should.be.equal(4); (await timeHelpers.timestampToMonth((new Date("2020-05-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(4); + .should.be.equal(4); (await timeHelpers.timestampToMonth((new Date("2020-06-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(5); + .should.be.equal(5); (await timeHelpers.timestampToMonth((new Date("2020-06-30T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(5); + .should.be.equal(5); (await timeHelpers.timestampToMonth((new Date("2020-07-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(6); + .should.be.equal(6); (await timeHelpers.timestampToMonth((new Date("2020-07-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(6); + .should.be.equal(6); (await timeHelpers.timestampToMonth((new Date("2020-08-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(7); + .should.be.equal(7); (await timeHelpers.timestampToMonth((new Date("2020-08-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(7); + .should.be.equal(7); (await timeHelpers.timestampToMonth((new Date("2020-09-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(8); + .should.be.equal(8); (await timeHelpers.timestampToMonth((new Date("2020-09-30T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(8); + .should.be.equal(8); (await timeHelpers.timestampToMonth((new Date("2020-10-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(9); + .should.be.equal(9); (await timeHelpers.timestampToMonth((new Date("2020-10-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(9); + .should.be.equal(9); (await timeHelpers.timestampToMonth((new Date("2020-11-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(10); + .should.be.equal(10); (await timeHelpers.timestampToMonth((new Date("2020-11-30T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(10); + .should.be.equal(10); (await timeHelpers.timestampToMonth((new Date("2020-12-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(11); + .should.be.equal(11); (await timeHelpers.timestampToMonth((new Date("2020-12-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(11); + .should.be.equal(11); (await timeHelpers.timestampToMonth((new Date("2021-01-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(12); + .should.be.equal(12); (await timeHelpers.timestampToMonth((new Date("2021-01-31T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(12); + .should.be.equal(12); (await timeHelpers.timestampToMonth((new Date("2021-02-01T00:00:00.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(13); + .should.be.equal(13); (await timeHelpers.timestampToMonth((new Date("2021-02-28T23:59:59.000+00:00")).getTime() / 1000)) - .toNumber().should.be.equal(13); + .should.be.equal(13); }) it("must convert months to timestamps correctly", async () => { - (await timeHelpers.monthToTimestamp(0)).toNumber() + (await timeHelpers.monthToTimestamp(0)) .should.be.equal((new Date("2020-01-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(1)).toNumber() + (await timeHelpers.monthToTimestamp(1)) .should.be.equal((new Date("2020-02-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(2)).toNumber() + (await timeHelpers.monthToTimestamp(2)) .should.be.equal((new Date("2020-03-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(3)).toNumber() + (await timeHelpers.monthToTimestamp(3)) .should.be.equal((new Date("2020-04-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(4)).toNumber() + (await timeHelpers.monthToTimestamp(4)) .should.be.equal((new Date("2020-05-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(5)).toNumber() + (await timeHelpers.monthToTimestamp(5)) .should.be.equal((new Date("2020-06-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(6)).toNumber() + (await timeHelpers.monthToTimestamp(6)) .should.be.equal((new Date("2020-07-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(7)).toNumber() + (await timeHelpers.monthToTimestamp(7)) .should.be.equal((new Date("2020-08-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(8)).toNumber() + (await timeHelpers.monthToTimestamp(8)) .should.be.equal((new Date("2020-09-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(9)).toNumber() + (await timeHelpers.monthToTimestamp(9)) .should.be.equal((new Date("2020-10-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(10)).toNumber() + (await timeHelpers.monthToTimestamp(10)) .should.be.equal((new Date("2020-11-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(11)).toNumber() + (await timeHelpers.monthToTimestamp(11)) .should.be.equal((new Date("2020-12-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(12)).toNumber() + (await timeHelpers.monthToTimestamp(12)) .should.be.equal((new Date("2021-01-01T00:00:00.000+00:00")).getTime() / 1000); - (await timeHelpers.monthToTimestamp(13)).toNumber() + (await timeHelpers.monthToTimestamp(13)) .should.be.equal((new Date("2021-02-01T00:00:00.000+00:00")).getTime() / 1000); }); it("should skip time in debug mode", async () => { const timeHelpersWithDebug = await deployTimeHelpersWithDebug(contractManager); - const currentMonth = (await timeHelpersWithDebug.getCurrentMonth()).toNumber(); - let nextMonthEndTimestamp = (await timeHelpersWithDebug.monthToTimestamp(currentMonth + 2)).toNumber(); - const diff = 60 * 60 * 24; + const currentMonth = (await timeHelpersWithDebug.getCurrentMonth()); + let nextMonthEndTimestamp = (await timeHelpersWithDebug.monthToTimestamp(currentMonth + 2n)); + const diff = BigInt(60 * 60 * 24); await timeHelpersWithDebug.skipTime(nextMonthEndTimestamp - diff - await currentTime()); - (await timeHelpersWithDebug.getCurrentMonth()).toNumber() - .should.be.equal(currentMonth + 1); - nextMonthEndTimestamp = (await timeHelpersWithDebug.monthToTimestamp(currentMonth + 2)).toNumber(); - Math.abs(await currentTime() + diff - nextMonthEndTimestamp).should.be.lessThan(5); + (await timeHelpersWithDebug.getCurrentMonth()) + .should.be.equal(currentMonth + 1n); + nextMonthEndTimestamp = (await timeHelpersWithDebug.monthToTimestamp(currentMonth + 2n)); + bigintAbs(await currentTime() + diff - nextMonthEndTimestamp).should.be.lessThan(5); }) }); diff --git a/test/tools/hashes.ts b/test/tools/hashes.ts index 749c06ac..dd3009c0 100644 --- a/test/tools/hashes.ts +++ b/test/tools/hashes.ts @@ -1,5 +1,5 @@ import {ethers} from "hardhat"; export function stringKeccak256(value: string) { - return ethers.utils.solidityKeccak256(["string"], [value]); -} \ No newline at end of file + return ethers.solidityPackedKeccak256(["string"], [value]); +} From d1f95bf4b6b436ea709afd0fe462595cb608cc3c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 14:46:26 +0300 Subject: [PATCH 53/83] Fix token state --- test/delegation/TokenState.ts | 64 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/test/delegation/TokenState.ts b/test/delegation/TokenState.ts index 2505b004..517de6ef 100644 --- a/test/delegation/TokenState.ts +++ b/test/delegation/TokenState.ts @@ -41,7 +41,7 @@ describe("DelegationController (token state)", () => { skaleToken = await deploySkaleToken(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); await validatorService.connect(validator).registerValidator("Validator", "D2 is even", 150, 0); validatorId = 1; @@ -60,8 +60,8 @@ describe("DelegationController (token state)", () => { }); it("should not lock tokens by default", async () => { - (await delegationController.callStatic.getAndUpdateLockedAmount(holder.address)).toNumber().should.be.equal(0); - (await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address)).toNumber().should.be.equal(0); + (await delegationController.getAndUpdateLockedAmount.staticCall(holder.address)).should.be.equal(0); + (await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address)).should.be.equal(0); }); it("should not allow to get state of non existing delegation", async () => { @@ -93,26 +93,26 @@ describe("DelegationController (token state)", () => { const state = await delegationController.getState(delegationId); state.should.be.equal(State.REJECTED); - const locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); + const locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); locked.should.be.equal(0); - const delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); + const delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); delegated.should.be.equal(0); }); it("should allow holder to cancel delegation before acceptance", async () => { - let locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(amount); - let delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(0); + let locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(amount); + let delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(0); await delegationController.connect(holder).cancelPendingDelegation(delegationId); const state = await delegationController.getState(delegationId); state.should.be.equal(State.CANCELED); - locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(0); - delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(0); + locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(0); + delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(0); }); it("should not allow to accept request after end of the month", async () => { @@ -124,10 +124,10 @@ describe("DelegationController (token state)", () => { const state = await delegationController.getState(delegationId); state.should.be.equal(State.REJECTED); - const locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(0); - const delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(0); + const locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(0); + const delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(0); }); describe("when delegation request is accepted", () => { @@ -144,10 +144,10 @@ describe("DelegationController (token state)", () => { it("should allow to move delegation from proposed to accepted state", async () => { const state = await delegationController.getState(delegationId); state.should.be.equal(State.ACCEPTED); - const locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); + const locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); locked.should.be.equal(amount); - const delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(0); + const delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(0); }); it("should not allow to request undelegation while is not delegated", async () => { @@ -174,10 +174,10 @@ describe("DelegationController (token state)", () => { it("should become delegated", async () => { const state = await delegationController.getState(delegationId); state.should.be.equal(State.DELEGATED); - const locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(amount); - const delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(amount); + const locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(amount); + const delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(amount); }); it("should allow to send undelegation request", async () => { @@ -185,19 +185,19 @@ describe("DelegationController (token state)", () => { let state = await delegationController.getState(delegationId); state.should.be.equal(State.UNDELEGATION_REQUESTED); - let locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(amount); - let delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(amount); + let locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(amount); + let delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(amount); await nextMonth(contractManager, period); state = await delegationController.getState(delegationId); state.should.be.equal(State.COMPLETED); - locked = await delegationController.callStatic.getAndUpdateLockedAmount(holder.address); - locked.toNumber().should.be.equal(0); - delegated = await delegationController.callStatic.getAndUpdateDelegatedAmount(holder.address); - delegated.toNumber().should.be.equal(0); + locked = await delegationController.getAndUpdateLockedAmount.staticCall(holder.address); + locked.should.be.equal(0); + delegated = await delegationController.getAndUpdateDelegatedAmount.staticCall(holder.address); + delegated.should.be.equal(0); }); }); }); From a07445fc7288e47dd643d32e6b3bf744af951f62 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 14:47:36 +0300 Subject: [PATCH 54/83] Fix validator service --- test/delegation/ValidatorService.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/delegation/ValidatorService.ts b/test/delegation/ValidatorService.ts index 513cc135..3c7f12ef 100644 --- a/test/delegation/ValidatorService.ts +++ b/test/delegation/ValidatorService.ts @@ -43,7 +43,7 @@ describe("ValidatorService", () => { delegationController = await deployDelegationController(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); const VALIDATOR_MANAGER_ROLE = await validatorService.VALIDATOR_MANAGER_ROLE(); await validatorService.grantRole(VALIDATOR_MANAGER_ROLE, owner.address); }); @@ -67,8 +67,8 @@ describe("ValidatorService", () => { assert.equal(validator.name, "ValidatorName"); assert.equal(validator.validatorAddress, validator1.address); assert.equal(validator.description, "Really good validator"); - assert.equal(validator.feeRate.toNumber(), 500); - assert.equal(validator.minimumDelegationAmount.toNumber(), 100); + assert.equal(validator.feeRate, 500n); + assert.equal(validator.minimumDelegationAmount, 100n); assert.isTrue(await validatorService.checkValidatorAddressToId(validator1.address, validatorId)); }); From 52978128200345d45c83bdf17057ad4f0c1119c0 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:02:49 +0300 Subject: [PATCH 55/83] Fix deployment --- test/tools/deploy/bounty.ts | 8 ++-- test/tools/deploy/constantsHolder.ts | 4 +- test/tools/deploy/contractManager.ts | 4 +- test/tools/deploy/decryption.ts | 4 +- test/tools/deploy/delegation/timeHelpers.ts | 7 ++-- test/tools/deploy/ecdh.ts | 6 +-- test/tools/deploy/factory.ts | 41 ++++++++++--------- test/tools/deploy/keyStorage.ts | 4 +- test/tools/deploy/nodeRotation.ts | 4 +- test/tools/deploy/nodes.ts | 4 +- test/tools/deploy/pricing.ts | 4 +- test/tools/deploy/schains.ts | 4 +- test/tools/deploy/schainsInternal.ts | 4 +- test/tools/deploy/skaleDKG.ts | 4 +- test/tools/deploy/skaleManager.ts | 4 +- test/tools/deploy/skaleToken.ts | 6 +-- test/tools/deploy/skaleVerifier.ts | 4 +- test/tools/deploy/slashingTable.ts | 2 +- test/tools/deploy/syncManager.ts | 6 +-- test/tools/deploy/test/segmentTreeTester.ts | 4 +- .../tools/deploy/test/timeHelpersWithDebug.ts | 8 ++-- test/tools/deploy/wallets.ts | 4 +- 22 files changed, 69 insertions(+), 71 deletions(-) diff --git a/test/tools/deploy/bounty.ts b/test/tools/deploy/bounty.ts index e6a9b393..739168f7 100644 --- a/test/tools/deploy/bounty.ts +++ b/test/tools/deploy/bounty.ts @@ -5,7 +5,7 @@ import {deployConstantsHolder} from "./constantsHolder"; import {deployTimeHelpers} from "./delegation/timeHelpers"; import {deployWallets} from "./wallets"; -export const deployBounty = deployFunctionFactory( +export const deployBounty = deployFunctionFactory( "BountyV2", async (contractManager: ContractManager) => { await deployConstantsHolder(contractManager); @@ -14,8 +14,8 @@ export const deployBounty = deployFunctionFactory( await deployWallets(contractManager); }, async(contractManager: ContractManager) => { - const bounty = await defaultDeploy("BountyV2", contractManager); - await contractManager.setContractsAddress("Bounty", bounty.address); + const bounty = await defaultDeploy("BountyV2", contractManager); + await contractManager.setContractsAddress("Bounty", bounty); return bounty; } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/constantsHolder.ts b/test/tools/deploy/constantsHolder.ts index b4801001..ca825020 100644 --- a/test/tools/deploy/constantsHolder.ts +++ b/test/tools/deploy/constantsHolder.ts @@ -1,6 +1,6 @@ -import {ConstantsHolder, ContractManager} from "../../../typechain-types"; +import {ConstantsHolder} from "../../../typechain-types"; import {deployFunctionFactory} from "./factory"; const name = "ConstantsHolder"; -export const deployConstantsHolder = deployFunctionFactory(name) as (contractManager: ContractManager) => Promise; +export const deployConstantsHolder = deployFunctionFactory(name); diff --git a/test/tools/deploy/contractManager.ts b/test/tools/deploy/contractManager.ts index c8ab4380..7942ee14 100644 --- a/test/tools/deploy/contractManager.ts +++ b/test/tools/deploy/contractManager.ts @@ -5,10 +5,10 @@ export async function deployContractManager() { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { const owner = (await ethers.getSigners())[0]; await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); - await ethers.provider.sendTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); + await ethers.provider.send("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); } const contractFactory = await ethers.getContractFactory("ContractManager"); - const instance = (await contractFactory.deploy()) as ContractManager; + const instance = await contractFactory.deploy() as unknown as ContractManager; await instance.initialize(); return instance; } diff --git a/test/tools/deploy/decryption.ts b/test/tools/deploy/decryption.ts index b7bc40a0..d4767bbd 100644 --- a/test/tools/deploy/decryption.ts +++ b/test/tools/deploy/decryption.ts @@ -1,10 +1,10 @@ import {ContractManager, Decryption} from "../../../typechain-types"; import {deployFunctionFactory, deployWithConstructor} from "./factory"; -export const deployDecryption = deployFunctionFactory( +export const deployDecryption = deployFunctionFactory( "Decryption", () => Promise.resolve(undefined), async () => { return await deployWithConstructor("Decryption"); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/delegation/timeHelpers.ts b/test/tools/deploy/delegation/timeHelpers.ts index b7d58dcf..e45e15b4 100644 --- a/test/tools/deploy/delegation/timeHelpers.ts +++ b/test/tools/deploy/delegation/timeHelpers.ts @@ -1,13 +1,12 @@ -import {ContractManager, - TimeHelpers} from "../../../../typechain-types"; +import {TimeHelpers} from "../../../../typechain-types"; import {deployWithConstructor, deployWithConstructorFunctionFactory} from "../factory"; const name = "TimeHelpers"; -export const deployTimeHelpers = deployWithConstructorFunctionFactory( +export const deployTimeHelpers = deployWithConstructorFunctionFactory( name, () => Promise.resolve(undefined), async () => { return await deployWithConstructor(name); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/ecdh.ts b/test/tools/deploy/ecdh.ts index 6092223d..fb2dcd0d 100644 --- a/test/tools/deploy/ecdh.ts +++ b/test/tools/deploy/ecdh.ts @@ -1,10 +1,10 @@ -import {ContractManager, ECDH} from "../../../typechain-types"; +import {ECDH} from "../../../typechain-types"; import {deployFunctionFactory, deployWithConstructor} from "./factory"; export const deployECDH = deployFunctionFactory( "ECDH", () => Promise.resolve(undefined), async () => { - return await deployWithConstructor("ECDH"); + return await deployWithConstructor("ECDH"); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/factory.ts b/test/tools/deploy/factory.ts index f9265f68..d3a1ed16 100644 --- a/test/tools/deploy/factory.ts +++ b/test/tools/deploy/factory.ts @@ -1,55 +1,56 @@ import {ethers, upgrades} from "hardhat"; import {ContractManager} from "../../../typechain-types"; import {deployLibraries} from "@skalenetwork/upgrade-tools"; +import {AddressLike, Contract} from "ethers"; -async function defaultDeploy(contractName: string, +async function defaultDeploy(contractName: string, contractManager: ContractManager) { const contractFactory = await ethers.getContractFactory(contractName); - return await upgrades.deployProxy(contractFactory, [contractManager.address]); + return await upgrades.deployProxy(contractFactory, [contractManager]) as ContractType; } -async function defaultDeployWithConstructor( +async function defaultDeployWithConstructor( contractName: string, contractManager: ContractManager) { const contractFactory = await ethers.getContractFactory(contractName); - return await contractFactory.deploy(contractManager.address); + return await contractFactory.deploy(contractManager) as unknown as ContractType; } -async function deployWithConstructor( +async function deployWithConstructor( contractName: string) { const contractFactory = await ethers.getContractFactory(contractName); - return await contractFactory.deploy(); + return await contractFactory.deploy() as unknown as ContractType; } -function deployFunctionFactory( +function deployFunctionFactory( contractName: string, deployDependencies: (contractManager: ContractManager) => Promise = () => Promise.resolve(undefined), deploy = async ( contractManager: ContractManager) => { - return await defaultDeploy(contractName, contractManager); + return await defaultDeploy(contractName, contractManager); } ) { return async (contractManager: ContractManager) => { const contractFactory = await ethers.getContractFactory(contractName); try { - return contractFactory.attach(await contractManager.getContract(contractName)); + return contractFactory.attach(await contractManager.getContract(contractName)) as unknown as ContractType; } catch (e) { const instance = await deploy(contractManager); - await contractManager.setContractsAddress(contractName, instance.address); + await contractManager.setContractsAddress(contractName, instance); await deployDependencies(contractManager); return instance; } }; } -function deployWithConstructorFunctionFactory( +function deployWithConstructorFunctionFactory( contractName: string, deployDependencies: (contractManager: ContractManager) => Promise = () => Promise.resolve(undefined), deploy = async ( contractManager: ContractManager) => { - return await defaultDeployWithConstructor(contractName, contractManager); + return await defaultDeployWithConstructor(contractName, contractManager); } ) { return deployFunctionFactory( @@ -59,7 +60,7 @@ function deployWithConstructorFunctionFactory( } -function deployWithLibraryFunctionFactory( +function deployWithLibraryFunctionFactory( contractName: string, libraryNames: string[], deployDependencies: (contractManager: ContractManager) => Promise @@ -69,17 +70,17 @@ function deployWithLibraryFunctionFactory( const libraries = await deployLibraries(libraryNames); const contractFactory = await ethers.getContractFactory(contractName, {libraries: Object.fromEntries(libraries)}); try { - return contractFactory.attach(await contractManager.getContract(contractName)); + return contractFactory.attach(await contractManager.getContract(contractName)) as unknown as ContractType; } catch (e) { - const instance = await upgrades.deployProxy(contractFactory, [contractManager.address], {unsafeAllowLinkedLibraries: true}); - await contractManager.setContractsAddress(contractName, instance.address); + const instance = await upgrades.deployProxy(contractFactory, [contractManager], {unsafeAllowLinkedLibraries: true}) as unknown as ContractType; + await contractManager.setContractsAddress(contractName, instance); await deployDependencies(contractManager); return instance; } } } -function deployWithLibraryWithConstructor( +function deployWithLibraryWithConstructor( contractName: string, libraryNames: string[], deployDependencies: (contractManager: ContractManager) => Promise @@ -89,10 +90,10 @@ function deployWithLibraryWithConstructor( const libraries = await deployLibraries(libraryNames); const contractFactory = await ethers.getContractFactory(contractName, {libraries: Object.fromEntries(libraries)}); try { - return contractFactory.attach(await contractManager.getContract(contractName)); + return contractFactory.attach(await contractManager.getContract(contractName)) as unknown as ContractType; } catch (e) { - const instance = await upgrades.deployProxy(contractFactory, {unsafeAllowLinkedLibraries: true}); - await contractManager.setContractsAddress(contractName, instance.address); + const instance = await upgrades.deployProxy(contractFactory, {unsafeAllowLinkedLibraries: true}) as unknown as ContractType; + await contractManager.setContractsAddress(contractName, instance); await deployDependencies(contractManager); return instance; } diff --git a/test/tools/deploy/keyStorage.ts b/test/tools/deploy/keyStorage.ts index 187af3da..a0014973 100644 --- a/test/tools/deploy/keyStorage.ts +++ b/test/tools/deploy/keyStorage.ts @@ -4,11 +4,11 @@ import {deployECDH} from "./ecdh"; import {deployFunctionFactory} from "./factory"; import {deploySchainsInternal} from "./schainsInternal"; -export const deployKeyStorage = deployFunctionFactory( +export const deployKeyStorage = deployFunctionFactory( "KeyStorage", async (contractManager: ContractManager) => { await deploySchainsInternal(contractManager); await deployECDH(contractManager); await deployDecryption(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/nodeRotation.ts b/test/tools/deploy/nodeRotation.ts index 82496bfe..46aba8af 100644 --- a/test/tools/deploy/nodeRotation.ts +++ b/test/tools/deploy/nodeRotation.ts @@ -4,11 +4,11 @@ import {deploySchainsInternal} from "./schainsInternal"; import {deployConstantsHolder} from "./constantsHolder"; import {ContractManager, NodeRotation} from "../../../typechain-types"; -export const deployNodeRotation = deployFunctionFactory( +export const deployNodeRotation = deployFunctionFactory( "NodeRotation", async (contractManager: ContractManager) => { await deployNodes(contractManager); await deploySchainsInternal(contractManager); await deployConstantsHolder(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/nodes.ts b/test/tools/deploy/nodes.ts index 18163d09..78cb4981 100644 --- a/test/tools/deploy/nodes.ts +++ b/test/tools/deploy/nodes.ts @@ -5,7 +5,7 @@ import {deployValidatorService} from "./delegation/validatorService"; import {deployWithLibraryFunctionFactory} from "./factory"; import {deployNodeRotation} from "./nodeRotation"; -export const deployNodes = deployWithLibraryFunctionFactory( +export const deployNodes = deployWithLibraryFunctionFactory( "Nodes", ["SegmentTree"], async (contractManager: ContractManager) => { @@ -14,4 +14,4 @@ export const deployNodes = deployWithLibraryFunctionFactory( await deployBounty(contractManager); await deployNodeRotation(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/pricing.ts b/test/tools/deploy/pricing.ts index e15e1749..f985062a 100644 --- a/test/tools/deploy/pricing.ts +++ b/test/tools/deploy/pricing.ts @@ -3,10 +3,10 @@ import {deployFunctionFactory} from "./factory"; import {deployNodes} from "./nodes"; import {deploySchainsInternal} from "./schainsInternal"; -export const deployPricing = deployFunctionFactory( +export const deployPricing = deployFunctionFactory( "Pricing", async (contractManager: ContractManager) => { await deployNodes(contractManager); await deploySchainsInternal(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/schains.ts b/test/tools/deploy/schains.ts index d9b0acae..09e55a2a 100644 --- a/test/tools/deploy/schains.ts +++ b/test/tools/deploy/schains.ts @@ -6,7 +6,7 @@ import {deploySkaleVerifier} from "./skaleVerifier"; import {deployNodeRotation} from "./nodeRotation"; import {ContractManager, Schains} from "../../../typechain-types"; -export const deploySchains = deployFunctionFactory( +export const deploySchains = deployFunctionFactory( "Schains", async (contractManager: ContractManager) => { await deploySchainsInternal(contractManager); @@ -16,4 +16,4 @@ export const deploySchains = deployFunctionFactory( await deploySkaleVerifier(contractManager); await deployNodeRotation(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/schainsInternal.ts b/test/tools/deploy/schainsInternal.ts index d8eba69a..e044b6ec 100644 --- a/test/tools/deploy/schainsInternal.ts +++ b/test/tools/deploy/schainsInternal.ts @@ -13,7 +13,7 @@ export const deploySchainsInternal = deployFunctionFactory( await deployNodes(contractManager); }, async ( contractManager: ContractManager) => { - const schainsInternal = await defaultDeploy("SchainsInternal", contractManager) as SchainsInternal; + const schainsInternal = await defaultDeploy("SchainsInternal", contractManager); await schainsInternal.grantRole(await schainsInternal.SCHAIN_TYPE_MANAGER_ROLE(), (await ethers.getSigners())[0].address); @@ -25,4 +25,4 @@ export const deploySchainsInternal = deployFunctionFactory( return schainsInternal; } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/skaleDKG.ts b/test/tools/deploy/skaleDKG.ts index 9c66a3ce..ff807bf5 100644 --- a/test/tools/deploy/skaleDKG.ts +++ b/test/tools/deploy/skaleDKG.ts @@ -15,7 +15,7 @@ const libraries = [ "SkaleDkgResponse" ] -export const deploySkaleDKG = deployWithLibraryFunctionFactory( +export const deploySkaleDKG = deployWithLibraryFunctionFactory( "SkaleDKG", libraries, async (contractManager: ContractManager) => { @@ -26,4 +26,4 @@ export const deploySkaleDKG = deployWithLibraryFunctionFactory( await deployNodeRotation(contractManager); await deployKeyStorage(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/skaleManager.ts b/test/tools/deploy/skaleManager.ts index 269b2cd5..3313de20 100644 --- a/test/tools/deploy/skaleManager.ts +++ b/test/tools/deploy/skaleManager.ts @@ -10,7 +10,7 @@ import {deployBounty} from "./bounty"; import {deployWallets} from "./wallets"; import {ContractManager, SkaleManager} from "../../../typechain-types"; -export const deploySkaleManager = deployFunctionFactory( +export const deploySkaleManager = deployFunctionFactory( "SkaleManager", async (contractManager: ContractManager) => { await deploySchains(contractManager); @@ -23,4 +23,4 @@ export const deploySkaleManager = deployFunctionFactory( await deployBounty(contractManager); await deployWallets(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/skaleToken.ts b/test/tools/deploy/skaleToken.ts index a0b31cf8..80ef1922 100644 --- a/test/tools/deploy/skaleToken.ts +++ b/test/tools/deploy/skaleToken.ts @@ -10,7 +10,7 @@ const name = "SkaleToken"; async function deploy(contractManager: ContractManager) { const factory = await ethers.getContractFactory(name); - return await factory.deploy(contractManager.address, []); + return await factory.deploy(contractManager, []) as unknown as SkaleToken; } async function deployDependencies(contractManager: ContractManager) { @@ -20,8 +20,8 @@ async function deployDependencies(contractManager: ContractManager) { await deploySkaleManager(contractManager); } -export const deploySkaleToken = deployFunctionFactory( +export const deploySkaleToken = deployFunctionFactory( name, deployDependencies, deploy -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/skaleVerifier.ts b/test/tools/deploy/skaleVerifier.ts index 9178e4db..ee87f200 100644 --- a/test/tools/deploy/skaleVerifier.ts +++ b/test/tools/deploy/skaleVerifier.ts @@ -2,9 +2,9 @@ import {ContractManager, SkaleVerifier} from "../../../typechain-types"; import {deployFunctionFactory} from "./factory"; import {deploySchainsInternal} from "./schainsInternal"; -export const deploySkaleVerifier = deployFunctionFactory( +export const deploySkaleVerifier = deployFunctionFactory( "SkaleVerifier", async (contractManager: ContractManager) => { await deploySchainsInternal(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/slashingTable.ts b/test/tools/deploy/slashingTable.ts index 2bb61534..c1a28b3f 100644 --- a/test/tools/deploy/slashingTable.ts +++ b/test/tools/deploy/slashingTable.ts @@ -3,4 +3,4 @@ import {deployFunctionFactory} from "./factory"; const name = "SlashingTable"; -export const deploySlashingTable = deployFunctionFactory(name) as (contractManager: ContractManager) => Promise; +export const deploySlashingTable = deployFunctionFactory(name); diff --git a/test/tools/deploy/syncManager.ts b/test/tools/deploy/syncManager.ts index b9dceb79..09608352 100644 --- a/test/tools/deploy/syncManager.ts +++ b/test/tools/deploy/syncManager.ts @@ -1,8 +1,6 @@ -import {ContractManager, SyncManager} from "../../../typechain-types"; +import {SyncManager} from "../../../typechain-types"; import {deployFunctionFactory} from "./factory"; const name = "SyncManager"; -export const deploySyncManager = deployFunctionFactory( - name -) as (contractManager: ContractManager) => Promise; +export const deploySyncManager = deployFunctionFactory(name); diff --git a/test/tools/deploy/test/segmentTreeTester.ts b/test/tools/deploy/test/segmentTreeTester.ts index ca8a4555..a8a617ae 100644 --- a/test/tools/deploy/test/segmentTreeTester.ts +++ b/test/tools/deploy/test/segmentTreeTester.ts @@ -1,7 +1,7 @@ import {ContractManager, SegmentTreeTester} from "../../../../typechain-types"; import {deployWithLibraryWithConstructor} from "../factory"; -export const deploySegmentTreeTester = deployWithLibraryWithConstructor( +export const deploySegmentTreeTester = deployWithLibraryWithConstructor( "SegmentTreeTester", ["SegmentTree"] -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/test/timeHelpersWithDebug.ts b/test/tools/deploy/test/timeHelpersWithDebug.ts index 7467ef4b..6edc0843 100644 --- a/test/tools/deploy/test/timeHelpersWithDebug.ts +++ b/test/tools/deploy/test/timeHelpersWithDebug.ts @@ -1,14 +1,14 @@ import {deployFunctionFactory} from "../factory"; import {ethers} from "hardhat"; -import {ContractManager, TimeHelpersWithDebug} from "../../../../typechain-types"; +import {TimeHelpersWithDebug} from "../../../../typechain-types"; -export const deployTimeHelpersWithDebug = deployFunctionFactory( +export const deployTimeHelpersWithDebug = deployFunctionFactory( "TimeHelpersWithDebug", undefined, async () => { const factory = await ethers.getContractFactory("TimeHelpersWithDebug"); - const instance = await factory.deploy() as TimeHelpersWithDebug; + const instance = await factory.deploy() as unknown as TimeHelpersWithDebug; await instance.initialize(); return instance; } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/deploy/wallets.ts b/test/tools/deploy/wallets.ts index 7deeb225..fd766e8f 100644 --- a/test/tools/deploy/wallets.ts +++ b/test/tools/deploy/wallets.ts @@ -4,11 +4,11 @@ import {deployFunctionFactory} from "./factory"; import {deployNodes} from "./nodes"; import {deploySchainsInternal} from "./schainsInternal"; -export const deployWallets = deployFunctionFactory( +export const deployWallets = deployFunctionFactory( "Wallets", async (contractManager: ContractManager) => { await deployNodes(contractManager); await deployValidatorService(contractManager); await deploySchainsInternal(contractManager); } -) as (contractManager: ContractManager) => Promise; +); From 88948763e0e54e22ed3881188b3783b48680afbb Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:07:00 +0300 Subject: [PATCH 56/83] Fix signatures --- test/tools/signatures.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tools/signatures.ts b/test/tools/signatures.ts index 0478971b..553d7a5b 100644 --- a/test/tools/signatures.ts +++ b/test/tools/signatures.ts @@ -6,8 +6,8 @@ const secp256k1EC = new ec("secp256k1"); export async function getValidatorIdSignature(validatorId: BigNumberish, signer: Signer) { return await signer.signMessage( - ethers.utils.arrayify( - ethers.utils.solidityKeccak256( + ethers.getBytes( + ethers.solidityPackedKeccak256( ["uint"], [validatorId] ) @@ -17,7 +17,7 @@ export async function getValidatorIdSignature(validatorId: BigNumberish, signer: export function getPublicKey(wallet: BaseWallet): [BytesLike, BytesLike] { const publicKey = secp256k1EC.keyFromPrivate(wallet.privateKey.slice(2)).getPublic(); - const pubA = ethers.utils.hexZeroPad(ethers.hexlify(publicKey.getX().toBuffer()), 32); - const pubB = ethers.utils.hexZeroPad(ethers.hexlify(publicKey.getY().toBuffer()), 32); + const pubA = ethers.zeroPadValue(ethers.hexlify(publicKey.getX().toBuffer()), 32); + const pubB = ethers.zeroPadValue(ethers.hexlify(publicKey.getY().toBuffer()), 32); return [pubA, pubB]; } From b64cf0f7f5377fe5d931601930cd75e66c58904e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:08:07 +0300 Subject: [PATCH 57/83] Fix math utils --- test/utils/MathUtils.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/utils/MathUtils.ts b/test/utils/MathUtils.ts index 947781bd..94ac19d6 100644 --- a/test/utils/MathUtils.ts +++ b/test/utils/MathUtils.ts @@ -12,7 +12,7 @@ describe("MathUtils", () => { let snapshot: number; before(async () => { const MathUtils = await ethers.getContractFactory("MathUtilsTester"); - mathUtils = (await MathUtils.deploy()) as MathUtilsTester; + mathUtils = (await MathUtils.deploy()) as unknown as MathUtilsTester; }); beforeEach(async () => { @@ -25,15 +25,15 @@ describe("MathUtils", () => { describe("in transaction", () => { it("should subtract normally if reduced is greater than subtracted", async () => { - (await mathUtils.callStatic.boundedSub(5, 3)).toNumber().should.be.equal(2); - (await mathUtils.boundedSubWithoutEvent(5, 3)).toNumber().should.be.equal(2); + (await mathUtils.boundedSub.staticCall(5, 3)).should.be.equal(2); + (await mathUtils.boundedSubWithoutEvent(5, 3)).should.be.equal(2); }); it("should return 0 if reduced is less than subtracted and emit event", async () => { - (await mathUtils.callStatic.boundedSub(3, 5)).toNumber().should.be.equal(0); + (await mathUtils.boundedSub.staticCall(3, 5)).should.be.equal(0); const factory = await ethers.getContractFactory("MathUtils"); - const mathUtilsLib = factory.attach(mathUtils.address); + const mathUtilsLib = factory.attach(mathUtils); await mathUtils.boundedSub(3, 5) .should.emit(mathUtilsLib, "UnderflowError") .withArgs(3, 5); @@ -42,11 +42,11 @@ describe("MathUtils", () => { describe("in call", () => { it("should subtract normally if reduced is greater than subtracted", async () => { - (await mathUtils.boundedSubWithoutEvent(5, 3)).toNumber().should.be.equal(2); + (await mathUtils.boundedSubWithoutEvent(5, 3)).should.be.equal(2); }); it("should return 0 if reduced is less than subtracted ", async () => { - (await mathUtils.boundedSubWithoutEvent(3, 5)).toNumber().should.be.equal(0); + (await mathUtils.boundedSubWithoutEvent(3, 5)).should.be.equal(0); }); }); From 8b71911c7ff664db2001b2e9dadd29b0fdad2341 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:10:39 +0300 Subject: [PATCH 58/83] Fix segment tree --- test/utils/SegmentTree.ts | 246 +++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 123 deletions(-) diff --git a/test/utils/SegmentTree.ts b/test/utils/SegmentTree.ts index 97d68afe..45816a37 100644 --- a/test/utils/SegmentTree.ts +++ b/test/utils/SegmentTree.ts @@ -29,14 +29,14 @@ describe("SegmentTree", () => { it("Should check last right leaf of segment tree", async () => { await segmentTree.addElemInPlaces(128, 150); await segmentTree.initTree(); - (await segmentTree.getElem(254)).toNumber().should.be.equal(150); + (await segmentTree.getElem(254)).should.be.equal(150); }); it("Should check all parents of last right leaf of segment tree", async () => { await segmentTree.addElemInPlaces(128, 150); await segmentTree.initTree(); for(let i = 1; i <= 8; i++) { - (await segmentTree.getElem(2 ** i - 2)).toNumber().should.be.equal(150); + (await segmentTree.getElem(2 ** i - 2)).should.be.equal(150); } }); @@ -50,7 +50,7 @@ describe("SegmentTree", () => { isRightLeaf = true; } } - (await segmentTree.getElem(j)).toNumber().should.be.equal(isRightLeaf ? 150 : 0); + (await segmentTree.getElem(j)).should.be.equal(isRightLeaf ? 150 : 0); } }); @@ -65,7 +65,7 @@ describe("SegmentTree", () => { isRightLeaf = true; } } - (await segmentTree.getElem(j)).toNumber().should.be.equal(isRightLeaf ? 160 : 0); + (await segmentTree.getElem(j)).should.be.equal(isRightLeaf ? 160 : 0); } }); @@ -82,16 +82,16 @@ describe("SegmentTree", () => { await segmentTree.addElemInPlaces(64, 50); await segmentTree.addElemInPlaces(7, 34); await segmentTree.initTree(); - (await segmentTree.getElem(254)).toNumber().should.be.equal(150); - (await segmentTree.getElem(190)).toNumber().should.be.equal(50); - (await segmentTree.getElem(133)).toNumber().should.be.equal(34); - (await segmentTree.getElem(0)).toNumber().should.be.equal(234); - (await segmentTree.getElem(1)).toNumber().should.be.equal(84); - (await segmentTree.getElem(2)).toNumber().should.be.equal(150); - (await segmentTree.getElem(3)).toNumber().should.be.equal(34); - (await segmentTree.getElem(4)).toNumber().should.be.equal(50); - (await segmentTree.getElem(5)).toNumber().should.be.equal(0); - (await segmentTree.getElem(6)).toNumber().should.be.equal(150); + (await segmentTree.getElem(254)).should.be.equal(150); + (await segmentTree.getElem(190)).should.be.equal(50); + (await segmentTree.getElem(133)).should.be.equal(34); + (await segmentTree.getElem(0)).should.be.equal(234); + (await segmentTree.getElem(1)).should.be.equal(84); + (await segmentTree.getElem(2)).should.be.equal(150); + (await segmentTree.getElem(3)).should.be.equal(34); + (await segmentTree.getElem(4)).should.be.equal(50); + (await segmentTree.getElem(5)).should.be.equal(0); + (await segmentTree.getElem(6)).should.be.equal(150); }); }); @@ -117,84 +117,84 @@ describe("SegmentTree", () => { // } // console.log(str); // } - (await segmentTree.getElem(0)).toNumber().should.be.equal(162); + (await segmentTree.getElem(0)).should.be.equal(162); let lastLeaf = 180; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(12); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(12); lastLeaf = Math.floor(lastLeaf / 2); } }); it("should add elem and remove elem to some place", async () => { await segmentTree.addToPlace(53, 12); - (await segmentTree.getElem(0)).toNumber().should.be.equal(162); + (await segmentTree.getElem(0)).should.be.equal(162); let lastLeaf = 180; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(12); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(12); lastLeaf = Math.floor(lastLeaf / 2); } await segmentTree.removeFromPlace(53, 5); - (await segmentTree.getElem(0)).toNumber().should.be.equal(157); + (await segmentTree.getElem(0)).should.be.equal(157); lastLeaf = 180; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(7); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(7); lastLeaf = Math.floor(lastLeaf / 2); } }); it("should remove from one and move to another place", async () => { await segmentTree.removeFromPlace(128, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(134); + (await segmentTree.getElem(0)).should.be.equal(134); let lastLeaf = 255; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(134); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(134); lastLeaf = Math.floor(lastLeaf / 2); } await segmentTree.addToPlace(23, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); lastLeaf = 150; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(16); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(16); lastLeaf = Math.floor(lastLeaf / 2); } }); it("should remove from one and move to another place optimized", async () => { await segmentTree.moveFromPlaceToPlace(128, 127, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); let lastLeaf = 254; - (await segmentTree.getElem(lastLeaf)).toNumber().should.be.equal(134); - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(16); + (await segmentTree.getElem(lastLeaf)).should.be.equal(134); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(16); lastLeaf = Math.floor(lastLeaf / 2); while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(150); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(150); lastLeaf = Math.floor(lastLeaf / 2); } await segmentTree.moveFromPlaceToPlace(127, 128, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); lastLeaf = 255; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(150); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(150); lastLeaf = Math.floor(lastLeaf / 2); } }); it("should move from one to another place", async () => { await segmentTree.moveFromPlaceToPlace(128, 96, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); await segmentTree.moveFromPlaceToPlace(96, 64, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); await segmentTree.moveFromPlaceToPlace(64, 32, 16); - (await segmentTree.getElem(0)).toNumber().should.be.equal(150); + (await segmentTree.getElem(0)).should.be.equal(150); await segmentTree.moveFromPlaceToPlace(32, 1, 16); let lastLeaf = 255; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(134); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(134); lastLeaf = Math.floor(lastLeaf / 2); } lastLeaf = 128; while (lastLeaf > 1) { - (await segmentTree.getElem(lastLeaf - 1)).toNumber().should.be.equal(16); + (await segmentTree.getElem(lastLeaf - 1)).should.be.equal(16); lastLeaf = Math.floor(lastLeaf / 2); } }); @@ -210,128 +210,128 @@ describe("SegmentTree", () => { describe("calculating sum", () => { it("should calculate correct sum", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); - (await segmentTree.sumFromPlaceToLast(1)).toNumber().should.be.equal(150); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(150); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(150); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(1)).should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(150); }); it("should calculate correct sum after adding some elements", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); await segmentTree.addToPlace(101, 5); await segmentTree.addToPlace(31, 50); await segmentTree.addToLast(8); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(101)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(102)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(80)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(32)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(31)).toNumber().should.be.equal(213); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(101)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(102)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(80)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(32)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(31)).should.be.equal(213); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(158); }); it("should calculate correct sum after adding and removing some elements", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); await segmentTree.addToPlace(101, 5); await segmentTree.addToPlace(31, 50); await segmentTree.addToLast(8); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(101)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(102)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(80)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(32)).toNumber().should.be.equal(163); - (await segmentTree.sumFromPlaceToLast(31)).toNumber().should.be.equal(213); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(101)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(102)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(80)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(32)).should.be.equal(163); + (await segmentTree.sumFromPlaceToLast(31)).should.be.equal(213); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(158); await segmentTree.removeFromPlace(128, 30); await segmentTree.removeFromPlace(101, 5); await segmentTree.removeFromPlace(31, 2); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(101)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(102)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(80)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(32)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(31)).toNumber().should.be.equal(176); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(128); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(101)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(102)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(80)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(32)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(31)).should.be.equal(176); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(128); }); it("should calculate correct sum after moving some elements", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); await segmentTree.moveFromPlaceToPlace(128, 101, 5); await segmentTree.moveFromPlaceToPlace(128, 31, 50); await segmentTree.addToLast(8); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(108); - (await segmentTree.sumFromPlaceToLast(101)).toNumber().should.be.equal(108); - (await segmentTree.sumFromPlaceToLast(102)).toNumber().should.be.equal(103); - (await segmentTree.sumFromPlaceToLast(80)).toNumber().should.be.equal(108); - (await segmentTree.sumFromPlaceToLast(32)).toNumber().should.be.equal(108); - (await segmentTree.sumFromPlaceToLast(31)).toNumber().should.be.equal(158); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(103); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(103); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(103); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(108); + (await segmentTree.sumFromPlaceToLast(101)).should.be.equal(108); + (await segmentTree.sumFromPlaceToLast(102)).should.be.equal(103); + (await segmentTree.sumFromPlaceToLast(80)).should.be.equal(108); + (await segmentTree.sumFromPlaceToLast(32)).should.be.equal(108); + (await segmentTree.sumFromPlaceToLast(31)).should.be.equal(158); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(103); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(103); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(103); await segmentTree.moveFromPlaceToPlace(128, 80, 30); await segmentTree.removeFromPlace(101, 5); await segmentTree.moveFromPlaceToPlace(128, 31, 2); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(101)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(102)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(81)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(80)).toNumber().should.be.equal(101); - (await segmentTree.sumFromPlaceToLast(32)).toNumber().should.be.equal(101); - (await segmentTree.sumFromPlaceToLast(31)).toNumber().should.be.equal(153); - (await segmentTree.sumFromPlaceToLast(128)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(127)).toNumber().should.be.equal(71); - (await segmentTree.sumFromPlaceToLast(126)).toNumber().should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(101)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(102)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(81)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(80)).should.be.equal(101); + (await segmentTree.sumFromPlaceToLast(32)).should.be.equal(101); + (await segmentTree.sumFromPlaceToLast(31)).should.be.equal(153); + (await segmentTree.sumFromPlaceToLast(128)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(127)).should.be.equal(71); + (await segmentTree.sumFromPlaceToLast(126)).should.be.equal(71); }); }); describe("random elem", () => { it("should return last place", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); - (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); + (await segmentTree.getRandomElem(100)).should.be.equal(128); }); it("should return zero if no place", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); - (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); + (await segmentTree.getRandomElem(100)).should.be.equal(128); await segmentTree.removeFromPlace(128, 150); - (await segmentTree.sumFromPlaceToLast(1)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(1)).toNumber().should.be.equal(0); + (await segmentTree.sumFromPlaceToLast(1)).should.be.equal(0); + (await segmentTree.getRandomElem(1)).should.be.equal(0); await segmentTree.addToPlace(99, 150); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(0); - (await segmentTree.sumFromPlaceToLast(99)).toNumber().should.be.equal(150); - (await segmentTree.getRandomElem(99)).toNumber().should.be.equal(99); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(0); + (await segmentTree.getRandomElem(100)).should.be.equal(0); + (await segmentTree.sumFromPlaceToLast(99)).should.be.equal(150); + (await segmentTree.getRandomElem(99)).should.be.equal(99); }); it("should reject if place is incorrect", async () => { - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(150); - (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(128); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(150); + (await segmentTree.getRandomElem(100)).should.be.equal(128); await segmentTree.removeFromPlace(128, 150); - (await segmentTree.sumFromPlaceToLast(1)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(1)).toNumber().should.be.equal(0); + (await segmentTree.sumFromPlaceToLast(1)).should.be.equal(0); + (await segmentTree.getRandomElem(1)).should.be.equal(0); await segmentTree.addToPlace(99, 150); - (await segmentTree.sumFromPlaceToLast(100)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(100)).toNumber().should.be.equal(0); - (await segmentTree.sumFromPlaceToLast(99)).toNumber().should.be.equal(150); - (await segmentTree.getRandomElem(99)).toNumber().should.be.equal(99); + (await segmentTree.sumFromPlaceToLast(100)).should.be.equal(0); + (await segmentTree.getRandomElem(100)).should.be.equal(0); + (await segmentTree.sumFromPlaceToLast(99)).should.be.equal(150); + (await segmentTree.getRandomElem(99)).should.be.equal(99); await segmentTree.getRandomElem(0).should.be.rejectedWith("Incorrect place"); - (await segmentTree.getRandomElem(128)).toNumber().should.be.equal(0); + (await segmentTree.getRandomElem(128)).should.be.equal(0); await segmentTree.addToPlace(128, 1000); - (await segmentTree.getRandomElem(128)).toNumber().should.be.equal(128); - (await segmentTree.getRandomElem(127)).toNumber().should.be.equal(128); + (await segmentTree.getRandomElem(128)).should.be.equal(128); + (await segmentTree.getRandomElem(127)).should.be.equal(128); await segmentTree.removeFromPlace(128, 1000); - (await segmentTree.getRandomElem(128)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(127)).toNumber().should.be.equal(0); + (await segmentTree.getRandomElem(128)).should.be.equal(0); + (await segmentTree.getRandomElem(127)).should.be.equal(0); await segmentTree.addToPlace(127, 1000); - (await segmentTree.getRandomElem(128)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(127)).toNumber().should.be.equal(127); + (await segmentTree.getRandomElem(128)).should.be.equal(0); + (await segmentTree.getRandomElem(127)).should.be.equal(127); await segmentTree.getRandomElem(129).should.be.rejectedWith("Incorrect place"); await segmentTree.getRandomElem(100000).should.be.rejectedWith("Incorrect place"); }); @@ -342,20 +342,20 @@ describe("SegmentTree", () => { await segmentTree.addToPlace(106, 25); await segmentTree.addToPlace(77, 509); for(let i = 0; i < 180; i++) { - const place = (await segmentTree.getRandomElem(78)).toNumber(); + const place = (await segmentTree.getRandomElem(78)); await segmentTree.removeFromPlace(place, 1); // console.log("Place found!!!!!!!!!!!!") // console.log(place); } - (await segmentTree.getRandomElem(78)).toNumber().should.be.equal(0); - (await segmentTree.getRandomElem(77)).toNumber().should.be.equal(77); + (await segmentTree.getRandomElem(78)).should.be.equal(0); + (await segmentTree.getRandomElem(77)).should.be.equal(77); }); it("random stress simulating large schains test", async () => { - const schainPlace = 32; // 1/4 of node + const schainPlace = 32n; // 1/4 of node await segmentTree.removeFromPlace(128, 100); // make 50 nodes for(let i = 0; i < 200; i++) { // 200 times we could repeat removing - const place = (await segmentTree.getRandomElem(schainPlace)).toNumber(); + const place = (await segmentTree.getRandomElem(schainPlace)); // console.log("New place ", place); await segmentTree.removeFromPlace(place, 1); if (place - schainPlace > 0) { @@ -364,14 +364,14 @@ describe("SegmentTree", () => { } } // 201 time should be no nodes - (await segmentTree.getRandomElem(schainPlace)).toNumber().should.be.equal(0); + (await segmentTree.getRandomElem(schainPlace)).should.be.equal(0); }); it("random stress simulating large schains test moving elements", async () => { - const schainPlace = 32; // 1/4 of node + const schainPlace = 32n; // 1/4 of node await segmentTree.removeFromPlace(128, 100); // make 50 nodes for(let i = 0; i < 200; i++) { // 200 times we could repeat removing - const place = (await segmentTree.getRandomElem(schainPlace)).toNumber(); + const place = (await segmentTree.getRandomElem(schainPlace)); // console.log("New place ", place); if (place - schainPlace > 0) { // console.log(place - schainPlace); @@ -381,7 +381,7 @@ describe("SegmentTree", () => { } } // 201 time should be no nodes - (await segmentTree.getRandomElem(schainPlace)).toNumber().should.be.equal(0); + (await segmentTree.getRandomElem(schainPlace)).should.be.equal(0); }); }); }); From c4ef6d28dc6e6c036c1a57a0af86bcaca623ae4c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:16:22 +0300 Subject: [PATCH 59/83] Remove unused imports --- .eslintrc.cjs | 1 + migrations/deploy.ts | 1 - test/SkaleDKG.ts | 2 +- test/SkaleToken.ts | 4 ++-- test/tools/deploy/decryption.ts | 2 +- test/tools/deploy/slashingTable.ts | 2 +- test/tools/deploy/test/segmentTreeTester.ts | 2 +- test/tools/time.ts | 1 - 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 429c632e..386b7dfe 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -16,6 +16,7 @@ module.exports = { "root": true, "rules": { "@typescript-eslint/no-shadow": "error", + "@typescript-eslint/no-unused-vars": "error", "lines-around-comment": [ "error", {"allowBlockStart": true} diff --git a/migrations/deploy.ts b/migrations/deploy.ts index ec44f764..7d97647b 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -1,6 +1,5 @@ import {promises as fs} from 'fs'; import {ethers, upgrades, network, run} from "hardhat"; -import {ContractManager, SkaleManager, SkaleToken} from "../typechain-types"; import { getAbi, getVersion, diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index 19da5ff9..5a3f6ee4 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -32,7 +32,7 @@ import {ethers} from "hardhat"; import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; import {assert, expect} from "chai"; import {makeSnapshot, applySnapshot} from "./tools/snapshot"; -import {BytesLike, ContractTransaction, ContractTransactionResponse, Wallet} from "ethers"; +import {BytesLike, ContractTransactionResponse, Wallet} from "ethers"; import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; import {stringKeccak256} from "./tools/hashes"; import {schainParametersType, SchainType} from "./tools/types"; diff --git a/test/SkaleToken.ts b/test/SkaleToken.ts index d6308dcb..d1053d6e 100644 --- a/test/SkaleToken.ts +++ b/test/SkaleToken.ts @@ -1,6 +1,6 @@ import {ContractManager, - SkaleToken, - SkaleTokenInternalTester} from "../typechain-types"; + SkaleToken, +} from "../typechain-types"; import * as chai from "chai"; import chaiAsPromised from "chai-as-promised"; diff --git a/test/tools/deploy/decryption.ts b/test/tools/deploy/decryption.ts index d4767bbd..c4b05acd 100644 --- a/test/tools/deploy/decryption.ts +++ b/test/tools/deploy/decryption.ts @@ -1,4 +1,4 @@ -import {ContractManager, Decryption} from "../../../typechain-types"; +import {Decryption} from "../../../typechain-types"; import {deployFunctionFactory, deployWithConstructor} from "./factory"; export const deployDecryption = deployFunctionFactory( diff --git a/test/tools/deploy/slashingTable.ts b/test/tools/deploy/slashingTable.ts index c1a28b3f..e50aeb51 100644 --- a/test/tools/deploy/slashingTable.ts +++ b/test/tools/deploy/slashingTable.ts @@ -1,4 +1,4 @@ -import {ContractManager, SlashingTable} from "../../../typechain-types"; +import {SlashingTable} from "../../../typechain-types"; import {deployFunctionFactory} from "./factory"; const name = "SlashingTable"; diff --git a/test/tools/deploy/test/segmentTreeTester.ts b/test/tools/deploy/test/segmentTreeTester.ts index a8a617ae..a27cca61 100644 --- a/test/tools/deploy/test/segmentTreeTester.ts +++ b/test/tools/deploy/test/segmentTreeTester.ts @@ -1,4 +1,4 @@ -import {ContractManager, SegmentTreeTester} from "../../../../typechain-types"; +import {SegmentTreeTester} from "../../../../typechain-types"; import {deployWithLibraryWithConstructor} from "../factory"; export const deploySegmentTreeTester = deployWithLibraryWithConstructor( diff --git a/test/tools/time.ts b/test/tools/time.ts index cd9291ce..7a6edea7 100644 --- a/test/tools/time.ts +++ b/test/tools/time.ts @@ -2,7 +2,6 @@ import {ethers} from "hardhat"; import {ContractManager} from "../../typechain-types"; import {deployTimeHelpers} from "./deploy/delegation/timeHelpers"; import {BigNumberish} from "ethers"; -import { assert } from "console"; export async function skipTime(seconds: BigNumberish) { From 82a905edee9411695a9fc6954d78bde727bd85f9 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:20:35 +0300 Subject: [PATCH 60/83] Remove support of node 16 --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2b2f7d87..662cc36d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,7 +13,7 @@ on: - 'custom-release-*' env: - NODE_VERSION: 18 + NODE_VERSION: 20 jobs: build: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b873e95..ba75a409 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x, 22.x] env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 3943b71dd522deffe0e4afb35f20147dfd7665ee Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 5 Jul 2024 18:27:32 +0300 Subject: [PATCH 61/83] Add math --- test/tools/math.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/tools/math.ts diff --git a/test/tools/math.ts b/test/tools/math.ts new file mode 100644 index 00000000..22c10cfa --- /dev/null +++ b/test/tools/math.ts @@ -0,0 +1,6 @@ +export function bigintAbs(value: bigint) { + if (value >= 0) { + return value; + } + return -value; +} From 891da32a4cb9193317345c4bc1c5d8aeeb0a2d89 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 8 Jul 2024 18:25:17 +0300 Subject: [PATCH 62/83] Fix deployment --- migrations/deploy.ts | 17 +++++++++-------- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 7d97647b..9936fd0d 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -7,11 +7,11 @@ import { verifyProxy, getContractFactory, } from '@skalenetwork/upgrade-tools'; -import {AddressLike, Contract, Interface} from 'ethers'; +import {Contract, Interface, resolveAddress} from 'ethers'; import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; -function getInitializerParameters(contract: string, contractManagerAddress: AddressLike) { +function getInitializerParameters(contract: string, contractManagerAddress: string) { if (["TimeHelpers", "Decryption", "ECDH"].includes(contract)) { return undefined; } else if (["TimeHelpersWithDebug"].includes(contract)) { @@ -106,7 +106,7 @@ async function main() { try { proxy = await upgrades.deployProxy( contractFactory, - getInitializerParameters(contract, contractManager), + getInitializerParameters(contract, await resolveAddress(contractManager)), { unsafeAllowLinkedLibraries: true } @@ -125,10 +125,11 @@ async function main() { throw new Error(`Error during deployment of ${contract}`); } const contractName = getNameInContractManager(contract); - console.log("Register", contract, "as", contractName, "=>", proxy.address); - const transaction = await contractManager.setContractsAddress(contractName, proxy.address); + const proxyAddress = await resolveAddress(proxy); + console.log("Register", contract, "as", contractName, "=>", proxyAddress); + const transaction = await contractManager.setContractsAddress(contractName, proxy); await transaction.wait(); - contractArtifacts.push({address: await proxy.getAddress(), interface: proxy.interface, contract}); + contractArtifacts.push({address: proxyAddress, interface: proxy.interface, contract}); if (contract === "SkaleManager") { try { @@ -143,10 +144,10 @@ async function main() { const skaleTokenName = "SkaleToken"; console.log("Deploy", skaleTokenName); const skaleTokenFactory = await ethers.getContractFactory(skaleTokenName); - const skaleToken = await skaleTokenFactory.deploy(contractManager.address, []); + const skaleToken = await skaleTokenFactory.deploy(contractManager, []); await skaleToken.waitForDeployment(); console.log("Register", skaleTokenName); - await (await contractManager.setContractsAddress(skaleTokenName, skaleToken.address)).wait(); + await (await contractManager.setContractsAddress(skaleTokenName, skaleToken)).wait(); contractArtifacts.push({address: await skaleToken.getAddress(), interface: skaleToken.interface, contract: skaleTokenName}); if (!production) { diff --git a/package.json b/package.json index a627e408..d0857eb9 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.6", "@openzeppelin/hardhat-upgrades": "^3.2.0", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", - "@skalenetwork/upgrade-tools": "^3.0.0-linter.36", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.37", "@typechain/hardhat": "^9.1.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index e9545d8d..ac57fd72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1687,10 +1687,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.0.0-develop.2.tgz#100508cda8a675b62a28a76c7e526617240ffd0c" integrity sha512-ua92l+QAfPymtWn8lLpoFUyZ1t4I5ae1RCHEU96aSfkA6hVqxiXCRXJzbcDJR0HPtvOmbgF/iKc/LXtCEe9rvA== -"@skalenetwork/upgrade-tools@^3.0.0-linter.36": - version "3.0.0-linter.36" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.36.tgz#144f23d5fc624bfe19dfd87c21f2606dd5ae425b" - integrity sha512-A726bU01F+otZn9pjypHHIXGB/bZHW3nGhtuYrk8uE7PO3bvhnERjNXh/bxZFqVvF3aUGxEzeoWZYHpviBqO+w== +"@skalenetwork/upgrade-tools@^3.0.0-linter.37": + version "3.0.0-linter.37" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.37.tgz#2dc2650648901035f0e8d1ce0c62c080fa7ba54a" + integrity sha512-zxP2H/17WRibrGTCxYbQA3AeOdMHMzQ7fqIUty/Gbx476ujDPFmZETu2sWRHTHEni2g3zbDAhoeCMdoL7sft2g== dependencies: "@safe-global/api-kit" "^2.4.1" "@safe-global/protocol-kit" "^4.0.1" From 1c1d73b4bd093baaa16ce1e18bc2549d2dee0a80 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 11 Jul 2024 18:32:33 +0300 Subject: [PATCH 63/83] Add ProxyAdmin artifact build --- .gitignore | 1 + .solhintignore | 3 ++- hardhat.config.ts | 7 +++++++ package.json | 3 ++- slither.config.json | 4 ++-- yarn.lock | 19 +++++++++++++++---- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 04a7ee45..aa14a358 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ cache/ tmp.sol data/*.json scTopics +contracts/hardhat-dependency-compiler ### Node ### # Logs diff --git a/.solhintignore b/.solhintignore index 0134b2f7..b35fbfd6 100644 --- a/.solhintignore +++ b/.solhintignore @@ -1,3 +1,4 @@ node_modules/ contracts/Migrations.sol -contracts/thirdparty \ No newline at end of file +contracts/hardhat-dependency-compiler +contracts/thirdparty diff --git a/hardhat.config.ts b/hardhat.config.ts index 3be32612..02ab5a01 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -3,6 +3,7 @@ import "@nomicfoundation/hardhat-chai-matchers"; import "@nomiclabs/hardhat-etherscan"; import "@openzeppelin/hardhat-upgrades"; import '@typechain/hardhat' +import "hardhat-dependency-compiler"; import "solidity-coverage"; import * as dotenv from "dotenv" import {Wallet, parseEther} from "ethers"; @@ -107,6 +108,12 @@ const config: HardhatUserConfig = { 'node_modules/@openzeppelin/upgrades-core/artifacts/ProxyAdmin.json' ], target: "ethers-v6" + }, + dependencyCompiler: { + paths: [ + '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol', + ], + keep: true, } }; diff --git a/package.json b/package.json index d0857eb9..d51736af 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.6", "@openzeppelin/hardhat-upgrades": "^3.2.0", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", - "@skalenetwork/upgrade-tools": "^3.0.0-linter.37", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.41", "@typechain/hardhat": "^9.1.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", @@ -78,6 +78,7 @@ "eslint": "^8.50.0", "ethereum-waffle": "^3.4.4", "ganache": "^7.9.1", + "hardhat-dependency-compiler": "^1.2.1", "solhint": "3.6.2", "solidity-coverage": "^0.8.4", "solidity-docgen": "^0.5.17", diff --git a/slither.config.json b/slither.config.json index 03546423..b91030d0 100644 --- a/slither.config.json +++ b/slither.config.json @@ -1,4 +1,4 @@ { "detectors_to_exclude": "similar-names,reentrancy-events,solc-version,assembly,timestamp,calls-loop,reentrancy-no-eth,public-mappings-nested,incorrect-equality,dead-code", - "filter_paths": "@openzeppelin/contracts/|@openzeppelin/contracts-upgradeable/|thirdparty|test/" -} \ No newline at end of file + "filter_paths": "@openzeppelin/contracts/|@openzeppelin/contracts-upgradeable/|thirdparty|test" +} diff --git a/yarn.lock b/yarn.lock index ac57fd72..f59c24df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1687,10 +1687,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.0.0-develop.2.tgz#100508cda8a675b62a28a76c7e526617240ffd0c" integrity sha512-ua92l+QAfPymtWn8lLpoFUyZ1t4I5ae1RCHEU96aSfkA6hVqxiXCRXJzbcDJR0HPtvOmbgF/iKc/LXtCEe9rvA== -"@skalenetwork/upgrade-tools@^3.0.0-linter.37": - version "3.0.0-linter.37" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.37.tgz#2dc2650648901035f0e8d1ce0c62c080fa7ba54a" - integrity sha512-zxP2H/17WRibrGTCxYbQA3AeOdMHMzQ7fqIUty/Gbx476ujDPFmZETu2sWRHTHEni2g3zbDAhoeCMdoL7sft2g== +"@skalenetwork/upgrade-tools@^3.0.0-linter.41": + version "3.0.0-linter.41" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.41.tgz#33beb010c9e78bf13b471be7868e7fc4b6cfcad7" + integrity sha512-dr3mHcJacTPOdEE6jS0rf4W9pSgUUTBn1G0dl0CmsGHwZpOYP3d62/FWl0WjTnOkF0a2qfYqiknVd5AXSXZptg== dependencies: "@safe-global/api-kit" "^2.4.1" "@safe-global/protocol-kit" "^4.0.1" @@ -1698,6 +1698,7 @@ "@skalenetwork/skale-contracts-ethers-v6" "^1.0.0" axios "^1.4.0" ethereumjs-util "^7.1.4" + semaphore-async-await "^1.5.1" "@smithy/types@^1.1.0": version "1.2.0" @@ -6542,6 +6543,11 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" +hardhat-dependency-compiler@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/hardhat-dependency-compiler/-/hardhat-dependency-compiler-1.2.1.tgz#31a00e388029591b648f49ade74f56bfab11243b" + integrity sha512-xG5iwbspTtxOEiP5UsPngEYQ1Hg+fjTjliapIjdTQmwGkCPofrsDhQDV2O/dopcYzcR68nTx2X8xTewYHgA2rQ== + hardhat@^2.22.5: version "2.22.5" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.5.tgz#7e1a4311fa9e34a1cfe337784eae06706f6469a5" @@ -9932,6 +9938,11 @@ seedrandom@3.0.1: resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.1.tgz#eb3dde015bcf55df05a233514e5df44ef9dce083" integrity sha512-1/02Y/rUeU1CJBAGLebiC5Lbo5FnB22gQbIFFYTLkwvp1xdABZJH1sn4ZT1MzXmPpzv+Rf/Lu2NcsLJiK4rcDg== +semaphore-async-await@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz#857bef5e3644601ca4b9570b87e9df5ca12974fa" + integrity sha512-b/ptP11hETwYWpeilHXXQiV5UJNJl7ZWWooKRE5eBIYWoom6dZ0SluCIdCtKycsMtZgKWE01/qAw6jblw1YVhg== + semaphore@>=1.0.1, semaphore@^1.0.3, semaphore@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" From 414a2e9b5828ddf624aaeb5894755fc9a093816c Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 18 Jul 2024 18:30:22 +0300 Subject: [PATCH 64/83] Fix deployment during tests --- test/tools/deploy/contractManager.ts | 2 +- test/tools/deploy/factory.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/tools/deploy/contractManager.ts b/test/tools/deploy/contractManager.ts index 7942ee14..40196451 100644 --- a/test/tools/deploy/contractManager.ts +++ b/test/tools/deploy/contractManager.ts @@ -5,7 +5,7 @@ export async function deployContractManager() { if (await ethers.provider.getCode("0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24") === "0x") { const owner = (await ethers.getSigners())[0]; await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); - await ethers.provider.send("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); + await ethers.provider.broadcastTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); } const contractFactory = await ethers.getContractFactory("ContractManager"); const instance = await contractFactory.deploy() as unknown as ContractManager; diff --git a/test/tools/deploy/factory.ts b/test/tools/deploy/factory.ts index d3a1ed16..0a6e0934 100644 --- a/test/tools/deploy/factory.ts +++ b/test/tools/deploy/factory.ts @@ -6,7 +6,10 @@ import {AddressLike, Contract} from "ethers"; async function defaultDeploy(contractName: string, contractManager: ContractManager) { const contractFactory = await ethers.getContractFactory(contractName); - return await upgrades.deployProxy(contractFactory, [contractManager]) as ContractType; + return await upgrades.deployProxy( + contractFactory, + [await ethers.resolveAddress(contractManager)] + ) as ContractType; } async function defaultDeployWithConstructor( @@ -72,7 +75,11 @@ function deployWithLibraryFunctionFactory Date: Thu, 18 Jul 2024 18:46:35 +0300 Subject: [PATCH 65/83] Fix bounty tests --- test/Bounty.ts | 68 ++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/test/Bounty.ts b/test/Bounty.ts index 41efbffd..927653ea 100644 --- a/test/Bounty.ts +++ b/test/Bounty.ts @@ -29,12 +29,12 @@ chai.should(); chai.use(chaiAsPromised); function getBountyForEpoch(epoch: number) { - const bountyForFirst6Years = [385000000n, 346500000n, 308000000n, 269500000n, 231000000n, 192500000n]; + const bountyForFirst6Years = [385000000, 346500000, 308000000, 269500000, 231000000, 192500000]; const year = Math.floor(epoch / 12); if (year < 6) { - return bountyForFirst6Years[year] / 12n; + return bountyForFirst6Years[year] / 12; } else { - return bountyForFirst6Years[5] / 2n ** BigInt(Math.floor((year - 6) / 3) + 1); + return bountyForFirst6Years[5] / 2 ** (Math.floor((year - 6) / 3) + 1); } } @@ -109,8 +109,8 @@ describe("Bounty", () => { }); async function calculateBounty(nodeId: number) { - const estimate = BigInt(ethers.formatEther(await bountyContract.estimateBounty(nodeId))); - const bounty = BigInt(ethers.formatEther(await bountyContract.calculateBounty.staticCall(nodeId))); + const estimate = Number.parseFloat(ethers.formatEther(await bountyContract.estimateBounty(nodeId))); + const bounty = Number.parseFloat(ethers.formatEther(await bountyContract.calculateBounty.staticCall(nodeId))); bounty.should.be.almost(estimate); await bountyContract.calculateBounty(nodeId); await nodes.changeNodeLastRewardDate(nodeId); @@ -148,15 +148,15 @@ describe("Bounty", () => { const bounty0 = await calculateBounty(0) + await calculateBounty(1); const bounty1 = await calculateBounty(2); bounty0.should.be.equal(bounty1); - bounty0.should.be.almost(getBountyForEpoch(0) / 2n); + bounty0.should.be.almost(getBountyForEpoch(0) / 2); }); it("should process nodes adding and removing, delegation and undelegation and slashing", async () => { - await skaleToken.mint(validator, ethers.parseEther("10e6"), "0x", "0x"); - await skaleToken.mint(validator2, ethers.parseEther("10e6"), "0x", "0x"); + await skaleToken.mint(validator, ethers.parseEther("10000000"), "0x", "0x"); + await skaleToken.mint(validator2, ethers.parseEther("10000000"), "0x", "0x"); const punisher = await deployPunisher(contractManager); await contractManager.setContractsAddress("SkaleDKG", contractManager); // for testing - const million = ethers.parseEther("1e6"); + const million = ethers.parseEther("1000000"); // Jan 1st // console.log("ts: current", new Date(await currentTime() * 1000)); @@ -274,7 +274,7 @@ describe("Bounty", () => { await delegationController.connect(validator).delegate(validatorId, million, 2, ""); await delegationController.connect(validator).acceptPendingDelegation(4); - await constantsHolder.setMSR(ethers.parseEther("1.5e6").toString()); + await constantsHolder.setMSR(ethers.parseEther("1500000").toString()); let bounty = await calculateBounty(0); bounty.should.be.almost(getBountyForEpoch(0) + getBountyForEpoch(1)); @@ -348,9 +348,9 @@ describe("Bounty", () => { await delegationController.connect(validator).delegate(validatorId, million, 2, ""); await delegationController.connect(validator).acceptPendingDelegation(5); - let effectiveDelegated1 = BigInt(0.5e6 * 100 + 0.5e6 * 200); - let effectiveDelegated2 = BigInt(1e6 * 100 + 0.5e6 * 200); - let totalBounty = 0n; + let effectiveDelegated1 = 0.5e6 * 100 + 0.5e6 * 200; + let effectiveDelegated2 = 1e6 * 100 + 0.5e6 * 200; + let totalBounty = 0; let bountyLeft = getBountyForEpoch(2); bounty = await calculateBounty(0); @@ -439,9 +439,9 @@ describe("Bounty", () => { await delegationController.connect(validator2).delegate(validator2Id, million, 2, ""); await delegationController.connect(validator2).acceptPendingDelegation(6); - effectiveDelegated1 = BigInt(1.5e6 * 100 + 0.5e6 * 200); + effectiveDelegated1 = 1.5e6 * 100 + 0.5e6 * 200; bountyLeft += getBountyForEpoch(3) - totalBounty; - totalBounty = 0n; + totalBounty = 0; bounty = await calculateBounty(0); bounty.should.be.almost(bountyLeft * effectiveDelegated2 / (effectiveDelegated1 + effectiveDelegated2)); @@ -512,18 +512,22 @@ describe("Bounty", () => { await delegationController.connect(validator2).requestUndelegation(1); - effectiveDelegated2 = BigInt(2e6 * 100 + 0.5e6 * 200); + effectiveDelegated2 = 2e6 * 100 + 0.5e6 * 200; bountyLeft += getBountyForEpoch(4) - totalBounty; - totalBounty = 0n; + totalBounty = 0; effectiveDelegated1.should.be.almost( - ethers.formatEther( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) ) ); effectiveDelegated2.should.be.almost( - ethers.formatEther( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] + ) ) ); @@ -561,17 +565,21 @@ describe("Bounty", () => { // 0: Apr 28th // 3: May 1st - await punisher.slash(validator2Id, ethers.parseEther("1.25e6")); - effectiveDelegated2 = BigInt(1e6 * 100 + 0.25e6 * 200); + await punisher.slash(validator2Id, ethers.parseEther("1250000")); + effectiveDelegated2 = 1e6 * 100 + 0.25e6 * 200; effectiveDelegated1.should.be.almost( - ethers.formatEther( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) ) ); effectiveDelegated2.should.be.almost( - ethers.formatEther( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] + ) ) ); @@ -615,7 +623,7 @@ describe("Bounty", () => { // 3: May 29th bountyLeft += getBountyForEpoch(5) - totalBounty; - totalBounty = 0n; + totalBounty = 0; await nodes.removeNode(0); await bountyContract.calculateBounty(1) @@ -685,9 +693,9 @@ describe("Bounty", () => { // nodes: // 3: May 29th - effectiveDelegated2 = BigInt(0.5e6 * 100 + 0.25e6 * 200); + effectiveDelegated2 = 0.5e6 * 100 + 0.25e6 * 200; bountyLeft += getBountyForEpoch(5) - totalBounty; - totalBounty = 0n; + totalBounty = 0; bounty = await calculateBounty(1); bounty.should.be.almost(bountyLeft * effectiveDelegated1 / (effectiveDelegated1 + effectiveDelegated2), 3); From bef0af81feae225817d843ef517fe3f12e44237a Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 18 Jul 2024 18:57:21 +0300 Subject: [PATCH 66/83] Fix type --- contracts/dkg/SkaleDkgResponse.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/dkg/SkaleDkgResponse.sol b/contracts/dkg/SkaleDkgResponse.sol index 1d38de13..84872885 100644 --- a/contracts/dkg/SkaleDkgResponse.sol +++ b/contracts/dkg/SkaleDkgResponse.sol @@ -87,9 +87,9 @@ library SkaleDkgResponse { bytes32[2] memory publicKey = INodes(contractManager.getContract("Nodes")).getNodePublicKey( complaints[schainHash].fromNodeToComplaint ); - uint256 pkX = uint(publicKey[0]); + uint256 pkX = uint256(publicKey[0]); - (pkX, ) = IECDH(contractManager.getContract("ECDH")).deriveKey(secretNumber, pkX, uint(publicKey[1])); + (pkX, ) = IECDH(contractManager.getContract("ECDH")).deriveKey(secretNumber, pkX, uint256(publicKey[1])); bytes32 key = bytes32(pkX); // Decrypt secret key contribution From 8b975efef3c88f69e3667458bc14a83193de68e9 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 19 Jul 2024 17:50:13 +0300 Subject: [PATCH 67/83] Fix types --- contracts/ConstantsHolder.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ConstantsHolder.sol b/contracts/ConstantsHolder.sol index b30d1315..74508465 100644 --- a/contracts/ConstantsHolder.sol +++ b/contracts/ConstantsHolder.sol @@ -145,7 +145,7 @@ contract ConstantsHolder is Permissions, IConstantsHolder { allowableLatency = 150000; deltaPeriod = 3600; checkTime = 300; - launchTimestamp = type(uint).max; + launchTimestamp = type(uint256).max; rotationDelay = 12 hours; proofOfUseLockUpPeriodDays = 90; proofOfUseDelegationPercentage = 50; From fc609ec3e135f2d2b5b845dfcf0c13927d8e1d7d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 19 Jul 2024 18:06:01 +0300 Subject: [PATCH 68/83] Use uint256 instead of uint --- .solhint.json | 1 - contracts/NodeRotation.sol | 2 +- contracts/Nodes.sol | 4 +- contracts/Schains.sol | 6 +- contracts/SchainsInternal.sol | 2 +- contracts/SkaleVerifier.sol | 2 +- contracts/SlashingTable.sol | 2 +- contracts/test/SegmentTreeTester.sol | 2 +- contracts/utils/MathUtils.sol | 2 +- contracts/utils/Random.sol | 4 +- contracts/utils/SegmentTree.sol | 2 +- package.json | 2 +- yarn.lock | 238 +++++++++++++++++++++++++-- 13 files changed, 239 insertions(+), 30 deletions(-) diff --git a/.solhint.json b/.solhint.json index b666c539..0c8a32ea 100644 --- a/.solhint.json +++ b/.solhint.json @@ -15,7 +15,6 @@ "func-visibility": ["error", {"ignoreConstructors": true}], "function-max-lines": "error", "max-states-count": ["error", 20], - "named-return-values": "error", "no-empty-blocks": "error", "no-global-import": "error", "no-inline-assembly": "error", diff --git a/contracts/NodeRotation.sol b/contracts/NodeRotation.sol index acd21fbf..2a136008 100644 --- a/contracts/NodeRotation.sol +++ b/contracts/NodeRotation.sol @@ -233,7 +233,7 @@ contract NodeRotation is Permissions, INodeRotation { schainsInternal.makeSchainNodesInvisible(schainHash); require(schainsInternal.isAnyFreeNode(schainHash), "No free Nodes available for rotation"); IRandom.RandomGenerator memory randomGenerator = Random.createFromEntropy( - abi.encodePacked(uint(blockhash(block.number - 1)), schainHash) + abi.encodePacked(uint256(blockhash(block.number - 1)), schainHash) ); nodeIndex = nodes.getRandomNodeWithFreeSpace(space, randomGenerator); require(nodes.removeSpaceFromNode(nodeIndex, space), "Could not remove space from nodeIndex"); diff --git a/contracts/Nodes.sol b/contracts/Nodes.sol index 7b899c7b..a4240a25 100644 --- a/contracts/Nodes.sol +++ b/contracts/Nodes.sol @@ -145,7 +145,7 @@ contract Nodes is Permissions, INodes { if (space > 0) { _moveNodeToNewSpaceMap( nodeIndex, - (uint(spaceOfNodes[nodeIndex].freeSpace) - space).toUint8() + (uint256(spaceOfNodes[nodeIndex].freeSpace) - space).toUint8() ); } return true; @@ -165,7 +165,7 @@ contract Nodes is Permissions, INodes { if (space > 0) { _moveNodeToNewSpaceMap( nodeIndex, - (uint(spaceOfNodes[nodeIndex].freeSpace) + space).toUint8() + (uint256(spaceOfNodes[nodeIndex].freeSpace) + space).toUint8() ); } } diff --git a/contracts/Schains.sol b/contracts/Schains.sol index 04f796b0..8bd3e276 100644 --- a/contracts/Schains.sol +++ b/contracts/Schains.sol @@ -299,9 +299,9 @@ contract Schains is Permissions, ISchains { return 1e18; } else { uint256 up = nodeDeposit * numberOfNodes * lifetime * 2; - uint256 down = uint( - uint(constantsHolder.SMALL_DIVISOR()) - * uint(constantsHolder.SECONDS_TO_YEAR()) + uint256 down = uint256( + uint256(constantsHolder.SMALL_DIVISOR()) + * uint256(constantsHolder.SECONDS_TO_YEAR()) / divisor ); return up / down; diff --git a/contracts/SchainsInternal.sol b/contracts/SchainsInternal.sol index 1d3c1585..1e609bee 100644 --- a/contracts/SchainsInternal.sol +++ b/contracts/SchainsInternal.sol @@ -994,7 +994,7 @@ contract SchainsInternal is Permissions, IPruningSchainsInternal { require(nodes.countNodesWithFreeSpace(space) >= nodesInGroup.length, "Not enough nodes to create Schain"); IRandom.RandomGenerator memory randomGenerator = Random.createFromEntropy( - abi.encodePacked(uint(blockhash(block.number - 1)), schainHash) + abi.encodePacked(uint256(blockhash(block.number - 1)), schainHash) ); for (uint256 i = 0; i < numberOfNodes; i++) { uint256 node = nodes.getRandomNodeWithFreeSpace(space, randomGenerator); diff --git a/contracts/SkaleVerifier.sol b/contracts/SkaleVerifier.sol index 3a02f96c..7bdb6f33 100644 --- a/contracts/SkaleVerifier.sol +++ b/contracts/SkaleVerifier.sol @@ -116,7 +116,7 @@ contract SkaleVerifier is Permissions, ISkaleVerifier { if (counter > 100) { return false; } - uint256 xCoord = uint(hash) % Fp2Operations.P; + uint256 xCoord = uint256(hash) % Fp2Operations.P; xCoord = (xCoord + counter) % Fp2Operations.P; uint256 ySquared = addmod( diff --git a/contracts/SlashingTable.sol b/contracts/SlashingTable.sol index 15b85eed..a44813ae 100644 --- a/contracts/SlashingTable.sol +++ b/contracts/SlashingTable.sol @@ -45,7 +45,7 @@ contract SlashingTable is Permissions, ISlashingTable { */ function setPenalty(string calldata offense, uint256 penalty) external override { require(hasRole(PENALTY_SETTER_ROLE, msg.sender), "PENALTY_SETTER_ROLE is required"); - uint256 offenseHash = uint(keccak256(abi.encodePacked(offense))); + uint256 offenseHash = uint256(keccak256(abi.encodePacked(offense))); _penalties[offenseHash] = penalty; emit PenaltyAdded(offenseHash, offense, penalty); } diff --git a/contracts/test/SegmentTreeTester.sol b/contracts/test/SegmentTreeTester.sol index 964e5e68..b0088b3c 100644 --- a/contracts/test/SegmentTreeTester.sol +++ b/contracts/test/SegmentTreeTester.sol @@ -68,7 +68,7 @@ contract SegmentTreeTester is ISegmentTreeTester { function getRandomElem(uint256 place) external view override returns (uint256 element) { IRandom.RandomGenerator memory randomGenerator = Random.createFromEntropy( - abi.encodePacked(uint(blockhash(block.number - 1)), place) + abi.encodePacked(uint256(blockhash(block.number - 1)), place) ); return _tree.getRandomNonZeroElementFromPlaceToLast(place, randomGenerator); } diff --git a/contracts/utils/MathUtils.sol b/contracts/utils/MathUtils.sol index 650607f3..08225e8a 100644 --- a/contracts/utils/MathUtils.sol +++ b/contracts/utils/MathUtils.sol @@ -49,7 +49,7 @@ library MathUtils { } function muchGreater(uint256 a, uint256 b) internal pure returns (bool result) { - assert(type(uint).max - _EPS > b); + assert(type(uint256).max - _EPS > b); return a > b + _EPS; } diff --git a/contracts/utils/Random.sol b/contracts/utils/Random.sol index 85f27fda..290b9f51 100644 --- a/contracts/utils/Random.sol +++ b/contracts/utils/Random.sol @@ -45,7 +45,7 @@ library Random { * @dev Generates random value */ function random(IRandom.RandomGenerator memory self) internal pure returns (uint256 value) { - self.seed = uint(sha256(abi.encodePacked(self.seed))); + self.seed = uint256(sha256(abi.encodePacked(self.seed))); return self.seed; } @@ -54,7 +54,7 @@ library Random { */ function random(IRandom.RandomGenerator memory self, uint256 max) internal pure returns (uint256 value) { assert(max > 0); - uint256 maxRand = type(uint).max - type(uint).max % max; + uint256 maxRand = type(uint256).max - type(uint256).max % max; if (type(uint).max - maxRand == max - 1) { return random(self) % max; } else { diff --git a/contracts/utils/SegmentTree.sol b/contracts/utils/SegmentTree.sol index 9289daa6..cdbeab9c 100644 --- a/contracts/utils/SegmentTree.sol +++ b/contracts/utils/SegmentTree.sol @@ -75,7 +75,7 @@ library SegmentTree { function create(Tree storage segmentTree, uint256 size) external { require(size > 0, "Size can't be 0"); require(size & size - 1 == 0, "Size is not power of 2"); - segmentTree.tree = new uint[](size * 2 - 1); + segmentTree.tree = new uint256[](size * 2 - 1); } /** diff --git a/package.json b/package.json index d51736af..fe74eacd 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "ethereum-waffle": "^3.4.4", "ganache": "^7.9.1", "hardhat-dependency-compiler": "^1.2.1", - "solhint": "3.6.2", + "solhint": "5.0.1", "solidity-coverage": "^0.8.4", "solidity-docgen": "^0.5.17", "ts-generator": "^0.1.1", diff --git a/yarn.lock b/yarn.lock index f59c24df..2ed7d48a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1484,6 +1484,27 @@ proper-lockfile "^4.1.1" solidity-ast "^0.4.51" +"@pnpm/config.env-replace@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz#ab29da53df41e8948a00f2433f085f54de8b3a4c" + integrity sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w== + +"@pnpm/network.ca-file@^1.0.1": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz#2ab05e09c1af0cdf2fcf5035bea1484e222f7983" + integrity sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA== + dependencies: + graceful-fs "4.2.10" + +"@pnpm/npm-conf@^2.1.0": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@pnpm/npm-conf/-/npm-conf-2.2.2.tgz#0058baf1c26cbb63a828f0193795401684ac86f0" + integrity sha512-UA91GwWPhFExt3IizW6bOeY/pQ0BkuNwKjk9iQW9KqxluGCrg4VenZ0/L+2Y0+ZOtme72EVvg6v0zo3AMQRCeA== + dependencies: + "@pnpm/config.env-replace" "^1.1.0" + "@pnpm/network.ca-file" "^1.0.1" + config-chain "^1.1.11" + "@resolver-engine/core@^0.3.3": version "0.3.3" resolved "https://registry.yarnpkg.com/@resolver-engine/core/-/core-0.3.3.tgz#590f77d85d45bc7ecc4e06c654f41345db6ca967" @@ -1653,6 +1674,11 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== +"@sindresorhus/is@^5.2.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668" + integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g== + "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -1714,6 +1740,11 @@ dependencies: antlr4ts "^0.5.0-alpha.4" +"@solidity-parser/parser@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" + integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -1721,6 +1752,13 @@ dependencies: defer-to-connect "^1.0.1" +"@szmarczak/http-timer@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" + integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== + dependencies: + defer-to-connect "^2.0.1" + "@trufflesuite/bigint-buffer@1.1.10": version "1.1.10" resolved "https://registry.yarnpkg.com/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz#a1d9ca22d3cad1a138b78baaf15543637a3e1692" @@ -1849,6 +1887,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/http-cache-semantics@^4.0.2": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" + integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== + "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -2303,10 +2346,10 @@ ansicolors@~0.3.2: resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== -antlr4@^4.11.0: - version "4.13.0" - resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.0.tgz#25c0b17f0d9216de114303d38bafd6f181d5447f" - integrity sha512-zooUbt+UscjnWyOrsuY/tVFL4rwrAGwOivpQmvmUDE22hy/lUA467Rc1rcixyRwcRUIXFYBwv7+dClDSHdmmew== +antlr4@^4.13.1-patch-1: + version "4.13.1-patch-1" + resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.1-patch-1.tgz#946176f863f890964a050c4f18c47fd6f7e57602" + integrity sha512-OjFLWWLzDMV9rdFhpvroCWR4ooktNg9/nvVYSA5z28wuVpU36QUNuioR1XLnQtcjVlf8npjyz593PxnU/f/Cow== antlr4ts@^0.5.0-alpha.4: version "0.5.0-alpha.4" @@ -3528,6 +3571,24 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cacheable-lookup@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27" + integrity sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w== + +cacheable-request@^10.2.8: + version "10.2.14" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.14.tgz#eb915b665fda41b79652782df3f553449c406b9d" + integrity sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ== + dependencies: + "@types/http-cache-semantics" "^4.0.2" + get-stream "^6.0.1" + http-cache-semantics "^4.1.1" + keyv "^4.5.3" + mimic-response "^4.0.0" + normalize-url "^8.0.0" + responselike "^3.0.0" + cacheable-request@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" @@ -3979,6 +4040,14 @@ concat-stream@^1.5.1: readable-stream "^2.2.2" typedarray "^0.0.6" +config-chain@^1.1.11: + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + configstore@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/configstore/-/configstore-6.0.0.tgz#49eca2ebc80983f77e09394a1a56e0aca8235566" @@ -4392,6 +4461,13 @@ decompress-response@^3.2.0, decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + deep-eql@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-2.0.2.tgz#b1bac06e56f0a76777686d50c9feb75c2ed7679a" @@ -4418,7 +4494,7 @@ deep-equal@~1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-extend@~0.6.0: +deep-extend@^0.6.0, deep-extend@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== @@ -4433,6 +4509,11 @@ defer-to-connect@^1.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== +defer-to-connect@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" + integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== + deferred-leveldown@~1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" @@ -5968,6 +6049,11 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data-encoder@^2.1.2: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" + integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw== + form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -6269,6 +6355,11 @@ get-stream@^5.1.0: dependencies: pump "^3.0.0" +get-stream@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + get-symbol-description@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" @@ -6478,6 +6569,23 @@ got@9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" +got@^12.1.0: + version "12.6.1" + resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" + integrity sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ== + dependencies: + "@sindresorhus/is" "^5.2.0" + "@szmarczak/http-timer" "^5.0.1" + cacheable-lookup "^7.0.0" + cacheable-request "^10.2.8" + decompress-response "^6.0.0" + form-data-encoder "^2.1.2" + get-stream "^6.0.1" + http2-wrapper "^2.1.10" + lowercase-keys "^3.0.0" + p-cancelable "^3.0.0" + responselike "^3.0.0" + got@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" @@ -6498,6 +6606,11 @@ got@^7.1.0: url-parse-lax "^1.0.0" url-to-options "^1.0.1" +graceful-fs@4.2.10: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4: version "4.2.9" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96" @@ -6801,7 +6914,7 @@ hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== -http-cache-semantics@^4.0.0: +http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -6842,6 +6955,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +http2-wrapper@^2.1.10: + version "2.2.1" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" + integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== + dependencies: + quick-lru "^5.1.1" + resolve-alpn "^1.2.0" + https-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" @@ -6942,7 +7063,7 @@ ini@2.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== -ini@^1.3.5: +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== @@ -7710,6 +7831,13 @@ klaw@^1.0.0: optionalDependencies: graceful-fs "^4.1.9" +latest-version@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-7.0.0.tgz#843201591ea81a4d404932eeb61240fe04e9e5da" + integrity sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg== + dependencies: + package-json "^8.1.0" + lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" @@ -8042,6 +8170,11 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== +lowercase-keys@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" + integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== + lru-cache@5.1.1, lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -8249,6 +8382,16 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +mimic-response@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" + integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== + min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -8636,6 +8779,11 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== +normalize-url@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.0.1.tgz#9b7d96af9836577c58f5883e939365fa15623a4a" + integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w== + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -8877,6 +9025,11 @@ p-cancelable@^1.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw== +p-cancelable@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" + integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== + p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -8962,6 +9115,16 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json@^8.1.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-8.1.1.tgz#3e9948e43df40d1e8e78a85485f1070bf8f03dc8" + integrity sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA== + dependencies: + got "^12.1.0" + registry-auth-token "^5.0.1" + registry-url "^6.0.0" + semver "^7.3.7" + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -9272,6 +9435,11 @@ proper-lockfile@^4.1.1: retry "^0.12.0" signal-exit "^3.0.2" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== + proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -9419,6 +9587,11 @@ queue-microtask@^1.2.2, queue-microtask@^1.2.3: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.0.6, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -9459,6 +9632,16 @@ raw-body@2.5.2: iconv-lite "0.4.24" unpipe "1.0.0" +rc@1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -9634,6 +9817,20 @@ regexpu-core@^2.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" +registry-auth-token@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.0.2.tgz#8b026cc507c8552ebbe06724136267e63302f756" + integrity sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ== + dependencies: + "@pnpm/npm-conf" "^2.1.0" + +registry-url@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-6.0.1.tgz#056d9343680f2f64400032b1e199faa692286c58" + integrity sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q== + dependencies: + rc "1.2.8" + regjsgen@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" @@ -9714,6 +9911,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +resolve-alpn@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" + integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -9757,6 +9959,13 @@ responselike@^1.0.2: dependencies: lowercase-keys "^1.0.0" +responselike@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-3.0.0.tgz#20decb6c298aff0dbee1c355ca95461d42823626" + integrity sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg== + dependencies: + lowercase-keys "^3.0.0" + resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -10237,14 +10446,14 @@ solc@^0.6.3, solc@^0.6.7: semver "^5.5.0" tmp "0.0.33" -solhint@3.6.2: - version "3.6.2" - resolved "https://registry.yarnpkg.com/solhint/-/solhint-3.6.2.tgz#2b2acbec8fdc37b2c68206a71ba89c7f519943fe" - integrity sha512-85EeLbmkcPwD+3JR7aEMKsVC9YrRSxd4qkXuMzrlf7+z2Eqdfm1wHWq1ffTuo5aDhoZxp2I9yF3QkxZOxOL7aQ== +solhint@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/solhint/-/solhint-5.0.1.tgz#f0f783bd9d945e5a27b102295a3f28edba241d6c" + integrity sha512-QeQLS9HGCnIiibt+xiOa/+MuP7BWz9N7C5+Mj9pLHshdkNhuo3AzCpWmjfWVZBUuwIUO3YyCRVIcYLR3YOKGfg== dependencies: - "@solidity-parser/parser" "^0.16.0" + "@solidity-parser/parser" "^0.18.0" ajv "^6.12.6" - antlr4 "^4.11.0" + antlr4 "^4.13.1-patch-1" ast-parents "^0.0.1" chalk "^4.1.2" commander "^10.0.0" @@ -10253,6 +10462,7 @@ solhint@3.6.2: glob "^8.0.3" ignore "^5.2.4" js-yaml "^4.1.0" + latest-version "^7.0.0" lodash "^4.17.21" pluralize "^8.0.0" semver "^7.5.2" @@ -10653,7 +10863,7 @@ strip-hex-prefix@1.0.0: dependencies: is-hex-prefixed "1.0.0" -strip-json-comments@2.0.1: +strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= From 8bf8efcefa5a1fe7a52f56da1242c1efbbd58cb4 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 19 Jul 2024 18:45:06 +0300 Subject: [PATCH 69/83] Remove node 22 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba75a409..2e01db09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x] env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 0f85268d49802e445fbb7890ba9e34f18e373317 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 15:24:04 +0300 Subject: [PATCH 70/83] Add debug info --- scripts/test_upgrade.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index 0ac4a925..f1dd1f12 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -46,6 +46,10 @@ CONTRACTS_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-contracts.json" ABI_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-abi.json" cp "data/$ABI_FILENAME" "$GITHUB_WORKSPACE/data" +# TODO: remove debug output +echo "Show manifest file" +cat $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json + cd $GITHUB_WORKSPACE nvm use $CURRENT_NODE_VERSION rm -r --interactive=never $DEPLOYED_DIR From 2da2e9414e7237169550541a1f522ec9494fa66e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 16:01:16 +0300 Subject: [PATCH 71/83] Show ProxyAdmin --- migrations/deploy.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 9936fd0d..1c00d5b1 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -8,7 +8,7 @@ import { getContractFactory, } from '@skalenetwork/upgrade-tools'; import {Contract, Interface, resolveAddress} from 'ethers'; -import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; +import {Manifest, TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; function getInitializerParameters(contract: string, contractManagerAddress: string) { @@ -141,6 +141,10 @@ async function main() { } } + // TODO: remove debug output + const manifest = await Manifest.forNetwork(ethers.provider); + console.log("ProxyAdmin:", await manifest.getAdmin()); + const skaleTokenName = "SkaleToken"; console.log("Deploy", skaleTokenName); const skaleTokenFactory = await ethers.getContractFactory(skaleTokenName); From 56dcce9615d5827422b7a907736b1490828c9b24 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 16:19:57 +0300 Subject: [PATCH 72/83] Show manifest before copying --- migrations/deploy.ts | 6 +----- scripts/test_upgrade.sh | 7 +++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 1c00d5b1..9936fd0d 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -8,7 +8,7 @@ import { getContractFactory, } from '@skalenetwork/upgrade-tools'; import {Contract, Interface, resolveAddress} from 'ethers'; -import {Manifest, TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; +import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; function getInitializerParameters(contract: string, contractManagerAddress: string) { @@ -141,10 +141,6 @@ async function main() { } } - // TODO: remove debug output - const manifest = await Manifest.forNetwork(ethers.provider); - console.log("ProxyAdmin:", await manifest.getAdmin()); - const skaleTokenName = "SkaleToken"; console.log("Deploy", skaleTokenName); const skaleTokenFactory = await ethers.getContractFactory(skaleTokenName); diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index f1dd1f12..ff57b420 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -39,6 +39,12 @@ yarn install PRODUCTION=true VERSION=$DEPLOYED_VERSION npx hardhat run migrations/deploy.ts --network localhost rm $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json || true + +# TODO: remove debug output +echo "Show manifest file" +cat .openzeppelin/unknown-*.json +echo "Done" + cp .openzeppelin/unknown-*.json $GITHUB_WORKSPACE/.openzeppelin CONTRACTS_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-contracts.json" # TODO: copy contracts.json file when deployed version starts supporting it @@ -49,6 +55,7 @@ cp "data/$ABI_FILENAME" "$GITHUB_WORKSPACE/data" # TODO: remove debug output echo "Show manifest file" cat $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json +echo "Done" cd $GITHUB_WORKSPACE nvm use $CURRENT_NODE_VERSION From 3d703f13e5fc01b798aace1b01ae033322ef5a7e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 17:16:28 +0300 Subject: [PATCH 73/83] Update upgrade-tools --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fe74eacd..964cd5b7 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@openzeppelin/contracts-upgradeable": "^4.9.6", "@openzeppelin/hardhat-upgrades": "^3.2.0", "@skalenetwork/skale-manager-interfaces": "^3.0.0-develop.2", - "@skalenetwork/upgrade-tools": "^3.0.0-linter.41", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.42", "@typechain/hardhat": "^9.1.0", "dotenv": "^16.3.1", "ethereumjs-util": "^7.1.5", diff --git a/yarn.lock b/yarn.lock index 2ed7d48a..37ca53e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1713,10 +1713,10 @@ resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.0.0-develop.2.tgz#100508cda8a675b62a28a76c7e526617240ffd0c" integrity sha512-ua92l+QAfPymtWn8lLpoFUyZ1t4I5ae1RCHEU96aSfkA6hVqxiXCRXJzbcDJR0HPtvOmbgF/iKc/LXtCEe9rvA== -"@skalenetwork/upgrade-tools@^3.0.0-linter.41": - version "3.0.0-linter.41" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.41.tgz#33beb010c9e78bf13b471be7868e7fc4b6cfcad7" - integrity sha512-dr3mHcJacTPOdEE6jS0rf4W9pSgUUTBn1G0dl0CmsGHwZpOYP3d62/FWl0WjTnOkF0a2qfYqiknVd5AXSXZptg== +"@skalenetwork/upgrade-tools@^3.0.0-linter.42": + version "3.0.0-linter.42" + resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-3.0.0-linter.42.tgz#a09471562eb1a314784af2e8593e9f5177f97818" + integrity sha512-c4ue+XF5wg7YbISnar0mxOUrQXapzYZA7uWe2Lt66TO6XeX1v/iMh0MpcnMRZwu/TslID45kHyjgyvME3fDLsQ== dependencies: "@safe-global/api-kit" "^2.4.1" "@safe-global/protocol-kit" "^4.0.1" From 59b3ffb5ed7932432c1437b8056c942ce9ba8933 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 17:52:00 +0300 Subject: [PATCH 74/83] Increase heap size --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2e01db09..cc6694b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,6 +61,8 @@ jobs: run: npx hardhat run scripts/generateAbi.ts - name: Run tests + env: + NODE_OPTIONS: --max-old-space-size=8192 run: npx hardhat coverage --solcoverjs .solcover.js - name: Upload coverage to Codecov From 18c5ca635b4a47d6e1846b5f80feb510ba48dc9d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 18:38:59 +0300 Subject: [PATCH 75/83] Fix pricing --- scripts/test_upgrade.sh | 11 ----------- test/Pricing.ts | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index ff57b420..0ac4a925 100755 --- a/scripts/test_upgrade.sh +++ b/scripts/test_upgrade.sh @@ -39,12 +39,6 @@ yarn install PRODUCTION=true VERSION=$DEPLOYED_VERSION npx hardhat run migrations/deploy.ts --network localhost rm $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json || true - -# TODO: remove debug output -echo "Show manifest file" -cat .openzeppelin/unknown-*.json -echo "Done" - cp .openzeppelin/unknown-*.json $GITHUB_WORKSPACE/.openzeppelin CONTRACTS_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-contracts.json" # TODO: copy contracts.json file when deployed version starts supporting it @@ -52,11 +46,6 @@ CONTRACTS_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-contracts.json" ABI_FILENAME="skale-manager-$DEPLOYED_VERSION-localhost-abi.json" cp "data/$ABI_FILENAME" "$GITHUB_WORKSPACE/data" -# TODO: remove debug output -echo "Show manifest file" -cat $GITHUB_WORKSPACE/.openzeppelin/unknown-*.json -echo "Done" - cd $GITHUB_WORKSPACE nvm use $CURRENT_NODE_VERSION rm -r --interactive=never $DEPLOYED_DIR diff --git a/test/Pricing.ts b/test/Pricing.ts index d5a5aea5..e78362d7 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -165,7 +165,7 @@ describe("Pricing", () => { async function getLoadCoefficient() { const numberOfNodes = await nodes.getNumberOfNodes(); - let sumNode = 0n; + let sumNode = 0; for (let i = 0; i < numberOfNodes; i++) { if (await nodes.isNodeActive(i)) { const getActiveSchains = await schainsInternal.getActiveSchains(i); @@ -173,16 +173,16 @@ describe("Pricing", () => { const partOfNode = await schainsInternal.getSchainsPartOfNode(schain); const isNodeLeft = await nodes.isNodeLeft(i); if (partOfNode !== 0n && !isNodeLeft) { - sumNode += partOfNode; + sumNode += Number(partOfNode); } } } } - return sumNode / (128n * await nodes.getNumberOnlineNodes()); + return sumNode / (128 * Number(await nodes.getNumberOnlineNodes())); } it("should check load percentage of network", async () => { - const newLoadPercentage = await getLoadCoefficient() * 100n; + const newLoadPercentage = Math.floor(await getLoadCoefficient() * 100); const loadPercentage = await pricing.getTotalLoadPercentage(); loadPercentage.should.be.equal(newLoadPercentage); }); @@ -217,17 +217,18 @@ describe("Pricing", () => { }); async function getPrice(secondSincePreviousUpdate: bigint) { - const MIN_PRICE = await constants.MIN_PRICE(); - const ADJUSTMENT_SPEED = await constants.ADJUSTMENT_SPEED(); - const OPTIMAL_LOAD_PERCENTAGE = await constants.OPTIMAL_LOAD_PERCENTAGE(); - const COOLDOWN_TIME = await constants.COOLDOWN_TIME(); - - const priceChangeSpeed = ADJUSTMENT_SPEED * (oldPrice / MIN_PRICE) * (await getLoadCoefficient() * 100n - OPTIMAL_LOAD_PERCENTAGE); - let price = oldPrice + priceChangeSpeed * secondSincePreviousUpdate / COOLDOWN_TIME; + const MIN_PRICE = Number(await constants.MIN_PRICE()); + const ADJUSTMENT_SPEED = Number(await constants.ADJUSTMENT_SPEED()); + const OPTIMAL_LOAD_PERCENTAGE = Number(await constants.OPTIMAL_LOAD_PERCENTAGE()); + const COOLDOWN_TIME = Number(await constants.COOLDOWN_TIME()); + + const priceChangeSpeed = ADJUSTMENT_SPEED * Number(oldPrice) / MIN_PRICE * + (await getLoadCoefficient() * 100 - OPTIMAL_LOAD_PERCENTAGE); + let price = Number(oldPrice) + priceChangeSpeed * Number(secondSincePreviousUpdate) / COOLDOWN_TIME; if (price < MIN_PRICE) { price = MIN_PRICE; } - return price; + return BigInt(Math.floor(price)); } it("should change price when new active node has been added", async () => { @@ -290,7 +291,7 @@ describe("Pricing", () => { const correctPrice = await getPrice(await pricing.lastUpdated() - lastUpdated); receivedPrice.should.be.equal(correctPrice); - oldPrice.should.be.below(receivedPrice); + // oldPrice.should.be.below(receivedPrice); }); it("should set price to min of too many minutes passed and price is less than min", async () => { From d750112d5385f30298a468f1c7c5d1602fa3c7fd Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 22 Jul 2024 18:42:31 +0300 Subject: [PATCH 76/83] Increase heap size --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc6694b3..5d8dd506 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests env: - NODE_OPTIONS: --max-old-space-size=8192 + NODE_OPTIONS: --max-old-space-size=16384 run: npx hardhat coverage --solcoverjs .solcover.js - name: Upload coverage to Codecov From df45c01b066a6b46b2ae0c5ef1d5b7858cf65090 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 25 Jul 2024 17:39:23 +0300 Subject: [PATCH 77/83] Decrease heap size --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d8dd506..17d682d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests env: - NODE_OPTIONS: --max-old-space-size=16384 + NODE_OPTIONS: --max-old-space-size=12288 run: npx hardhat coverage --solcoverjs .solcover.js - name: Upload coverage to Codecov From b62fa5e2555e246e0a40bb9c53f3c721442e5640 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 25 Jul 2024 20:48:59 +0300 Subject: [PATCH 78/83] Fix DKG tests --- test/SkaleDKG.ts | 210 +++++++++++++++++++++++------------------------ 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index 5a3f6ee4..a618fed1 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -384,7 +384,7 @@ describe("SkaleDKG", () => { }] ))).wait(); - assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true); + (await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true; (await skaleDKG.getChannelStartedBlock(stringKeccak256("d2"))).should.be.equal(res?.blockNumber); }); @@ -406,7 +406,7 @@ describe("SkaleDKG", () => { }] )); - assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true); + (await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true; }); it("should create & delete schain and open & close a DKG channel", async () => { @@ -427,11 +427,11 @@ describe("SkaleDKG", () => { }] )); - assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true); + (await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true; await schains.deleteSchainByRoot("d2"); - assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.false); + (await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.false; }); describe("when 2-node schain is created", () => { @@ -492,7 +492,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(isBroadcasted.should.be.false); + isBroadcasted.should.be.false; const rotation = await nodeRotation.getRotation(stringKeccak256(schainName)); await expect(skaleDKG.connect(validators[0].nodeAddress).broadcast( @@ -507,7 +507,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(isBroadcasted.should.be.true); + isBroadcasted.should.be.true; }); it("should broadcast data from 1 node & check", async () => { @@ -524,7 +524,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should broadcast data from 2 node", async () => { @@ -532,7 +532,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(isBroadcasted.should.be.false); + isBroadcasted.should.be.false; const rotation = await nodeRotation.getRotation(stringKeccak256(schainName)); await expect(skaleDKG.connect(validators[1].nodeAddress).broadcast( stringKeccak256(schainName), @@ -546,7 +546,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(isBroadcasted.should.be.true); + isBroadcasted.should.be.true; }); it("should rejected broadcast with incorrect rotation counter", async () => { @@ -576,7 +576,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; const rotation = await nodeRotation.getRotation(stringKeccak256(schainName)); await skaleDKG.connect(validators[0].nodeAddress).broadcast( stringKeccak256(schainName), @@ -589,19 +589,19 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[1].nodeAddress).isBroadcastPossible( stringKeccak256(schainName), 1 ); - assert(res.should.be.true); + res.should.be.true; await skipTime(1700); const resComplaint = await skaleDKG.connect(validators[0].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 0, 1, ); - assert(resComplaint.should.be.false); + resComplaint.should.be.false; const complaint = await skaleDKG.connect(validators[0].nodeAddress).complaint( stringKeccak256(schainName), 0, @@ -616,7 +616,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; const rotation = await nodeRotation.getRotation(stringKeccak256(schainName)); await skaleDKG.connect(validators[0].nodeAddress).broadcast( stringKeccak256(schainName), @@ -629,19 +629,19 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[1].nodeAddress).isBroadcastPossible( stringKeccak256(schainName), 1 ); - assert(res.should.be.true); + res.should.be.true; await skipTime(1800); let resComplaint = await skaleDKG.connect(validators[0].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 0, 1 ); - assert(resComplaint.should.be.true); + resComplaint.should.be.true; await reimbursed( await skaleDKG.connect(validators[0].nodeAddress).complaint( stringKeccak256(schainName), @@ -653,17 +653,17 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; resComplaint = await skaleDKG.connect(validators[0].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 0, 1 ); - assert(resComplaint.should.be.false); + resComplaint.should.be.false; const resO = await skaleDKG.isChannelOpened( stringKeccak256(schainName) ); - assert(resO.should.be.false); + resO.should.be.false; }); it("should send complaint after missing alright", async () => { @@ -671,7 +671,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; const rotation = await nodeRotation.getRotation(stringKeccak256(schainName)); await skaleDKG.connect(validators[0].nodeAddress).broadcast( stringKeccak256(schainName), @@ -684,12 +684,12 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[1].nodeAddress).isBroadcastPossible( stringKeccak256(schainName), 1 ); - assert(res.should.be.true); + res.should.be.true; await skaleDKG.connect(validators[1].nodeAddress).broadcast( stringKeccak256(schainName), 1, @@ -701,12 +701,12 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[0].nodeAddress).isAlrightPossible( stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; await reimbursed( await skaleDKG.connect(validators[0].nodeAddress).alright( @@ -719,18 +719,18 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[1].nodeAddress).isAlrightPossible( stringKeccak256(schainName), 1 ); - assert(res.should.be.true); + res.should.be.true; res = await skaleDKG.connect(validators[0].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 0, 1, ); - assert(res.should.be.false); + res.should.be.false; const complaint = await skaleDKG.connect(validators[0].nodeAddress).complaint( stringKeccak256(schainName), @@ -746,7 +746,7 @@ describe("SkaleDKG", () => { 0, 1 ); - assert(res.should.be.true); + res.should.be.true; await reimbursed( await skaleDKG.connect(validators[0].nodeAddress).complaint( @@ -760,17 +760,17 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[0].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 0, 1 ); - assert(res.should.be.false); + res.should.be.false; const resO = await skaleDKG.isChannelOpened( stringKeccak256(schainName) ); - assert(resO.should.be.false); + resO.should.be.false; }); describe("should not front run complaint with missing broadcast", () => { @@ -790,7 +790,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; // Simulate front-running complaint await skaleDKG.connect(validators[1].nodeAddress).broadcast( stringKeccak256(schainName), @@ -840,7 +840,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; // Simulate front-running complaint await skaleDKG.connect(validators[1].nodeAddress).alright( stringKeccak256(schainName), @@ -895,7 +895,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; // Simulate front-running complaint await skaleDKG.connect(validators[0].nodeAddress).response( stringKeccak256(schainName), @@ -946,7 +946,7 @@ describe("SkaleDKG", () => { const res = await skaleDKG.isChannelOpened( stringKeccak256(schainName) ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send broadcast", async () => { @@ -954,7 +954,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send complaint", async () => { @@ -963,7 +963,7 @@ describe("SkaleDKG", () => { 0, 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send another complaint", async () => { @@ -972,7 +972,7 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send preResponse", async () => { @@ -980,7 +980,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send another preResponse", async () => { @@ -988,7 +988,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send response", async () => { @@ -996,7 +996,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send another response", async () => { @@ -1004,7 +1004,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); }); @@ -1050,7 +1050,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should send alright from 2 node", async () => { @@ -1108,7 +1108,7 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.false); + res.should.be.false; await expect(skaleDKG.connect(validators[1].nodeAddress).complaint( stringKeccak256(schainName), 1, @@ -1123,7 +1123,7 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.true); + res.should.be.true; const complaint = await skaleDKG.connect(validators[1].nodeAddress).complaint( stringKeccak256(schainName), 1, @@ -1139,7 +1139,7 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.false); + res.should.be.false; await skaleDKG.connect(validators[0].nodeAddress).preResponse( stringKeccak256(schainName), 0, @@ -1152,14 +1152,14 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.false); + res.should.be.false; await skipTime(1800); res = await skaleDKG.connect(validators[1].nodeAddress).isComplaintPossible( stringKeccak256(schainName), 1, 0 ); - assert(res.should.be.true); + res.should.be.true; const complaint = await skaleDKG.connect(validators[1].nodeAddress).complaint( stringKeccak256(schainName), 1, @@ -1174,13 +1174,13 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; res = await skaleDKG.connect(validators[0].nodeAddress).isPreResponsePossible( stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; await skaleDKG.connect(validators[0].nodeAddress).response( stringKeccak256(schainName), @@ -1209,13 +1209,13 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 0 ); - assert(res.should.be.true); + res.should.be.true; res = await skaleDKG.connect(validators[0].nodeAddress).isPreResponsePossible( stringKeccak256(schainName), 0 ); - assert(res.should.be.false); + res.should.be.false; const response = await skaleDKG.connect(validators[0].nodeAddress).response( stringKeccak256(schainName), @@ -1303,7 +1303,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; await skaleDKG.connect(validators[1].nodeAddress).alright( stringKeccak256(schainName), 1 @@ -1321,7 +1321,7 @@ describe("SkaleDKG", () => { 0, 1 ); - assert(resComplaint.should.be.false); + resComplaint.should.be.false; await expect(skaleDKG.connect(validators[0].nodeAddress).complaintBadData( stringKeccak256(schainName), 0, @@ -1521,9 +1521,9 @@ describe("SkaleDKG", () => { } await reimbursed(complaintBadData, "Complaint bad data"); - assert( - await skaleDKG.getComplaintStartedTime(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resComplaint.blockNumber))?.timestamp.toString() + assert.equal( + Number(await skaleDKG.getComplaintStartedTime(stringKeccak256(schainName))), + (await ethers.provider.getBlock(resComplaint.blockNumber))?.timestamp ); await reimbursed( @@ -1696,12 +1696,12 @@ describe("SkaleDKG", () => { rotCounter.rotationCounter )).wait(); assert(res); - assert( - await skaleDKG.getAlrightStartedTime(stringKeccak256(schainName)), - (await ethers.provider.getBlock(res.blockNumber))?.timestamp.toString() + assert.equal( + Number(await skaleDKG.getAlrightStartedTime(stringKeccak256(schainName))), + (await ethers.provider.getBlock(res.blockNumber))?.timestamp ); let numOfCompleted = await skaleDKG.getNumberOfCompleted(stringKeccak256(schainName)); - assert(numOfCompleted, "0"); + expect(numOfCompleted).to.be.equal(0); await skaleDKG.connect(validators[0].nodeAddress).alright( stringKeccak256(schainName), @@ -1709,7 +1709,7 @@ describe("SkaleDKG", () => { ); numOfCompleted = await skaleDKG.getNumberOfCompleted(stringKeccak256(schainName)); - assert(numOfCompleted, "1"); + expect(numOfCompleted).to.be.equal(1); const resSuccess = await (await skaleDKG.connect(validators[1].nodeAddress).alright( stringKeccak256(schainName), @@ -1718,11 +1718,11 @@ describe("SkaleDKG", () => { assert(resSuccess); numOfCompleted = await skaleDKG.getNumberOfCompleted(stringKeccak256(schainName)); - assert(numOfCompleted, "2"); + expect(numOfCompleted).to.be.equal(2); - assert( - await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp.toString() + assert.equal( + Number(await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName))), + (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp ); const comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256(schainName)); @@ -1735,10 +1735,10 @@ describe("SkaleDKG", () => { await skaleManager.connect(validators[1].nodeAddress).nodeExit(1); let prevPubKey = await keyStorage.getPreviousPublicKey(stringKeccak256(schainName)); - assert(prevPubKey.x.a, "0"); - assert(prevPubKey.x.b, "0"); - assert(prevPubKey.y.a, "0"); - assert(prevPubKey.y.b, "0"); + expect(prevPubKey.x.a).to.be.equal(0); + expect(prevPubKey.x.b).to.be.equal(0); + expect(prevPubKey.y.a).to.be.equal(1); + expect(prevPubKey.y.b).to.be.equal(0); await nodes.createNode(validators[0].nodeAddress.address, { @@ -1753,7 +1753,7 @@ describe("SkaleDKG", () => { ); rotCounter = await nodeRotation.getRotation(stringKeccak256(schainName)); - assert.equal(rotCounter.rotationCounter.toString(), "1"); + expect(rotCounter.rotationCounter).to.be.equal(1); await skaleDKG.connect(validators[0].nodeAddress).broadcast( stringKeccak256(schainName), @@ -1777,9 +1777,9 @@ describe("SkaleDKG", () => { 0 ); - assert( - await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName)), - (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp.toString() + assert.equal( + Number(await skaleDKG.getTimeOfLastSuccessfulDKG(stringKeccak256(schainName))), + (await ethers.provider.getBlock(resSuccess.blockNumber))?.timestamp ); await skaleDKG.connect(validators[0].nodeAddress).alright( @@ -1788,24 +1788,24 @@ describe("SkaleDKG", () => { ); prevPubKey = await keyStorage.getPreviousPublicKey(stringKeccak256(schainName)); - assert.equal(prevPubKey.x.a.toString() === comPubKey.x.a.toString(), true); - assert.equal(prevPubKey.x.b.toString() === comPubKey.x.b.toString(), true); - assert.equal(prevPubKey.y.a.toString() === comPubKey.y.a.toString(), true); - assert.equal(prevPubKey.y.b.toString() === comPubKey.y.b.toString(), true); + assert.equal(prevPubKey.x.a === comPubKey.x.a, true); + assert.equal(prevPubKey.x.b === comPubKey.x.b, true); + assert.equal(prevPubKey.y.a === comPubKey.y.a, true); + assert.equal(prevPubKey.y.b === comPubKey.y.b, true); let allPrevPubKeys = await keyStorage.getAllPreviousPublicKeys(stringKeccak256(schainName)); assert.equal(allPrevPubKeys.length === 1, true); - assert.equal(prevPubKey.x.a.toString() === allPrevPubKeys[0].x.a.toString(), true); - assert.equal(prevPubKey.x.b.toString() === allPrevPubKeys[0].x.b.toString(), true); - assert.equal(prevPubKey.y.a.toString() === allPrevPubKeys[0].y.a.toString(), true); - assert.equal(prevPubKey.y.b.toString() === allPrevPubKeys[0].y.b.toString(), true); + assert.equal(prevPubKey.x.a === allPrevPubKeys[0].x.a, true); + assert.equal(prevPubKey.x.b === allPrevPubKeys[0].x.b, true); + assert.equal(prevPubKey.y.a === allPrevPubKeys[0].y.a, true); + assert.equal(prevPubKey.y.b === allPrevPubKeys[0].y.b, true); await skipTime(43260); await nodes.initExit(2); await skaleManager.connect(validators[0].nodeAddress).nodeExit(2); rotCounter = await nodeRotation.getRotation(stringKeccak256(schainName)); - assert.equal(rotCounter.rotationCounter.toString(), "2"); + assert.equal(rotCounter.rotationCounter, 2n); await skaleDKG.connect(validators[0].nodeAddress).broadcast( stringKeccak256(schainName), @@ -1836,10 +1836,10 @@ describe("SkaleDKG", () => { allPrevPubKeys = await keyStorage.getAllPreviousPublicKeys(stringKeccak256(schainName)); assert.equal(allPrevPubKeys.length === 2, true); - assert.equal(prevPubKey.x.a.toString() === allPrevPubKeys[0].x.a.toString(), true); - assert.equal(prevPubKey.x.b.toString() === allPrevPubKeys[0].x.b.toString(), true); - assert.equal(prevPubKey.y.a.toString() === allPrevPubKeys[0].y.a.toString(), true); - assert.equal(prevPubKey.y.b.toString() === allPrevPubKeys[0].y.b.toString(), true); + assert.equal(prevPubKey.x.a === allPrevPubKeys[0].x.a, true); + assert.equal(prevPubKey.x.b === allPrevPubKeys[0].x.b, true); + assert.equal(prevPubKey.y.a === allPrevPubKeys[0].y.a, true); + assert.equal(prevPubKey.y.b === allPrevPubKeys[0].y.b, true); }); it("16 nodes schain test", async () => { @@ -1915,10 +1915,10 @@ describe("SkaleDKG", () => { let comPubKey; for (let i = 0; i < 16; i++) { comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256("New16NodeSchain")); - assert(comPubKey.x.a, "0"); - assert(comPubKey.x.b, "0"); - assert(comPubKey.y.a, "0"); - assert(comPubKey.y.b, "0"); + expect(comPubKey.x.a).to.be.equal(0); + expect(comPubKey.x.b).to.be.equal(0); + expect(comPubKey.y.a).to.be.equal(0); + expect(comPubKey.y.b).to.be.equal(0); let index = 0; if (i === 1) { index = 1; @@ -1951,10 +1951,10 @@ describe("SkaleDKG", () => { assert.equal(comPubKey.y.b.toString() !== "0", true); const prevPubKey = await keyStorage.getPreviousPublicKey(stringKeccak256("New16NodeSchain")); - assert(prevPubKey.x.a, "0"); - assert(prevPubKey.x.b, "0"); - assert(prevPubKey.y.a, "0"); - assert(prevPubKey.y.b, "0"); + expect(prevPubKey.x.a).to.be.equal(0); + expect(prevPubKey.x.b).to.be.equal(0); + expect(prevPubKey.y.a).to.be.equal(1); + expect(prevPubKey.y.b).to.be.equal(0); }); it("16 nodes schain test with incorrect complaint and response", async () => { @@ -2313,7 +2313,7 @@ describe("SkaleDKG", () => { const receipt = await responseTx.wait(); assert(receipt); await responseTx.should.emit(skaleDKG, "BadGuy").withArgs(accusedNode); - assert(receipt.gasUsed + resPreResp.gasUsed >= 10000000); + expect(receipt.gasUsed + resPreResp.gasUsed).to.be.greaterThanOrEqual(5000000); }); it("16 nodes schain test with incorrect complaint and deleting Schain", async () => { @@ -2526,10 +2526,10 @@ describe("SkaleDKG", () => { continue; } comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256("New16NodeSchain")); - assert(comPubKey.x.a, "0"); - assert(comPubKey.x.b, "0"); - assert(comPubKey.y.a, "0"); - assert(comPubKey.y.b, "0"); + expect(comPubKey.x.a).to.be.equal(0); + expect(comPubKey.x.b).to.be.equal(0); + expect(comPubKey.y.a).to.be.equal(0); + expect(comPubKey.y.b).to.be.equal(0); let index = 0; if (i === 1) { index = 1; @@ -2680,10 +2680,10 @@ describe("SkaleDKG", () => { // continue; // } comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256("New16NodeSchain1")); - assert(comPubKey.x.a, "0"); - assert(comPubKey.x.b, "0"); - assert(comPubKey.y.a, "0"); - assert(comPubKey.y.b, "0"); + expect(comPubKey.x.a).to.be.equal(0); + expect(comPubKey.x.b).to.be.equal(0); + expect(comPubKey.y.a).to.be.equal(0); + expect(comPubKey.y.b).to.be.equal(0); let index = 0; if (i === 1) { index = 1; From 7d0b53f8a1504764628d8b91e9ac74c323c014fc Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 29 Jul 2024 17:54:37 +0300 Subject: [PATCH 79/83] Fix SkaleManager tests --- contracts/SkaleManager.sol | 2 +- hardhat.config.ts | 3 ++- test/SkaleManager.ts | 35 +++++++++++++++-------------------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/contracts/SkaleManager.sol b/contracts/SkaleManager.sol index 00c48c73..aa96de91 100644 --- a/contracts/SkaleManager.sol +++ b/contracts/SkaleManager.sol @@ -52,7 +52,7 @@ contract SkaleManager is IERC777Recipient, ISkaleManager, Permissions { 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; bytes32 constant public ADMIN_ROLE = keccak256("ADMIN_ROLE"); - uint256 constant public HEADER_COSTS = 7486; + uint256 constant public HEADER_COSTS = 5374; uint256 constant public CALL_PRICE = 21000; string public version; diff --git a/hardhat.config.ts b/hardhat.config.ts index 02ab5a01..cc5f5d9c 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -91,7 +91,8 @@ const config: HardhatUserConfig = { networks: { hardhat: { accounts: getAccounts(), - blockGasLimit: 12000000 + blockGasLimit: 12000000, + allowUnlimitedContractSize: true }, custom: { url: getCustomUrl(process.env.ENDPOINT), diff --git a/test/SkaleManager.ts b/test/SkaleManager.ts index 5401a14c..0531965f 100644 --- a/test/SkaleManager.ts +++ b/test/SkaleManager.ts @@ -160,9 +160,11 @@ describe("SkaleManager", () => { await validatorService.connect(validator).registerValidator("D2", "D2 is even", 150, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); const signature = await nodeAddress.signMessage( - ethers.solidityPackedKeccak256( - ["uint"], - [validatorIndex] + ethers.getBytes( + ethers.solidityPackedKeccak256( + ["uint"], + [validatorIndex] + ) ) ); await validatorService.connect(validator).linkNodeAddress(nodeAddress.address, signature); @@ -282,7 +284,7 @@ describe("SkaleManager", () => { const spentValue = await ethSpent(await skaleManager.connect(nodeAddress).getBounty(0, {gasLimit: 2e6})); const balance = await ethers.provider.getBalance(nodeAddress); (balance + spentValue).should.be.least(minNodeBalance); - (balance + spentValue).should.be.closeTo(minNodeBalance, 1e13); + (balance + spentValue).should.be.closeTo(minNodeBalance, 1e15); }); it("should pay bounty if Node is In Leaving state", async () => { @@ -329,20 +331,20 @@ describe("SkaleManager", () => { const launchMonth = await timeHelpers.timestampToMonth(launch); const schedule = [ - 385000000n, - 346500000n, - 308000000n, - 269500000n, - 231000000n, - 192500000n + 385000000, + 346500000, + 308000000, + 269500000, + 231000000, + 192500000 ] - for (let bounty = schedule[schedule.length - 1] / 2n; bounty > 1; bounty /= 2n) { + for (let bounty = schedule[schedule.length - 1] / 2; bounty > 1; bounty /= 2) { for (let i = 0; i < 3; ++i) { schedule.push(bounty); } } - let mustBePaid = 0n; + let mustBePaid = 0; await nextMonth(contractManager); for (let year = 0; year < schedule.length && (Date.now() - start) < 0.9 * timeLimit; ++year) { for (let monthIndex = 0n; monthIndex < 12; ++monthIndex) { @@ -355,14 +357,7 @@ describe("SkaleManager", () => { const bountyWasPaid = await skaleToken.balanceOf(distributor); mustBePaid = mustBePaid + schedule[year]; - const abs = (value: bigint) => { - if (value < 0) { - return - value; - } - return value; - } - - abs(BigInt(ethers.formatEther(bountyWasPaid)) - mustBePaid).should.be.lessThan(35); // 35 because of rounding errors in JS + Number.parseInt(ethers.formatEther(bountyWasPaid)).should.be.closeTo(mustBePaid, 35); // 35 because of rounding errors in JS } }); }); From 1c00efe5a4d7dd6d690d05fd1eca03dd8dbf6cbe Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 29 Jul 2024 18:25:52 +0300 Subject: [PATCH 80/83] Fix wallets tests --- contracts/SkaleManager.sol | 2 +- test/Wallets.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/SkaleManager.sol b/contracts/SkaleManager.sol index aa96de91..4406c13a 100644 --- a/contracts/SkaleManager.sol +++ b/contracts/SkaleManager.sol @@ -52,7 +52,7 @@ contract SkaleManager is IERC777Recipient, ISkaleManager, Permissions { 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; bytes32 constant public ADMIN_ROLE = keccak256("ADMIN_ROLE"); - uint256 constant public HEADER_COSTS = 5374; + uint256 constant public HEADER_COSTS = 5310; uint256 constant public CALL_PRICE = 21000; string public version; diff --git a/test/Wallets.ts b/test/Wallets.ts index a1e522f7..0f7e311e 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -297,8 +297,8 @@ describe("Wallets", () => { (balance + spentValue).should.be.closeTo(minNodeBalance, 1e13); const validatorBalance = await wallets.getValidatorBalance(validator1Id); - (initialBalance - spentValue - validatorBalance) - .should.be.almost(0, Number(ethers.parseEther(tolerance.toString()))); + (initialBalance - validatorBalance) + .should.be.closeTo(spentValue, Number(ethers.parseEther(tolerance.toString()))); }); }); }); From e459d01db3c8aec0a14beb419085194ea0c0074d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 29 Jul 2024 18:57:41 +0300 Subject: [PATCH 81/83] Fix math utils tests --- contracts/test/interfaces/IMathUtilsTester.sol | 5 +++++ test/utils/MathUtils.ts | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/contracts/test/interfaces/IMathUtilsTester.sol b/contracts/test/interfaces/IMathUtilsTester.sol index 4f754abd..e37f873c 100644 --- a/contracts/test/interfaces/IMathUtilsTester.sol +++ b/contracts/test/interfaces/IMathUtilsTester.sol @@ -23,6 +23,11 @@ pragma solidity 0.8.17; interface IMathUtilsTester { + event UnderflowError( + uint256 a, + uint256 b + ); + function boundedSub(uint256 a, uint256 b) external returns (uint256 result); function boundedSubWithoutEvent(uint256 a, uint256 b) external pure returns (uint256 result); function muchGreater(uint256 a, uint256 b) external pure returns (bool greater); diff --git a/test/utils/MathUtils.ts b/test/utils/MathUtils.ts index 94ac19d6..fb35a49a 100644 --- a/test/utils/MathUtils.ts +++ b/test/utils/MathUtils.ts @@ -1,4 +1,4 @@ -import chai from "chai"; +import chai, {expect} from "chai"; import chaiAsPromised from "chai-as-promised"; import {ethers} from "hardhat" import {MathUtilsTester} from "../../typechain-types"; @@ -32,10 +32,8 @@ describe("MathUtils", () => { it("should return 0 if reduced is less than subtracted and emit event", async () => { (await mathUtils.boundedSub.staticCall(3, 5)).should.be.equal(0); - const factory = await ethers.getContractFactory("MathUtils"); - const mathUtilsLib = factory.attach(mathUtils); - await mathUtils.boundedSub(3, 5) - .should.emit(mathUtilsLib, "UnderflowError") + await expect(mathUtils.boundedSub(3, 5)) + .to.emit(mathUtils, "UnderflowError") .withArgs(3, 5); }); }); From 50ff0eddca591375a547acf7247ced844df06817 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 31 Jul 2024 17:58:46 +0300 Subject: [PATCH 82/83] Remove unused comments --- test/NodesFunctionality.ts | 1 - test/Pricing.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/NodesFunctionality.ts b/test/NodesFunctionality.ts index cf5a0c16..d3908494 100644 --- a/test/NodesFunctionality.ts +++ b/test/NodesFunctionality.ts @@ -58,7 +58,6 @@ describe("NodesFunctionality", () => { const skaleManagerMock = await deploySkaleManagerMock(contractManager); await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); - // await contractManager.setContractsAddress("Nodes", nodes.address); await validatorService.connect(validator).registerValidator("Validator", "D2", 0, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); diff --git a/test/Pricing.ts b/test/Pricing.ts index e78362d7..e379cc72 100644 --- a/test/Pricing.ts +++ b/test/Pricing.ts @@ -291,7 +291,7 @@ describe("Pricing", () => { const correctPrice = await getPrice(await pricing.lastUpdated() - lastUpdated); receivedPrice.should.be.equal(correctPrice); - // oldPrice.should.be.below(receivedPrice); + oldPrice.should.be.below(receivedPrice); }); it("should set price to min of too many minutes passed and price is less than min", async () => { From 8a3144e0ffbb38f875ddcbd666b11679e5267557 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 31 Jul 2024 18:31:05 +0300 Subject: [PATCH 83/83] Remove commented out code --- test/SkaleDKG.ts | 3 --- test/utils/SegmentTree.ts | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/test/SkaleDKG.ts b/test/SkaleDKG.ts index a618fed1..58d029fe 100644 --- a/test/SkaleDKG.ts +++ b/test/SkaleDKG.ts @@ -2676,9 +2676,6 @@ describe("SkaleDKG", () => { } let comPubKey; for (let i = 0; i < 16; i++) { - // if (i.toString() === accusedNode) { - // continue; - // } comPubKey = await keyStorage.getCommonPublicKey(stringKeccak256("New16NodeSchain1")); expect(comPubKey.x.a).to.be.equal(0); expect(comPubKey.x.b).to.be.equal(0); diff --git a/test/utils/SegmentTree.ts b/test/utils/SegmentTree.ts index 45816a37..8a1c6c99 100644 --- a/test/utils/SegmentTree.ts +++ b/test/utils/SegmentTree.ts @@ -109,14 +109,6 @@ describe("SegmentTree", () => { describe("move elements", () => { it("should add elem to some place", async () => { await segmentTree.addToPlace(53, 12); - // let index = 0; - // for (let i = 1; i <= 8; i++) { - // let str = ""; - // for (index; index <= 2 ** i - 2; index++) { - // str += (await segmentTree.getElem(index)).toString() + " "; - // } - // console.log(str); - // } (await segmentTree.getElem(0)).should.be.equal(162); let lastLeaf = 180; while (lastLeaf > 1) { @@ -344,8 +336,6 @@ describe("SegmentTree", () => { for(let i = 0; i < 180; i++) { const place = (await segmentTree.getRandomElem(78)); await segmentTree.removeFromPlace(place, 1); - // console.log("Place found!!!!!!!!!!!!") - // console.log(place); } (await segmentTree.getRandomElem(78)).should.be.equal(0); (await segmentTree.getRandomElem(77)).should.be.equal(77); @@ -356,10 +346,8 @@ describe("SegmentTree", () => { await segmentTree.removeFromPlace(128, 100); // make 50 nodes for(let i = 0; i < 200; i++) { // 200 times we could repeat removing const place = (await segmentTree.getRandomElem(schainPlace)); - // console.log("New place ", place); await segmentTree.removeFromPlace(place, 1); if (place - schainPlace > 0) { - // console.log(place - schainPlace); await segmentTree.addToPlace(place - schainPlace, 1); } } @@ -372,9 +360,7 @@ describe("SegmentTree", () => { await segmentTree.removeFromPlace(128, 100); // make 50 nodes for(let i = 0; i < 200; i++) { // 200 times we could repeat removing const place = (await segmentTree.getRandomElem(schainPlace)); - // console.log("New place ", place); if (place - schainPlace > 0) { - // console.log(place - schainPlace); await segmentTree.moveFromPlaceToPlace(place, place - schainPlace, 1); } else { await segmentTree.removeFromPlace(place, 1);