diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 4adcdd82c..000000000 --- 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 000000000..386b7dfec --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,38 @@ +/* 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", + "@typescript-eslint/no-unused-vars": "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" + ] + } +}; diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bb3d3388e..72d420344 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 cad355a11..17d682d75 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] env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -57,10 +57,12 @@ 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 + env: + NODE_OPTIONS: --max-old-space-size=12288 run: npx hardhat coverage --solcoverjs .solcover.js - name: Upload coverage to Codecov diff --git a/.gitignore b/.gitignore index 04a7ee454..aa14a358e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ cache/ tmp.sol data/*.json scTopics +contracts/hardhat-dependency-compiler ### Node ### # Logs diff --git a/.solhint.json b/.solhint.json index b666c539e..0c8a32ead 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/.solhintignore b/.solhintignore index 0134b2f79..b35fbfd60 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/contracts/ConstantsHolder.sol b/contracts/ConstantsHolder.sol index b30d13159..745084653 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; diff --git a/contracts/NodeRotation.sol b/contracts/NodeRotation.sol index acd21fbfd..2a1360085 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 7b899c7b1..a4240a254 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 04f796b01..8bd3e2764 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 1d3c1585d..1e609bee7 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/SkaleManager.sol b/contracts/SkaleManager.sol index 00c48c73f..4406c13a1 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 = 5310; uint256 constant public CALL_PRICE = 21000; string public version; diff --git a/contracts/SkaleVerifier.sol b/contracts/SkaleVerifier.sol index 3a02f96cb..7bdb6f33d 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 15b85eed4..a44813aeb 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/dkg/SkaleDkgResponse.sol b/contracts/dkg/SkaleDkgResponse.sol index 1d38de13a..84872885e 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 diff --git a/contracts/test/SegmentTreeTester.sol b/contracts/test/SegmentTreeTester.sol index 964e5e688..b0088b3c6 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/test/interfaces/IMathUtilsTester.sol b/contracts/test/interfaces/IMathUtilsTester.sol index 4f754abdc..e37f873ce 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/contracts/utils/MathUtils.sol b/contracts/utils/MathUtils.sol index 650607f3d..08225e8a4 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 85f27fdad..290b9f511 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 9289daa6e..cdbeab9c4 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/cspell.json b/cspell.json index 72a270a61..2c2ce5376 100644 --- a/cspell.json +++ b/cspell.json @@ -19,7 +19,8 @@ "**/coverage.json", "**/*.hbs", ".openzeppelin/**", - ".github/**" + ".github/**", + "**/*.orig" ], "dictionaries": ["domain-terms", "libraries", "names", "skale-terms", "solidity"], "dictionaryDefinitions": [ @@ -29,4 +30,4 @@ { "name": "names", "path": "./dictionaries/names.txt"}, { "name": "solidity", "path": "./dictionaries/solidity.txt"} ] -} \ No newline at end of file +} diff --git a/gas/createSchain.ts b/gas/createSchain.ts index cea4914b1..de9bfa7c9 100644 --- a/gas/createSchain.ts +++ b/gas/createSchain.ts @@ -1,29 +1,24 @@ -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 "@nomicfoundation/hardhat-ethers/signers"; +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"; -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"); +export 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 2ac0d9174..c9bf3d3d3 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,36 +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 "@nomicfoundation/hardhat-ethers/signers"; +import {ethers} from "hardhat"; +import {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"; - -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 {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 {findEvent} from "./createSchain"; + describe("nodeRotation", () => { let owner: SignerWithAddress; @@ -57,18 +44,18 @@ 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); - 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); @@ -76,7 +63,6 @@ describe("nodeRotation", () => { }) describe("Tests without memory", () => { - fastBeforeEach(() => Promise.resolve(undefined)); it("64 node rotations on 17 nodes", async () => { @@ -102,9 +88,9 @@ 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"); + console.log("create", schainNumber + 1, "schain on", nodesAmount, "nodes:\t", result?.gasUsed, "gu"); } await skaleManager.connect(node).createNode( @@ -125,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,8 +163,8 @@ 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 nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const result = await (await schains.addSchainByFoundation(0, SchainType.SMALL, 0, `schain-${schainNumber}`, owner.address, ethers.ZeroAddress, [])).wait(); + const nodeInGroup = findEvent(result, "SchainNodes").args?.nodesInGroup; console.log("Nodes in Schain:"); const setOfNodes = new Set(); for (const nodeOfSchain of nodeInGroup) { @@ -188,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( @@ -207,20 +196,23 @@ 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 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( @@ -239,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[] = []; @@ -256,8 +248,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 ethers.provider.getBalance(node) < ethers.parseEther("0.1")) { + await owner.sendTransaction({value: ethers.parseEther("1"), to: node.address}); } await skaleManager.connect(node).createNode( @@ -274,12 +266,15 @@ 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(); + 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; } } @@ -298,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.utils.parseEther("0.1"))) { - await owner.sendTransaction({value: ethers.utils.parseEther("1"), to: node.address}); + 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/hardhat.config.ts b/hardhat.config.ts index ff03ec592..cc5f5d9c5 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,28 +1,29 @@ -import { task, HardhatUserConfig } from "hardhat/config"; +import {task, HardhatUserConfig} from "hardhat/config"; 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 { utils, Wallet } from "ethers"; -import { HardhatNetworkAccountUserConfig } from "hardhat/types/config"; +import {Wallet, parseEther} 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(); - 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"); + transaction = await ethers.provider.broadcastTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); await transaction.wait(); } }); -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) { @@ -32,7 +33,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) { @@ -90,7 +91,8 @@ const config: HardhatUserConfig = { networks: { hardhat: { accounts: getAccounts(), - blockGasLimit: 12000000 + blockGasLimit: 12000000, + allowUnlimitedContractSize: true }, custom: { url: getCustomUrl(process.env.ENDPOINT), @@ -105,7 +107,14 @@ const config: HardhatUserConfig = { externalArtifacts: [ 'node_modules/@openzeppelin/upgrades-core/artifacts/AdminUpgradeabilityProxy.json', 'node_modules/@openzeppelin/upgrades-core/artifacts/ProxyAdmin.json' - ] + ], + target: "ethers-v6" + }, + dependencyCompiler: { + paths: [ + '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol', + ], + keep: true, } }; diff --git a/long-test/Treetest.ts b/long-test/Treetest.ts index 81d340214..46c2c57bb 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, NodeRotation, @@ -12,22 +12,22 @@ 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 { deployNodeRotation } from "../test/tools/deploy/nodeRotation"; +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 "@nomicfoundation/hardhat-ethers/signers"; +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 {deployNodeRotation} from "../test/tools/deploy/nodeRotation"; async function createNode(skaleManager: SkaleManager, node: Wallet, nodeId: number) { await skaleManager.connect(node).createNode( @@ -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,27 +66,27 @@ 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); } } 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,13 +234,13 @@ 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(); 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); diff --git a/long-test/createSchain.ts b/long-test/createSchain.ts index ab3cec265..13a7542b7 100644 --- a/long-test/createSchain.ts +++ b/long-test/createSchain.ts @@ -1,30 +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 "@nomicfoundation/hardhat-ethers/signers"; +import {Wallet} from "ethers"; +import {getPublicKey, getValidatorIdSignature} from "../test/tools/signatures"; +import {SchainType} from "../test/tools/types"; +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; @@ -40,11 +27,11 @@ 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); - await contractManager.setContractsAddress("SchainsInternal", schainsInternal.address); + await contractManager.setContractsAddress("SchainsInternal", schainsInternal); validatorService = await deployValidatorService(contractManager); skaleManager = await deploySkaleManager(contractManager); schains = await deploySchains(contractManager); @@ -74,8 +61,8 @@ 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 nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}${try1}`, owner.address, ethers.ZeroAddress, [])).wait(); + 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"); } } }); @@ -119,8 +106,8 @@ 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 nodeInGroup = findEvent(result.events, "SchainNodes").args?.nodesInGroup; + const result = await (await schains.addSchainByFoundation(0, type, 0, `schain-${tries}`, owner.address, ethers.ZeroAddress, [])).wait(); + 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"); } }); }); diff --git a/migrations/deploy.ts b/migrations/deploy.ts index 07a73d7f4..9936fd0d3 100644 --- a/migrations/deploy.ts +++ b/migrations/deploy.ts @@ -1,7 +1,5 @@ -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 {ethers, upgrades, network, run} from "hardhat"; import { getAbi, getVersion, @@ -9,6 +7,8 @@ import { verifyProxy, getContractFactory, } from '@skalenetwork/upgrade-tools'; +import {Contract, Interface, resolveAddress} from 'ethers'; +import {TransactionMinedTimeout} from "@openzeppelin/upgrades-core"; function getInitializerParameters(contract: string, contractManagerAddress: string) { @@ -91,29 +91,50 @@ 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 verifyProxy(contractManagerName, contractManager.address, []); + await (await contractManager.setContractsAddress(contractManagerName, contractManager)).wait(); + contractArtifacts.push({address: await contractManager.getAddress(), interface: contractManager.interface, contract: contractManagerName}) - 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 }); - 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, await resolveAddress(contractManager)), + { + unsafeAllowLinkedLibraries: true + } + ); + await proxy.waitForDeployment(); + } 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); + 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: proxy.address, interface: proxy.interface, contract}); - await verifyProxy(contract, proxy.address, []); + contractArtifacts.push({address: proxyAddress, 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"); } @@ -123,12 +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, []); + 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}); - await verify(skaleTokenName, skaleToken.address, [contractManager.address, []]); + await (await contractManager.setContractsAddress(skaleTokenName, skaleToken)).wait(); + contractArtifacts.push({address: await skaleToken.getAddress(), interface: skaleToken.interface, contract: skaleTokenName}); if (!production) { console.log("Do actions for non production deployment"); @@ -136,6 +156,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 +178,15 @@ 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, await skaleToken.getAddress(), [contractManager.address, []]); + } else { + await verifyProxy(artifact.contract, artifact.address, []) + } + } + console.log("Done"); } diff --git a/migrations/submitTransactions.ts b/migrations/submitTransactions.ts index 65e9b87e6..b1d96efb6 100644 --- a/migrations/submitTransactions.ts +++ b/migrations/submitTransactions.ts @@ -1,6 +1,5 @@ -import { createMultiSendTransaction } from "@skalenetwork/upgrade-tools"; -import { UnsignedTransaction } from "ethers"; -import { promises as fs } from "fs"; +import {createMultiSendTransaction} from "@skalenetwork/upgrade-tools"; +import {promises as fs} from "fs"; async function main() { if (!process.env.TRANSACTIONS || !process.env.SAFE) { @@ -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"); diff --git a/migrations/upgrade.ts b/migrations/upgrade.ts index 6fa8a233b..3975137f2 100644 --- a/migrations/upgrade.ts +++ b/migrations/upgrade.ts @@ -1,37 +1,45 @@ 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 { 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-v6"; +import {SkaleManager} from "../typechain-types"; +import {Manifest, getImplementationAddress} from "@openzeppelin/upgrades-core"; +import {Transaction} from "ethers"; -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.getNetworkByProvider(ethers.provider); + const project = 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, - contractNamesToUpgrade, + { + contractNamesToUpgrade, + instance, + name: "skale-manager", + version: targetVersion + }, submitter); } async getSkaleManager() { - return await ethers.getContractAt("SkaleManager", this.abi.skale_manager_address as string) as SkaleManager; + return await this.instance.getContract("SkaleManager") as SkaleManager; } getDeployedVersion = async () => { @@ -45,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 = () => { }; @@ -56,11 +64,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.11.0", - await getSkaleManagerAbiAndAddresses(), - contracts, + skaleManager, + await prepareContractsList(skaleManager) ); await upgrader.upgrade(); } diff --git a/package.json b/package.json index 0072222c4..b09043724 100644 --- a/package.json +++ b/package.json @@ -36,33 +36,35 @@ "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": { - "@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": "^3.2.0", "@skalenetwork/skale-manager-interfaces": "3.1.0", - "@skalenetwork/upgrade-tools": "^2.0.1", - "@typechain/hardhat": "^7.0.0", + "@skalenetwork/upgrade-tools": "^3.0.0-linter.42", + "@typechain/hardhat": "^9.1.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", + "@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", @@ -75,9 +77,9 @@ "elliptic": "^6.5.3", "eslint": "^8.50.0", "ethereum-waffle": "^3.4.4", - "ganache-cli": "^6.11.0", - "kill-port": "^2.0.1", - "solhint": "3.6.2", + "ganache": "^7.9.1", + "hardhat-dependency-compiler": "^1.2.1", + "solhint": "5.0.1", "solidity-coverage": "^0.8.4", "solidity-docgen": "^0.5.17", "ts-generator": "^0.1.1", diff --git a/scripts/byteCodeSize.ts b/scripts/byteCodeSize.ts index dfefac0c4..8fc2f7db8 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 6cddc6db6..0b4128111 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 016a95cd6..39e10d22e 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 '@nomicfoundation/hardhat-ethers/types' async function main() { const allContracts = contracts.concat(["SkaleToken", "TimeHelpersWithDebug"]) @@ -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/scripts/test_deploy.sh b/scripts/test_deploy.sh index 7f7a0f2d3..b508a6e34 100755 --- a/scripts/test_deploy.sh +++ b/scripts/test_deploy.sh @@ -2,8 +2,14 @@ set -e -npx ganache-cli --gasLimit 8000000 --quiet & +# 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 -npx kill-port 8545 +npx ganache instances stop $GANACHE_SESSION diff --git a/scripts/test_upgrade.sh b/scripts/test_upgrade.sh index 4be82d10f..0ac4a9255 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/hydrogen" @@ -24,7 +24,13 @@ CURRENT_NODE_VERSION=$(nvm current) git clone --branch $DEPLOYED_TAG https://github.com/$GITHUB_REPOSITORY.git $DEPLOYED_DIR -npx ganache-cli --gasLimit 8000000 --quiet & +# 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 @@ -34,6 +40,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 +50,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 +npx ganache instances stop $GANACHE_SESSION diff --git a/slither.config.json b/slither.config.json index 03546423c..b91030d04 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/test/Bounty.ts b/test/Bounty.ts index 21792e417..927653ea3 100644 --- a/test/Bounty.ts +++ b/test/Bounty.ts @@ -7,24 +7,23 @@ 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 {deployPunisher} from "./tools/deploy/delegation/punisher"; +import {fastBeforeEach} from "./tools/mocha"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; chai.should(); chai.use(chaiAsPromised); @@ -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 = 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); @@ -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 () => { @@ -154,11 +152,11 @@ describe("Bounty", () => { }); 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("10000000"), "0x", "0x"); + await skaleToken.mint(validator2, ethers.parseEther("10000000"), "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("1000000"); // 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("1500000").toString()); let bounty = await calculateBounty(0); bounty.should.be.almost(getBountyForEpoch(0) + getBountyForEpoch(1)); @@ -519,13 +517,19 @@ describe("Bounty", () => { totalBounty = 0; effectiveDelegated1.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] - .div(ten18) - .toNumber()); + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) + ) + ); effectiveDelegated2.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] - .div(ten18) - .toNumber()); + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[1] + ) + ) + ); await bountyContract.calculateBounty(0) .should.be.eventually.rejectedWith("Transaction is sent too early"); @@ -561,17 +565,23 @@ describe("Bounty", () => { // 0: Apr 28th // 3: May 1st - await punisher.slash(validator2Id, ten18.mul(1.25e6).toString()); + await punisher.slash(validator2Id, ethers.parseEther("1250000")); effectiveDelegated2 = 1e6 * 100 + 0.25e6 * 200; effectiveDelegated1.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] - .div(ten18) - .toNumber()); + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validatorId))[0] + ) + ) + ); effectiveDelegated2.should.be.almost( - (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] - .div(ten18) - .toNumber()); + Number.parseFloat( + ethers.formatEther( + (await delegationController.getEffectiveDelegatedValuesByValidator(validator2Id))[0] + ) + ) + ); bounty = await calculateBounty(0); bounty.should.be.almost(0); // stake is too small diff --git a/test/ConstantsHolder.ts b/test/ConstantsHolder.ts index 5f67a1fe8..90e29273b 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 "@nomicfoundation/hardhat-ethers/signers"; chai.should(); chai.use(chaiAsPromised); @@ -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); }); @@ -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 a383ab40e..ee570043b 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 "@nomicfoundation/hardhat-ethers/signers"; 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); @@ -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); }); }); diff --git a/test/Decryption.ts b/test/Decryption.ts index 771814d56..c3ddfbfc0 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 e858315b7..47a31ecc8 100644 --- a/test/ECDH.ts +++ b/test/ECDH.ts @@ -1,28 +1,26 @@ 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 {deployECDH} from "./tools/deploy/ecdh"; +import {deployContractManager} from "./tools/deploy/contractManager"; +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; fastBeforeEach(async () => { - const contractManager = await deployContractManager(); ecdh = await deployECDH(contractManager); @@ -39,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; @@ -49,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); }); @@ -64,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); @@ -79,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); @@ -109,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); @@ -149,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 () => { @@ -198,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); @@ -206,74 +204,73 @@ 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); result1.z3.should.be.equal(1); - }); 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); @@ -282,22 +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"); }); @@ -316,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); }); @@ -328,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]; @@ -341,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]; @@ -361,11 +357,10 @@ 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); @@ -374,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; @@ -383,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); }); diff --git a/test/NodeRotation.ts b/test/NodeRotation.ts index da141c9a6..f34e0be17 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 {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"; +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"; @@ -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,42 +48,42 @@ 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; 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())) { 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}) } }) @@ -104,30 +104,29 @@ describe("NodeRotation", () => { let chainNodes: RegisteredNode[]; fastBeforeEach(async () => { - const schainType = SchainType.LARGE; 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, 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(node => node.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()}`) } @@ -149,10 +148,10 @@ describe("NodeRotation", () => { await nodes.initExit(exitingNode.id); 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 newChainNodesIds = (await schainsInternal.getNodesInGroup(schainHash)).map(id => id); + 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"); } @@ -165,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"); } @@ -217,11 +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; + const failingNodeFinishTs = (await nodeRotation.getLeavingHistory(failingNode.id))[0].finishedRotation; - const exitingNodeFinishTs = (await nodeRotation.getLeavingHistory(exitingNode.id))[0].finishedRotation.toNumber(); - const failingNodeFinishTs = (await nodeRotation.getLeavingHistory(failingNode.id))[0].finishedRotation.toNumber(); - - failingNodeFinishTs.should.be.equal(exitingNodeFinishTs + 1); + failingNodeFinishTs.should.be.equal(exitingNodeFinishTs + 1n); }) }); }) diff --git a/test/NodesData.ts b/test/NodesData.ts index d9e089ad0..527fd325d 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 {Wallet} from "ethers"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; +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); @@ -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); @@ -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", () => { @@ -382,7 +385,6 @@ describe("NodesData", () => { (await nodes.countNodesWithFreeSpace(1)).should.be.equal(2); }); }); - }); describe("when two nodes are added", () => { @@ -457,9 +459,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 3b4343188..d39084947 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 { getTransactionTimestamp, 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 {getTransactionTimestamp, 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 "@nomicfoundation/hardhat-ethers/signers"; +import {expect} from "chai"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); @@ -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); @@ -57,8 +57,7 @@ describe("NodesFunctionality", () => { delegationController = await deployDelegationController(contractManager); const skaleManagerMock = await deploySkaleManagerMock(contractManager); - await contractManager.setContractsAddress("SkaleManager", skaleManagerMock.address); - // await contractManager.setContractsAddress("Nodes", nodes.address); + await contractManager.setContractsAddress("SkaleManager", skaleManagerMock); await validatorService.connect(validator).registerValidator("Validator", "D2", 0, 0); const validatorIndex = await validatorService.getValidatorId(validator.address); @@ -69,7 +68,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 +168,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 f7666377d..e379cc727 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 "@nomicfoundation/hardhat-ethers/signers"; +import {getPublicKey, getValidatorIdSignature} from "./tools/signatures"; +import {stringKeccak256} from "./tools/hashes"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -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); @@ -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, { @@ -140,7 +140,6 @@ describe("Pricing", () => { name: "elvis4", domainName: "some.domain.name" }); - }); it("should increase number of schains", async () => { @@ -159,15 +158,13 @@ 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() { - const numberOfNodes = (await nodes.getNumberOfNodes()).toNumber(); + const numberOfNodes = await nodes.getNumberOfNodes(); let sumNode = 0; for (let i = 0; i < numberOfNodes; i++) { if (await nodes.isNodeActive(i)) { @@ -175,13 +172,13 @@ describe("Pricing", () => { for (const schain of getActiveSchains) { const partOfNode = await schainsInternal.getSchainsPartOfNode(schain); const isNodeLeft = await nodes.isNodeLeft(i); - if (partOfNode !== 0 && !isNodeLeft) { - sumNode += partOfNode; + if (partOfNode !== 0n && !isNodeLeft) { + sumNode += Number(partOfNode); } } } } - return sumNode / (128 * (await nodes.getNumberOnlineNodes()).toNumber()); + return sumNode / (128 * Number(await nodes.getNumberOnlineNodes())); } it("should check load percentage of network", async () => { @@ -210,27 +207,28 @@ 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 = 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 * (oldPrice / MIN_PRICE) * (await getLoadCoefficient() * 100 - OPTIMAL_LOAD_PERCENTAGE); - let price = oldPrice + priceChangeSpeed * secondSincePreviousUpdate / 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 Math.floor(price); + return BigInt(Math.floor(price)); } it("should change price when new active node has been added", async () => { @@ -245,13 +243,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); @@ -261,10 +259,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); @@ -284,13 +282,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); @@ -309,13 +307,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); diff --git a/test/Schains.ts b/test/Schains.ts index 6535ed7b1..d03230b8e 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 {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 "@nomicfoundation/hardhat-ethers/signers"; +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); @@ -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(); @@ -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,14 +116,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, 5, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, 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"); }) @@ -139,14 +139,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, 5, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: 6, // wrong type nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -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,14 +166,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "Mainnet", // wrong name - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -185,14 +185,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "", // wrong name - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -204,14 +204,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, price.toString(), - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -238,14 +238,14 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -254,14 +254,14 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -297,14 +297,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -360,14 +360,14 @@ describe("Schains", () => { await schains.addSchain( owner.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -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( @@ -572,7 +572,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 () => { @@ -590,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 = [{ @@ -762,7 +761,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"); - }); }); @@ -788,14 +786,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -817,14 +815,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -839,14 +837,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -865,14 +863,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -887,14 +885,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -905,14 +903,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -944,14 +942,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -966,14 +964,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -988,14 +986,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1010,14 +1008,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d5", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1036,14 +1034,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [ { name: "one", @@ -1087,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); @@ -1104,16 +1102,16 @@ 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 () => { 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); @@ -1124,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) @@ -1162,14 +1160,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1185,14 +1183,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1201,14 +1199,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1217,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); @@ -1228,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); @@ -1239,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); @@ -1269,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 () => { @@ -1277,14 +1275,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1302,14 +1300,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1359,14 +1357,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1394,14 +1392,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1429,14 +1427,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1463,14 +1461,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1482,14 +1480,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1522,24 +1520,22 @@ 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( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1551,14 +1547,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "D2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1566,7 +1562,6 @@ describe("Schains", () => { }); it("should be able to delete schain", async () => { - await schains.deleteSchain( holder.address, "D2", @@ -1575,15 +1570,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"); }); - }); - }); }); @@ -1611,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); }); @@ -1629,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 () => { @@ -1651,14 +1643,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1670,14 +1662,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1713,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); @@ -1780,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++; @@ -1789,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( @@ -1811,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++; @@ -1820,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( @@ -1844,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++; @@ -1853,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( @@ -1875,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++; @@ -1884,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( @@ -1954,14 +1946,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1971,14 +1963,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -1988,14 +1980,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2004,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); }); @@ -2261,7 +2253,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; @@ -2279,14 +2270,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2298,14 +2289,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2317,14 +2308,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2336,14 +2327,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2351,7 +2342,6 @@ describe("Schains", () => { await skaleDKG.setSuccessfulDKGPublic( stringKeccak256("d4"), ); - }); it("should rotate 1 node with 3 schains", async () => { @@ -2419,7 +2409,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; @@ -2453,14 +2442,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2472,14 +2461,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2491,14 +2480,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2510,14 +2499,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2525,7 +2514,6 @@ describe("Schains", () => { await skaleDKG.setSuccessfulDKGPublic( stringKeccak256("d4"), ); - }); it("should rotate 1 node with 3 schains", async () => { @@ -2726,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; @@ -2757,14 +2745,13 @@ 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; } if (!(await nodes.isNodeLeft(rotIndex))) { - while (!(await nodes.isNodeLeft(rotIndex))) { await skaleManager.connect(senderAddress).nodeExit(rotIndex); } @@ -2784,18 +2771,16 @@ 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; } } - }); }); describe("when 17 nodes, 1 schain and remove schain type", () => { - const encryptedSecretKeyContributions: {share: string, publicKey: [string, string]}[][] = [ [ { @@ -2880,14 +2865,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: schainType, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3050,14 +3035,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: 6, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3076,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( @@ -3128,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); @@ -3150,14 +3135,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: lifetime, typeOfSchain: schainType, nonce: 0, name: schain2Name, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3169,14 +3154,14 @@ describe("Schains", () => { await schains.addSchain( holder.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: lifetime, typeOfSchain: schainType, nonce: 0, name: schain3Name, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -3214,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); } } }); diff --git a/test/SchainsInternal.ts b/test/SchainsInternal.ts index ba8b20c7d..938879dea 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 "@nomicfoundation/hardhat-ethers/signers"; +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); @@ -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); @@ -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(); @@ -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"); @@ -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 () => { @@ -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); + generation = generation + 1n; - 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, @@ -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]); }); @@ -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); } }); @@ -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], @@ -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 d186d0e4e..58d029fee 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,51 +12,53 @@ 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 "@nomicfoundation/hardhat-ethers/signers"; +import {assert, expect} from "chai"; +import {makeSnapshot, applySnapshot} from "./tools/snapshot"; +import {BytesLike, ContractTransactionResponse, 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); -const weiTolerance = ethers.utils.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`); if (operation !== undefined) { console.log(`During ${operation}`); } - } balanceAfter.should.be.least(balanceBefore); balanceAfter.should.be.closeTo(balanceBefore, weiTolerance); @@ -92,8 +94,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 = [ { @@ -118,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); @@ -370,20 +372,20 @@ describe("SkaleDKG", () => { const res = await (await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ))).wait(); - assert((await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true); - (await skaleDKG.getChannelStartedBlock(stringKeccak256("d2"))).should.be.equal(res.blockNumber); + (await skaleDKG.isChannelOpened(stringKeccak256("d2"))).should.be.true; + (await skaleDKG.getChannelStartedBlock(stringKeccak256("d2"))).should.be.equal(res?.blockNumber); }); it("should create schain and reopen a DKG channel", async () => { @@ -392,19 +394,19 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); - 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 () => { @@ -413,23 +415,23 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); - 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", () => { @@ -442,14 +444,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -458,21 +460,21 @@ 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, typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -490,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( @@ -505,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 () => { @@ -522,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 () => { @@ -530,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), @@ -544,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 () => { @@ -574,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), @@ -587,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, @@ -614,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), @@ -627,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), @@ -651,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 () => { @@ -669,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), @@ -682,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, @@ -699,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( @@ -717,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), @@ -744,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( @@ -758,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", () => { @@ -788,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), @@ -838,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), @@ -893,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), @@ -907,7 +909,6 @@ describe("SkaleDKG", () => { 0 ).should.emit(skaleDKG, "BadGuy") .withArgs(0); - }); after(async () => { @@ -945,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 () => { @@ -953,7 +954,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send complaint", async () => { @@ -962,7 +963,7 @@ describe("SkaleDKG", () => { 0, 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send another complaint", async () => { @@ -971,7 +972,7 @@ describe("SkaleDKG", () => { 1, 0 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send preResponse", async () => { @@ -979,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 () => { @@ -987,7 +988,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); it("should be impossible send response", async () => { @@ -995,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 () => { @@ -1003,7 +1004,7 @@ describe("SkaleDKG", () => { stringKeccak256(schainName), 1 ); - assert(res.should.be.false); + res.should.be.false; }); }); @@ -1049,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 () => { @@ -1107,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, @@ -1122,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, @@ -1138,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, @@ -1151,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, @@ -1173,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), @@ -1208,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), @@ -1227,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); }); @@ -1302,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 @@ -1320,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, @@ -1342,7 +1343,6 @@ describe("SkaleDKG", () => { }); describe("when complaint successfully sent", () => { - let nodeSentBadData: number; before(async () => { nodeSentBadData = await makeSnapshot(); @@ -1388,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); }); @@ -1419,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); }); }); @@ -1436,14 +1436,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1451,21 +1451,21 @@ 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, typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1516,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() + assert.equal( + Number(await skaleDKG.getComplaintStartedTime(stringKeccak256(schainName))), + (await ethers.provider.getBlock(resComplaint.blockNumber))?.timestamp ); await reimbursed( @@ -1546,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"); @@ -1621,14 +1628,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1636,21 +1643,21 @@ 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, typeOfSchain: SchainType.TEST, nonce: 0, name: schainName, - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1688,12 +1695,13 @@ describe("SkaleDKG", () => { encryptedSecretKeyContributions[indexes[1]], rotCounter.rotationCounter )).wait(); - assert( - await skaleDKG.getAlrightStartedTime(stringKeccak256(schainName)), - (await ethers.provider.getBlock(res.blockNumber)).timestamp.toString() + assert(res); + 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), @@ -1701,19 +1709,20 @@ 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), 1 )).wait(); + 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)); @@ -1726,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, { @@ -1744,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), @@ -1768,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( @@ -1779,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), @@ -1827,14 +1836,13 @@ 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 () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -1854,14 +1862,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -1907,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; @@ -1943,15 +1951,13 @@ 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 () => { - for (let i = 3; i <= 16; i++) { const hexIndex = ("0" + i.toString(16)).slice(-2); await nodes.createNode(validators[0].nodeAddress.address, @@ -1971,14 +1977,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2271,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; @@ -2297,18 +2303,20 @@ 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); + expect(receipt.gasUsed + resPreResp.gasUsed).to.be.greaterThanOrEqual(5000000); }); 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, @@ -2328,14 +2336,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2392,7 +2400,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, @@ -2412,14 +2419,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2519,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; @@ -2541,7 +2548,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, @@ -2561,14 +2567,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "New16NodeSchain", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -2636,14 +2642,14 @@ describe("SkaleDKG", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.SMALL, nonce: 0, name: "New16NodeSchain1", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -2670,14 +2676,11 @@ describe("SkaleDKG", () => { } let comPubKey; for (let i = 0; i < 16; i++) { - // if (i.toString() === accusedNode) { - // 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; diff --git a/test/SkaleDkgFakeComplaint.ts b/test/SkaleDkgFakeComplaint.ts index 182f53f20..d741b08c8 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, @@ -12,31 +12,31 @@ import { ContractManager, Wallets, NodeRotation} 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 { deployNodeRotation } from "./tools/deploy/nodeRotation"; +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 "@nomicfoundation/hardhat-ethers/signers"; +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 {deployNodeRotation} from "./tools/deploy/nodeRotation"; chai.should(); chai.use(chaiAsPromised); @@ -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 = [ { @@ -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,14 +648,14 @@ describe("SkaleDkgFakeComplaint", () => { await schains.addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -664,21 +664,21 @@ 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, 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 9ce227196..0531965f5 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,39 +15,42 @@ 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 {ContractTransactionResponse, Wallet} from "ethers"; +import {deployTimeHelpers} from "./tools/deploy/delegation/timeHelpers"; +import {ethers} from "hardhat"; +import {SignerWithAddress} from "@nomicfoundation/hardhat-ethers/signers"; +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); -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"); } @@ -81,8 +84,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(); @@ -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,15 +153,15 @@ 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( + ethers.getBytes( + ethers.solidityPackedKeccak256( ["uint"], [validatorIndex] ) @@ -224,7 +227,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 () => { @@ -274,27 +277,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, 1e15); }); 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 +305,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 +315,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,9 +327,8 @@ 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, @@ -342,20 +344,20 @@ describe("SkaleManager", () => { } } - let mustBePaid = BigNumber.from(0); + let mustBePaid = 0; 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]; - bountyWasPaid.div(ten18).sub(mustBePaid).abs().toNumber().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 } }); }); @@ -425,7 +427,7 @@ describe("SkaleManager", () => { "some.domain.name"); } - const schainHash = ethers.utils.solidityKeccak256(["string"], ["d2"]); + const schainHash = ethers.solidityPackedKeccak256(["string"], ["d2"]); if (schainHash) { d2SchainHash = schainHash; } @@ -450,16 +452,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -473,16 +475,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -490,16 +492,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -511,19 +513,19 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -533,16 +535,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -573,19 +575,18 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -626,12 +627,11 @@ 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", () => { - fastBeforeEach(async () => { await skaleToken.transfer(developer.address, "0x3635C9ADC5DEA000000"); }); @@ -639,16 +639,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -658,16 +658,16 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -678,35 +678,34 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); await skaleToken.connect(developer).send( - skaleManager.address, + skaleManager, "0x1cc2d6d04a2ca", - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) @@ -728,9 +727,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) { @@ -748,22 +745,22 @@ 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, typeOfSchain: SchainType.SMALL, nonce: 0, name: "d2", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); - 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"); @@ -772,22 +769,22 @@ 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, typeOfSchain: SchainType.MEDIUM, nonce: 0, name: "d3", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); - 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"); @@ -795,22 +792,22 @@ 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, typeOfSchain: SchainType.LARGE, nonce: 0, name: "d4", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); - 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"); @@ -818,22 +815,22 @@ 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, typeOfSchain: SchainType.TEST, nonce: 0, name: "d5", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); - 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"); @@ -841,22 +838,22 @@ 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, typeOfSchain: SchainType.MEDIUM_TEST, nonce: 0, name: "d6", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] ) ); - 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/SkaleToken.ts b/test/SkaleToken.ts index af36e80ba..d1053d6ea 100644 --- a/test/SkaleToken.ts +++ b/test/SkaleToken.ts @@ -1,19 +1,18 @@ -import { BigNumber } from "ethers"; -import { ContractManager, - SkaleToken, - SkaleTokenInternalTester} from "../typechain-types"; +import {ContractManager, + SkaleToken, +} 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 "@nomicfoundation/hardhat-ethers/signers"; +import {expect} from "chai"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); @@ -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)); -} diff --git a/test/SkaleVerifier.ts b/test/SkaleVerifier.ts index 4603b2f9a..1b5a26d4c 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 "@nomicfoundation/hardhat-ethers/signers"; +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); @@ -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); @@ -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(); @@ -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( { @@ -254,14 +253,14 @@ describe("SkaleVerifier", () => { await schains.connect(validator1).addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "Bob", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -321,14 +320,14 @@ describe("SkaleVerifier", () => { await schains.connect(validator1).addSchain( validator1.address, deposit, - ethers.utils.defaultAbiCoder.encode( + ethers.AbiCoder.defaultAbiCoder().encode( [schainParametersType], [{ lifetime: 5, typeOfSchain: SchainType.TEST, nonce: 0, name: "Bob", - originator: ethers.constants.AddressZero, + originator: ethers.ZeroAddress, options: [] }] )); @@ -415,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", diff --git a/test/SlashingTable.ts b/test/SlashingTable.ts index 6ec6a981c..99cb5482d 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 "@nomicfoundation/hardhat-ethers/signers"; +import {fastBeforeEach} from "./tools/mocha"; chai.should(); chai.use(chaiAsPromised); diff --git a/test/SyncMananager.ts b/test/SyncMananager.ts index 9d9f5e8f4..4efdcc35a 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 "@nomicfoundation/hardhat-ethers/signers"; +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"); } @@ -93,9 +91,9 @@ 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); + 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 6c8c87e9b..0f7e311e5 100644 --- a/test/Wallets.ts +++ b/test/Wallets.ts @@ -1,37 +1,37 @@ -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 "@nomicfoundation/hardhat-ethers/signers"; +import {ContractTransactionResponse, 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); -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.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"))}); + 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.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"))}); + 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 () => { @@ -124,36 +124,36 @@ describe("Wallets", () => { }); it("should revert if someone sends ETH to contract Wallets", async() => { - const amount = ethers.utils.parseEther("1.0"); - await owner.sendTransaction({to: wallets.address, value: amount}) + const amount = ethers.parseEther("1.0"); + 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.utils.parseEther("1.0"); - (await wallets.getValidatorBalance(validator1Id)).toNumber().should.be.equal(0); - await validator1.sendTransaction({to: wallets.address, value: amount}); + const amount = ethers.parseEther("1.0"); + (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"); }); @@ -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,30 +230,30 @@ 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()); + 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.utils.parseEther("1.0"); - (await wallets.getSchainBalance(schain1Id)).toNumber().should.be.equal(0); - await validator1.sendTransaction({to: wallets.address, value: amount}); + const amount = ethers.parseEther("1.0"); + (await wallets.getSchainBalance(schain1Id)).should.be.equal(0); + await validator1.sendTransaction({to: wallets, 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; @@ -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.utils.parseEther(tolerance.toString()).toNumber()); + (initialBalance - validatorBalance) + .should.be.closeTo(spentValue, Number(ethers.parseEther(tolerance.toString()))); }); }); }); diff --git a/test/delegation/Delegation.ts b/test/delegation/Delegation.ts index 064e58cea..49ce02231 100644 --- a/test/delegation/Delegation.ts +++ b/test/delegation/Delegation.ts @@ -1,4 +1,4 @@ -import { ConstantsHolder, +import {ConstantsHolder, ContractManager, DelegationController, DelegationPeriodManager, @@ -11,36 +11,36 @@ 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 {HDNodeWallet, 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 "@nomicfoundation/hardhat-ethers/signers"; +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); -const allowedDelegationPeriods = [2, 6, 12]; +const allowedDelegationPeriods = [2n, 6n, 12n]; describe("Delegation", () => { let owner: SignerWithAddress; @@ -62,12 +62,12 @@ describe("Delegation", () => { let punisher: Punisher; let nodes: Nodes; - const defaultAmount = ethers.utils.parseEther("100"); - const month = 60 * 60 * 24 * 31; + const defaultAmount = ethers.parseEther("100"); + 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) { @@ -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); @@ -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) { @@ -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); @@ -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,13 +266,12 @@ 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); }); describe("when delegation request is sent", () => { - fastBeforeEach(async () => { await delegationController.connect(holder1).delegate( validatorId, defaultAmount.toString(), delegationPeriod, "D2 is even"); @@ -312,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); }); @@ -325,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"); @@ -337,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"); @@ -348,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); @@ -385,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()); }); @@ -400,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 () =>{ @@ -420,42 +419,42 @@ 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 skaleToken.mint(holder1.address, ethers.utils.parseEther("10000"), "0x", "0x"); - await skaleToken.mint(holder2.address, ethers.utils.parseEther("10000"), "0x", "0x"); + 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"); - 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 constantsHolder.setLaunchTimestamp((await currentTime()) - 4n * 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); } @@ -464,17 +463,17 @@ 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.utils.parseEther("10000")); + await punisher.slash(validatorId, ethers.parseEther("10000")); - (await skaleToken.callStatic.getAndUpdateSlashedAmount(holder1.address)).toString() - .should.be.equal(ethers.utils.parseEther("10000")); - (await skaleToken.callStatic.getAndUpdateDelegatedAmount(holder1.address)).toString() + (await skaleToken.getAndUpdateSlashedAmount.staticCall(holder1.address)).toString() + .should.be.equal(ethers.parseEther("10000")); + (await skaleToken.getAndUpdateDelegatedAmount.staticCall(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); @@ -494,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); }); @@ -505,11 +504,11 @@ 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)); } - const etherAmount = ethers.utils.parseEther("5000"); + const etherAmount = ethers.parseEther("5000"); await constantsHolder.setLaunchTimestamp(0); @@ -531,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); } }); @@ -590,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"); @@ -606,27 +605,26 @@ 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", () => { - it("should slash validator and lock delegators fund in proportion of delegation share", async () => { // do 5 separate slashes to check aggregation const slashesNumber = 5; @@ -639,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() => { @@ -720,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 () => { @@ -734,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); }); @@ -744,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); }); }); diff --git a/test/delegation/DelegationController.ts b/test/delegation/DelegationController.ts index cc9c674e2..063c552fc 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 "@nomicfoundation/hardhat-ethers/signers"; +import {deploySkaleManagerMock} from "../tools/deploy/test/skaleManagerMock"; +import {expect, assert} from "chai"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); @@ -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); }); @@ -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 () => { @@ -225,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); @@ -267,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 () => { @@ -285,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()); @@ -301,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); @@ -309,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/delegation/PartialDifferences.ts b/test/delegation/PartialDifferences.ts index 7de694db5..97c01a7fb 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); @@ -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,7 +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 +}); diff --git a/test/delegation/TimeHelpers.ts b/test/delegation/TimeHelpers.ts index 6b3328881..c43eaa078 100644 --- a/test/delegation/TimeHelpers.ts +++ b/test/delegation/TimeHelpers.ts @@ -1,11 +1,12 @@ -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"; +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/delegation/TokenState.ts b/test/delegation/TokenState.ts index f84eb6c4c..517de6ef0 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 "@nomicfoundation/hardhat-ethers/signers"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; chai.should(); chai.use(chaiAsPromised); @@ -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); }); }); }); diff --git a/test/delegation/ValidatorService.ts b/test/delegation/ValidatorService.ts index facb14476..3c7f12efe 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 "@nomicfoundation/hardhat-ethers/signers"; +import {assert} from "chai"; +import {makeSnapshot, applySnapshot} from "../tools/snapshot"; +import {getValidatorIdSignature} from "../tools/signatures"; chai.should(); chai.use(chaiAsPromised); @@ -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)); }); @@ -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 ac3ccb39f..2c295a8a5 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 8a029e313..739168f70 100644 --- a/test/tools/deploy/bounty.ts +++ b/test/tools/deploy/bounty.ts @@ -1,11 +1,11 @@ -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( +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 019efe6e1..ca8250205 100644 --- a/test/tools/deploy/constantsHolder.ts +++ b/test/tools/deploy/constantsHolder.ts @@ -1,6 +1,6 @@ -import { ConstantsHolder, ContractManager } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +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 bf9ed27c3..401964515 100644 --- a/test/tools/deploy/contractManager.ts +++ b/test/tools/deploy/contractManager.ts @@ -1,14 +1,14 @@ -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") { const owner = (await ethers.getSigners())[0]; - await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.utils.parseEther("0.08")}); - await ethers.provider.sendTransaction("0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820"); + await owner.sendTransaction({to: "0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", value: ethers.parseEther("0.08")}); + await ethers.provider.broadcastTransaction("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 5ffbfce6e..c4b05acdb 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"; +import {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/delegationController.ts b/test/tools/deploy/delegation/delegationController.ts index c0986e947..52b3df9b0 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 f9fab4acd..d3bdca936 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 1b535d183..acd1a1f54 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 82b4aaa96..819f52c8c 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 753dc52dc..e45e15b40 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 { deployWithConstructor, deployWithConstructorFunctionFactory } from "../factory"; +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/delegation/tokenState.ts b/test/tools/deploy/delegation/tokenState.ts index b368da50a..bb9d15b89 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 ff38a2857..a6ab1a042 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 62bfe5765..fb2dcd0d5 100644 --- a/test/tools/deploy/ecdh.ts +++ b/test/tools/deploy/ecdh.ts @@ -1,10 +1,10 @@ -import { ContractManager, ECDH } from "../../../typechain-types"; -import { deployFunctionFactory, deployWithConstructor } from "./factory"; +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 e603122bf..0a6e09341 100644 --- a/test/tools/deploy/factory.ts +++ b/test/tools/deploy/factory.ts @@ -1,56 +1,59 @@ -import { ethers, upgrades } from "hardhat"; -import { ContractManager } from "../../../typechain-types"; -import { deployLibraries, getLinkedContractFactory } from "@skalenetwork/upgrade-tools"; +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, + [await ethers.resolveAddress(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( @@ -60,7 +63,7 @@ function deployWithConstructorFunctionFactory( } -function deployWithLibraryFunctionFactory( +function deployWithLibraryFunctionFactory( contractName: string, libraryNames: string[], deployDependencies: (contractManager: ContractManager) => Promise @@ -68,19 +71,23 @@ 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)); + 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, + [await ethers.resolveAddress(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 @@ -88,12 +95,12 @@ 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)); + 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 7a8c0bdcf..a00149738 100644 --- a/test/tools/deploy/keyStorage.ts +++ b/test/tools/deploy/keyStorage.ts @@ -1,14 +1,14 @@ -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( +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 8cab67b93..46aba8af8 100644 --- a/test/tools/deploy/nodeRotation.ts +++ b/test/tools/deploy/nodeRotation.ts @@ -1,14 +1,14 @@ -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( +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 27073b988..78cb49818 100644 --- a/test/tools/deploy/nodes.ts +++ b/test/tools/deploy/nodes.ts @@ -1,11 +1,11 @@ -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( +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 47d56bd8c..f985062a3 100644 --- a/test/tools/deploy/pricing.ts +++ b/test/tools/deploy/pricing.ts @@ -1,12 +1,12 @@ -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( +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 43381f0e9..09e55a2ab 100644 --- a/test/tools/deploy/schains.ts +++ b/test/tools/deploy/schains.ts @@ -1,12 +1,12 @@ -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( +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 c9c8237ea..e044b6ecd 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", @@ -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 266d76750..ff807bf5a 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", @@ -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 56c7435b7..3313de206 100644 --- a/test/tools/deploy/skaleManager.ts +++ b/test/tools/deploy/skaleManager.ts @@ -1,16 +1,16 @@ -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( +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 b777d4d60..80ef19221 100644 --- a/test/tools/deploy/skaleToken.ts +++ b/test/tools/deploy/skaleToken.ts @@ -1,16 +1,16 @@ -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"; 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 0c86c6de3..ee87f2005 100644 --- a/test/tools/deploy/skaleVerifier.ts +++ b/test/tools/deploy/skaleVerifier.ts @@ -1,10 +1,10 @@ -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( +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 1005fb543..e50aeb519 100644 --- a/test/tools/deploy/slashingTable.ts +++ b/test/tools/deploy/slashingTable.ts @@ -1,6 +1,6 @@ -import { ContractManager, SlashingTable } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +import {SlashingTable} from "../../../typechain-types"; +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 d94e0e4fa..096083524 100644 --- a/test/tools/deploy/syncManager.ts +++ b/test/tools/deploy/syncManager.ts @@ -1,8 +1,6 @@ -import { ContractManager, SyncManager } from "../../../typechain-types"; -import { deployFunctionFactory } from "./factory"; +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/fieldOperationsTester.ts b/test/tools/deploy/test/fieldOperationsTester.ts index abbee5c21..ded8c7d58 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 {ContractManager, FieldOperationsTester} from "../../../../typechain-types"; +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; diff --git a/test/tools/deploy/test/nodesMock.ts b/test/tools/deploy/test/nodesMock.ts index ff53c1fee..38d410994 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 4aa6d7106..b06ff27d0 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 dfc6f7037..42588bbd3 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 f8001aa2a..eff223b8f 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 c19306388..a27cca61a 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"; +import {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/skaleDKGTester.ts b/test/tools/deploy/test/skaleDKGTester.ts index 433984dcc..756c3e688 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 510b22f5f..061c09916 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 427536500..6edc0843c 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 {deployFunctionFactory} from "../factory"; +import {ethers} from "hardhat"; +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 077d7b51d..fd766e8f8 100644 --- a/test/tools/deploy/wallets.ts +++ b/test/tools/deploy/wallets.ts @@ -1,14 +1,14 @@ -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( +export const deployWallets = deployFunctionFactory( "Wallets", async (contractManager: ContractManager) => { await deployNodes(contractManager); await deployValidatorService(contractManager); await deploySchainsInternal(contractManager); } -) as (contractManager: ContractManager) => Promise; +); diff --git a/test/tools/hashes.ts b/test/tools/hashes.ts index b6cdd8188..dd3009c02 100644 --- a/test/tools/hashes.ts +++ b/test/tools/hashes.ts @@ -1,5 +1,5 @@ -import { ethers } from "hardhat"; +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]); +} diff --git a/test/tools/math.ts b/test/tools/math.ts new file mode 100644 index 000000000..22c10cfae --- /dev/null +++ b/test/tools/math.ts @@ -0,0 +1,6 @@ +export function bigintAbs(value: bigint) { + if (value >= 0) { + return value; + } + return -value; +} diff --git a/test/tools/mocha.ts b/test/tools/mocha.ts index 64edab92b..014223123 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 18292b876..553d7a5b2 100644 --- a/test/tools/signatures.ts +++ b/test/tools/signatures.ts @@ -1,13 +1,13 @@ -import { BigNumberish, BytesLike, Signer, Wallet } from "ethers"; -import { ethers } from "hardhat"; -import { ec } from "elliptic"; +import {BigNumberish, BytesLike, Signer, BaseWallet} from "ethers"; +import {ethers} from "hardhat"; +import {ec} from "elliptic"; 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] ) @@ -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.zeroPadValue(ethers.hexlify(publicKey.getX().toBuffer()), 32); + const pubB = ethers.zeroPadValue(ethers.hexlify(publicKey.getY().toBuffer()), 32); return [pubA, pubB]; } diff --git a/test/tools/snapshot.ts b/test/tools/snapshot.ts index 566f261ee..2fa1ff937 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 af797dd7e..7a6edea7b 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) { @@ -11,7 +11,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) { @@ -22,26 +26,36 @@ 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"]; 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; } diff --git a/test/utils/FieldOperations.ts b/test/utils/FieldOperations.ts index 15532b7cc..c453e15d7 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 87637aed7..fb35a49a2 100644 --- a/test/utils/MathUtils.ts +++ b/test/utils/MathUtils.ts @@ -1,8 +1,8 @@ -import chai from "chai"; +import chai, {expect} 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); @@ -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,28 +25,26 @@ 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); - await mathUtils.boundedSub(3, 5) - .should.emit(mathUtilsLib, "UnderflowError") + await expect(mathUtils.boundedSub(3, 5)) + .to.emit(mathUtils, "UnderflowError") .withArgs(3, 5); }); }); 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); }); }); diff --git a/test/utils/SegmentTree.ts b/test/utils/SegmentTree.ts index dd5a94f9c..8a1c6c991 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); @@ -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,21 +82,20 @@ 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); }); }); describe("when initialized", () => { - before(async () => { cleanContracts = await makeSnapshot(); await segmentTree.addElemInPlaces(128, 150); @@ -108,95 +107,86 @@ 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)).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); } }); @@ -211,135 +201,131 @@ 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"); - - }); it("should return and remove random places", async () => { @@ -348,46 +334,40 @@ 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(); - // console.log("New place ", place); + const place = (await segmentTree.getRandomElem(schainPlace)); await segmentTree.removeFromPlace(place, 1); if (place - schainPlace > 0) { - // console.log(place - schainPlace); await segmentTree.addToPlace(place - schainPlace, 1); } } // 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(); - // console.log("New place ", place); + const place = (await segmentTree.getRandomElem(schainPlace)); if (place - schainPlace > 0) { - // console.log(place - schainPlace); await segmentTree.moveFromPlaceToPlace(place, place - schainPlace, 1); } else { await segmentTree.removeFromPlace(place, 1); } } // 201 time should be no nodes - (await segmentTree.getRandomElem(schainPlace)).toNumber().should.be.equal(0); + (await segmentTree.getRandomElem(schainPlace)).should.be.equal(0); }); }); }); diff --git a/tsconfig.json b/tsconfig.json index 2ca1d5a01..a60f4c430 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2018", + "target": "es2020", "module": "commonjs", "strict": true, "esModuleInterop": true, diff --git a/yarn.lock b/yarn.lock index beaedff6d..ece2f28a1 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" @@ -463,7 +432,12 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.4.0": + version "4.10.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.1.tgz#361461e5cb3845d874e61731c11cfedd664d83a0" + integrity sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA== + +"@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== @@ -556,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== @@ -698,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== @@ -842,7 +816,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== @@ -925,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== @@ -955,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== @@ -1096,11 +1070,28 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.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" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== +"@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" @@ -1127,151 +1118,117 @@ "@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" + 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" @@ -1338,11 +1295,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" @@ -1467,7 +1419,7 @@ dependencies: "@oclif/core" "^2.11.7" -"@openzeppelin/contracts-upgradeable@^4.4.2", "@openzeppelin/contracts-upgradeable@^4.9.6": +"@openzeppelin/contracts-upgradeable@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.6.tgz#38b21708a719da647de4bb0e4802ee235a0d24df" integrity sha512-m4iHazOsOCv1DgM7eD7GupTJ+NFVujRZt1wzddDPSVGpWdKq1SKkla5htKG7+IS4d2XOCtzkUNwRZ7Vq5aEUMA== @@ -1477,53 +1429,81 @@ 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-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== dependencies: - amazon-cognito-identity-js "^6.0.1" + amazon-cognito-identity-js "^6.3.6" async-retry "^1.3.3" - axios "^1.4.0" - 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-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== + dependencies: + "@openzeppelin/defender-sdk-base-client" "^1.13.4" + axios "^1.6.8" + lodash "^4.17.21" + +"@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-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@^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-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 "^6.11.1" -"@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== +"@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== 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== - 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" + +"@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" @@ -1562,63 +1542,42 @@ path-browserify "^1.0.0" url "^0.11.0" -"@safe-global/safe-core-sdk-types@^1.9.0", "@safe-global/safe-core-sdk-types@^1.9.2": - version "1.10.1" - resolved "https://registry.yarnpkg.com/@safe-global/safe-core-sdk-types/-/safe-core-sdk-types-1.10.1.tgz#94331b982671d2f2b8cc23114c58baf63d460c81" - integrity sha512-BKvuYTLOlY16Rq6qCXglmnL6KxInDuXMFqZMaCzwDKiEh+uoHu3xCumG5tVtWOkCgBF4XEZXMqwZUiLcon7IsA== +"@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/bignumber" "^5.7.0" - "@ethersproject/contracts" "^5.7.0" - "@safe-global/safe-deployments" "^1.20.2" - web3-core "^1.8.1" - web3-utils "^1.8.1" - -"@safe-global/safe-core-sdk-utils@^1.7.4": - version "1.7.4" - resolved "https://registry.yarnpkg.com/@safe-global/safe-core-sdk-utils/-/safe-core-sdk-utils-1.7.4.tgz#810d36cf9629129a28eb1b9c6e690b163834b572" - integrity sha512-ITocwSWlFUA1K9VMP/eJiMfgbP/I9qDxAaFz7ukj5N5NZD3ihVQZkmqML6hjse5UhrfjCnfIEcLkNZhtB2XC2Q== - dependencies: - "@safe-global/safe-core-sdk-types" "^1.9.2" - semver "^7.3.8" - web3-utils "^1.8.1" - -"@safe-global/safe-core-sdk@^3.3.2": - version "3.3.4" - resolved "https://registry.yarnpkg.com/@safe-global/safe-core-sdk/-/safe-core-sdk-3.3.4.tgz#d404287f9b910feab3e692243aaf62494ff2d2a9" - integrity sha512-tgcK7VWo66Z8632xaYDzUHQ8InPOaI10ELk1wCrO/C3QjPwxjIozbMGOMzF4RZPCSJX2YAHowAvOgmEukgSkxA== - dependencies: - "@ethersproject/solidity" "^5.7.0" - "@safe-global/safe-core-sdk-types" "^1.9.2" - "@safe-global/safe-core-sdk-utils" "^1.7.4" - "@safe-global/safe-deployments" "^1.25.0" - ethereumjs-util "^7.1.5" - semver "^7.3.8" - web3-utils "^1.8.1" + "@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/safe-deployments@^1.20.2", "@safe-global/safe-deployments@^1.25.0": - version "1.26.0" - resolved "https://registry.yarnpkg.com/@safe-global/safe-deployments/-/safe-deployments-1.26.0.tgz#b83615b3b5a66e736e08f8ecf2801ed988e9e007" - integrity sha512-Tw89O4/paT19ieMoiWQbqRApb0Bef/DxweS9rxodXAM5EQModkbyFXGZca+YxXE67sLvWjLr2jJUOxwze8mhGw== +"@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: - semver "^7.3.7" + "@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" + ethers "^6.13.1" + semver "^7.6.2" -"@safe-global/safe-ethers-lib@^1.9.2": - version "1.9.4" - resolved "https://registry.yarnpkg.com/@safe-global/safe-ethers-lib/-/safe-ethers-lib-1.9.4.tgz#049989a302c6f2010c574cf3a834b0cfb9cf67c5" - integrity sha512-WhzcmNun0s0VxeVQKRqaapV0vEpdm76zZBR2Du+S+58u1r57OjZkOSL2Gru0tdwkt3FIZZtE3OhDu09M70pVkA== +"@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: - "@safe-global/safe-core-sdk-types" "^1.9.2" - "@safe-global/safe-core-sdk-utils" "^1.7.4" - ethers "5.7.2" + abitype "^1.0.2" -"@safe-global/safe-service-client@^2.0.0": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@safe-global/safe-service-client/-/safe-service-client-2.0.2.tgz#85e00017cb7f63d4cc9c9bf9702bd9cb7b27e62e" - integrity sha512-UFmA53EMRU++2mzo547+tCWaw2BknpbuMDjR786pPgm5dhB4ADattTdV7pYqYBMWn4uGoGgb2kaImEq097bATQ== +"@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: - "@ethersproject/abstract-signer" "^5.7.0" - "@safe-global/safe-core-sdk-types" "^1.9.2" - node-fetch "^2.6.6" + semver "^7.6.0" "@scure/base@~1.1.0": version "1.1.1" @@ -1715,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" @@ -1729,23 +1693,38 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@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.0" + ethers "^6.7.1" + +"@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" + "@skalenetwork/skale-manager-interfaces@3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.1.0.tgz#e97750462b1dafa9eee1c347802d5405afc9474f" integrity sha512-lVJM6nRfIrlwRy7N009jGCZa5nDJo2/QMrKN0A2nRz/sqT8wWlOQUeDKrJ1mC5Esdbzhya6T6hTiZbN2yNwcRg== -"@skalenetwork/upgrade-tools@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@skalenetwork/upgrade-tools/-/upgrade-tools-2.0.1.tgz#fa5d71c4ea0bb60285c13e2f1958b4980df1a3ff" - integrity sha512-pp+T5Ghj9yd4Xg0rmOM0PpQIuaN8+8+9yjxCTeykZqBQzx/waTq8CDpcwdREYvskKRIS5DSO8rxxeFQo+dBYQQ== - dependencies: - "@openzeppelin/contracts-upgradeable" "^4.4.2" - "@safe-global/safe-core-sdk" "^3.3.2" - "@safe-global/safe-core-sdk-types" "^1.9.0" - "@safe-global/safe-ethers-lib" "^1.9.2" - "@safe-global/safe-service-client" "^2.0.0" - axios "^0.27.2" +"@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" + "@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" + semaphore-async-await "^1.5.1" "@smithy/types@^1.1.0": version "1.2.0" @@ -1761,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" @@ -1768,6 +1752,30 @@ 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" + 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" @@ -1788,14 +1796,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" @@ -1803,14 +1803,22 @@ dependencies: ethers "^5.0.2" -"@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/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@^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" -"@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== @@ -1857,6 +1865,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" @@ -1872,12 +1887,17 @@ "@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.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== + 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/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== @@ -1904,6 +1924,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" @@ -1912,18 +1937,30 @@ "@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== 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" 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" @@ -1936,14 +1973,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" @@ -1958,10 +1987,15 @@ 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" - integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg== + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/sinon-chai@^3.2.9": version "3.2.9" @@ -2082,19 +2116,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.3: - 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.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== @@ -2114,6 +2141,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" @@ -2173,6 +2212,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" @@ -2213,10 +2257,10 @@ 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== +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" @@ -2229,6 +2273,13 @@ amdefine@>=0.0.4: 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" @@ -2295,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" @@ -2385,6 +2436,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" @@ -2405,6 +2464,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" @@ -2428,6 +2499,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" @@ -2479,7 +2564,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== @@ -2542,6 +2627,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" @@ -2552,21 +2644,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@^0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== - dependencies: - 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" @@ -2576,6 +2653,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" @@ -3144,11 +3230,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" @@ -3234,6 +3315,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" @@ -3277,16 +3372,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" @@ -3418,6 +3503,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" @@ -3472,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" @@ -3501,6 +3618,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" @@ -3516,7 +3644,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== @@ -3534,28 +3662,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.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" @@ -3710,17 +3840,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" @@ -3741,6 +3860,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" @@ -3916,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" @@ -4033,14 +4165,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" @@ -4085,14 +4209,7 @@ cross-fetch@^2.1.0, cross-fetch@^2.1.1: node-fetch "2.6.1" whatwg-fetch "2.0.4" -cross-fetch@^3.1.4: - version "3.1.8" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" - integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== - 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== @@ -4262,6 +4379,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" @@ -4281,7 +4425,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== @@ -4317,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" @@ -4343,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== @@ -4358,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" @@ -4373,6 +4529,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" @@ -4388,6 +4553,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" @@ -4583,6 +4757,11 @@ elliptic@^6.5.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" @@ -4649,32 +4828,6 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.18.5, es-abstract@^1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" - integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== - dependencies: - call-bind "^1.0.2" - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - get-intrinsic "^1.1.1" - get-symbol-description "^1.0.0" - has "^1.0.3" - has-symbols "^1.0.2" - internal-slot "^1.0.3" - is-callable "^1.2.4" - is-negative-zero "^2.0.1" - is-regex "^1.1.4" - is-shared-array-buffer "^1.0.1" - is-string "^1.0.7" - is-weakref "^1.0.1" - object-inspect "^1.11.0" - object-keys "^1.1.1" - object.assign "^4.1.2" - string.prototype.trimend "^1.0.4" - string.prototype.trimstart "^1.0.4" - unbox-primitive "^1.0.1" - es-abstract@^1.19.0, es-abstract@^1.20.4, es-abstract@^1.21.2: version "1.22.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.1.tgz#8b4e5fc5cefd7f1660f0f8e1a52900dfbc9d9ccc" @@ -4720,11 +4873,108 @@ es-abstract@^1.19.0, es-abstract@^1.20.4, es-abstract@^1.21.2: unbox-primitive "^1.0.2" which-typed-array "^1.1.10" +es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" + has "^1.0.3" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.1" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" + object-inspect "^1.11.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + 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" @@ -4734,6 +4984,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" @@ -4762,11 +5028,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" @@ -5337,7 +5598,7 @@ ethereumjs-wallet@0.6.5: utf8 "^3.0.0" uuid "^3.3.2" -ethers@5.7.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: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -5373,6 +5634,19 @@ ethers@5.7.2, ethers@^5.0.1, ethers@^5.0.2, ethers@^5.5.2, ethers@^5.7.1, ethers "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" +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== + 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" @@ -5397,11 +5671,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" @@ -5420,24 +5689,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" - 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" @@ -5776,7 +6027,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.14.9, 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== @@ -5793,16 +6044,16 @@ for-in@^1.0.2: resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= -foreach@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" - integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= - forever-agent@~0.6.1: version "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" @@ -5932,6 +6183,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" @@ -5942,6 +6198,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" @@ -5952,15 +6218,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" @@ -5998,6 +6255,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" @@ -6037,6 +6315,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" @@ -6052,7 +6341,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== @@ -6066,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" @@ -6074,10 +6368,14 @@ 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-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" @@ -6271,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" @@ -6291,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" @@ -6336,31 +6656,30 @@ 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-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" + 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" @@ -6435,11 +6754,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" @@ -6469,6 +6800,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" @@ -6532,6 +6870,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" @@ -6569,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== @@ -6610,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" @@ -6710,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== @@ -6733,6 +7086,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" @@ -6750,11 +7112,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" @@ -6798,6 +7155,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" @@ -6873,6 +7238,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" @@ -6952,13 +7324,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" @@ -6976,6 +7341,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" @@ -7052,7 +7422,14 @@ 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-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" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -7078,16 +7455,12 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.9: dependencies: which-typed-array "^1.1.11" -is-typed-array@^1.1.3, is-typed-array@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.8.tgz#cbaa6585dc7db43318bc5b89523ea384a6f65e79" - integrity sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA== +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: - available-typed-arrays "^1.0.5" - call-bind "^1.0.2" - es-abstract "^1.18.5" - foreach "^2.0.5" - has-tostringtag "^1.0.0" + which-typed-array "^1.1.14" is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" @@ -7196,11 +7569,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" @@ -7393,7 +7761,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== @@ -7425,14 +7793,6 @@ 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" @@ -7471,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" @@ -7478,13 +7845,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" @@ -7497,6 +7857,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" @@ -7585,6 +7952,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" @@ -7615,13 +7987,14 @@ 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== +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: - browser-level "^1.0.1" - classic-level "^1.2.0" + 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" @@ -7718,6 +8091,16 @@ 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.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" @@ -7733,7 +8116,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== @@ -7787,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" @@ -7828,13 +8216,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" @@ -7847,11 +8228,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" @@ -7866,15 +8242,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" @@ -7899,15 +8266,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" @@ -8019,16 +8377,21 @@ 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" 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" @@ -8195,7 +8558,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== @@ -8287,10 +8650,10 @@ 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" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== natural-compare-lite@^1.4.0: version "1.4.0" @@ -8352,20 +8715,13 @@ 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== dependencies: whatwg-url "^5.0.0" -node-fetch@^2.6.12, node-fetch@^2.6.6: - version "2.6.12" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba" - integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== - dependencies: - whatwg-url "^5.0.0" - node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -8381,6 +8737,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" @@ -8418,12 +8779,10 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== -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" +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" @@ -8467,6 +8826,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" @@ -8527,6 +8891,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" @@ -8566,13 +8940,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 sha1-VVQoTFQ6ImbXo48X4HOCH73jk80= - 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" @@ -8643,15 +9010,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" @@ -8667,21 +9025,16 @@ 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-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-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" 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" @@ -8762,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" @@ -8908,7 +9271,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= @@ -9000,6 +9363,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" @@ -9035,11 +9403,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" @@ -9072,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" @@ -9219,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" @@ -9259,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" @@ -9415,6 +9798,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" @@ -9424,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" @@ -9504,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" @@ -9547,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" @@ -9603,13 +10022,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" @@ -9632,6 +10044,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" @@ -9658,6 +10080,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" @@ -9702,7 +10133,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== @@ -9716,6 +10147,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" @@ -9731,13 +10167,18 @@ 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.7, semver@^7.3.8, 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== 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" @@ -9795,6 +10236,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" @@ -9852,11 +10315,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" @@ -9875,7 +10333,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== @@ -9988,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" @@ -10004,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" @@ -10013,10 +10472,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" @@ -10245,7 +10706,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== @@ -10263,6 +10724,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" @@ -10289,6 +10760,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" @@ -10306,6 +10786,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" @@ -10367,11 +10856,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" @@ -10379,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= @@ -10688,6 +11172,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" @@ -10842,6 +11331,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" @@ -10852,6 +11350,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" @@ -10863,6 +11372,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" @@ -10872,6 +11393,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" @@ -10961,6 +11494,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" @@ -10968,6 +11506,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" @@ -11067,6 +11610,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" @@ -11095,17 +11652,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" @@ -11178,14 +11724,6 @@ web3-bzz@1.2.11: swarm-js "^0.1.40" underscore "1.9.1" -web3-core-helpers@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.10.0.tgz#1016534c51a5df77ed4f94d1fcce31de4af37fad" - integrity sha512-pIxAzFDS5vnbXvfvLSpaA1tfRykAe9adw43YCKsEYQwH0gCLL0kMLkaCX3q+Q8EVmAh+e1jWL/nl9U0de1+++g== - dependencies: - web3-eth-iban "1.10.0" - web3-utils "1.10.0" - 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" @@ -11195,17 +11733,6 @@ web3-core-helpers@1.2.11: web3-eth-iban "1.2.11" web3-utils "1.2.11" -web3-core-method@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.10.0.tgz#82668197fa086e8cc8066742e35a9d72535e3412" - integrity sha512-4R700jTLAMKDMhQ+nsVfIXvH6IGJlJzGisIfMKWAIswH31h5AZz7uDUW2YctI+HrYd+5uOAlS4OJeeT9bIpvkA== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.10.0" - web3-core-promievent "1.10.0" - web3-core-subscriptions "1.10.0" - web3-utils "1.10.0" - 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" @@ -11218,13 +11745,6 @@ web3-core-method@1.2.11: web3-core-subscriptions "1.2.11" web3-utils "1.2.11" -web3-core-promievent@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.10.0.tgz#cbb5b3a76b888df45ed3a8d4d8d4f54ccb66a37b" - integrity sha512-68N7k5LWL5R38xRaKFrTFT2pm2jBNFaM4GioS00YjAKXRQ3KjmhijOMG3TICz6Aa5+6GDWYelDNx21YAeZ4YTg== - 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" @@ -11232,17 +11752,6 @@ web3-core-promievent@1.2.11: dependencies: eventemitter3 "4.0.4" -web3-core-requestmanager@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.10.0.tgz#4b34f6e05837e67c70ff6f6993652afc0d54c340" - integrity sha512-3z/JKE++Os62APml4dvBM+GAuId4h3L9ckUrj7ebEtS2AR0ixyQPbrBodgL91Sv7j7cQ3Y+hllaluqjguxvSaQ== - dependencies: - util "^0.12.5" - web3-core-helpers "1.10.0" - web3-providers-http "1.10.0" - web3-providers-ipc "1.10.0" - web3-providers-ws "1.10.0" - 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" @@ -11254,14 +11763,6 @@ web3-core-requestmanager@1.2.11: web3-providers-ipc "1.2.11" web3-providers-ws "1.2.11" -web3-core-subscriptions@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.10.0.tgz#b534592ee1611788fc0cb0b95963b9b9b6eacb7c" - integrity sha512-HGm1PbDqsxejI075gxBc5OSkwymilRWZufIy9zEpnWKNmfbuv5FfHgW1/chtJP6aP3Uq2vHkvTDl3smQBb8l+g== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.0" - 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" @@ -11284,19 +11785,6 @@ web3-core@1.2.11: web3-core-requestmanager "1.2.11" web3-utils "1.2.11" -web3-core@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.10.0.tgz#9aa07c5deb478cf356c5d3b5b35afafa5fa8e633" - integrity sha512-fWySwqy2hn3TL89w5TM8wXF1Z2Q6frQTKHWmP0ppRQorEK8NcHJRfeMiv/mQlSKoTS1F6n/nv2uyZsixFycjYQ== - dependencies: - "@types/bn.js" "^5.1.1" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.10.0" - web3-core-method "1.10.0" - web3-core-requestmanager "1.10.0" - web3-utils "1.10.0" - 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" @@ -11353,14 +11841,6 @@ web3-eth-ens@1.2.11: web3-eth-contract "1.2.11" web3-utils "1.2.11" -web3-eth-iban@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.10.0.tgz#5a46646401965b0f09a4f58e7248c8a8cd22538a" - integrity sha512-0l+SP3IGhInw7Q20LY3IVafYEuufo4Dn75jAHT7c2aDJsIolvf2Lc6ugHkBajlwUneGfbRQs/ccYPQ9JeMUbrg== - dependencies: - bn.js "^5.2.1" - web3-utils "1.10.0" - 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" @@ -11435,16 +11915,6 @@ web3-provider-engine@14.2.1: xhr "^2.2.0" xtend "^4.0.1" -web3-providers-http@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.0.tgz#864fa48675e7918c9a4374e5f664b32c09d0151b" - integrity sha512-eNr965YB8a9mLiNrkjAWNAPXgmQWfpBfkkn7tpEFlghfww0u3I0tktMZiaToJVcL2+Xq+81cxbkpeWJ5XQDwOA== - dependencies: - abortcontroller-polyfill "^1.7.3" - cross-fetch "^3.1.4" - es6-promise "^4.2.8" - web3-core-helpers "1.10.0" - 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" @@ -11453,14 +11923,6 @@ web3-providers-http@1.2.11: web3-core-helpers "1.2.11" xhr2-cookies "1.1.0" -web3-providers-ipc@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.10.0.tgz#9747c7a6aee96a51488e32fa7c636c3460b39889" - integrity sha512-OfXG1aWN8L1OUqppshzq8YISkWrYHaATW9H8eh0p89TlWMc1KZOL9vttBuaBEi96D/n0eYDn2trzt22bqHWfXA== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.10.0" - 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" @@ -11470,15 +11932,6 @@ web3-providers-ipc@1.2.11: underscore "1.9.1" web3-core-helpers "1.2.11" -web3-providers-ws@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.10.0.tgz#cb0b87b94c4df965cdf486af3a8cd26daf3975e5" - integrity sha512-sK0fNcglW36yD5xjnjtSGBnEtf59cbw4vZzJ+CmOWIKGIR96mP5l684g0WD0Eo+f4NQc2anWWXG74lRc9OVMCQ== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.0" - 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" @@ -11499,19 +11952,6 @@ web3-shh@1.2.11: web3-core-subscriptions "1.2.11" web3-net "1.2.11" -web3-utils@1.10.0, web3-utils@^1.3.6, web3-utils@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.0.tgz#ca4c1b431a765c14ac7f773e92e0fd9377ccf578" - integrity sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg== - dependencies: - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereumjs-util "^7.1.0" - 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" @@ -11539,6 +11979,19 @@ web3-utils@^1.0.0-beta.31: randombytes "^2.1.0" utf8 "3.0.0" +web3-utils@^1.3.6: + version "1.10.0" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.0.tgz#ca4c1b431a765c14ac7f773e92e0fd9377ccf578" + integrity sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg== + dependencies: + bn.js "^5.2.1" + ethereum-bloom-filters "^1.0.6" + ethereumjs-util "^7.1.0" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "3.0.0" + web3@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.11.tgz#50f458b2e8b11aa37302071c170ed61cff332975" @@ -11569,7 +12022,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== @@ -11626,17 +12079,16 @@ which-typed-array@^1.1.10, which-typed-array@^1.1.11: gopd "^1.0.1" has-tostringtag "^1.0.0" -which-typed-array@^1.1.2: - version "1.1.7" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.7.tgz#2761799b9a22d4b8660b3c1b40abaa7739691793" - integrity sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw== +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.5" - call-bind "^1.0.2" - es-abstract "^1.18.5" - foreach "^2.0.5" - has-tostringtag "^1.0.0" - is-typed-array "^1.1.7" + 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" @@ -11749,6 +12201,16 @@ 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@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" @@ -11854,7 +12316,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== @@ -11899,23 +12361,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"