From e44c89f9b9633f5f7d0d85d0e5ecf91e4b422913 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 23 Jan 2024 12:25:38 +0200 Subject: [PATCH 01/16] replace tslint with eslint for typescript * remove many unneeded awaits and asyncs * change console logs to console info * ignore some more offensive files * fix some interprolated values which could have been [object object] * add missing dependencies * try to have minimal changes --- .babelrc | 3 - .eslintrc.js | 279 ++++++ .vscode/settings.json | 1 - package.json | 10 +- packages/celotool/.eslintrc.js | 8 + packages/celotool/package.json | 9 +- packages/celotool/src/cli.ts | 2 +- packages/celotool/src/cmds/account/faucet.ts | 13 +- packages/celotool/src/cmds/account/list.ts | 8 +- packages/celotool/src/cmds/backup.ts | 2 +- .../celotool/src/cmds/contract_addresses.ts | 5 +- .../src/cmds/deploy/destroy/cluster.ts | 2 +- .../src/cmds/deploy/initial/blockchain-api.ts | 3 + .../src/cmds/deploy/initial/contracts.ts | 2 +- .../src/cmds/deploy/upgrade/faucet.ts | 4 +- .../src/cmds/deploy/upgrade/hotfix.ts | 8 +- packages/celotool/src/cmds/fork_env.ts | 2 +- .../src/cmds/generate/account-address.ts | 7 +- .../src/cmds/generate/address-from-env.ts | 3 +- packages/celotool/src/cmds/generate/bip32.ts | 5 +- .../src/cmds/generate/faucet-load-test.ts | 10 +- .../src/cmds/generate/genesis-file.ts | 2 +- .../src/cmds/generate/istanbul-extra.ts | 2 +- .../cmds/generate/prepare-load-test-client.ts | 4 +- .../celotool/src/cmds/generate/public-key.ts | 4 +- .../celotool/src/cmds/geth/create_account.ts | 4 +- .../src/cmds/geth/get_gold_balance.ts | 2 +- packages/celotool/src/cmds/geth/run.ts | 2 +- .../celotool/src/cmds/geth/simulate_client.ts | 13 +- packages/celotool/src/cmds/geth/start.ts | 4 +- packages/celotool/src/cmds/geth/trace.ts | 11 +- .../src/cmds/transactions/describe.ts | 2 +- .../celotool/src/cmds/transactions/list.ts | 6 +- .../celotool/src/cmds/unfreeze_contracts.ts | 6 +- .../e2e-tests/blockchain_parameters_tests.ts | 1 - .../celotool/src/e2e-tests/cip35_tests.ts | 15 +- .../src/e2e-tests/governance_tests.ts | 12 +- .../celotool/src/e2e-tests/replica_tests.ts | 9 +- .../celotool/src/e2e-tests/slashing_tests.ts | 1 - packages/celotool/src/e2e-tests/sync_tests.ts | 5 +- .../celotool/src/e2e-tests/transfer_tests.ts | 9 +- packages/celotool/src/e2e-tests/utils.ts | 9 +- packages/celotool/src/lib/artifacts.ts | 4 +- packages/celotool/src/lib/generate_utils.ts | 2 +- packages/celotool/src/lib/geth.ts | 40 +- packages/celotool/src/lib/port_forward.ts | 8 +- packages/celotool/src/lib/pubsub.ts | 2 +- packages/dev-utils/package.json | 2 +- packages/dev-utils/src/ganache-setup.ts | 53 +- packages/dev-utils/src/ganache-teardown.ts | 9 +- packages/dev-utils/src/ganache-test.ts | 7 +- packages/dev-utils/src/matchers.ts | 6 +- packages/dev-utils/src/network.ts | 4 +- packages/env-tests/package.json | 2 +- packages/env-tests/src/logger.ts | 14 +- packages/env-tests/src/monorepoRun.ts | 5 +- packages/env-tests/src/tests/exchange.ts | 1 + packages/env-tests/src/tests/granda-mento.ts | 263 ----- packages/env-tests/src/tests/oracle.ts | 1 + packages/env-tests/src/tests/reserve.ts | 1 + packages/env-tests/src/tests/transfer.ts | 3 +- packages/protocol/.eslintrc.js | 6 + packages/protocol/lib/bytecode.ts | 2 +- .../protocol/lib/compatibility/ast-version.ts | 4 +- packages/protocol/lib/compatibility/change.ts | 2 +- packages/protocol/lib/compatibility/report.ts | 4 +- .../lib/compatibility/verify-bytecode.ts | 12 +- .../protocol/lib/compatibility/version.ts | 12 +- packages/protocol/lib/test-utils.ts | 48 +- packages/protocol/lib/web3-utils.ts | 20 +- .../protocol/migrations_ts/02_registry.ts | 2 +- packages/protocol/migrations_ts/03_freezer.ts | 1 - .../protocol/migrations_ts/04_goldtoken.ts | 1 - .../migrations_ts/05_sortedoracles.ts | 1 - .../migrations_ts/06_gaspriceminimum.ts | 1 - packages/protocol/migrations_ts/08_reserve.ts | 1 - .../migrations_ts/09_01_stableToken_EUR.ts | 1 - .../migrations_ts/09_02_stableToken_BRL.ts | 1 - .../migrations_ts/09_0_stabletoken_USD.ts | 1 - .../migrations_ts/10_01_exchange_EUR.ts | 2 - .../migrations_ts/10_02_exchange_BRL.ts | 2 - .../migrations_ts/10_0_exchange_USD.ts | 2 - .../protocol/migrations_ts/14_election.ts | 1 - .../protocol/migrations_ts/24_grandamento.ts | 2 - .../protocol/migrations_ts/28_governance.ts | 4 +- .../migrations_ts/29_elect_validators.ts | 3 +- packages/protocol/package.json | 4 +- packages/protocol/runTests.js | 4 +- packages/protocol/scripts/build.ts | 18 +- packages/protocol/scripts/check-opcodes.ts | 7 +- packages/protocol/scripts/devchain.ts | 67 +- .../scripts/make-release-3-changes.ts | 15 +- .../scripts/make-release-6-changes.ts | 13 +- .../prepare-contracts-and-abis-publishing.ts | 5 +- packages/protocol/scripts/sourcify-publish.ts | 31 +- packages/protocol/scripts/truffle/govern.ts | 5 +- .../protocol/scripts/truffle/make-release.ts | 26 +- .../scripts/truffle/set_block_gas_limit.ts | 3 +- .../scripts/truffle/verify-bytecode.ts | 8 +- packages/protocol/test/common/feehandler.ts | 6 +- packages/protocol/test/common/migration.ts | 8 +- .../test/common/uniswapfeehandlerseller.ts | 2 +- .../test/governance/voting/election.ts | 6 +- .../test/governance/voting/release_gold.ts | 4 +- packages/protocol/truffle-config-parent.js | 2 +- .../noGlobalArrowFunctionsRule.js | 49 - .../noGlobalArrowFunctionsRule.ts | 44 - packages/typescript/package.json | 11 +- packages/typescript/tsconfig.json | 17 - packages/typescript/tslint.json | 38 - patches/tslint+5.20.0.patch | 12 - scripts/check-packages.js | 2 +- scripts/hooks/pre-push.js | 2 +- tslint-to-eslint-config.log | 31 + yarn.lock | 918 ++++++++++++++---- 115 files changed, 1439 insertions(+), 991 deletions(-) delete mode 100644 .babelrc create mode 100644 .eslintrc.js create mode 100644 packages/celotool/.eslintrc.js delete mode 100644 packages/env-tests/src/tests/granda-mento.ts create mode 100644 packages/protocol/.eslintrc.js delete mode 100644 packages/typescript/custom-rules/noGlobalArrowFunctionsRule.js delete mode 100644 packages/typescript/custom-rules/noGlobalArrowFunctionsRule.ts delete mode 100644 packages/typescript/tsconfig.json delete mode 100644 packages/typescript/tslint.json delete mode 100644 patches/tslint+5.20.0.patch create mode 100644 tslint-to-eslint-config.log diff --git a/.babelrc b/.babelrc deleted file mode 100644 index a9ce1369e61..00000000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["react-native"] -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000000..143888996b4 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,279 @@ +/* +👋 Hi! This file was autogenerated by tslint-to-eslint-config. +https://github.com/typescript-eslint/tslint-to-eslint-config + +It represents the closest reasonable ESLint configuration to this +project's original TSLint configuration. + +We recommend eventually switching this configuration to extend from +the recommended rulesets in typescript-eslint. +https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md + +Happy linting! 💖 +*/ +module.exports = { + env: { + es6: true, + node: true, + }, + ignorePatterns: [ + '**/node_modules/**', + '**/coverage/**', + '**/build/**', + '**/dist/**', + '**/lib/**', + '**/*.js', + 'packages/protocol/build/**', + 'packages/protocol/types/**', + '/packages/protocol/migrations_ts/**', + 'packages/protocol/scripts/truffle/**', + // ignoring any files that for which "TSConfig does not include this file" error was given + 'packages/protocol/scripts/utils.test.ts', + 'packages/protocol/truffle-config.js', + 'packages/protocol/truffle-config0.8.js', + 'packages/protocol/truffle-config-parent.js', + 'packages/protocol/abis', + 'packages/protocol/test/**', + 'packages/protocol/wagmi.config.ts', + '**/jest.config.js', + ], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-type-checked', + ], + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: `${__dirname}`, + project: ['./packages/typescript/tsconfig.library.json', './packages/*/tsconfig.json'], + sourceType: 'module', + }, + plugins: ['eslint-plugin-import', '@typescript-eslint'], + root: true, + rules: { + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, + ], + + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': [ + 'error', + { + default: 'array', + }, + ], + '@typescript-eslint/ban-types': [ + 'error', + { + types: { + Object: { + message: 'Avoid using the `Object` type. Did you mean `object`?', + }, + Function: { + message: + 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.', + }, + Boolean: { + message: 'Avoid using the `Boolean` type. Did you mean `boolean`?', + }, + Number: { + message: 'Avoid using the `Number` type. Did you mean `number`?', + }, + String: { + message: 'Avoid using the `String` type. Did you mean `string`?', + }, + Symbol: { + message: 'Avoid using the `Symbol` type. Did you mean `symbol`?', + }, + }, + }, + ], + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-member-accessibility': [ + 'off', + { + accessibility: 'explicit', + }, + ], + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/indent': 'off', + '@typescript-eslint/member-delimiter-style': [ + 'off', + { + multiline: { + delimiter: 'none', + requireLast: true, + }, + singleline: { + delimiter: 'semi', + requireLast: false, + }, + }, + ], + '@typescript-eslint/naming-convention': [ + 'off', + { + selector: 'variable', + format: ['camelCase', 'UPPER_CASE'], + leadingUnderscore: 'forbid', + trailingUnderscore: 'forbid', + }, + ], + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-parameter-properties': 'off', + '@typescript-eslint/no-shadow': [ + 'error', + { + hoist: 'all', + }, + ], + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unused-expressions': 'error', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + '@typescript-eslint/quotes': 'off', + '@typescript-eslint/semi': ['off', null], + '@typescript-eslint/triple-slash-reference': [ + 'error', + { + path: 'always', + types: 'prefer-import', + lib: 'always', + }, + ], + '@typescript-eslint/type-annotation-spacing': 'off', + '@typescript-eslint/typedef': 'off', + '@typescript-eslint/unified-signatures': 'error', + 'arrow-parens': ['off', 'always'], + 'brace-style': ['off', 'off'], + 'comma-dangle': 'off', + complexity: 'off', + 'constructor-super': 'error', + 'dot-notation': 'off', + 'eol-last': 'off', + eqeqeq: ['error', 'smart'], + 'guard-for-in': 'error', + 'id-denylist': 'error', + 'id-match': 'error', + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: false, + }, + ], + 'import/no-internal-modules': 'off', + indent: 'off', + 'linebreak-style': 'off', + 'max-classes-per-file': ['error', 1], + 'max-len': 'off', + 'new-parens': 'off', + 'newline-per-chained-call': 'off', + 'no-bitwise': 'error', + 'no-caller': 'error', + 'no-cond-assign': 'error', + 'no-console': [ + 'error', + { + allow: [ + 'warn', + 'dir', + 'time', + 'timeEnd', + 'timeLog', + 'trace', + 'assert', + 'clear', + 'count', + 'countReset', + 'group', + 'groupEnd', + 'table', + 'debug', + 'info', + 'dirxml', + 'error', + 'groupCollapsed', + 'Console', + 'profile', + 'profileEnd', + 'timeStamp', + 'context', + ], + }, + ], + 'no-constant-condition': 'error', + 'no-debugger': 'error', + 'no-duplicate-case': 'error', + 'no-duplicate-imports': 'error', + 'no-empty': 'error', + 'no-empty-function': 'off', + 'no-eval': 'error', + 'no-extra-bind': 'error', + 'no-extra-semi': 'off', + 'no-fallthrough': 'off', + 'no-invalid-this': 'off', + 'no-irregular-whitespace': 'off', + 'no-multiple-empty-lines': 'off', + 'no-new-func': 'error', + 'no-new-wrappers': 'error', + 'no-redeclare': 'error', + 'no-restricted-syntax': ['error', 'ForInStatement'], + 'no-return-await': 'error', + 'no-sequences': 'error', + 'no-shadow': 'off', + 'no-sparse-arrays': 'error', + 'no-template-curly-in-string': 'error', + 'no-throw-literal': 'error', + 'no-trailing-spaces': 'off', + 'no-undef-init': 'error', + 'no-underscore-dangle': 'error', + 'no-unsafe-finally': 'error', + 'no-unused-expressions': 'off', + 'no-unused-labels': 'error', + 'no-use-before-define': 'off', + 'no-var': 'error', + 'object-shorthand': 'error', + 'one-var': ['off', 'never'], + 'padded-blocks': [ + 'off', + { + blocks: 'never', + }, + { + allowSingleLineBlocks: true, + }, + ], + 'prefer-const': 'error', + 'prefer-object-spread': 'error', + 'quote-props': 'off', + quotes: 'off', + radix: 'error', + semi: 'off', + 'space-before-function-paren': 'off', + 'space-in-parens': ['off', 'never'], + 'spaced-comment': [ + 'error', + 'always', + { + markers: ['/'], + }, + ], + 'use-isnan': 'error', + 'valid-typeof': 'off', + }, +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b1004ffe9f..ed8cd18653f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -43,7 +43,6 @@ "javascript.format.enable": false, "editor.tabSize": 2, "editor.detectIndentation": false, - "tslint.jsEnable": true, "typescript.tsdk": "node_modules/typescript/lib", "[javascriptreact][typescript][typescriptreact]": { "editor.codeActionsOnSave": { diff --git a/package.json b/package.json index fadefe545e9..e6332be3b7a 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,12 @@ "@types/node": "18.7.16", "@types/prompt": "1.1.1", "@types/semver": "7.3.8", + "@typescript-eslint/eslint-plugin": "^6.19.0", + "@typescript-eslint/parser": "^6.19.0", "codecov": "^3.6.5", "colors": "1.4.0", + "eslint": "^8.56.0", + "eslint-plugin-import": "^2.29.1", "husky": "^8.0.0", "jest": "^29.0.2", "lerna": "^5.5.0", @@ -57,9 +61,7 @@ "ts-jest": "^29.0.0", "ts-node": "^10.9.1", "tsconfig-paths": "^3.8.0", - "tslint": "^5.20.0", - "typescript": "4.7.4", - "typescript-tslint-plugin": "^0.5.4" + "typescript": "^5.3.3" }, "resolutions": { "ganache": "npm:@soloseng/ganache@7.8.0-beta.1", @@ -68,4 +70,4 @@ "@types/bn.js": "4.11.6", "bignumber.js": "9.0.0" } -} \ No newline at end of file +} diff --git a/packages/celotool/.eslintrc.js b/packages/celotool/.eslintrc.js new file mode 100644 index 00000000000..63096d24e87 --- /dev/null +++ b/packages/celotool/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + rules: { + 'no-underscore-dangle': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + 'no-bitwise': 'off', + }, +} diff --git a/packages/celotool/package.json b/packages/celotool/package.json index 297c076b1e8..2e56c349d89 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -29,8 +29,11 @@ "compare-versions": "^3.5.1", "dotenv": "^16.0.3", "ecurve": "^1.0.6", + "eth-lib": "^0.2.8", "ethereum-cryptography": "1.2.0", "generate-password": "^1.5.1", + "rlp": "^2.2.4", + "minimist": "^1.2.5", "js-yaml": "^3.13.1", "lodash": "^4.17.21", "node-fetch": "^2.6.7", @@ -39,6 +42,8 @@ "sleep-promise": "^8.0.1", "string-hash": "^1.1.3", "tiny-secp256k1": "2.2.1", + "chai": "^4.3.7", + "mocha": "^10.2.0", "web3": "1.10.0", "web3-eth-admin": "1.0.0-beta.55", "yargs": "17.7.2" @@ -54,13 +59,11 @@ "@types/prompts": "^1.1.1", "@types/string-hash": "^1.1.1", "@types/yargs": "^13.0.2", - "chai": "^4.3.7", - "mocha": "^10.2.0", "web3-core": "1.10.0" }, "scripts": { "cli": "TS_NODE_FILES=true ts-node -r tsconfig-paths/register src/cli.ts", - "lint": "tslint -c tslint.json --project tsconfig.json", + "lint": "yarn run --top-level eslint .", "build": "tsc -b ." }, "private": true diff --git a/packages/celotool/src/cli.ts b/packages/celotool/src/cli.ts index c74f74af968..92c6f6071fd 100755 --- a/packages/celotool/src/cli.ts +++ b/packages/celotool/src/cli.ts @@ -1,7 +1,7 @@ #!/usr/bin/env yarn run ts-node -r tsconfig-paths/register --cwd ../celotool import yargs from 'yargs' -// tslint:disable-next-line: no-unused-expression +// eslint-disable-next-line @typescript-eslint/no-unused-expressions yargs .scriptName('celotooljs') .option('verbose', { diff --git a/packages/celotool/src/cmds/account/faucet.ts b/packages/celotool/src/cmds/account/faucet.ts index f22b606767a..6422fa022c4 100644 --- a/packages/celotool/src/cmds/account/faucet.ts +++ b/packages/celotool/src/cmds/account/faucet.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-console */ import { newKitFromWeb3 } from '@celo/contractkit' import { celoTokenInfos, CeloTokenType, Token } from '@celo/contractkit/lib/celo-tokens' import { concurrentMap, sleep } from '@celo/utils/lib/async' @@ -65,7 +64,7 @@ export const builder = (argv: yargs.Argv) => { } // Note: this does not check if token has been deployed on network if (!validCeloTokens.includes(token as CeloTokenType)) { - throw Error(`Invalid token '${token}', must be one of: ${validCeloTokens}.`) + throw Error(`Invalid token '${token}', must be one of: ${validCeloTokens.join('|')}.`) } if (!(amount && /^\d+$/.test(amount))) { throw Error(`Invalid amount '${amount}', must consist of only numbers.`) @@ -102,7 +101,7 @@ export const handler = async (argv: FaucetArgv) => { const web3 = new Web3('http://localhost:8545') const kit = newKitFromWeb3(web3) const account = (await kit.connection.getAccounts())[0] - console.log(`Using account: ${account}`) + console.info(`Using account: ${account}`) kit.connection.defaultAccount = account // Check that input token has been deployed to this network @@ -115,7 +114,9 @@ export const handler = async (argv: FaucetArgv) => { argv.tokenParams.map((tokenParam) => { if (!deployedCeloTokens.includes(tokenParam.token)) { throw Error( - `Invalid token '${tokenParam.token}' (or not yet deployed on ${argv.celoEnv}) must be one of: ${deployedCeloTokens}.` + `Invalid token '${tokenParam.token}' (or not yet deployed on ${ + argv.celoEnv + }) must be one of: ${deployedCeloTokens.join('|')}.` ) } }) @@ -137,7 +138,7 @@ export const handler = async (argv: FaucetArgv) => { } } const tokenAmount = await convertToContractDecimals(tokenParams.amount, tokenWrapper) - console.log(`Fauceting ${tokenAmount.toFixed()} of ${tokenParams.token} to ${address}`) + console.info(`Fauceting ${tokenAmount.toFixed()} of ${tokenParams.token} to ${address}`) if (tokenParams.token === Token.CELO) { // Special handling for reserve transfer @@ -148,7 +149,7 @@ export const handler = async (argv: FaucetArgv) => { } } await tokenWrapper.transfer(address, tokenAmount.toFixed()).sendAndWaitForReceipt() - console.log(`Successfully fauceted ${tokenParams.token}`) + console.info(`Successfully fauceted ${tokenParams.token}`) } } // Ensure all faucets attempts are independent of failures and report failures. diff --git a/packages/celotool/src/cmds/account/list.ts b/packages/celotool/src/cmds/account/list.ts index ce57a4fe5b5..dae437d275b 100644 --- a/packages/celotool/src/cmds/account/list.ts +++ b/packages/celotool/src/cmds/account/list.ts @@ -29,7 +29,7 @@ export const handler = async (argv: ListArgv) => { await switchToClusterFromEnv(argv.celoEnv, false, true) - console.log(`Getting list of users for "${argv.celoEnv}" environment`) + console.info(`Getting list of users for "${argv.celoEnv}" environment`) const resp = await fetch(listUsersUrl) const jsonResp = await resp.json() await handleListOfUsers(domain, jsonResp, process.env.CELOTOOL_VERBOSE === 'true') @@ -37,7 +37,7 @@ export const handler = async (argv: ListArgv) => { async function handleListOfUsers(domain: string, json: any, verboseMode: boolean) { if (verboseMode) { - console.log('verbose mode enabled') + console.info('verbose mode enabled') } const transactionUrlPrefix = `${domain}/api?module=account&action=tokentx&address=` const users = new Set() @@ -45,7 +45,7 @@ async function handleListOfUsers(domain: string, json: any, verboseMode: boolean users.add(object.from) } - console.log(`Num of users: ${users.size}`) + console.info(`Num of users: ${users.size}`) const usersArray = Array.from(users.values()) const usersAndTransactions = new Array(usersArray.length) @@ -100,7 +100,7 @@ async function handleListOfUsers(domain: string, json: any, verboseMode: boolean if (knownAccounts.has(address)) { infoString = `${infoString} (${knownAccounts.get(address)}` } - console.log(infoString) + console.info(infoString) } } diff --git a/packages/celotool/src/cmds/backup.ts b/packages/celotool/src/cmds/backup.ts index 99e8a93a47b..1813590ebf1 100644 --- a/packages/celotool/src/cmds/backup.ts +++ b/packages/celotool/src/cmds/backup.ts @@ -39,5 +39,5 @@ export const handler = async (argv: BackupArgv) => { const createSnapshotCommand = `gcloud compute disks snapshot ${pdId} --zone ${zone} --snapshot-names ${snapshotName}` await execCmdWithExitOnFailure(createSnapshotCommand) const gcloudSnapshotsUrl = 'https://console.cloud.google.com/compute/snapshots' - console.info(`Snapshot \"${snapshotName}\" can be seen at ${gcloudSnapshotsUrl}`) + console.info(`Snapshot "${snapshotName}" can be seen at ${gcloudSnapshotsUrl}`) } diff --git a/packages/celotool/src/cmds/contract_addresses.ts b/packages/celotool/src/cmds/contract_addresses.ts index 23b07b01728..db3e000867f 100644 --- a/packages/celotool/src/cmds/contract_addresses.ts +++ b/packages/celotool/src/cmds/contract_addresses.ts @@ -1,6 +1,6 @@ import * as fs from 'fs' import { CONTRACTS_TO_COPY, downloadArtifacts, getContractAddresses } from 'src/lib/artifacts' -import { addCeloEnvMiddleware, CeloEnvArgv } from 'src/lib/env-utils' +import { CeloEnvArgv, addCeloEnvMiddleware } from 'src/lib/env-utils' import yargs from 'yargs' export const command = 'contract-addresses' @@ -36,7 +36,6 @@ export const handler = async (argv: CopyContractArtifactsArgs) => { if (argv.outputPath) { fs.writeFileSync(argv.outputPath, JSON.stringify(addressMap, null, 2)) } else { - // tslint:disable-next-line: no-console - console.log(addressMap) + console.info(addressMap) } } diff --git a/packages/celotool/src/cmds/deploy/destroy/cluster.ts b/packages/celotool/src/cmds/deploy/destroy/cluster.ts index b4cb62058d4..9173803453a 100644 --- a/packages/celotool/src/cmds/deploy/destroy/cluster.ts +++ b/packages/celotool/src/cmds/deploy/destroy/cluster.ts @@ -12,7 +12,7 @@ export const builder = {} export const handler = async (argv: DestroyArgv) => { exitIfCelotoolHelmDryRun() - const envType = fetchEnv(envVar.ENV_TYPE) + const envType = fetchEnv(envVar.ENV_TYPE) as envTypes if (envType !== envTypes.DEVELOPMENT) { console.error('You can only delete dev clusters') process.exit(1) diff --git a/packages/celotool/src/cmds/deploy/initial/blockchain-api.ts b/packages/celotool/src/cmds/deploy/initial/blockchain-api.ts index e50a4f9699a..e3a1e9d6850 100644 --- a/packages/celotool/src/cmds/deploy/initial/blockchain-api.ts +++ b/packages/celotool/src/cmds/deploy/initial/blockchain-api.ts @@ -17,9 +17,12 @@ export const handler = async (argv: BlockchainApiArgv) => { const newFaucetAddress = getAddressFromEnv(AccountType.VALIDATOR, 0) // We use the 0th validator as the faucet console.info(`updating blockchain-api yaml file for env ${argv.celoEnv}`) await execCmd( + // eslint-disable-next-line no-useless-escape `sed -i.bak 's/FAUCET_ADDRESS: .*$/FAUCET_ADDRESS: \"${newFaucetAddress}\"/g' ../blockchain-api/app.${argv.celoEnv}.yaml` ) await execCmd(`rm ../blockchain-api/app.${argv.celoEnv}.yaml.bak`) // Removing temporary bak file + + // eslint-disable-next-line @typescript-eslint/unbound-method, @typescript-eslint/restrict-template-expressions console.info(`deploying blockchain-api for env ${argv.config}`) await execCmd(`yarn --cwd ../blockchain-api run deploy -n ${argv.celoEnv}`) console.info(`blockchain-api deploy complete`) diff --git a/packages/celotool/src/cmds/deploy/initial/contracts.ts b/packages/celotool/src/cmds/deploy/initial/contracts.ts index a5544537eb0..5c3ba4dd4c4 100644 --- a/packages/celotool/src/cmds/deploy/initial/contracts.ts +++ b/packages/celotool/src/cmds/deploy/initial/contracts.ts @@ -76,7 +76,7 @@ export const handler = async (argv: ContractsArgv) => { exitIfCelotoolHelmDryRun() await switchToClusterFromEnv(argv.celoEnv) - console.log(`Deploying smart contracts to ${argv.celoEnv}`) + console.info(`Deploying smart contracts to ${argv.celoEnv}`) const cb = async () => { await execCmd( `yarn --cwd ../protocol run init-network -n ${argv.celoEnv} -c '${JSON.stringify( diff --git a/packages/celotool/src/cmds/deploy/upgrade/faucet.ts b/packages/celotool/src/cmds/deploy/upgrade/faucet.ts index 13a684f6143..679bab23859 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/faucet.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/faucet.ts @@ -36,7 +36,7 @@ function getEnvMnemonic(env: string): string { if (envMemonicResult.error) { throw envMemonicResult.error } else if (envMemonicResult.parsed) { - return envMemonicResult.parsed.MNEMONIC as string + return envMemonicResult.parsed.MNEMONIC } throw new Error('Could not get mnmonic') } @@ -79,7 +79,7 @@ export const handler = async (argv: UpgradeFaucetArgs) => { // // Need to clear because we generate the same account each time here. console.info(`Clearing accounts for network ${argv.celoEnv} on ${argv.firebaseProject}`) - await execSync(`yarn --cwd ../faucet cli accounts:clear --net ${argv.celoEnv}`, { + execSync(`yarn --cwd ../faucet cli accounts:clear --net ${argv.celoEnv}`, { stdio: 'inherit', }) diff --git a/packages/celotool/src/cmds/deploy/upgrade/hotfix.ts b/packages/celotool/src/cmds/deploy/upgrade/hotfix.ts index ff5e14c552e..0554873625d 100644 --- a/packages/celotool/src/cmds/deploy/upgrade/hotfix.ts +++ b/packages/celotool/src/cmds/deploy/upgrade/hotfix.ts @@ -17,7 +17,7 @@ export const command = 'hotfix' export const describe = 'runs a hotfix' -type EthstatsArgv = UpgradeArgv & {} +type EthstatsArgv = UpgradeArgv export const builder = (argv: yargs.Argv) => { return argv @@ -92,7 +92,11 @@ export const handler = async (argv: EthstatsArgv) => { try { await governance.whitelistHotfix(proposalHash).sendAndWaitForReceipt({ from: address }) } catch (error) { - console.error(`Error whitelisting for validator ${index} (${address}): ${error}`) + console.error( + `Error whitelisting for validator ${index} (${address}): ${ + error instanceof Error ? JSON.stringify(error) : error?.toString() + }` + ) } }) diff --git a/packages/celotool/src/cmds/fork_env.ts b/packages/celotool/src/cmds/fork_env.ts index e03e3185fa2..fbbd2f96187 100644 --- a/packages/celotool/src/cmds/fork_env.ts +++ b/packages/celotool/src/cmds/fork_env.ts @@ -32,7 +32,7 @@ export const builder = (args: yargs.Argv) => { }) } -export const handler = async (argv: ForkEnvArgs) => { +export const handler = (argv: ForkEnvArgs) => { const genericEnvFile = readFileSync(genericEnvFilePath) const defaultEnvVars = parse(genericEnvFile) diff --git a/packages/celotool/src/cmds/generate/account-address.ts b/packages/celotool/src/cmds/generate/account-address.ts index 40ec6ba5148..aff7d7f1450 100644 --- a/packages/celotool/src/cmds/generate/account-address.ts +++ b/packages/celotool/src/cmds/generate/account-address.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-console */ import { coerceMnemonicAccountType, generateAddress, @@ -45,11 +44,11 @@ export const builder = (argv: yargs.Argv) => { }) } -export const handler = async (argv: AccountAddressArgv) => { +export const handler = (argv: AccountAddressArgv) => { if (argv.privateKey) { - console.log(privateKeyToAddress(argv.privateKey)) + console.info(privateKeyToAddress(argv.privateKey)) } else if (argv.mnemonic && argv.accountType && argv.index != null) { - console.log( + console.info( generateAddress(argv.mnemonic, coerceMnemonicAccountType(argv.accountType), argv.index) ) } else { diff --git a/packages/celotool/src/cmds/generate/address-from-env.ts b/packages/celotool/src/cmds/generate/address-from-env.ts index 7a51ce54816..e292a3e11b6 100644 --- a/packages/celotool/src/cmds/generate/address-from-env.ts +++ b/packages/celotool/src/cmds/generate/address-from-env.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-console */ import { addCeloEnvMiddleware, CeloEnvArgv } from 'src/lib/env-utils' import { coerceMnemonicAccountType, @@ -36,7 +35,7 @@ export const builder = (argv: yargs.Argv) => { ) } -export const handler = async (argv: CeloEnvArgv & AccountAddressArgv) => { +export const handler = (argv: CeloEnvArgv & AccountAddressArgv) => { const validatorAddress = getAddressFromEnv( coerceMnemonicAccountType(argv.accountType), argv.index diff --git a/packages/celotool/src/cmds/generate/bip32.ts b/packages/celotool/src/cmds/generate/bip32.ts index 87487f6c9df..eb95aaf3670 100644 --- a/packages/celotool/src/cmds/generate/bip32.ts +++ b/packages/celotool/src/cmds/generate/bip32.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-console */ import { coerceMnemonicAccountType, generatePrivateKey, @@ -44,8 +43,8 @@ export const builder = (argv: yargs.Argv) => { * https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki * https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki */ -export const handler = async (argv: Bip32Argv) => { - console.log( +export const handler = (argv: Bip32Argv) => { + console.info( generatePrivateKey(argv.mnemonic, coerceMnemonicAccountType(argv.accountType), argv.index) ) } diff --git a/packages/celotool/src/cmds/generate/faucet-load-test.ts b/packages/celotool/src/cmds/generate/faucet-load-test.ts index 230438f082f..2fae45c3eb9 100644 --- a/packages/celotool/src/cmds/generate/faucet-load-test.ts +++ b/packages/celotool/src/cmds/generate/faucet-load-test.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-console */ import { newKit } from '@celo/contractkit' import { switchToClusterFromEnv } from 'src/lib/cluster' import { convertToContractDecimals } from 'src/lib/contract-utils' @@ -65,7 +64,7 @@ export const handler = async (argv: CeloEnvArgv & FaucetLoadTest) => { const cb = async () => { const kit = newKit('http://localhost:8545') const account = (await kit.web3.eth.getAccounts())[0] - console.log(`Using account: ${account}`) + console.info(`Using account: ${account}`) kit.defaultAccount = account const [goldToken, stableToken] = await Promise.all([ @@ -82,9 +81,9 @@ export const handler = async (argv: CeloEnvArgv & FaucetLoadTest) => { for (let threadIndex = argv.threads_from; threadIndex <= argv.threads_to; threadIndex++) { const index = getIndexForLoadTestThread(podIndex, threadIndex) const address = generateAddress(mnemonic, accountType, index) - console.log(`${index} --> Fauceting ${goldAmount.toFixed()} Gold to ${address}`) + console.info(`${index} --> Fauceting ${goldAmount.toFixed()} Gold to ${address}`) await goldToken.transfer(address, goldAmount.toFixed()).send() - console.log(`${index} --> Fauceting ${stableTokenAmount.toFixed()} Dollars to ${address}`) + console.info(`${index} --> Fauceting ${stableTokenAmount.toFixed()} Dollars to ${address}`) await stableToken.transfer(address, stableTokenAmount.toFixed()).send() } } @@ -92,7 +91,8 @@ export const handler = async (argv: CeloEnvArgv & FaucetLoadTest) => { try { await portForwardAnd(argv.celoEnv, cb) - await cb + // note this wasnt called before + await cb() } catch (error) { console.error(`Unable to faucet load-test accounts on ${argv.celoEnv}`) console.error(error) diff --git a/packages/celotool/src/cmds/generate/genesis-file.ts b/packages/celotool/src/cmds/generate/genesis-file.ts index 28b4a63afe6..74b9fb24db0 100644 --- a/packages/celotool/src/cmds/generate/genesis-file.ts +++ b/packages/celotool/src/cmds/generate/genesis-file.ts @@ -12,7 +12,7 @@ export const builder = (argv: yargs.Argv) => { return addCeloEnvMiddleware(argv) } -export const handler = async (_argv: GenesisFileArgv) => { +export const handler = (_argv: GenesisFileArgv) => { const genesisFile = generateGenesisFromEnv() console.info(genesisFile) } diff --git a/packages/celotool/src/cmds/generate/istanbul-extra.ts b/packages/celotool/src/cmds/generate/istanbul-extra.ts index 73810ccf50a..28e4fd8d691 100644 --- a/packages/celotool/src/cmds/generate/istanbul-extra.ts +++ b/packages/celotool/src/cmds/generate/istanbul-extra.ts @@ -27,7 +27,7 @@ export const builder = (argv: yargs.Argv) => { ) } -export const handler = async (argv: IstanbulExtraArgv) => { +export const handler = (argv: IstanbulExtraArgv) => { const validators: Validator[] = argv.validators === 'env' ? getValidatorsInformation( diff --git a/packages/celotool/src/cmds/generate/prepare-load-test-client.ts b/packages/celotool/src/cmds/generate/prepare-load-test-client.ts index 07da73f9a64..14721d7ed03 100644 --- a/packages/celotool/src/cmds/generate/prepare-load-test-client.ts +++ b/packages/celotool/src/cmds/generate/prepare-load-test-client.ts @@ -36,7 +36,7 @@ export const builder = (argv: yargs.Argv) => { }) } -export const handler = async (argv: Bip32Argv) => { +export const handler = (argv: Bip32Argv) => { const accountType = AccountType.LOAD_TESTING_ACCOUNT for (let t = 0; t < argv.threads; t++) { const index = argv.index * 10000 + t @@ -45,6 +45,6 @@ export const handler = async (argv: Bip32Argv) => { const address = privateKeyToAddress(privateKey) fs.writeFileSync(`/root/.celo/pkey${t}`, `${privateKey}\n`) fs.appendFileSync(`/root/.celo/address`, `${address}\n`) - console.log(`Address for index ${argv.index} and thread ${t} --> ${address}`) + console.info(`Address for index ${argv.index} and thread ${t} --> ${address}`) } } diff --git a/packages/celotool/src/cmds/generate/public-key.ts b/packages/celotool/src/cmds/generate/public-key.ts index 43b33f6e9db..6f43c3873e5 100644 --- a/packages/celotool/src/cmds/generate/public-key.ts +++ b/packages/celotool/src/cmds/generate/public-key.ts @@ -45,8 +45,8 @@ export const builder = (argv: yargs.Argv) => { * https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki * https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki */ -export const handler = async (argv: Bip32Argv) => { - console.log( +export const handler = (argv: Bip32Argv) => { + console.info( privateKeyToPublicKey( generatePrivateKey(argv.mnemonic, coerceMnemonicAccountType(argv.accountType), argv.index) ) diff --git a/packages/celotool/src/cmds/geth/create_account.ts b/packages/celotool/src/cmds/geth/create_account.ts index 5104f5e8b0b..6a2f7bcaf49 100644 --- a/packages/celotool/src/cmds/geth/create_account.ts +++ b/packages/celotool/src/cmds/geth/create_account.ts @@ -3,7 +3,7 @@ import fs from 'fs' import path from 'path' import { switchToClusterFromEnv } from 'src/lib/cluster' import { execCmd, execCmdWithExitOnFailure } from 'src/lib/cmd-utils' -import { addCeloEnvMiddleware, CeloEnvArgv } from 'src/lib/env-utils' +import { CeloEnvArgv, addCeloEnvMiddleware } from 'src/lib/env-utils' import { fetchPassword } from 'src/lib/geth' import { addCeloGethMiddleware } from 'src/lib/utils' import yargs from 'yargs' @@ -81,7 +81,7 @@ export const handler = async (argv: CreateAccountArgv) => { console.info(`Created account address: 0x${address}`) if (needFaucet) { - console.log(`Fauceting 0x${address} on ${env}`) + console.info(`Fauceting 0x${address} on ${env}`) await execCmdWithExitOnFailure( `yarn --cwd ${process.cwd()} run cli account faucet -e ${env} --account 0x${address}` ) diff --git a/packages/celotool/src/cmds/geth/get_gold_balance.ts b/packages/celotool/src/cmds/geth/get_gold_balance.ts index 35e9613b1c0..aeb2ec4798d 100644 --- a/packages/celotool/src/cmds/geth/get_gold_balance.ts +++ b/packages/celotool/src/cmds/geth/get_gold_balance.ts @@ -39,7 +39,7 @@ export const handler = async (argv: GetGoldBalanceArgv) => { if (account.length !== 42) { invalidArgumentExit(account, 'Account must be 40 hex-chars') } - + // eslint-disable-next-line no-useless-escape const jsCmd = `eth.getBalance\('${account}'\)` const returnValues = await execGethJsCmd(gethBinary, datadir, jsCmd) console.info('Gold balance: ' + returnValues[0]) diff --git a/packages/celotool/src/cmds/geth/run.ts b/packages/celotool/src/cmds/geth/run.ts index 97b05107489..c6f2be712f7 100644 --- a/packages/celotool/src/cmds/geth/run.ts +++ b/packages/celotool/src/cmds/geth/run.ts @@ -80,7 +80,7 @@ export const builder = (argv: yargs.Argv) => { ) } -export const handler = async (argv: RunArgv) => { +export const handler = (argv: RunArgv) => { const gethBinary = `${argv.gethDir}/build/bin/geth` const datadir = argv.dataDir const networkId = argv.networkId diff --git a/packages/celotool/src/cmds/geth/simulate_client.ts b/packages/celotool/src/cmds/geth/simulate_client.ts index d5f9a42c989..51c0d1559be 100644 --- a/packages/celotool/src/cmds/geth/simulate_client.ts +++ b/packages/celotool/src/cmds/geth/simulate_client.ts @@ -2,10 +2,10 @@ import BigNumber from 'bignumber.js' import { AccountType, generateAddress, generatePrivateKey } from 'src/lib/generate_utils' import { - getIndexForLoadTestThread, MAX_LOADTEST_THREAD_COUNT, - simulateClient, TestMode, + getIndexForLoadTestThread, + simulateClient, } from 'src/lib/geth' import * as yargs from 'yargs' export const command = 'simulate-client' @@ -125,16 +125,15 @@ export const handler = async (argv: SimulateClientArgv) => { const web3ProviderPort = argv.reuseClient ? 8545 : 8545 + thread - console.log( + console.info( `PK for sender index ${argv.index} thread ${thread}, final index ${senderIndex}: ${senderPK}` ) - console.log( + console.info( `Account for recipient index ${argv.recipientIndex} thread ${thread}, final index ${recipientIndex}: ${recipientAddress}` ) - console.log(`web3ProviderPort for thread ${thread}: ${web3ProviderPort}`) + console.info(`web3ProviderPort for thread ${thread}: ${web3ProviderPort}`) - // tslint:disable-next-line: no-floating-promises - simulateClient( + await simulateClient( senderPK, recipientAddress, argv.contractAddress, diff --git a/packages/celotool/src/cmds/geth/start.ts b/packages/celotool/src/cmds/geth/start.ts index 9273ceabbf7..a0502571e47 100644 --- a/packages/celotool/src/cmds/geth/start.ts +++ b/packages/celotool/src/cmds/geth/start.ts @@ -281,7 +281,7 @@ export const handler = async (argv: StartArgv) => { if (gethConfig.migrate || gethConfig.migrateTo) { const attestationKeys = getPrivateKeysFor(AccountType.ATTESTATION, mnemonic, instances) - console.log('Migrating contracts (this will take a long time) ...') + console.info('Migrating contracts (this will take a long time) ...') await migrateContracts( monorepoDir, @@ -293,6 +293,6 @@ export const handler = async (argv: StartArgv) => { verbose ) - console.log('... done migrating contracts!') + console.info('... done migrating contracts!') } } diff --git a/packages/celotool/src/cmds/geth/trace.ts b/packages/celotool/src/cmds/geth/trace.ts index 286c6a2bede..07cea411eab 100644 --- a/packages/celotool/src/cmds/geth/trace.ts +++ b/packages/celotool/src/cmds/geth/trace.ts @@ -29,7 +29,7 @@ export const builder = (argv: yargs.Argv) => { } const sleep = (ms: number) => { - return new Promise((resolve: any) => setTimeout(resolve, ms)) + return new Promise((resolve) => setTimeout(resolve, ms)) } export const handler = async (argv: TraceArgv) => { @@ -40,7 +40,7 @@ export const handler = async (argv: TraceArgv) => { checkGethStarted(dataDir) let iterations = 70 - let web3AndContracts = null + let web3AndContracts: Awaited> | null = null outerwhile: while (iterations-- > 0) { try { web3AndContracts = await getWeb3AndTokensContracts() @@ -59,6 +59,10 @@ export const handler = async (argv: TraceArgv) => { await sleep(1000) } } + if (!web3AndContracts) { + console.error('bad start -- could not get contracts') + process.exit(1) + } if (iterations <= 0) { console.warn('Can not wait for geth to sync') @@ -66,7 +70,7 @@ export const handler = async (argv: TraceArgv) => { process.exit(1) } - const { kit, goldToken, stableToken } = web3AndContracts! + const { kit, goldToken, stableToken } = web3AndContracts // This is needed to turn off debug logging which is made in `sendTransaction` // and needed only for mobile client. @@ -77,7 +81,6 @@ export const handler = async (argv: TraceArgv) => { await traceTransactions( kit, goldToken, - // @ts-ignore - TODO: remove when web3 upgrade completed everywhere stableToken, [address1, address2], getBlockscoutUrl(argv.celoEnv) diff --git a/packages/celotool/src/cmds/transactions/describe.ts b/packages/celotool/src/cmds/transactions/describe.ts index 9c6c70c935d..e6df29d4c74 100644 --- a/packages/celotool/src/cmds/transactions/describe.ts +++ b/packages/celotool/src/cmds/transactions/describe.ts @@ -24,7 +24,7 @@ export const handler = async (argv: DescribeArgv) => { await switchToClusterFromEnv(argv.celoEnv, false) const web3 = new Web3(getFornoUrl(argv.celoEnv)) - const kit = await newKitFromWeb3(web3) + const kit = newKitFromWeb3(web3) const blockExplorer = await newBlockExplorer(kit) const logExplorer = await newLogExplorer(kit) const transaction = await web3.eth.getTransaction(argv.transactionHash) diff --git a/packages/celotool/src/cmds/transactions/list.ts b/packages/celotool/src/cmds/transactions/list.ts index 930236e6b1d..b9fb06bb738 100644 --- a/packages/celotool/src/cmds/transactions/list.ts +++ b/packages/celotool/src/cmds/transactions/list.ts @@ -36,13 +36,13 @@ export const handler = async (argv: ListArgv) => { const web3 = await getWeb3Client(argv.celoEnv) const blockscoutURL = getBlockscoutUrl(argv.celoEnv) - const kit = await newKitFromWeb3(web3) + const kit = newKitFromWeb3(web3) const blockExplorer = await newBlockExplorer(kit) const logExplorer = await newLogExplorer(kit) const resp = await fetch( `${blockscoutURL}/api?module=account&action=txlist&address=${argv.address}&sort=desc` ) - const jsonResp = (await resp.json()) as any + const jsonResp = await resp.json() if (jsonResp.result === undefined) { return @@ -88,7 +88,7 @@ async function fetchTx( console.info(`\t${parsedLog.event}(${JSON.stringify(parsedLog.returnValues)})`) } catch (e) { - console.error(`Error while parsing log ${log}`) + console.error(`Error while parsing log ${JSON.stringify(log)}`) } }) } diff --git a/packages/celotool/src/cmds/unfreeze_contracts.ts b/packages/celotool/src/cmds/unfreeze_contracts.ts index 97492b5a981..b0f49aa4f70 100644 --- a/packages/celotool/src/cmds/unfreeze_contracts.ts +++ b/packages/celotool/src/cmds/unfreeze_contracts.ts @@ -1,7 +1,7 @@ /* tslint:disable no-console */ import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { switchToClusterFromEnv } from 'src/lib/cluster' -import { addCeloEnvMiddleware, CeloEnvArgv } from 'src/lib/env-utils' +import { CeloEnvArgv, addCeloEnvMiddleware } from 'src/lib/env-utils' import { portForwardAnd } from 'src/lib/port_forward' import Web3 from 'web3' import yargs from 'yargs' @@ -54,7 +54,7 @@ export const handler = async (argv: UnfreezeContractsArgv) => { const web3: Web3 = new Web3('http://localhost:8545') const kit: ContractKit = newKitFromWeb3(web3) const account = (await kit.connection.getAccounts())[0] - console.log(`Using account: ${account}`) + console.info(`Using account: ${account}`) kit.connection.defaultAccount = account const [exchange, epochRewards] = await Promise.all([ @@ -68,7 +68,7 @@ export const handler = async (argv: UnfreezeContractsArgv) => { continue } - const address = (contract as any)._address + const address = contract._address if (argv.precheck) { const frozen = await freezerContract.methods.isFrozen(address).call() // console.debug(`${name}.frozen = ${frozen}`) diff --git a/packages/celotool/src/e2e-tests/blockchain_parameters_tests.ts b/packages/celotool/src/e2e-tests/blockchain_parameters_tests.ts index 3e4c77cd960..228a5944ef7 100644 --- a/packages/celotool/src/e2e-tests/blockchain_parameters_tests.ts +++ b/packages/celotool/src/e2e-tests/blockchain_parameters_tests.ts @@ -1,4 +1,3 @@ -// tslint:disable:no-console import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { BlockchainParametersWrapper } from '@celo/contractkit/lib/wrappers/BlockchainParameters' import { assert } from 'chai' diff --git a/packages/celotool/src/e2e-tests/cip35_tests.ts b/packages/celotool/src/e2e-tests/cip35_tests.ts index a93fb2bec39..d6892326440 100644 --- a/packages/celotool/src/e2e-tests/cip35_tests.ts +++ b/packages/celotool/src/e2e-tests/cip35_tests.ts @@ -1,4 +1,3 @@ -// tslint:disable:no-console import { CeloTx } from '@celo/connect' import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { privateKeyToAddress } from '@celo/utils/lib/address' @@ -35,10 +34,10 @@ const bytecode = const verbose = false -///////// Configurable values to run only some of the tests during development //////////////// +/// ////// Configurable values to run only some of the tests during development //////////////// // ReplayProtectionTests lets you skip or run only the replay-protection tests during dev // Value when committing should be "run" -// tslint:disable-next-line +// eslint-disable-next-line let replayProtectionTests: 'run' | 'skip' | 'only' = 'run' // devFilter can be used during development to only run a subset of testcases. // But if you're going to commit you should set them all back to undefined (i.e. no filter). @@ -52,7 +51,7 @@ const devFilter: Filter = { useGatewayFeeRecipient: undefined, sendRawTransaction: undefined, } -/////////////////////////////////////////////////////////////////////////////////////////////// +/// //////////////////////////////////////////////////////////////////////////////////////////// // Filter specifies which subset of cases to generate. // (e.g. {lightNode: true, sendRawTransaction: false} makes it only run cases which send through a light @@ -130,7 +129,7 @@ function generateTestCases(cipIsActivated: boolean) { } function getGethRunConfig(withDonut: boolean, withEspresso: boolean): GethRunConfig { - console.log('getGethRunConfig', withDonut) + console.info('getGethRunConfig', withDonut) return { migrate: true, runPath: TMP_PATH, @@ -357,7 +356,7 @@ class TestEnv { if (testCase.contractCreation) { tx.data = bytecode } else { - tx.to = await toAddress + tx.to = toAddress tx.value = 5 } @@ -453,7 +452,7 @@ describe('CIP-35 >', function (this: any) { }) }) - describe('after activation', async () => { + describe('after activation', () => { if (devFilter.cipIsActivated === false) { return } @@ -479,7 +478,7 @@ describe('CIP-35 >', function (this: any) { }) }) - describe('after cip50 (optional replay protection)', async () => { + describe('after cip50 (optional replay protection)', () => { if (devFilter.cipIsActivated === false) { return } diff --git a/packages/celotool/src/e2e-tests/governance_tests.ts b/packages/celotool/src/e2e-tests/governance_tests.ts index d89ded096e1..7690acfd019 100644 --- a/packages/celotool/src/e2e-tests/governance_tests.ts +++ b/packages/celotool/src/e2e-tests/governance_tests.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable */ import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { getBlsPoP, getBlsPublicKey } from '@celo/cryptographic-utils/lib/bls' import { eqAddress, privateKeyToAddress } from '@celo/utils/lib/address' @@ -949,7 +949,7 @@ describe('governance tests', () => { await connectPeers([...gethConfig.instances, validatorGroup], verbose) - console.log('wait for validatorGroup to finish syncing') + console.info('wait for validatorGroup to finish syncing') await waitToFinishInstanceSyncing(validatorGroup) const additionalValidatingNodes: GethInstanceConfig[] = [ @@ -986,7 +986,7 @@ describe('governance tests', () => { // Connect the validating nodes to the non-validating nodes, to test that announce messages are properly gossiped. await connectBipartiteClique(gethConfig.instances, additionalValidatingNodes, verbose) - console.log('wait for new validators to sync') + console.infoo('wait for new validators to sync') await Promise.all(additionalValidatingNodes.map((i) => waitToFinishInstanceSyncing(i))) validatorAccounts = await getValidatorGroupMembers() @@ -994,7 +994,7 @@ describe('governance tests', () => { epoch = new BigNumber(await validators.methods.getEpochSize().call()).toNumber() assert.equal(epoch, 10) - console.log('wait for end of epoch') + console.info('wait for end of epoch') // Wait for an epoch transition to ensure everyone is connected to one another. await waitForEpochTransition(web3, epoch) @@ -1067,7 +1067,7 @@ describe('governance tests', () => { it('validator 0 should have signed at least one block', async () => { const rotation0MinedBlock = miners.some((a) => eqAddress(a, rotation0Address)) if (!rotation0MinedBlock) { - console.log(rotation0Address, rotation1Address, miners) + console.info(rotation0Address, rotation1Address, miners) } assert.isTrue(rotation0MinedBlock) }) @@ -1075,7 +1075,7 @@ describe('governance tests', () => { it('validator 1 should have signed at least one block', async () => { const rotation1MinedBlock = miners.some((a) => eqAddress(a, rotation1Address)) if (!rotation1MinedBlock) { - console.log(rotation0Address, rotation1Address, miners) + console.info(rotation0Address, rotation1Address, miners) } assert.isTrue(rotation1MinedBlock) }) diff --git a/packages/celotool/src/e2e-tests/replica_tests.ts b/packages/celotool/src/e2e-tests/replica_tests.ts index c29a2f3eef0..b7b5a3a4877 100644 --- a/packages/celotool/src/e2e-tests/replica_tests.ts +++ b/packages/celotool/src/e2e-tests/replica_tests.ts @@ -186,7 +186,6 @@ describe('replica swap tests', () => { if (verbose) { console.info(`Swapping validators at block ${swapBlock}`) } - // tslint:disable-next-line: no-shadowed-variable let resp = await replicaRPC.call(IstanbulManagement.startAtBlock, [swapBlock]) assert.equal(resp.error, null) resp = await validatoRPC.call(IstanbulManagement.stopAtBlock, [swapBlock]) @@ -230,17 +229,17 @@ describe('replica swap tests', () => { }) it('replica is validating', async () => { - const validating = (await replicaRPC.call(IstanbulManagement.validating, [])).result as any + const validating = (await replicaRPC.call(IstanbulManagement.validating, [])).result assert.isTrue(validating) }) it('primary is not validating', async () => { - const validating = (await validatoRPC.call(IstanbulManagement.validating, [])).result as any + const validating = (await validatoRPC.call(IstanbulManagement.validating, [])).result assert.isFalse(validating) }) it('replica should have good val enode table', async () => { - const resp = (await replicaRPC.call(IstanbulManagement.valEnodeTableInfo, [])).result as any + const resp = (await replicaRPC.call(IstanbulManagement.valEnodeTableInfo, [])).result Object.keys(resp).forEach((k) => { const enode = resp[k].enode assert.isTrue((enode || '') !== '') @@ -253,7 +252,7 @@ describe('replica swap tests', () => { assert.equal(resp.length, 2) }) - it('should switch without downtime', async () => { + it('should switch without downtime', () => { if (missed.length !== 0) { missed.forEach((x: any) => console.warn(`Validator idx ${x.idx} missed block ${x.num}`)) console.warn(`Val idx 0 should have switched on block ${swapBlock}`) diff --git a/packages/celotool/src/e2e-tests/slashing_tests.ts b/packages/celotool/src/e2e-tests/slashing_tests.ts index 25303a7834e..ee027c05341 100644 --- a/packages/celotool/src/e2e-tests/slashing_tests.ts +++ b/packages/celotool/src/e2e-tests/slashing_tests.ts @@ -1,4 +1,3 @@ -// tslint:disable-next-line: no-reference (Required to make this work w/ ts-node) import { NULL_ADDRESS } from '@celo/base/lib/address' import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { ensureLeading0x } from '@celo/utils/lib/address' diff --git a/packages/celotool/src/e2e-tests/sync_tests.ts b/packages/celotool/src/e2e-tests/sync_tests.ts index b998be8fe86..ffb73e8d45a 100644 --- a/packages/celotool/src/e2e-tests/sync_tests.ts +++ b/packages/celotool/src/e2e-tests/sync_tests.ts @@ -1,4 +1,3 @@ -// tslint:disable: no-console import { assert } from 'chai' import Web3 from 'web3' import { GethInstanceConfig } from '../lib/interfaces/geth-instance-config' @@ -116,12 +115,12 @@ describe('sync tests', function (this: any) { it('should sync the latest block', async () => { const validatingWeb3 = new Web3(`http://localhost:8545`) const validatingFirstBlock = await validatingWeb3.eth.getBlockNumber() - console.log(`At block ${validatingFirstBlock}, waiting for next block`) + console.info(`At block ${validatingFirstBlock}, waiting for next block`) await waitForBlock(validatingWeb3, validatingFirstBlock + 1) const validatingLatestBlock = await validatingWeb3.eth.getBlockNumber() const syncWeb3 = new Web3(`http://localhost:8555`) - console.log(`Waiting to sync to block ${validatingFirstBlock}`) + console.info(`Waiting to sync to block ${validatingFirstBlock}`) await waitForBlock(syncWeb3, validatingLatestBlock) const syncLatestBlock = await syncWeb3.eth.getBlockNumber() diff --git a/packages/celotool/src/e2e-tests/transfer_tests.ts b/packages/celotool/src/e2e-tests/transfer_tests.ts index d465fdfb3e4..99e5079022f 100644 --- a/packages/celotool/src/e2e-tests/transfer_tests.ts +++ b/packages/celotool/src/e2e-tests/transfer_tests.ts @@ -1,4 +1,3 @@ -// tslint:disable-next-line: no-reference (Required to make this work w/ ts-node) import { CeloTxPending, CeloTxReceipt, TransactionResult } from '@celo/connect' import { ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { CeloTokenType, EachCeloToken, StableToken, Token } from '@celo/contractkit/lib/celo-tokens' @@ -174,8 +173,8 @@ async function newBalanceWatcher(kit: ContractKit, accounts: string[]): Promise< return initial[address][token] || new BigNumber(0) }, debugPrint(address: string, token: CeloTokenType) { - // tslint:disable-next-line: no-console - console.log({ + // eslint-disable-next-line: no-console + console.info({ initial: initial[address][token]?.toString(), current: current[address][token]?.toString(), delta: (current[address][token] || new BigNumber(0)) @@ -454,8 +453,8 @@ describe('Transfer tests', function (this: any) { const events = parseEvents(receipt) if (receipt != null && receipt.gasUsed !== expectedGasUsed) { - // tslint:disable-next-line: no-console - console.log('OOPSS: Different Gas', receipt.gasUsed, expectedGasUsed) + // eslint-disable-next-line: no-console + console.info('OOPSS: Different Gas', receipt.gasUsed, expectedGasUsed) } const gasVal = receipt ? receipt.gasUsed : expectedGasUsed diff --git a/packages/celotool/src/e2e-tests/utils.ts b/packages/celotool/src/e2e-tests/utils.ts index 6c6aff2d3b2..357b8083256 100644 --- a/packages/celotool/src/e2e-tests/utils.ts +++ b/packages/celotool/src/e2e-tests/utils.ts @@ -1,4 +1,3 @@ -/* tslint:disable: no-console */ import BigNumber from 'bignumber.js' import { assert } from 'chai' import fs from 'fs' @@ -58,6 +57,7 @@ export async function initAndSyncGethWithRetry( await waitToFinishInstanceSyncing(instance) break } catch (error) { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions console.info(`initAndSyncGethWithRetry error: ${error}`) const logFilename = getLogFilename(gethConfig.runPath, instance) console.info(`tail -50 ${logFilename}`) @@ -184,7 +184,7 @@ export async function shutdownOrKill(identifier: string | number, signal: Signal export function sleep(seconds: number, verbose = false) { if (verbose) { - console.log(`Sleeping for ${seconds} seconds. Stay tuned!`) + console.info(`Sleeping for ${seconds} seconds. Stay tuned!`) } return new Promise((resolve) => setTimeout(resolve, seconds * 1000)) } @@ -257,7 +257,6 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose } if (!fs.existsSync(gethConfig.runPath)) { - // @ts-ignore fs.mkdirSync(gethConfig.runPath, { recursive: true }) } @@ -270,7 +269,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose } await writeGenesisWithMigrations(gethConfig, repo.path, mnemonic, validators.length, verbose) } else { - await writeGenesis(gethConfig, validators, verbose) + writeGenesis(gethConfig, validators, verbose) } let validatorIndex = 0 @@ -286,7 +285,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose throw new Error('proxied validator must have exactly one proxy') } - instance.proxies = [proxyEnode[0][1]!, proxyEnode[0][2]!] + instance.proxies = [proxyEnode[0][1], proxyEnode[0][2]] } // Set the private key for the validator or proxy instance diff --git a/packages/celotool/src/lib/artifacts.ts b/packages/celotool/src/lib/artifacts.ts index f4cf6e475ec..24dadb37214 100644 --- a/packages/celotool/src/lib/artifacts.ts +++ b/packages/celotool/src/lib/artifacts.ts @@ -16,7 +16,7 @@ export const CONTRACTS_TO_COPY = [ export async function downloadArtifacts(celoEnv: string) { let baseCmd = `yarn --cwd ../protocol run download-artifacts -n ${celoEnv}` - console.log(`Downloading artifacts for ${celoEnv}`) + console.info(`Downloading artifacts for ${celoEnv}`) if (isProduction()) { baseCmd += ` -b contract_artifacts_production` } @@ -38,7 +38,7 @@ export async function uploadArtifacts(celoEnv: string, checkOrPromptIfStagingOrP if (isProduction()) { baseCmd += ` -b contract_artifacts_production` } - console.log(`Uploading artifacts for ${celoEnv}`) + console.info(`Uploading artifacts for ${celoEnv}`) try { await execCmd(baseCmd) } catch (error) { diff --git a/packages/celotool/src/lib/generate_utils.ts b/packages/celotool/src/lib/generate_utils.ts index 6da7be1099b..172b1fd6230 100644 --- a/packages/celotool/src/lib/generate_utils.ts +++ b/packages/celotool/src/lib/generate_utils.ts @@ -136,7 +136,7 @@ export const generateAddress = (mnemonic: string, accountType: AccountType, inde export const privateKeyToPublicKey = (privateKey: string): string => { // NOTE: elliptic is disabled elsewhere in this library to prevent // accidental signing of truncated messages. - // tslint:disable-next-line:import-blacklist + // eslint-disable-next-line:import-blacklist const EC = require('elliptic').ec const ec = new EC('secp256k1') const ecPrivateKey = ec.keyFromPrivate(Buffer.from(privateKey, 'hex')) diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index 90d76e18645..d4a0841eb57 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console: 0 */ import { CeloTxReceipt, TransactionResult } from '@celo/connect' import { CeloContract, ContractKit, newKitFromWeb3 } from '@celo/contractkit' import { GoldTokenWrapper } from '@celo/contractkit/lib/wrappers/GoldTokenWrapper' @@ -19,12 +19,12 @@ import { convertToContractDecimals } from './contract-utils' import { envVar, fetchEnv, fetchEnvOrFallback } from './env-utils' import { AccountType, + Validator, generateGenesis, generateGenesisWithMigrations, generatePrivateKey, privateKeyToAddress, privateKeyToPublicKey, - Validator, } from './generate_utils' import { retrieveClusterIPAddress, retrieveIPAddress } from './helm_deploy' import { GethInstanceConfig } from './interfaces/geth-instance-config' @@ -309,7 +309,7 @@ const validateTransactionAndReceipt = ( } const tracerLog = (logMessage: any) => { - console.log(JSON.stringify(logMessage)) + console.info(JSON.stringify(logMessage)) } const exitTracerTool = (logMessage: any) => { @@ -941,7 +941,7 @@ export const runGethNodes = async ({ if (verbose) { const validatorAddresses = validators.map((validator) => validator.address) - console.log('Validators', JSON.stringify(validatorAddresses, null, 2)) + console.info('Validators', JSON.stringify(validatorAddresses, null, 2)) } for (const instance of gethConfig.instances) { @@ -997,7 +997,7 @@ export async function initGeth( const genesisPath = path.join(gethConfig.runPath, 'genesis.json') if (verbose) { console.info(`geth:${instance.name}: init datadir ${datadir}`) - console.log(`init geth with genesis at ${genesisPath}`) + console.info(`init geth with genesis at ${genesisPath}`) } await spawnCmdWithExitOnFailure('rm', ['-rf', datadir], { silent: !verbose }) @@ -1036,7 +1036,7 @@ export async function importPrivateKey( ] if (verbose) { - console.log(gethBinaryPath, ...args) + console.info(gethBinaryPath, ...args) } await spawnCmdWithExitOnFailure(gethBinaryPath, args, { silent: true }) @@ -1070,14 +1070,14 @@ export async function getEnode(peer: string, ws: boolean = false) { export async function addStaticPeers(datadir: string, peers: string[], verbose: boolean) { const staticPeersPath = path.join(datadir, 'static-nodes.json') if (verbose) { - console.log(`Writing static peers to ${staticPeersPath}`) + console.info(`Writing static peers to ${staticPeersPath}`) } const enodes = await Promise.all(peers.map((peer) => getEnode(peer))) const enodesString = JSON.stringify(enodes, null, 2) if (verbose) { - console.log('eNodes', enodesString) + console.info('eNodes', enodesString) } fs.writeFileSync(staticPeersPath, enodesString) @@ -1106,9 +1106,9 @@ export async function startGeth( verbose: boolean ) { if (verbose) { - console.log('starting geth with config', JSON.stringify(instance, null, 2)) + console.info('starting geth with config', JSON.stringify(instance, null, 2)) } else { - console.log(`${instance.name}: starting.`) + console.info(`${instance.name}: starting.`) } const datadir = getDatadir(gethConfig.runPath, instance) @@ -1295,19 +1295,19 @@ export async function startGeth( try { block = await new Web3('http://localhost:8545').eth.getBlock('latest') } catch (e) { - console.log(`Failed to fetch test block: ${e}`) + console.info(`Failed to fetch test block: ${e}`) } if (block) { break } - console.log('Could not fetch test block. Wait one second, then retry.') + console.info('Could not fetch test block. Wait one second, then retry.') await sleep(1000) } if (tries === maxTries) { throw new Error(`Geth did not start within ${tries} seconds`) } - console.log( + console.info( `${instance.name}: running.`, rpcport ? `RPC: ${rpcport}` : '', wsport ? `WS: ${wsport}` : '', @@ -1331,13 +1331,13 @@ export function writeGenesis(gethConfig: GethRunConfig, validators: Validator[], const genesisPath = path.join(gethConfig.runPath, 'genesis.json') if (verbose) { - console.log('writing genesis') + console.info('writing genesis') } fs.writeFileSync(genesisPath, genesis) if (verbose) { - console.log(`wrote genesis to ${genesisPath}`) + console.info(`wrote genesis to ${genesisPath}`) } } @@ -1366,13 +1366,13 @@ export async function writeGenesisWithMigrations( const genesisPath = path.join(gethConfig.runPath, 'genesis.json') if (verbose) { - console.log('writing genesis') + console.info('writing genesis') } fs.writeFileSync(genesisPath, genesis) if (verbose) { - console.log(`wrote genesis to ${genesisPath}`) + console.info(`wrote genesis to ${genesisPath}`) } } @@ -1382,7 +1382,7 @@ export async function snapshotDatadir( verbose: boolean ) { if (verbose) { - console.log('snapshotting data dir') + console.info('snapshotting data dir') } // Sometimes the socket is still present, preventing us from snapshotting. @@ -1441,7 +1441,7 @@ export function spawnWithLog(cmd: string, args: string[], logsFilepath: string, const logStream = fs.createWriteStream(logsFilepath, { flags: 'a' }) if (verbose) { - console.log(cmd, ...args) + console.info(cmd, ...args) } const p = spawn(cmd, args) @@ -1488,7 +1488,7 @@ export async function connectBipartiteClique( return } if (verbose) { - console.log(`connecting ${sourceEnode} with ${enode}`) + console.info(`connecting ${sourceEnode} with ${enode}`) } const success = await admin.addPeer(enode) if (!success) { diff --git a/packages/celotool/src/lib/port_forward.ts b/packages/celotool/src/lib/port_forward.ts index 297a326fab0..74ca21daaca 100644 --- a/packages/celotool/src/lib/port_forward.ts +++ b/packages/celotool/src/lib/port_forward.ts @@ -23,7 +23,7 @@ async function getKubernetesPortForwardCmd( if (!component) { component = DEFAULT_COMPONENT } - console.log(`Port-forwarding to ${celoEnv} ${component} ${ports}`) + console.info(`Port-forwarding to ${celoEnv} ${component} ${ports}`) const portForwardArgs = await getPortForwardArgs(celoEnv, component, ports) return `kubectl ${portForwardArgs.join(' ')}` } @@ -32,7 +32,7 @@ async function getPortForwardArgs(celoEnv: string, component?: string, ports = d if (!component) { component = DEFAULT_COMPONENT } - console.log(`Port-forwarding to ${celoEnv} ${component} ${ports}`) + console.info(`Port-forwarding to ${celoEnv} ${component} ${ports}`) // The testnet helm chart used to have the label app=ethereum, but this was changed // to app=testnet. To preserve backward compatibility, we search for both labels. // It's not expected to ever have a situation where a namespace has pods with @@ -47,8 +47,8 @@ export async function portForward(celoEnv: string, component?: string, ports?: s try { const portForwardCmd = await getPortForwardCmd(celoEnv, component, ports) const splitCmd = portForwardCmd.split(' ') - console.log(`Port-forwarding to celoEnv ${celoEnv} ports ${ports}`) - console.log(`\t$ ${portForwardCmd}`) + console.info(`Port-forwarding to celoEnv ${celoEnv} ports ${ports}`) + console.info(`\t$ ${portForwardCmd}`) await spawnSync(splitCmd[0], splitCmd.slice(1), { stdio: 'inherit', }) diff --git a/packages/celotool/src/lib/pubsub.ts b/packages/celotool/src/lib/pubsub.ts index b3597a05caf..18170ddd56d 100644 --- a/packages/celotool/src/lib/pubsub.ts +++ b/packages/celotool/src/lib/pubsub.ts @@ -43,7 +43,7 @@ export const createStreamingPull = ( client: any, projectID: string, subscriptionName: string, - // tslint:disable-next-line: ban-types + // eslint-disable-next-line: ban-types handler: Function ) => { const stream = client.streamingPull().on('data', handler) diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index f82aae1e8bc..67bfbdbbffc 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -17,7 +17,7 @@ ], "scripts": { "build": "tsc -b .", - "lint": "tslint -c tslint.json --project .", + "lint": "yarn run --top-level eslint .", "prepack": "yarn build" }, "dependencies": { diff --git a/packages/dev-utils/src/ganache-setup.ts b/packages/dev-utils/src/ganache-setup.ts index dd9746628dd..c97afaf0474 100644 --- a/packages/dev-utils/src/ganache-setup.ts +++ b/packages/dev-utils/src/ganache-setup.ts @@ -1,9 +1,9 @@ import * as fs from 'fs-extra' -// @ts-ignore import * as ganache from 'ganache' import * as path from 'path' import * as targz from 'targz' +/* eslint no-console: 0 */ // --> OFF const MNEMONIC = 'concert load couple harbor equip island argue ramp clarify fence smart topic' export const ACCOUNT_PRIVATE_KEYS = [ '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d', @@ -37,16 +37,16 @@ export async function startGanache( ) { const chainCopyBase = process.env.GANACHE_CHAIN_DATA_PATH || path.resolve(filePath) const chainCopy: string = path.resolve(path.join(chainCopyBase, 'tmp/copychain')) - console.log(chainCopy) - console.log(filePath, datafile) + console.info(chainCopy) + console.info(filePath, datafile) const filenameWithPath: string = path.resolve(path.join(filePath, datafile)) // erases tmp chain if (fs.existsSync(chainCopy)) { - console.log(`Removing old chain tmp folder: ${chainCopy}`) + console.info(`Removing old chain tmp folder: ${chainCopy}`) fs.removeSync(chainCopy) } - console.log(`Creating chain tmp folder: ${chainCopy}`) + console.info(`Creating chain tmp folder: ${chainCopy}`) fs.mkdirsSync(chainCopy) if (opts.from_targz) { @@ -58,12 +58,12 @@ export async function startGanache( return launchServer(opts, chainCopy) } -async function launchServer(opts: { verbose?: boolean; from_targz?: boolean }, chain?: string) { +function launchServer(opts: { verbose?: boolean; from_targz?: boolean }, chain?: string) { const logFn = opts.verbose - ? // tslint:disable-next-line: no-console - (...args: any[]) => console.log(...args) + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + (...args: any[]) => console.info(...args) : () => { - /*nothing*/ + /* nothing */ } const server = ganache.server({ @@ -74,30 +74,28 @@ async function launchServer(opts: { verbose?: boolean; from_targz?: boolean }, c chain: { networkId: 1101, chainId: 1, allowUnlimitedContractSize: true, hardfork: 'istanbul' }, }) - server.listen(8545, async (err: any) => { + server.listen(8545, (err: any) => { if (err) { throw err } }) - return async () => { - try { - await server.close() - } catch (e) { - throw e - } + async function stopGanache() { + return server.close() } + + return { stopGanache } } function decompressChain(tarPath: string, copyChainPath: string): Promise { - console.log('Decompressing chain') + console.info('Decompressing chain') return new Promise((resolve, reject) => { targz.decompress({ src: tarPath, dest: copyChainPath }, (err) => { if (err) { console.error(err) reject(err) } else { - console.log('Chain decompressed') + console.info('Chain decompressed') resolve() } }) @@ -110,7 +108,8 @@ export default function setup( opts: { verbose?: boolean; from_targz?: boolean } = {} ) { return startGanache(filePath, datafile, opts) - .then((stopGanache) => { + .then(({ stopGanache }) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access ;(global as any).stopGanache = stopGanache }) .catch((err) => { @@ -121,12 +120,12 @@ export default function setup( } export function emptySetup(opts: { verbose?: boolean; from_targz?: boolean } = {}) { - return launchServer(opts) - .then((stopGanache) => { - ;(global as any).stopGanache = stopGanache - }) - .catch((err) => { - console.error(err) - process.exit(1) - }) + try { + const { stopGanache } = launchServer(opts) + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + ;(global as any).stopGanache = stopGanache + } catch (err) { + console.error(err) + process.exit(1) + } } diff --git a/packages/dev-utils/src/ganache-teardown.ts b/packages/dev-utils/src/ganache-teardown.ts index 27400b9a1aa..c0660ea142d 100644 --- a/packages/dev-utils/src/ganache-teardown.ts +++ b/packages/dev-utils/src/ganache-teardown.ts @@ -1,7 +1,10 @@ export default function tearDown() { - console.log('Stopping ganache') - return (global as any).stopGanache().catch((err: any) => { + try { + console.info('Stopping ganache') + // eslint-disable-next-line + return (global as any).stopGanache() + } catch (err) { console.error('error stopping ganache') console.error(err) - }) + } } diff --git a/packages/dev-utils/src/ganache-test.ts b/packages/dev-utils/src/ganache-test.ts index 2722d043f2b..1486d121a2b 100644 --- a/packages/dev-utils/src/ganache-test.ts +++ b/packages/dev-utils/src/ganache-test.ts @@ -22,12 +22,13 @@ export function jsonRpcCall(web3: Web3, method: string, params: any[]): Promi } else if (res.error) { reject( new Error( - `Failed JsonRpcResponse: method: ${method} params: ${params} error: ${JSON.stringify( - res.error - )}` + `Failed JsonRpcResponse: method: ${method} params: ${JSON.stringify( + params + )} error: ${JSON.stringify(res.error)}` ) ) } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument resolve(res.result) } } diff --git a/packages/dev-utils/src/matchers.ts b/packages/dev-utils/src/matchers.ts index c0bac376ff2..066e6a53813 100644 --- a/packages/dev-utils/src/matchers.ts +++ b/packages/dev-utils/src/matchers.ts @@ -1,6 +1,7 @@ import BigNumber from 'bignumber.js' declare global { + // eslint-disable-next-line @typescript-eslint/no-namespace namespace jest { interface Matchers { toBeBigNumber(): R @@ -15,12 +16,13 @@ expect.extend({ const pass = BigNumber.isBigNumber(received) if (pass) { return { - message: () => `expected ${received} not to be BigNumber`, + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + message: () => `expected ${received.toJSON()} not to be BigNumber`, pass: true, } } else { return { - message: () => `expected ${received} to be bigNumber`, + message: () => `expected ${received} to be BigNumber`, pass: false, } } diff --git a/packages/dev-utils/src/network.ts b/packages/dev-utils/src/network.ts index 8801372e894..860bb86e1a3 100644 --- a/packages/dev-utils/src/network.ts +++ b/packages/dev-utils/src/network.ts @@ -14,8 +14,8 @@ export async function isPortOpen(host: string, port: number) { return (await execCmd('nc', ['-z', host, port.toString()], { silent: true })) === 0 } -function execCmd(cmd: string, args: string[], options?: SpawnOptions & { silent?: boolean }) { - return new Promise(async (resolve, reject) => { +async function execCmd(cmd: string, args: string[], options?: SpawnOptions & { silent?: boolean }) { + return new Promise((resolve, reject) => { const { silent, ...spawnOptions } = options || { silent: false } if (!silent) { console.debug('$ ' + [cmd].concat(args).join(' ')) diff --git a/packages/env-tests/package.json b/packages/env-tests/package.json index 839d44d8f0f..144beac0a1b 100644 --- a/packages/env-tests/package.json +++ b/packages/env-tests/package.json @@ -22,7 +22,7 @@ "scripts": { "clean": "tsc -b . --clean", "build": "tsc -b .", - "lint": "tslint -c tslint.json --project tsconfig.json", + "lint": "yarn run --top-level eslint .", "test": "jest --runInBand", "baklava-test": "CELO_ENV=baklava CELO_PROVIDER=https://baklava-forno.celo-testnet.org jest --runInBand", "alfajores-test": "CELO_ENV=alfajores CELO_PROVIDER=https://alfajores-forno.celo-testnet.org jest --runInBand", diff --git a/packages/env-tests/src/logger.ts b/packages/env-tests/src/logger.ts index 5bfd683e0ad..1cf1a1cef8b 100644 --- a/packages/env-tests/src/logger.ts +++ b/packages/env-tests/src/logger.ts @@ -6,21 +6,25 @@ import { fetchEnvOrDefault } from './env' const logLevel = fetchEnvOrDefault('LOG_LEVEL', 'info') as LogLevelString const logFormat = fetchEnvOrDefault('LOG_FORMAT', 'human') -let stream: any +const streams: Logger.LoggerOptions['streams'] = [] switch (logFormat) { case 'stackdriver': - stream = createStream(levelFromName[logLevel]) + streams.push(createStream(levelFromName[logLevel])) break case 'json': - stream = { stream: process.stdout, level: logLevel } + streams.push({ stream: process.stdout, level: logLevel }) break default: - stream = { level: logLevel, stream: bunyanDebugStream() } + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + streams.push({ + level: logLevel, + stream: bunyanDebugStream() as unknown as NodeJS.WritableStream, + }) break } export const rootLogger: Logger = createLogger({ name: 'env-tests', serializers: stdSerializers, - streams: [stream], + streams, }) diff --git a/packages/env-tests/src/monorepoRun.ts b/packages/env-tests/src/monorepoRun.ts index 4cb689f5ab8..da2a572e30a 100644 --- a/packages/env-tests/src/monorepoRun.ts +++ b/packages/env-tests/src/monorepoRun.ts @@ -4,7 +4,6 @@ import { loadFromEnvFile } from './env' import { rootLogger } from './logger' import { clearAllFundsToRoot, parseStableTokensList } from './scaffold' import { runExchangeTest } from './tests/exchange' -import { runGrandaMentoTest } from './tests/granda-mento' import { runOracleTest } from './tests/oracle' import { runReserveTest } from './tests/reserve' import { runTransfersTest } from './tests/transfer' @@ -20,7 +19,7 @@ function runTests() { throw new Error('No MNEMONIC was set, envName was parsed as ' + envName) } const kit = newKitFromWeb3(new Web3(process.env.CELO_PROVIDER || 'http://localhost:8545')) - const mnemonic = process.env.MNEMONIC! + const mnemonic: string = process.env.MNEMONIC const reserveSpenderMultiSigAddress = process.env.RESERVE_SPENDER_MULTISIG_ADDRESS const stableTokensToTest = process.env.STABLETOKENS @@ -40,8 +39,6 @@ function runTests() { runExchangeTest(context, stableTokensToTest) runOracleTest(context) runReserveTest(context) - runGrandaMentoTest(context, stableTokensToTest) - // TODO: Governance Proposals // TODO: Validator election + Slashing diff --git a/packages/env-tests/src/tests/exchange.ts b/packages/env-tests/src/tests/exchange.ts index 8eafdbd4181..fe956d94cd2 100644 --- a/packages/env-tests/src/tests/exchange.ts +++ b/packages/env-tests/src/tests/exchange.ts @@ -1,5 +1,6 @@ import { sleep } from '@celo/base' import { StableToken } from '@celo/contractkit' +// eslint-disable-next-line import/no-extraneous-dependencies import { describe, test } from '@jest/globals' import BigNumber from 'bignumber.js' import { EnvTestContext } from '../context' diff --git a/packages/env-tests/src/tests/granda-mento.ts b/packages/env-tests/src/tests/granda-mento.ts deleted file mode 100644 index 81ef0b2d7c9..00000000000 --- a/packages/env-tests/src/tests/granda-mento.ts +++ /dev/null @@ -1,263 +0,0 @@ -import { sleep } from '@celo/base' -import { StableToken } from '@celo/contractkit' -import { GoldTokenWrapper } from '@celo/contractkit/lib/wrappers/GoldTokenWrapper' -import { StableTokenWrapper } from '@celo/contractkit/lib/wrappers/StableTokenWrapper' -import { describe, test } from '@jest/globals' -import BigNumber from 'bignumber.js' -import Logger from 'bunyan' -import { EnvTestContext } from '../context' -import { - fundAccountWithCELO, - fundAccountWithStableToken, - getKey, - getValidatorKey, - ONE, - TestAccounts, -} from '../scaffold' - -export function runGrandaMentoTest(context: EnvTestContext, stableTokensToTest: StableToken[]) { - const celoAmountToFund = ONE.times(61000) - const stableTokenAmountToFund = ONE.times(61000) - - const celoAmountToSell = ONE.times(60000) - const stableTokenAmountToSell = ONE.times(60000) - - describe('Granda Mento Test', () => { - beforeAll(async () => { - await fundAccountWithCELO(context, TestAccounts.GrandaMentoExchanger, celoAmountToFund) - }) - - const baseLogger = context.logger.child({ test: 'grandaMento' }) - - for (const sellCelo of [true, false]) { - for (const stableToken of stableTokensToTest) { - const sellTokenStr = sellCelo ? 'CELO' : stableToken - const buyTokenStr = sellCelo ? stableToken : 'CELO' - describe(`selling ${sellTokenStr} for ${buyTokenStr}`, () => { - beforeAll(async () => { - if (!sellCelo) { - await fundAccountWithStableToken( - context, - TestAccounts.GrandaMentoExchanger, - stableTokenAmountToFund, - stableToken - ) - } - }) - - let buyToken: GoldTokenWrapper | StableTokenWrapper - let sellToken: GoldTokenWrapper | StableTokenWrapper - let stableTokenAddress: string - let sellAmount: BigNumber - - beforeEach(async () => { - const goldTokenWrapper = await context.kit.contracts.getGoldToken() - const stableTokenWrapper = await context.kit.celoTokens.getWrapper( - stableToken as StableToken - ) - stableTokenAddress = stableTokenWrapper.address - if (sellCelo) { - buyToken = stableTokenWrapper - sellToken = goldTokenWrapper - sellAmount = celoAmountToSell - } else { - buyToken = goldTokenWrapper - sellToken = stableTokenWrapper - sellAmount = stableTokenAmountToSell - } - }) - - const createExchangeProposal = async (logger: Logger, fromAddress: string) => { - const grandaMento = await context.kit.contracts.getGrandaMento() - const tokenApprovalReceipt = await sellToken - .approve(grandaMento.address, sellAmount.toFixed()) - .sendAndWaitForReceipt({ - from: fromAddress, - }) - logger.debug( - { - sellAmount, - sellTokenStr, - spender: grandaMento.address, - }, - 'Approved GrandaMento to spend sell token' - ) - const minedTokenApprovalTx = await context.kit.web3.eth.getTransaction( - tokenApprovalReceipt.transactionHash - ) - const tokenApprovalCeloFees = new BigNumber(tokenApprovalReceipt.gasUsed).times( - minedTokenApprovalTx.gasPrice - ) - - // Some flakiness has been observed after approving, so we sleep - await sleep(5000) - - const creationTx = await grandaMento.createExchangeProposal( - context.kit.celoTokens.getContract(stableToken as StableToken), - sellAmount, - sellCelo - ) - const creationReceipt = await creationTx.sendAndWaitForReceipt({ - from: fromAddress, - }) - // Some flakiness has been observed after proposing, so we sleep - await sleep(5000) - const proposalId = - creationReceipt.events!.ExchangeProposalCreated.returnValues.proposalId - - logger.debug( - { - sellAmount, - sellCelo, - proposalId, - }, - 'Created exchange proposal' - ) - const minedCreationTx = await context.kit.web3.eth.getTransaction( - creationReceipt.transactionHash - ) - const creationCeloFees = new BigNumber(creationReceipt.gasUsed).times( - minedCreationTx.gasPrice - ) - return { - creationReceipt, - minedCreationTx, - proposalId, - celoFees: tokenApprovalCeloFees.plus(creationCeloFees), - } - } - - test('exchanger creates and cancels an exchange proposal', async () => { - const from = await getKey(context.mnemonic, TestAccounts.GrandaMentoExchanger) - context.kit.connection.addAccount(from.privateKey) - context.kit.defaultAccount = from.address - - const logger = baseLogger.child({ from: from.address }) - const grandaMento = await context.kit.contracts.getGrandaMento() - - const sellTokenBalanceBeforeCreation = await sellToken.balanceOf(from.address) - - const creationInfo = await createExchangeProposal(logger, from.address) - let celoFees = creationInfo.celoFees - - const sellTokenBalanceAfterCreation = await sellToken.balanceOf(from.address) - - // If we are looking at the CELO balance, take the fees spent into consideration. - const expectedBalanceDifference = sellCelo ? sellAmount.plus(celoFees) : sellAmount - - expect( - sellTokenBalanceBeforeCreation.minus(sellTokenBalanceAfterCreation).toString() - ).toBe(expectedBalanceDifference.toString()) - - const cancelReceipt = await grandaMento - .cancelExchangeProposal(creationInfo.proposalId) - .sendAndWaitForReceipt({ - from: from.address, - }) - const minedCancelTx = await context.kit.web3.eth.getTransaction( - cancelReceipt.transactionHash - ) - - logger.debug( - { - proposalId: creationInfo.proposalId, - }, - 'Cancelled exchange proposal' - ) - - celoFees = celoFees.plus( - new BigNumber(cancelReceipt.gasUsed).times(minedCancelTx.gasPrice) - ) - - const sellTokenBalanceAfterCancel = await sellToken.balanceOf(from.address) - // If we are looking at the CELO balance, take the fees spent into consideration. - const expectedBalance = sellCelo - ? sellTokenBalanceBeforeCreation.minus(celoFees) - : sellTokenBalanceBeforeCreation - expect(sellTokenBalanceAfterCancel.toString()).toBe(expectedBalance.toString()) - }) - - test('exchanger creates and executes an approved exchange proposal', async () => { - const from = await getKey(context.mnemonic, TestAccounts.GrandaMentoExchanger) - context.kit.connection.addAccount(from.privateKey) - context.kit.defaultAccount = from.address - - const logger = baseLogger.child({ from: from.address }) - - const grandaMento = await context.kit.contracts.getGrandaMento() - - const sellTokenBalanceBefore = await sellToken.balanceOf(from.address) - const buyTokenBalanceBefore = await buyToken.balanceOf(from.address) - - const creationInfo = await createExchangeProposal(logger, from.address) - - const approver = await getValidatorKey(context.mnemonic, 0) - await grandaMento - .approveExchangeProposal(creationInfo.proposalId) - .sendAndWaitForReceipt({ - from: approver.address, - }) - - const vetoPeriodSeconds = await grandaMento.vetoPeriodSeconds() - // Sleep for the veto period, add 5 seconds for extra measure - const sleepPeriodMs = vetoPeriodSeconds.plus(5).times(1000).toNumber() - logger.debug( - { - sleepPeriodMs, - vetoPeriodSeconds, - }, - 'Sleeping so the veto period elapses' - ) - await sleep(sleepPeriodMs) - - // Executing from the approver to avoid needing to calculate additional gas paid - // by the approver in this test. - await grandaMento - .executeExchangeProposal(creationInfo.proposalId) - .sendAndWaitForReceipt({ - from: approver.address, - }) - - logger.debug( - { - proposalId: creationInfo.proposalId, - }, - 'Executed exchange proposal' - ) - - const sellTokenBalanceAfter = await sellToken.balanceOf(from.address) - let expectedSellTokenBalanceAfter = sellTokenBalanceBefore.minus(sellAmount) - if (sellCelo) { - expectedSellTokenBalanceAfter = expectedSellTokenBalanceAfter.minus( - creationInfo.celoFees - ) - } - expect(sellTokenBalanceAfter.toString()).toBe(expectedSellTokenBalanceAfter.toString()) - - const sortedOracles = await context.kit.contracts.getSortedOracles() - const celoStableTokenRate = (await sortedOracles.medianRate(stableTokenAddress)).rate - - const exchangeRate = sellCelo - ? celoStableTokenRate - : new BigNumber(1).div(celoStableTokenRate) - const buyAmount = getBuyAmount(exchangeRate, sellAmount, await grandaMento.spread()) - - const buyTokenBalanceAfter = await buyToken.balanceOf(from.address) - let expectedBuyTokenBalanceAfter = buyTokenBalanceBefore.plus(buyAmount) - if (!sellCelo) { - expectedBuyTokenBalanceAfter = expectedBuyTokenBalanceAfter.minus( - creationInfo.celoFees - ) - } - expect(buyTokenBalanceAfter.toString()).toBe(expectedBuyTokenBalanceAfter.toString()) - }) - }) - } - } - }) -} - -// exchangeRate is the price of the sell token quoted in buy token -function getBuyAmount(exchangeRate: BigNumber, sellAmount: BigNumber, spread: BigNumber.Value) { - return sellAmount.times(new BigNumber(1).minus(spread)).times(exchangeRate) -} diff --git a/packages/env-tests/src/tests/oracle.ts b/packages/env-tests/src/tests/oracle.ts index d1459e2467f..6e18bc9cfe1 100644 --- a/packages/env-tests/src/tests/oracle.ts +++ b/packages/env-tests/src/tests/oracle.ts @@ -1,4 +1,5 @@ import { CeloContract } from '@celo/contractkit' +// eslint-disable-next-line import/no-extraneous-dependencies import { describe, expect, test } from '@jest/globals' import BigNumber from 'bignumber.js' import { EnvTestContext } from '../context' diff --git a/packages/env-tests/src/tests/reserve.ts b/packages/env-tests/src/tests/reserve.ts index 8610207e34e..f3a8cafd4d6 100644 --- a/packages/env-tests/src/tests/reserve.ts +++ b/packages/env-tests/src/tests/reserve.ts @@ -1,4 +1,5 @@ import { CeloContract } from '@celo/contractkit' +// eslint-disable-next-line import/no-extraneous-dependencies import { describe, test } from '@jest/globals' import BigNumber from 'bignumber.js' import { EnvTestContext } from '../context' diff --git a/packages/env-tests/src/tests/transfer.ts b/packages/env-tests/src/tests/transfer.ts index cf18e891b79..318044e3dad 100644 --- a/packages/env-tests/src/tests/transfer.ts +++ b/packages/env-tests/src/tests/transfer.ts @@ -1,8 +1,9 @@ import { StableToken } from '@celo/contractkit' +// eslint-disable-next-line import/no-extraneous-dependencies import { describe, expect, test } from '@jest/globals' import BigNumber from 'bignumber.js' import { EnvTestContext } from '../context' -import { fundAccountWithStableToken, getKey, ONE, TestAccounts } from '../scaffold' +import { ONE, TestAccounts, fundAccountWithStableToken, getKey } from '../scaffold' export function runTransfersTest(context: EnvTestContext, stableTokensToTest: StableToken[]) { describe('Transfer Test', () => { diff --git a/packages/protocol/.eslintrc.js b/packages/protocol/.eslintrc.js new file mode 100644 index 00000000000..0a2477dfcee --- /dev/null +++ b/packages/protocol/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + rules: { + 'import/no-extraneous-dependencies': 'off', + 'no-underscore-dangle': 'off', + }, +} diff --git a/packages/protocol/lib/bytecode.ts b/packages/protocol/lib/bytecode.ts index 17ca227218e..c4a215790b8 100644 --- a/packages/protocol/lib/bytecode.ts +++ b/packages/protocol/lib/bytecode.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-classes-per-file +/* eslint-disable max-classes-per-file: 0 */ /* * The Solidity compiler appends a Swarm Hash of compilation metadata to the end * of bytecode. We find this hash based on the specification here: diff --git a/packages/protocol/lib/compatibility/ast-version.ts b/packages/protocol/lib/compatibility/ast-version.ts index db246bb9234..6adfb4c8055 100644 --- a/packages/protocol/lib/compatibility/ast-version.ts +++ b/packages/protocol/lib/compatibility/ast-version.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-classes-per-file +/* eslint-disable max-classes-per-file: 0 */ import { Artifact } from '@celo/protocol/lib/compatibility/internal'; import { ContractVersion, ContractVersionChecker, ContractVersionCheckerIndex, ContractVersionDelta, ContractVersionDeltaIndex, ContractVersionIndex, DEFAULT_VERSION_STRING } from '@celo/protocol/lib/compatibility/version'; import { Address as EJSAddress } from "@ethereumjs/util"; @@ -68,7 +68,7 @@ export class ASTContractVersionsChecker { }) return new ASTContractVersionsChecker(contracts) } - + constructor(public readonly contracts: ContractVersionCheckerIndex) {} /** diff --git a/packages/protocol/lib/compatibility/change.ts b/packages/protocol/lib/compatibility/change.ts index 5409def930d..c5febe9cd6b 100644 --- a/packages/protocol/lib/compatibility/change.ts +++ b/packages/protocol/lib/compatibility/change.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-classes-per-file +/* eslint-disable max-classes-per-file: 0 */ /** * A code change detected from an old to a new version of a contract. */ diff --git a/packages/protocol/lib/compatibility/report.ts b/packages/protocol/lib/compatibility/report.ts index 615e5424293..ac50e34ac9c 100644 --- a/packages/protocol/lib/compatibility/report.ts +++ b/packages/protocol/lib/compatibility/report.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-classes-per-file +/* eslint-disable max-classes-per-file: 0 */ import { BuildArtifacts } from '@openzeppelin/upgrades' import ContractAST from '@openzeppelin/upgrades/lib/utils/ContractAST' @@ -127,7 +127,7 @@ export const isLibrary = (contract: string, artifactsSet: BuildArtifacts[]) => { const artifact = artifacts.getArtifactByName(contract) if (artifact === undefined){ - // EAFP + // EAFP // the library may be in another package continue } diff --git a/packages/protocol/lib/compatibility/verify-bytecode.ts b/packages/protocol/lib/compatibility/verify-bytecode.ts index aaab5b4a124..96abf763e2c 100644 --- a/packages/protocol/lib/compatibility/verify-bytecode.ts +++ b/packages/protocol/lib/compatibility/verify-bytecode.ts @@ -1,11 +1,11 @@ -// tslint:disable: no-console +/* eslint-disable no-console: 0 */ import { ensureLeading0x } from '@celo/base/lib/address' import { - LibraryAddresses, - LibraryPositions, - linkLibraries, - stripMetadata, - verifyAndStripLibraryPrefix, + LibraryAddresses, + LibraryPositions, + linkLibraries, + stripMetadata, + verifyAndStripLibraryPrefix, } from '@celo/protocol/lib/bytecode' import { verifyProxyStorageProof } from '@celo/protocol/lib/proxy-utils' import { ProposalTx } from '@celo/protocol/scripts/truffle/make-release' diff --git a/packages/protocol/lib/compatibility/version.ts b/packages/protocol/lib/compatibility/version.ts index 9dece2fa024..b5c47c31865 100644 --- a/packages/protocol/lib/compatibility/version.ts +++ b/packages/protocol/lib/compatibility/version.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-classes-per-file +/* eslint-disable max-classes-per-file: 0 */ export const DEFAULT_VERSION_STRING = '1.1.0.0' export class ContractVersion { @@ -126,12 +126,12 @@ export class ContractVersionDelta { public isVersionIncremented = () : boolean => { return ( - this.storage === Delta.Increment || - this.major === Delta.Increment || - this.minor === Delta.Increment|| + this.storage === Delta.Increment || + this.major === Delta.Increment || + this.minor === Delta.Increment|| this.patch === Delta.Increment ) - } + } } /** @@ -158,7 +158,7 @@ export class ContractVersionChecker { if (this.oldVersion === null) { // Newly added contracts should have version 1.1.0.0 return ContractVersion.fromString(DEFAULT_VERSION_STRING) - } else { + } else { return this.expectedDelta.appliedTo(this.oldVersion) } } diff --git a/packages/protocol/lib/test-utils.ts b/packages/protocol/lib/test-utils.ts index 8c5f9b9e114..04f7953ac74 100644 --- a/packages/protocol/lib/test-utils.ts +++ b/packages/protocol/lib/test-utils.ts @@ -1,29 +1,29 @@ -import { ArtifactsSingleton } from '@celo/protocol/lib/artifactsSingleton'; -import { hasEntryInRegistry, usesRegistry } from '@celo/protocol/lib/registry-utils'; -import { getParsedSignatureOfAddress } from '@celo/protocol/lib/signing-utils'; -import { getDeployedProxiedContract } from '@celo/protocol/lib/web3-utils'; -import { config } from '@celo/protocol/migrationsConfig'; -import { privateKeyToAddress } from '@celo/utils/lib/address'; -import { soliditySha3 } from '@celo/utils/lib/solidity'; -import BigNumber from 'bignumber.js'; -import chai from 'chai'; -import chaiSubset from 'chai-subset'; -// tslint:disable-next-line: ordered-imports -import { spawn, SpawnOptions } from 'child_process'; -import { keccak256 } from 'ethereum-cryptography/keccak'; -import { GovernanceApproverMultiSigInstance, GovernanceInstance, LockedGoldInstance, ProxyInstance, RegistryInstance, UsingRegistryInstance } from 'types'; -import Web3 from 'web3'; -import { ContractPackage, MENTO_PACKAGE } from '../contractPackages'; - -// tslint:disable: ordered-imports -import { fromFixed } from '@celo/utils/lib/fixidity'; -import { bufferToHex, toBuffer } from '@ethereumjs/util'; -import { utf8ToBytes } from 'ethereum-cryptography/utils'; -import { AccountsInstance } from 'types'; +import { ArtifactsSingleton } from '@celo/protocol/lib/artifactsSingleton' +import { hasEntryInRegistry, usesRegistry } from '@celo/protocol/lib/registry-utils' +import { getParsedSignatureOfAddress } from '@celo/protocol/lib/signing-utils' +import { getDeployedProxiedContract } from '@celo/protocol/lib/web3-utils' +import { config } from '@celo/protocol/migrationsConfig' +import { privateKeyToAddress } from '@celo/utils/lib/address' +import { soliditySha3 } from '@celo/utils/lib/solidity' +import BigNumber from 'bignumber.js' +import chai from 'chai' +import chaiSubset from 'chai-subset' +// eslint-disable-next-line: ordered-imports +import { spawn, SpawnOptions } from 'child_process' +import { keccak256 } from 'ethereum-cryptography/keccak' +import { GovernanceApproverMultiSigInstance, GovernanceInstance, LockedGoldInstance, ProxyInstance, RegistryInstance, UsingRegistryInstance } from 'types' +import Web3 from 'web3' +import { ContractPackage, MENTO_PACKAGE } from '../contractPackages' + +/* eslint:disabled ordered-imports: 0 */ +import { getIdentifierHash, IdentifierPrefix } from "@celo/odis-identifiers" +import { fromFixed } from '@celo/utils/lib/fixidity' +import { bufferToHex, toBuffer } from '@ethereumjs/util' +import { utf8ToBytes } from 'ethereum-cryptography/utils' +import { AccountsInstance } from 'types' import BN = require('bn.js') -import { getIdentifierHash, IdentifierPrefix } from "@celo/odis-identifiers" export function getOdisHash( phoneNumber: string, pepper?: string, @@ -192,7 +192,7 @@ export async function assertRevert(promise: any, errorMessage: string = '') { } export async function exec(command: string, args: string[]) { - console.log(`Running: ${command} ${args}`) + console.info(`Running: ${command} ${args}`) return new Promise((resolve, reject) => { const proc = spawn(command, args, { stdio: [process.stdout, process.stderr], diff --git a/packages/protocol/lib/web3-utils.ts b/packages/protocol/lib/web3-utils.ts index b72b9d5cae0..a528cd5ed52 100644 --- a/packages/protocol/lib/web3-utils.ts +++ b/packages/protocol/lib/web3-utils.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-console */ + // TODO(asa): Refactor and rename to 'deployment-utils.ts' import { Address, CeloTxObject } from '@celo/connect' import { setAndInitializeImplementation } from '@celo/protocol/lib/proxy-utils' @@ -151,10 +151,10 @@ export function checkFunctionArgsLength(args: any[], abi: any) { export async function setInitialProxyImplementation< ContractInstance extends Truffle.ContractInstance >(web3: Web3, artifacts: any, contractName: string, contractPackage?: ContractPackage, ...args: any[]): Promise { - + const wrappedArtifacts = ArtifactsSingleton.getInstance(contractPackage, artifacts) const Contract = wrappedArtifacts.require(contractName) - + // getProxy function supports the case the proxy is in a different package // which is the case for GasPriceMimimum const ContractProxy = wrappedArtifacts.getProxy(contractName, artifacts) @@ -188,7 +188,7 @@ export async function _setInitialProxyImplementation< if (initializerAbi) { // TODO(Martin): check types, not just argument number checkFunctionArgsLength(args, initializerAbi) - console.log(` Setting initial ${contractName} implementation on proxy`) + console.info(` Setting initial ${contractName} implementation on proxy`) receipt = await setAndInitializeImplementation(web3, proxy, implementation.address, initializerAbi, txOptions, ...args) } else { if (txOptions.from != null) { @@ -213,7 +213,7 @@ export async function getDeployedProxiedContract { const Contract: Truffle.Contract = customArtifacts.require(contractName) - + let Proxy:ProxyContract // this wrap avoids a lot of rewrite const overloadedArtifact = ArtifactsSingleton.wrap(customArtifacts) @@ -308,16 +308,16 @@ export function deploymentForContract Started deployment for", name) + console.info("-> Started deployment for", name) let Contract let ContractProxy if (artifactPath) { Contract = makeTruffleContractForMigration(name, artifactPath, web3) - + // This supports the case the proxy is in a different package if (artifactPath.proxiesPath){ if (artifactPath.proxiesPath == "/"){ - ContractProxy = artifacts.require(name + 'Proxy') + ContractProxy = artifacts.require(name + 'Proxy') } else { throw "Loading proxies for custom path not supported" } @@ -331,7 +331,7 @@ export function deploymentForContract { - console.log("\n-> Deploying", name) + console.info("\n-> Deploying", name) deployer.deploy(ContractProxy) deployer.deploy(Contract, testingDeployment) @@ -383,7 +383,7 @@ export async function transferOwnershipOfProxy( export async function transferOwnershipOfProxyAndImplementation< ContractInstance extends OwnableInstance >(contractName: string, owner: string, artifacts: any) { - console.log(` Transferring ownership of ${contractName} and its Proxy to ${owner}`) + console.info(` Transferring ownership of ${contractName} and its Proxy to ${owner}`) const contract: ContractInstance = await getDeployedProxiedContract( contractName, artifacts diff --git a/packages/protocol/migrations_ts/02_registry.ts b/packages/protocol/migrations_ts/02_registry.ts index e81da75621c..1b7448007d1 100644 --- a/packages/protocol/migrations_ts/02_registry.ts +++ b/packages/protocol/migrations_ts/02_registry.ts @@ -9,7 +9,7 @@ const Contract = artifacts.require(name) const ContractProxy = artifacts.require(name + 'Proxy') module.exports = (deployer: any, _networkName: string, _accounts: string[]) => { - // tslint:disable-next-line: no-console + // eslint-disable-next-line: no-console console.info('Deploying Registry') deployer.deploy(ContractProxy) deployer.deploy(Contract, false) diff --git a/packages/protocol/migrations_ts/03_freezer.ts b/packages/protocol/migrations_ts/03_freezer.ts index e1faed794ec..17d9b171c72 100644 --- a/packages/protocol/migrations_ts/03_freezer.ts +++ b/packages/protocol/migrations_ts/03_freezer.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils' import { FreezerInstance } from 'types' diff --git a/packages/protocol/migrations_ts/04_goldtoken.ts b/packages/protocol/migrations_ts/04_goldtoken.ts index 5fd15cad7d2..59138ccc537 100644 --- a/packages/protocol/migrations_ts/04_goldtoken.ts +++ b/packages/protocol/migrations_ts/04_goldtoken.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/05_sortedoracles.ts b/packages/protocol/migrations_ts/05_sortedoracles.ts index c4c8da207a3..8bdacad01c9 100644 --- a/packages/protocol/migrations_ts/05_sortedoracles.ts +++ b/packages/protocol/migrations_ts/05_sortedoracles.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils' import { config } from '@celo/protocol/migrationsConfig' diff --git a/packages/protocol/migrations_ts/06_gaspriceminimum.ts b/packages/protocol/migrations_ts/06_gaspriceminimum.ts index 1dac16b3cd3..5f19ea971d9 100644 --- a/packages/protocol/migrations_ts/06_gaspriceminimum.ts +++ b/packages/protocol/migrations_ts/06_gaspriceminimum.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils' import { config } from '@celo/protocol/migrationsConfig' diff --git a/packages/protocol/migrations_ts/08_reserve.ts b/packages/protocol/migrations_ts/08_reserve.ts index b269785c77d..8c0b1efce37 100644 --- a/packages/protocol/migrations_ts/08_reserve.ts +++ b/packages/protocol/migrations_ts/08_reserve.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/09_01_stableToken_EUR.ts b/packages/protocol/migrations_ts/09_01_stableToken_EUR.ts index 1a864c3f313..a8c67aa4fdb 100644 --- a/packages/protocol/migrations_ts/09_01_stableToken_EUR.ts +++ b/packages/protocol/migrations_ts/09_01_stableToken_EUR.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { ensureLeading0x, eqAddress, NULL_ADDRESS } from '@celo/base/lib/address' import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { diff --git a/packages/protocol/migrations_ts/09_02_stableToken_BRL.ts b/packages/protocol/migrations_ts/09_02_stableToken_BRL.ts index 09568743d5f..2e42f9ff353 100644 --- a/packages/protocol/migrations_ts/09_02_stableToken_BRL.ts +++ b/packages/protocol/migrations_ts/09_02_stableToken_BRL.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { ensureLeading0x, eqAddress, NULL_ADDRESS } from '@celo/base/lib/address' import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { diff --git a/packages/protocol/migrations_ts/09_0_stabletoken_USD.ts b/packages/protocol/migrations_ts/09_0_stabletoken_USD.ts index 156498f438c..44cc2d52d5a 100644 --- a/packages/protocol/migrations_ts/09_0_stabletoken_USD.ts +++ b/packages/protocol/migrations_ts/09_0_stabletoken_USD.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { ensureLeading0x, eqAddress, NULL_ADDRESS } from '@celo/base/lib/address' import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { diff --git a/packages/protocol/migrations_ts/10_01_exchange_EUR.ts b/packages/protocol/migrations_ts/10_01_exchange_EUR.ts index 3a158e16c66..aeb69eb208d 100644 --- a/packages/protocol/migrations_ts/10_01_exchange_EUR.ts +++ b/packages/protocol/migrations_ts/10_01_exchange_EUR.ts @@ -1,5 +1,3 @@ -/* tslint:disable:no-console */ - import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/10_02_exchange_BRL.ts b/packages/protocol/migrations_ts/10_02_exchange_BRL.ts index a12fc3de83d..c4f4155b11d 100644 --- a/packages/protocol/migrations_ts/10_02_exchange_BRL.ts +++ b/packages/protocol/migrations_ts/10_02_exchange_BRL.ts @@ -1,5 +1,3 @@ -/* tslint:disable:no-console */ - import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/10_0_exchange_USD.ts b/packages/protocol/migrations_ts/10_0_exchange_USD.ts index 9fb48f25fcd..22e2ced22fe 100644 --- a/packages/protocol/migrations_ts/10_0_exchange_USD.ts +++ b/packages/protocol/migrations_ts/10_0_exchange_USD.ts @@ -1,5 +1,3 @@ -/* tslint:disable:no-console */ - import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/14_election.ts b/packages/protocol/migrations_ts/14_election.ts index 9f48f7a1d80..94bc55add3a 100644 --- a/packages/protocol/migrations_ts/14_election.ts +++ b/packages/protocol/migrations_ts/14_election.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils' import { config } from '@celo/protocol/migrationsConfig' diff --git a/packages/protocol/migrations_ts/24_grandamento.ts b/packages/protocol/migrations_ts/24_grandamento.ts index 5c6e9635d9f..1d676b51eca 100644 --- a/packages/protocol/migrations_ts/24_grandamento.ts +++ b/packages/protocol/migrations_ts/24_grandamento.ts @@ -1,5 +1,3 @@ -/* tslint:disable:no-console */ - import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { deploymentForCoreContract, diff --git a/packages/protocol/migrations_ts/28_governance.ts b/packages/protocol/migrations_ts/28_governance.ts index 1410c95fa56..56845d78a8d 100644 --- a/packages/protocol/migrations_ts/28_governance.ts +++ b/packages/protocol/migrations_ts/28_governance.ts @@ -1,5 +1,3 @@ -/* tslint:disable:no-console */ - import { constitution } from '@celo/protocol/governanceConstitution' import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { @@ -55,7 +53,7 @@ module.exports = deploymentForCoreContract( ) for (const contractName of constitutionContractNames) { - console.log(`\tSetting constitution thresholds for ${contractName}`) + console.info(`\tSetting constitution thresholds for ${contractName}`) const artifactsObject = ArtifactsSingleton.getInstance( constitution[contractName].__contractPackage, diff --git a/packages/protocol/migrations_ts/29_elect_validators.ts b/packages/protocol/migrations_ts/29_elect_validators.ts index 742fff47910..aaf0fd1424a 100644 --- a/packages/protocol/migrations_ts/29_elect_validators.ts +++ b/packages/protocol/migrations_ts/29_elect_validators.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { NULL_ADDRESS } from '@celo/base/lib/address' import { CeloTxObject } from '@celo/connect' import { getBlsPoP, getBlsPublicKey } from '@celo/cryptographic-utils/lib/bls' @@ -400,5 +399,5 @@ module.exports = async (_deployer: any, networkName: string) => { to: election.address, }) } - console.log('Done with migrations') + console.info('Done with migrations') } diff --git a/packages/protocol/package.json b/packages/protocol/package.json index ac0d2e11002..5f6f4ae3ea7 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -6,7 +6,7 @@ "author": "Celo", "license": "LGPL-3.0", "scripts": { - "lint:ts": "tslint -c tslint.json --project tsconfig.json", + "lint:ts": "DEBUG=* && yarn run --top-level eslint .", "lint:sol": "solhint './contracts/**/*.sol'", "lint": "yarn run lint:ts && yarn run lint:sol", "clean": "rm -rf ./types/typechain && rm -rf build/* && rm -rf .0x-artifacts/* && rm -rf migrations/*.js* && rm -rf migrations_ts/*.js* && rm -rf test/**/*.js* && rm -f lib/*.js* && rm -f lib/**/*.js* && rm -f scripts/*.js* && yarn clean:foundry", @@ -97,6 +97,7 @@ "openzeppelin-solidity": "^2.5.0", "prompts": "^2.0.1", "solhint": "^2.3.1", + "semver": "^7.5.4", "solidity-bytes-utils": "0.0.7", "truffle": "5.9.0", "truffle-security": "^1.7.3", @@ -129,7 +130,6 @@ "jest": "^29.0.2", "merkle-patricia-tree": "4.0.0", "rimraf": "^5.0.5", - "semver": "^7.5.4", "targz": "^1.0.1", "tmp": "^0.1.0", "truffle-typings": "^1.0.6", diff --git a/packages/protocol/runTests.js b/packages/protocol/runTests.js index 747bfc1041b..6537a9a5f59 100644 --- a/packages/protocol/runTests.js +++ b/packages/protocol/runTests.js @@ -74,7 +74,7 @@ async function test() { : `test/\*\*/*.ts` const testFiles = glob.readdirSync(testGlob) if (testFiles.length === 0) { - // tslint:disable-next-line: no-console + // eslint-disable-next-line: no-console console.error(`No test files matched with ${testGlob}`) process.exit(1) } @@ -83,7 +83,7 @@ async function test() { await exec('yarn', testArgs) await closeGanache() } catch (e) { - // tslint:disable-next-line: no-console + // eslint-disable-next-line: no-console console.error(e.stdout ? e.stdout : e) process.nextTick(() => process.exit(1)) } diff --git a/packages/protocol/scripts/build.ts b/packages/protocol/scripts/build.ts index 93d6df4719a..8d5ced816c8 100644 --- a/packages/protocol/scripts/build.ts +++ b/packages/protocol/scripts/build.ts @@ -21,11 +21,11 @@ function hasEmptyBytecode(contract: any) { } function compile({ coreContractsOnly, solidity: outdir }: BuildTargets) { - console.log(`protocol: Compiling solidity to ${outdir}`) + console.info(`protocol: Compiling solidity to ${outdir}`) // the reason to generate a different folder is to avoid path collisions, which could be very dangerous for (const contractPackage of contractPackages) { - console.log(`Building Contracts for package ${contractPackage.name}`) + console.info(`Building Contracts for package ${contractPackage.name}`) const contractPath = path.join( './', @@ -34,7 +34,7 @@ function compile({ coreContractsOnly, solidity: outdir }: BuildTargets) { contractPackage.contractsFolder ) if (!existsSync(contractPath)) { - console.log(`Contract package named ${contractPackage.name} doesn't exist`) + console.info(`Contract package named ${contractPackage.name} doesn't exist`) continue } @@ -67,7 +67,7 @@ function compile({ coreContractsOnly, solidity: outdir }: BuildTargets) { process.exit(1) } } catch (e) { - console.log(e) + console.info(e) console.debug( `WARNING: ${contractName} artifact could not be fetched. Maybe it doesn't exist?` ) @@ -76,10 +76,10 @@ function compile({ coreContractsOnly, solidity: outdir }: BuildTargets) { } function generateFilesForTruffle({ coreContractsOnly, truffleTypes: outdir }: BuildTargets) { - // tslint:disable-next-line + // eslint-disable-next-line for (let externalContractPackage of contractPackages) { const outdirExternal = outdir + '-' + externalContractPackage.name - console.log( + console.info( `protocol: Generating Truffle Types for external dependency ${externalContractPackage.name} to ${outdirExternal}` ) @@ -89,7 +89,7 @@ function generateFilesForTruffle({ coreContractsOnly, truffleTypes: outdir }: Bu ) } - console.log(`protocol: Generating Truffle Types to ${outdir}`) + console.info(`protocol: Generating Truffle Types to ${outdir}`) exec(`rm -rf "${outdir}"`) const globPattern = coreContractsOnly @@ -100,7 +100,7 @@ function generateFilesForTruffle({ coreContractsOnly, truffleTypes: outdir }: Bu } function generateFilesForEthers({ coreContractsOnly, ethersTypes: outdir }: BuildTargets) { - console.log(`protocol: Generating Ethers Types to ${outdir}`) + console.info(`protocol: Generating Ethers Types to ${outdir}`) exec(`rm -rf "${outdir}"`) const contractKitContracts = coreContractsOnly @@ -112,7 +112,7 @@ function generateFilesForEthers({ coreContractsOnly, ethersTypes: outdir }: Buil } async function generateFilesForContractKit({ coreContractsOnly, web3Types: outdir }: BuildTargets) { - console.log(`protocol: Generating Web3 Types to ${outdir}`) + console.info(`protocol: Generating Web3 Types to ${outdir}`) exec(`rm -rf ${outdir}`) const relativePath = path.relative(ROOT_DIR, outdir) diff --git a/packages/protocol/scripts/check-opcodes.ts b/packages/protocol/scripts/check-opcodes.ts index e97e056f16a..effabb3e887 100644 --- a/packages/protocol/scripts/check-opcodes.ts +++ b/packages/protocol/scripts/check-opcodes.ts @@ -21,13 +21,14 @@ const handleGrepOutput = (err: ExecException, grepOutput: string, stderr: string const contractMatch = contractPath.slice(contractPath.lastIndexOf('/') + 1) if (CHECK_CONTRACTS.includes(contractMatch)) { safe = false - console.error(`Core contract ${contractMatch} should not include ${UNSAFE_OPCODES} opcodes`) + console.error( + `Core contract ${contractMatch} should not include ${UNSAFE_OPCODES.join('+')} opcodes` + ) } }) if (safe) { - // tslint:disable:no-console - console.log(`Core contracts are safe against ${UNSAFE_OPCODES} vulnerabilities`) + console.info(`Core contracts are safe against ${UNSAFE_OPCODES.join('+')} vulnerabilities`) } else { process.exit(1) } diff --git a/packages/protocol/scripts/devchain.ts b/packages/protocol/scripts/devchain.ts index 6e07d0639cf..d1a03101f0e 100644 --- a/packages/protocol/scripts/devchain.ts +++ b/packages/protocol/scripts/devchain.ts @@ -22,7 +22,7 @@ const isCI = process.env.CI === 'true' const CallerCWD = process.env.INIT_CWD ? process.env.INIT_CWD : process.cwd() process.chdir(CallerCWD) -// tslint:disable-next-line: no-unused-expression +// eslint-disable-next-line @typescript-eslint/no-unused-expressions yargs .scriptName('devchain') .recommendCommands() @@ -119,16 +119,12 @@ yargs (args) => exitOnError(compressChain(args.datadir, args.filename)) ).argv -async function startGanache( - datadir: string, - opts: { verbose?: boolean }, - chainCopy?: tmp.DirResult -) { +function startGanache(datadir: string, opts: { verbose?: boolean }, chainCopy?: tmp.DirResult) { const logFn = opts.verbose - ? // tslint:disable-next-line: no-console - (...args: any[]) => console.log(...args) + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + (...args: any[]) => console.info(...args) : () => { - /*nothing*/ + /* nothing */ } const server = ganache.server({ @@ -140,25 +136,20 @@ async function startGanache( allowUnlimitedInitCodeSize: true, }) - server.listen(8545, async (err) => { + server.listen(8545, (err) => { if (err) { throw err } - // tslint:disable-next-line: no-console - console.log(chalk.red('Ganache STARTED')) + // eslint-disable-next-line: no-console + console.info(chalk.red('Ganache STARTED')) }) return async () => { - try { - await server.close() - if (chainCopy) { - chainCopy.removeCallback() - } - // tslint:disable-next-line: no-console - console.log(chalk.red('Ganache server CLOSED')) - } catch (e) { - throw e + await server.close() + if (chainCopy) { + chainCopy.removeCallback() } + console.info(chalk.red('Ganache server CLOSED')) } } @@ -167,7 +158,7 @@ export function execCmd( args: string[], options?: SpawnOptions & { silent?: boolean } ) { - return new Promise(async (resolve, reject) => { + return new Promise((resolve, reject) => { const { silent, ...spawnOptions } = options || { silent: false } if (!silent) { console.debug('$ ' + [cmd].concat(args).join(' ')) @@ -246,13 +237,13 @@ function deployReleaseGold(releaseGoldContracts: string) { async function runDevChainFromTar(filename: string) { const chainCopy: tmp.DirResult = tmp.dirSync({ keep: false, unsafeCleanup: true }) - // tslint:disable-next-line: no-console - console.log(`Creating tmp folder: ${chainCopy.name}`) + // eslint-disable-next-line: no-console + console.info(`Creating tmp folder: ${chainCopy.name}`) await decompressChain(filename, chainCopy.name) console.info('Starting Ganache ...') - const stopGanache = await startGanache(chainCopy.name, { verbose: true }, chainCopy) + const stopGanache = startGanache(chainCopy.name, { verbose: true }, chainCopy) if (isCI) { // If we are running on circle ci we need to wait for ganache to be up. await waitForPortOpen('localhost', 8545, 120) @@ -272,8 +263,8 @@ async function runDevChainFromTarInBackGround(filename: string) { // keep is set to true, because `release-on-devchain` fails when set to false. const chainCopy: tmp.DirResult = tmp.dirSync({ keep: true, unsafeCleanup: true }) - // tslint:disable-next-line: no-console - console.log(`Creating tmp folder: ${chainCopy.name}`) + // eslint-disable-next-line: no-console + console.info(`Creating tmp folder: ${chainCopy.name}`) await decompressChain(filename, chainCopy.name) @@ -283,16 +274,16 @@ async function runDevChainFromTarInBackGround(filename: string) { } function decompressChain(tarPath: string, copyChainPath: string): Promise { - // tslint:disable-next-line: no-console - console.log('Decompressing chain') + // eslint-disable-next-line: no-console + console.info('Decompressing chain') return new Promise((resolve, reject) => { targz.decompress({ src: tarPath, dest: copyChainPath }, (err) => { if (err) { console.error(err) reject(err) } else { - // tslint:disable-next-line: no-console - console.log('Chain decompressed') + // eslint-disable-next-line: no-console + console.info('Chain decompressed') resolve() } }) @@ -315,7 +306,7 @@ async function runDevChain( } createDirIfMissing(datadir) console.info('Starting Ganache ...') - const stopGanache = await startGanache(datadir, { verbose: true }) + const stopGanache = startGanache(datadir, { verbose: true }) if (isCI) { // If we are running on circle ci we need to wait for ganache to be up. await waitForPortOpen('localhost', 8545, 120) @@ -369,18 +360,18 @@ async function generateDevChain( } async function compressChain(chainPath: string, filename: string): Promise { - // tslint:disable-next-line: no-console - console.log('Compressing chain') + // eslint-disable-next-line: no-console + console.info('Compressing chain') return new Promise((resolve, reject) => { // ensures the path to the file fs.ensureFileSync(filename) - targz.compress({ src: chainPath, dest: filename }, async (err: Error) => { + targz.compress({ src: chainPath, dest: filename }, (err: Error) => { if (err) { console.error(err) reject(err) } else { - // tslint:disable-next-line: no-console - console.log('Chain compressed') + // eslint-disable-next-line: no-console + console.info('Chain compressed') resolve() } }) @@ -405,6 +396,6 @@ async function isPortOpen(host: string, port: number) { return (await execCmd('nc', ['-z', host, port.toString()], { silent: true })) === 0 } -function delay(time) { +function delay(time: number) { return new Promise((resolve) => setTimeout(resolve, time)) } diff --git a/packages/protocol/scripts/make-release-3-changes.ts b/packages/protocol/scripts/make-release-3-changes.ts index 4fcf7925585..8991940cc4b 100644 --- a/packages/protocol/scripts/make-release-3-changes.ts +++ b/packages/protocol/scripts/make-release-3-changes.ts @@ -22,14 +22,15 @@ const makeRelease3Changes = (releaseProposal: ProposalTx[]) => { } try { - const argv = require('minimist')(process.argv.slice(2), { - string: ['input_proposal', 'output_proposal'], - }) + const argv: { input_proposal: string; output_proposal: string } = require('minimist')( + process.argv.slice(2), + { + string: ['input_proposal', 'output_proposal'], + } + ) const releaseProposal: ProposalTx[] = readJsonSync(argv.input_proposal) writeJsonSync(argv.output_proposal, makeRelease3Changes(releaseProposal), { spaces: 2 }) - // tslint:disable-next-line: no-console - console.log(`Modifications made sucessfully; written to ${argv.output_proposal}`) + console.info(`Modifications made sucessfully; written to ${argv.output_proposal}`) } catch (e) { - // tslint:disable-next-line: no-console - console.error(`Something went wrong: ${e}`) + console.error(`Something went wrong: ${e?.message || e?.toString()}`) } diff --git a/packages/protocol/scripts/make-release-6-changes.ts b/packages/protocol/scripts/make-release-6-changes.ts index d5b2c0bbf4e..51985211d25 100644 --- a/packages/protocol/scripts/make-release-6-changes.ts +++ b/packages/protocol/scripts/make-release-6-changes.ts @@ -22,14 +22,15 @@ const makeRelease6Changes = (releaseProposal: ProposalTx[]) => { } try { - const argv = require('minimist')(process.argv.slice(2), { - string: ['input_proposal', 'output_proposal'], - }) + const argv: { input_proposal: string; output_proposal: string } = require('minimist')( + process.argv.slice(2), + { + string: ['input_proposal', 'output_proposal'], + } + ) const releaseProposal: ProposalTx[] = readJsonSync(argv.input_proposal) writeJsonSync(argv.output_proposal, makeRelease6Changes(releaseProposal), { spaces: 2 }) - // tslint:disable-next-line: no-console - console.log(`Modifications made sucessfully; written to ${argv.output_proposal}`) + console.info(`Modifications made sucessfully; written to ${argv.output_proposal}`) } catch (e) { - // tslint:disable-next-line: no-console console.error(`Something went wrong: ${e}`) } diff --git a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts index 2b3d0cffea3..0f0c2766a94 100644 --- a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts +++ b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts @@ -17,8 +17,8 @@ import { } from './consts' function log(...args: any[]) { - // tslint:disable-next-line - console.log('[prepare-contracts-and-abis]', ...args) + // eslint-disable-next-line + console.info('[prepare-contracts-and-abis]', ...args) } try { @@ -143,6 +143,7 @@ function prepareTargetTypesExports() { parsedPathName )}` + // eslint-disable-next-line no-prototype-builtins if (!exports.hasOwnProperty(exportKey)) { exports[exportKey] = {} } diff --git a/packages/protocol/scripts/sourcify-publish.ts b/packages/protocol/scripts/sourcify-publish.ts index bab30e09513..4ca1e80f041 100644 --- a/packages/protocol/scripts/sourcify-publish.ts +++ b/packages/protocol/scripts/sourcify-publish.ts @@ -1,4 +1,4 @@ -/* tslint:disable no-console */ +/* eslint:disable no-console */ import FormData from 'form-data' import fs from 'fs' import fetch from 'node-fetch' @@ -39,6 +39,10 @@ interface BuildOptions { proposalPath: string } +type Artifact = { + contractName: string +} + async function main(buildTargets: BuildOptions) { const artifactBasePath = buildTargets.buildArtifactsPath || './build/contracts' const artifactPaths = fs.readdirSync(artifactBasePath) @@ -48,16 +52,17 @@ async function main(buildTargets: BuildOptions) { const web3 = new Web3('http://localhost:8545') const chainId = await web3.eth.getChainId() - console.log('Uploading sources & metadata') - console.log('============================') - console.log(artifactPaths) + console.info('Uploading sources & metadata') + console.info('============================') + console.info(artifactPaths) + // eslint-disable-next-line @typescript-eslint/no-unsafe-return const artifacts = artifactPaths.map((a) => require(path.join(process.cwd(), artifactBasePath, a))) if ( !isEqual( - artifacts.map((a) => a.contractName), - report.map((a) => a.contract) + artifacts.map((a: Artifact) => a.contractName), + report.map((a: { contract: string }) => a.contract) ) ) { if (report.length !== artifactPaths.length) { @@ -70,11 +75,11 @@ async function main(buildTargets: BuildOptions) { } for (const r of report) { - const artifact = artifacts.find((a) => a.contractName === r.contract) + const artifact: Artifact = artifacts.find((a) => a.contractName === r.contract) - console.log() - console.log(artifact.contractName) - console.log('-'.repeat(artifact.contractName.length)) + console.info() + console.info(artifact.contractName) + console.info('-'.repeat(artifact.contractName.length)) const address = r.contract.includes('Proxy') ? r.args[0] : r.args[1] const formData = new FormData() @@ -96,19 +101,19 @@ async function main(buildTargets: BuildOptions) { ) ) } - console.log('Finished.') + console.info('Finished.') } const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b) const minimist = require('minimist') -const argv = minimist(process.argv.slice(3), { +const argv: BuildOptions = minimist(process.argv.slice(3), { string: ['network', 'build_artifacts_path', 'proposal_path'], }) main(argv) .then(() => process.exit(0)) .catch((err) => { - console.log(err) + console.info(err) process.exit(1) }) diff --git a/packages/protocol/scripts/truffle/govern.ts b/packages/protocol/scripts/truffle/govern.ts index 91e3eee7358..edfa717bf1d 100644 --- a/packages/protocol/scripts/truffle/govern.ts +++ b/packages/protocol/scripts/truffle/govern.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import assert = require('assert') import { @@ -40,8 +39,8 @@ module.exports = async (callback: (error?: any) => number) => { const functionName = functionCall.split('(')[0] const functionArgs = functionCall.split('(')[1].split(')')[0].split(', ') - console.log(contractName, contract.address, functionName, functionArgs) - console.log('Calling', '"' + argv.command + '"', 'via MultiSig') + console.info(contractName, contract.address, functionName, functionArgs) + console.info('Calling', '"' + argv.command + '"', 'via MultiSig') await submitMultiSigTransaction( multiSig, contract.address, diff --git a/packages/protocol/scripts/truffle/make-release.ts b/packages/protocol/scripts/truffle/make-release.ts index 60e2b557b6c..dedd3172377 100644 --- a/packages/protocol/scripts/truffle/make-release.ts +++ b/packages/protocol/scripts/truffle/make-release.ts @@ -1,6 +1,6 @@ -// tslint:disable: max-classes-per-file -// tslint:disable: no-console -// tslint:disable: ordered-imports +/* eslint-disable max-classes-per-file: 0 */ +/* eslint-disable no-console: 0 */ +/* eslint:disabled ordered-imports: 0 */ import { LibraryAddresses } from '@celo/protocol/lib/bytecode' import { ASTDetailedVersionedReport } from '@celo/protocol/lib/compatibility/report' import { getCeloContractDependencies } from '@celo/protocol/lib/contract-dependencies' @@ -59,7 +59,7 @@ class ContractAddresses { addresses.set(contract, registeredAddress) } } catch (error) { - console.log('contract', contract, error) + console.info('contract', contract, error) throw error } }) @@ -112,7 +112,7 @@ const deployImplementation = async ( if (from) { Contract.defaults({ from }) // override truffle with provided from address } - console.log(`Deploying ${contractName}`) + console.info(`Deploying ${contractName}`) // Hack to trick truffle, which checks that the provided address has code // without this delay it sometimes fails with ProviderError @@ -148,7 +148,7 @@ const deployProxy = async ( if (contractName === 'Governance') { throw new Error(`Storage incompatible changes to Governance are not yet supported`) } - console.log(`Deploying ${contractName}Proxy`) + console.info(`Deploying ${contractName}Proxy`) const Proxy = await artifacts.require(`${contractName}Proxy`) if (from) { Proxy.defaults({ from }) // override truffle with provided from address @@ -157,7 +157,7 @@ const deployProxy = async ( const proxy = await (dryRun ? Proxy.at(celoRegistryAddress) : Proxy.new()) // This makes essentially every contract dependent on Governance. - console.log(`Transferring ownership of ${contractName}Proxy to Governance`) + console.info(`Transferring ownership of ${contractName}Proxy to Governance`) if (!dryRun) { await proxy._transferOwnership(addresses.get('Governance')) } @@ -225,7 +225,7 @@ const deployCoreContract = async ( setImplementationTx.function = '_setAndInitializeImplementation' setImplementationTx.args.push(callData) } - console.log( + console.info( `Add '${contractName}.${setImplementationTx.function} with ${setImplementationTx.args}' to proposal` ) proposal.push(setImplementationTx) @@ -305,7 +305,7 @@ module.exports = async (callback: (error?: any) => number) => { return } - console.log('Dependencies for contract', contractName) + console.info('Dependencies for contract', contractName) let contractArtifact @@ -331,7 +331,7 @@ module.exports = async (callback: (error?: any) => number) => { // 1. Release all dependencies. Guarantees library addresses are canonical for linking. const contractDependencies = dependencies.get(contractName) for (const dependency of contractDependencies) { - console.log('Releasing dependency', dependency) + console.info('Releasing dependency', dependency) await release(dependency) } // 2. Link dependencies. @@ -339,7 +339,7 @@ module.exports = async (callback: (error?: any) => number) => { contractDependencies.map((d) => contractArtifact.link(d, addresses.get(d))) ) // 3. Deploy new versions of the contract or library, if indicated by the report. - console.log('Deploying Contract:', contractName) + console.info('Deploying Contract:', contractName) await deployCoreContract( contractName, contractArtifact, @@ -351,10 +351,10 @@ module.exports = async (callback: (error?: any) => number) => { argv.from ) } else if (shouldDeployLibrary) { - console.log('Deploying library:', contractName) + console.info('Deploying library:', contractName) await deployLibrary(contractName, contractArtifact, addresses, argv.dry_run, argv.from) } else { - console.log('Not deployed:', contractName, "(it's not included in the report)") + console.info('Not deployed:', contractName, "(it's not included in the report)") } // 4. Mark the contract as released diff --git a/packages/protocol/scripts/truffle/set_block_gas_limit.ts b/packages/protocol/scripts/truffle/set_block_gas_limit.ts index 44d2b95f794..6f643884753 100644 --- a/packages/protocol/scripts/truffle/set_block_gas_limit.ts +++ b/packages/protocol/scripts/truffle/set_block_gas_limit.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-console */ import { getDeployedProxiedContract, transferOwnershipOfProxyAndImplementation, @@ -15,7 +14,7 @@ module.exports = async (callback: (error?: any) => number) => { 'BlockchainParameters', artifacts ) - console.log('Setting block gas limit to', config.blockchainParameters.blockGasLimit) + console.info('Setting block gas limit to', config.blockchainParameters.blockGasLimit) await bcp.setBlockGasLimit(config.blockchainParameters.blockGasLimit) if (!config.governance.skipTransferOwnership) { const governance = await getDeployedProxiedContract( diff --git a/packages/protocol/scripts/truffle/verify-bytecode.ts b/packages/protocol/scripts/truffle/verify-bytecode.ts index f1fcf28ab4c..a5123e7166c 100644 --- a/packages/protocol/scripts/truffle/verify-bytecode.ts +++ b/packages/protocol/scripts/truffle/verify-bytecode.ts @@ -60,11 +60,11 @@ module.exports = async (callback: (error?: any) => number) => { network ) - // tslint:disable-next-line: no-console - console.log('Success, no bytecode mismatches found!') + // eslint-disable-next-line: no-console + console.info('Success, no bytecode mismatches found!') - // tslint:disable-next-line: no-console - console.log(`Writing linked library addresses to ${librariesFile}`) + // eslint-disable-next-line: no-console + console.info(`Writing linked library addresses to ${librariesFile}`) writeJsonSync(librariesFile, libraryAddresses.addresses, { spaces: 2 }) } catch (error) { callback(error) diff --git a/packages/protocol/test/common/feehandler.ts b/packages/protocol/test/common/feehandler.ts index 4c2f93119ab..d52240db824 100644 --- a/packages/protocol/test/common/feehandler.ts +++ b/packages/protocol/test/common/feehandler.ts @@ -1,5 +1,5 @@ // TODO remove magic numbers -// tslint:disable: ordered-imports +/* eslint:disabled ordered-imports: 0 */ // TODO either pretiffy is not fixing this or the linter is broken import { CeloContractName } from '@celo/protocol/lib/registry-utils' import { @@ -577,8 +577,8 @@ contract('FeeHandler', (accounts: string[]) => { beforeEach(async () => { deadline = (await web3.eth.getBlock('latest')).timestamp + 100 uniswapFactory = await UniswapV2Factory.new('0x0000000000000000000000000000000000000000') // feeSetter - // tslint:disable-next-line - console.log('Uniswap INIT CODE PAIR HASH:', await uniswapFactory.INIT_CODE_PAIR_HASH()) + // eslint-disable-next-line + console.info('Uniswap INIT CODE PAIR HASH:', await uniswapFactory.INIT_CODE_PAIR_HASH()) const initCodePairHash = await uniswapFactory.INIT_CODE_PAIR_HASH() diff --git a/packages/protocol/test/common/migration.ts b/packages/protocol/test/common/migration.ts index b4e1dd5751a..05b6eda1573 100644 --- a/packages/protocol/test/common/migration.ts +++ b/packages/protocol/test/common/migration.ts @@ -9,7 +9,7 @@ import { ArtifactsSingleton } from '../../lib/artifactsSingleton' const getProxiedContract = async (contractName: string, contractPackage: ContractPackage) => { const artifactsObject = ArtifactsSingleton.getInstance(contractPackage, artifacts) - /* tslint:disable-next-line */ + /* eslint-disable-next-line */ return await getDeployedProxiedContract(contractName, artifactsObject) } @@ -18,15 +18,15 @@ const getContract = async ( type: string, contractPackage: ContractPackage ) => { - // /* tslint:disable-next-line */ + // /* eslint-disable-next-line */ const artifactsObject = ArtifactsSingleton.getInstance(contractPackage, artifacts) if (type === 'contract') { - /* tslint:disable-next-line */ + /* eslint-disable-next-line */ return await artifactsObject.require(contractName).deployed() } if (type === 'proxy') { - /* tslint:disable-next-line */ + /* eslint-disable-next-line */ return await artifactsObject.require(contractName + 'Proxy').deployed() } } diff --git a/packages/protocol/test/common/uniswapfeehandlerseller.ts b/packages/protocol/test/common/uniswapfeehandlerseller.ts index 0c0aca7d5ed..3f410125f51 100644 --- a/packages/protocol/test/common/uniswapfeehandlerseller.ts +++ b/packages/protocol/test/common/uniswapfeehandlerseller.ts @@ -1,4 +1,4 @@ -// /* tslint:disable */ +// /* eslint:disable */ // TODO remove magic numbers import { CeloContractName } from '@celo/protocol/lib/registry-utils' diff --git a/packages/protocol/test/governance/voting/election.ts b/packages/protocol/test/governance/voting/election.ts index 448071bbfdc..012108ee8b1 100644 --- a/packages/protocol/test/governance/voting/election.ts +++ b/packages/protocol/test/governance/voting/election.ts @@ -2318,8 +2318,8 @@ contract('Election', (accounts: string[]) => { const debugLog = (s: string) => { if (debug) { - // tslint:disable-next-line: no-console - console.log(s) + // eslint-disable-next-line: no-console + console.info(s) } } @@ -2548,7 +2548,7 @@ contract('Election', (accounts: string[]) => { NULL_ADDRESS, NULL_ADDRESS ) - // tslint:disable-next-line + // eslint-disable-next-line for (let i = 0; i < vAccounts.length; i++) { vAccounts[i].active = activeTotal .plus(reward) diff --git a/packages/protocol/test/governance/voting/release_gold.ts b/packages/protocol/test/governance/voting/release_gold.ts index 513cede5eee..928d4ba9a53 100644 --- a/packages/protocol/test/governance/voting/release_gold.ts +++ b/packages/protocol/test/governance/voting/release_gold.ts @@ -6,13 +6,13 @@ import { assertGteBN, assertLogMatches, assertSameAddress, - // tslint:disable-next-line: ordered-imports + // eslint-disable-next-line: ordered-imports assertTransactionRevertWithReason, assertTransactionRevertWithoutReason, expectBigNumberInRange, timeTravel, } from '@celo/protocol/lib/test-utils' -// tslint:disable-next-line: ordered-imports +// eslint-disable-next-line: ordered-imports import { Signature, addressToPublicKey } from '@celo/utils/lib/signatureUtils' import { BigNumber } from 'bignumber.js' import _ from 'lodash' diff --git a/packages/protocol/truffle-config-parent.js b/packages/protocol/truffle-config-parent.js index b5595f17760..aae2d8e8980 100644 --- a/packages/protocol/truffle-config-parent.js +++ b/packages/protocol/truffle-config-parent.js @@ -124,7 +124,7 @@ const networks = { coverageProvider.start((err) => { if (err !== undefined) { - // tslint:disable-next-line: no-console + // eslint-disable-next-line: no-console console.error(err) process.exit(1) } diff --git a/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.js b/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.js deleted file mode 100644 index eab4ab1678a..00000000000 --- a/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict' -exports.__esModule = true -var tslib_1 = require('tslib') -var Lint = require('tslint') -var ts = require('typescript') -var Rule = /** @class */ (function (_super) { - tslib_1.__extends(Rule, _super) - function Rule() { - return (_super !== null && _super.apply(this, arguments)) || this - } - Rule.prototype.apply = function (sourceFile) { - return this.applyWithFunction(sourceFile, walk) - } - Rule.FAILURE_STRING = 'arrow functions forbidden in global scope, use named function' - return Rule -})(Lint.Rules.AbstractRule) -exports.Rule = Rule -// @ts-ignore -function walk(ctx) { - return ts.forEachChild(ctx.sourceFile, function cb(node) { - if (ts.isArrowFunction(node) && isGlobalScopeArrowFunction(node)) { - ctx.addFailureAtNode(node, Rule.FAILURE_STRING) - } - return ts.forEachChild(node, cb) - }) -} -function isGlobalScopeArrowFunction(node) { - return checkParentChainType( - [ - ts.SyntaxKind.ArrowFunction, - ts.SyntaxKind.VariableDeclaration, - ts.SyntaxKind.VariableDeclarationList, - ts.SyntaxKind.VariableStatement, - ts.SyntaxKind.SourceFile, - ], - node - ) -} -function checkParentChainType(types, node) { - var temp = node - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var t = types_1[_i] - if (!temp || !(temp.kind === t)) { - return false - } - temp = temp.parent - } - return true -} diff --git a/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.ts b/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.ts deleted file mode 100644 index 26ba15a105c..00000000000 --- a/packages/typescript/custom-rules/noGlobalArrowFunctionsRule.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as Lint from 'tslint' -import * as ts from 'typescript' - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING = 'arrow functions forbidden in global scope, use named function' - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithFunction(sourceFile, walk) - } -} - -// @ts-ignore -function walk(ctx: Lint.WalkContext) { - return ts.forEachChild(ctx.sourceFile, function cb(node): void { - if (ts.isArrowFunction(node) && isGlobalScopeArrowFunction(node)) { - ctx.addFailureAtNode(node, Rule.FAILURE_STRING) - } - return ts.forEachChild(node, cb) - }) -} - -function isGlobalScopeArrowFunction(node: ts.Node) { - return checkParentChainType( - [ - ts.SyntaxKind.ArrowFunction, - ts.SyntaxKind.VariableDeclaration, - ts.SyntaxKind.VariableDeclarationList, - ts.SyntaxKind.VariableStatement, - ts.SyntaxKind.SourceFile, - ], - node - ) -} - -function checkParentChainType(types: ts.SyntaxKind[], node: ts.Node) { - let temp = node - for (const t of types) { - if (!temp || !(temp.kind === t)) { - return false - } - temp = temp.parent - } - return true -} diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 4ab14fda300..f8790a9ba71 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -4,16 +4,9 @@ "description": "typescript configuration", "author": "Celo", "license": "Apache-2.0", - "main": "tslint.json", + "main": "tsconfig.library.json", "scripts": { "build-rules": "tsc" }, - "devDependencies": { - "tslint": "^5.20.0", - "tslint-config-prettier": "^1.18.0", - "tslint-eslint-rules": "^5.4.0", - "tslint-microsoft-contrib": "^6.2.0", - "tslint-react": "^4.1.0", - "tslint-react-hooks": "^2.2.1" - } + "devDependencies": {} } diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json deleted file mode 100644 index 89a1e70dcc6..00000000000 --- a/packages/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": false, - "baseUrl": ".", - "importHelpers": true, - "lib": ["es7", "esnext"], - "moduleResolution": "node16", - "noImplicitAny": true, - "noUnusedLocals": true, - "strictNullChecks": true, - "skipLibCheck": true, - "target": "es6", - "strict": true - }, - "exclude": ["node_modules"] -} diff --git a/packages/typescript/tslint.json b/packages/typescript/tslint.json deleted file mode 100644 index 27167350239..00000000000 --- a/packages/typescript/tslint.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "extends": ["tslint:latest", "tslint-react", "tslint-react-hooks", "tslint-config-prettier"], - "rulesDirectory": [ - "../../../node_modules/tslint-eslint-rules/dist/rules", - "../../../node_modules/tslint-microsoft-contrib", - "./custom-rules" - ], - "rules": { - "no-eval": true, - "no-duplicate-switch-case": true, - "no-reference": true, - "no-duplicate-super": true, - "member-access": false, - "no-implicit-dependencies": [ - true, - "dev" - ], - "interface-name": false, - "no-submodule-imports": false, - "object-literal-sort-keys": false, - "one-variable-per-declaration": false, - "no-var-requires": false, - "no-console": [true, "log"], - "variable-name": { - "options": ["allow-leading-underscore", "allow-pascal-case"] - }, - "no-constant-condition": [true, { "checkLoops": false }], - "no-extra-boolean-cast": true, - "no-ex-assign": true, - "no-inner-declarations": [true, "functions"], - "no-for-in": true, - "void-zero": false, - "no-global-arrow-functions": true, - "no-floating-promises": true, - "no-promise-as-boolean": true, - "import-blacklist": [true, { "elliptic": ["ec"]}] - } -} diff --git a/patches/tslint+5.20.0.patch b/patches/tslint+5.20.0.patch deleted file mode 100644 index 106d410100e..00000000000 --- a/patches/tslint+5.20.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -patch-package ---- a/node_modules/tslint/lib/linter.js -+++ b/node_modules/tslint/lib/linter.js -@@ -193,7 +193,7 @@ var Linter = /** @class */ (function () { - var oldSource = fs.readFileSync(filePath, "utf-8"); - fileNewSource = rule_1.Replacement.applyFixes(oldSource, fileFixes); - } -- fs.writeFileSync(filePath, fileNewSource); -+ fs.writeFileSync(path.resolve(filePath), fileNewSource); - _this.updateProgram(filePath); - }); - return source; diff --git a/scripts/check-packages.js b/scripts/check-packages.js index 2db200f0a18..297cc92ba95 100644 --- a/scripts/check-packages.js +++ b/scripts/check-packages.js @@ -55,7 +55,7 @@ function getErrors(pkgJson) { const errors = [].concat(...pkgJsons.map(getErrors).filter((err) => err.length > 0)) -console.log( +console.info( errors .map( (err) => diff --git a/scripts/hooks/pre-push.js b/scripts/hooks/pre-push.js index ddb63d83520..287ceba3cfb 100644 --- a/scripts/hooks/pre-push.js +++ b/scripts/hooks/pre-push.js @@ -82,7 +82,7 @@ for (const change of changes) { ) if (pushedMnemonicFiles.length > 0) { console.error(`Trying to push conflicting files`) - console.log(`Conflicting Files:\n ${pushedMnemonicFiles.join('\n ')}`) + console.info(`Conflicting Files:\n ${pushedMnemonicFiles.join('\n ')}`) console.error(chalk.red(`(${change.remoteRef}) Push rejected!`)) process.exit(1) } diff --git a/tslint-to-eslint-config.log b/tslint-to-eslint-config.log new file mode 100644 index 00000000000..6e85eeaa025 --- /dev/null +++ b/tslint-to-eslint-config.log @@ -0,0 +1,31 @@ +9 ESLint rules behave differently from their TSLint counterparts: + * one-var: + - Variables declared in for loops will no longer be checked. + * no-console: + - Custom console methods, if they exist, will no longer be allowed. + * no-underscore-dangle: + - Leading or trailing underscores (_) on identifiers will now be forbidden. + * no-invalid-this: + - Functions in methods will no longer be ignored. + * @typescript-eslint/no-unused-expressions: + - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored. + * prefer-arrow/prefer-arrow-functions: + - ESLint (eslint-plugin-prefer-arrow plugin) does not support allowing named functions defined with the function keyword. + * eqeqeq: + - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons. + * no-redeclare: + - ESLint does not support check-parameters. + * padded-blocks: + - ESLint's padded-blocks rule also bans a blank line before a closing brace. + +Error: multiple output react/jsx-curly-spacing ESLint rule options were generated, but tslint-to-eslint-config doesn't have "merger" logic to deal with this. +Please file an issue at https://github.com/typescript-eslint/tslint-to-eslint-config/issues/new?template=missing_merger.md. Thanks! + +4 rules are not known by tslint-to-eslint-config to have ESLint equivalents: + * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-ex-assign". + * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-extra-boolean-cast". + * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-inner-declarations". + * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-promise-as-boolean". + + * import-destructuring-spacing + diff --git a/yarn.lock b/yarn.lock index fc46ff209e3..e01be197605 100644 --- a/yarn.lock +++ b/yarn.lock @@ -267,6 +267,11 @@ ethers "~4.0.4" lodash "^4.17.21" +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + 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.9.4": version "1.9.4" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz#aae21cb858bbb0411949d5b7b3051f4209043f62" @@ -1162,6 +1167,38 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.16.17.tgz#c5a1a4bfe1b57f0c3e61b29883525c6da3e5c091" integrity sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q== +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" + integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.56.0": + version "8.56.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" + integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== + "@ethereumjs/block@4.2.1", "@ethereumjs/block@^4.2.1": version "4.2.1" resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-4.2.1.tgz#cb0d8b770fe69c61e6e41d6693d285de76b3a7cb" @@ -1957,6 +1994,25 @@ protobufjs "^7.0.0" yargs "^16.2.0" +"@humanwhocodes/config-array@^0.11.13": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== + dependencies: + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" + integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + "@hutson/parse-repository-url@^3.0.0": version "3.0.2" resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" @@ -3061,7 +3117,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -4800,6 +4856,11 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/json-schema@^7.0.12": + 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/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -5091,6 +5152,11 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59" integrity sha512-D/2EJvAlCEtYFEYmmlGwbGXuK886HzyCc3nZX/tkFTQdEU8jZDAgiv08P162yB17y4ZXZoq7yFAnW4GDBb9Now== +"@types/semver@^7.5.0": + version "7.5.6" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" + integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== + "@types/send@*": version "0.17.1" resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301" @@ -5211,6 +5277,97 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz#db03f3313b57a30fbbdad2e6929e88fc7feaf9ba" + integrity sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.19.0" + "@typescript-eslint/type-utils" "6.19.0" + "@typescript-eslint/utils" "6.19.0" + "@typescript-eslint/visitor-keys" "6.19.0" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/parser@^6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.19.0.tgz#80344086f362181890ade7e94fc35fe0480bfdf5" + integrity sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow== + dependencies: + "@typescript-eslint/scope-manager" "6.19.0" + "@typescript-eslint/types" "6.19.0" + "@typescript-eslint/typescript-estree" "6.19.0" + "@typescript-eslint/visitor-keys" "6.19.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz#b6d2abb825b29ab70cb542d220e40c61c1678116" + integrity sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ== + dependencies: + "@typescript-eslint/types" "6.19.0" + "@typescript-eslint/visitor-keys" "6.19.0" + +"@typescript-eslint/type-utils@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz#522a494ef0d3e9fdc5e23a7c22c9331bbade0101" + integrity sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w== + dependencies: + "@typescript-eslint/typescript-estree" "6.19.0" + "@typescript-eslint/utils" "6.19.0" + debug "^4.3.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/types@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.19.0.tgz#689b0498c436272a6a2059b09f44bcbd90de294a" + integrity sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A== + +"@typescript-eslint/typescript-estree@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz#0813ba364a409afb4d62348aec0202600cb468fa" + integrity sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ== + dependencies: + "@typescript-eslint/types" "6.19.0" + "@typescript-eslint/visitor-keys" "6.19.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "9.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.19.0.tgz#557b72c3eeb4f73bef8037c85dae57b21beb1a4b" + integrity sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.19.0" + "@typescript-eslint/types" "6.19.0" + "@typescript-eslint/typescript-estree" "6.19.0" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@6.19.0": + version "6.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz#4565e0ecd63ca1f81b96f1dd76e49f746c6b2b49" + integrity sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ== + dependencies: + "@typescript-eslint/types" "6.19.0" + eslint-visitor-keys "^3.4.1" + +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== + "@wagmi/cli@^1.0.1": version "1.5.2" resolved "https://registry.yarnpkg.com/@wagmi/cli/-/cli-1.5.2.tgz#11e767b8c5d1cfb5045b6ec63df6fa5001189bc4" @@ -5414,7 +5571,7 @@ accepts@^1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-jsx@^5.0.0: +acorn-jsx@^5.0.0, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== @@ -5434,6 +5591,11 @@ acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +acorn@^8.9.0: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + add-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" @@ -5487,7 +5649,7 @@ ajv-formats@^2.1.1: dependencies: ajv "^8.0.0" -ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.5, ajv@^6.6.1, ajv@^6.9.1: +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.6.1, ajv@^6.9.1: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -5856,6 +6018,17 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng== +array-includes@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" + integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-string "^1.0.7" + array-slice@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" @@ -5871,6 +6044,37 @@ array-unique@^0.2.1: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" integrity sha512-G2n5bG5fSUCpnsXz4+8FUkYsGPkNfLn9YvS66U5qbTIXI2Ynnlo4Bi42bWv+omKUCqz+ejzfClwne0alJWJPhg== +array.prototype.findlastindex@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz#b37598438f97b579166940814e2c0493a4f50207" + integrity sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + get-intrinsic "^1.2.1" + +array.prototype.flat@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" + integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +array.prototype.flatmap@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" + integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + array.prototype.map@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.5.tgz#6e43c2fee6c0fb5e4806da2dc92eb00970809e55" @@ -5893,6 +6097,19 @@ array.prototype.reduce@^1.0.5: es-array-method-boxes-properly "^1.0.0" is-string "^1.0.7" +arraybuffer.prototype.slice@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-array-buffer "^3.0.2" + is-shared-array-buffer "^1.0.2" + arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -6680,11 +6897,6 @@ bufferutil@^4.0.1: dependencies: node-gyp-build "^4.3.0" -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ== - builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" @@ -6825,6 +7037,15 @@ 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.4, call-bind@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== + dependencies: + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" + caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" @@ -7503,7 +7724,7 @@ commander@3.0.2, commander@^3.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== -commander@^2.12.1, commander@^2.20.3, commander@^2.8.1: +commander@^2.20.3, commander@^2.8.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -7893,7 +8114,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -8061,14 +8282,14 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@4.3.4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.3: +debug@4, debug@4.3.4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, 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== dependencies: ms "2.1.2" -debug@^3.1.0, debug@^3.2.6: +debug@^3.1.0, debug@^3.2.6, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== @@ -8216,7 +8437,7 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== @@ -8266,6 +8487,15 @@ deferred-leveldown@~5.3.0: abstract-leveldown "~6.2.1" inherits "^2.0.3" +define-data-property@^1.0.1, define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" @@ -8432,13 +8662,12 @@ dirty-chai@^2.0.1: resolved "https://registry.yarnpkg.com/dirty-chai/-/dirty-chai-2.0.1.tgz#6b2162ef17f7943589da840abc96e75bda01aff3" integrity sha512-ys79pWKvDMowIDEPC6Fig8d5THiC0DJ2gmTeGzVAoEH18J8OzLud0Jh7I9IWg3NSk8x2UocznUuFmfHCXYZx9w== -doctrine@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523" - integrity sha512-qiB/Rir6Un6Ad/TIgTRzsremsTGWzs8j7woXvp14jgq00676uBiBT5eUOi+FgRywZFVy5Us/c04ISRpZhRbS6w== +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: - esutils "^1.1.6" - isarray "0.0.1" + esutils "^2.0.2" doctrine@^3.0.0: version "3.0.0" @@ -8842,6 +9071,51 @@ es-abstract@^1.17.0-next.1, es-abstract@^1.19.0, es-abstract@^1.20.4, es-abstrac unbox-primitive "^1.0.2" which-typed-array "^1.1.9" +es-abstract@^1.22.1: + version "1.22.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.3.tgz#48e79f5573198de6dee3589195727f4f74bc4f32" + integrity sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA== + dependencies: + array-buffer-byte-length "^1.0.0" + arraybuffer.prototype.slice "^1.0.2" + available-typed-arrays "^1.0.5" + call-bind "^1.0.5" + es-set-tostringtag "^2.0.1" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.2" + get-symbol-description "^1.0.0" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + internal-slot "^1.0.5" + is-array-buffer "^3.0.2" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.12" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" + safe-regex-test "^1.0.0" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" + typed-array-buffer "^1.0.0" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.13" + 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" @@ -8871,6 +9145,13 @@ es-set-tostringtag@^2.0.1: has "^1.0.3" has-tostringtag "^1.0.0" +es-shim-unscopables@^1.0.0: + 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" @@ -8966,7 +9247,7 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== -escape-string-regexp@4.0.0: +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -8988,6 +9269,45 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" +eslint-import-resolver-node@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== + dependencies: + debug "^3.2.7" + is-core-module "^2.13.0" + resolve "^1.22.4" + +eslint-module-utils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49" + integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw== + dependencies: + debug "^3.2.7" + +eslint-plugin-import@^2.29.1: + version "2.29.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643" + integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw== + dependencies: + array-includes "^3.1.7" + array.prototype.findlastindex "^1.2.3" + array.prototype.flat "^1.3.2" + array.prototype.flatmap "^1.3.2" + debug "^3.2.7" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.9" + eslint-module-utils "^2.8.0" + hasown "^2.0.0" + is-core-module "^2.13.1" + is-glob "^4.0.3" + minimatch "^3.1.2" + object.fromentries "^2.0.7" + object.groupby "^1.0.1" + object.values "^1.1.7" + semver "^6.3.1" + tsconfig-paths "^3.15.0" + eslint-scope@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" @@ -8996,6 +9316,14 @@ eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + eslint-utils@^1.3.1: version "1.4.3" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" @@ -9008,6 +9336,11 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + eslint@^5.16.0, eslint@^5.5.0, eslint@^5.6.0: version "5.16.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" @@ -9050,6 +9383,50 @@ eslint@^5.16.0, eslint@^5.5.0, eslint@^5.6.0: table "^5.2.3" text-table "^0.2.0" +eslint@^8.56.0: + version "8.56.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15" + integrity sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.56.0" + "@humanwhocodes/config-array" "^0.11.13" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + espree@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" @@ -9059,6 +9436,15 @@ espree@^5.0.1: acorn-jsx "^5.0.0" eslint-visitor-keys "^1.0.0" +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima-extract-comments@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/esprima-extract-comments/-/esprima-extract-comments-1.1.0.tgz#0dacab567a5900240de6d344cf18c33617becbc9" @@ -9076,14 +9462,14 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.1: +esquery@^1.0.1, esquery@^1.4.2: version "1.5.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" -esrecurse@^4.1.0: +esrecurse@^4.1.0, esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== @@ -9105,11 +9491,6 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -esutils@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375" - integrity sha512-RG1ZkUT7iFJG9LSHr7KDuuMSlujfeTtMNIcInURxKAxhMtwQhI3NrQhz26gZQYlsYZQKzsnwtpKrFKj9K9Qu1A== - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -9878,7 +10259,7 @@ fast-check@3.1.1: dependencies: pure-rand "^5.0.1" -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== @@ -9926,7 +10307,7 @@ fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-sta resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== @@ -10005,6 +10386,13 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + file-type@^3.8.0: version "3.9.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9" @@ -10108,7 +10496,7 @@ find-up@4.1.0, find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-up@5.0.0: +find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -10165,6 +10553,15 @@ flat-cache@^2.0.1: rimraf "2.6.3" write "1.0.3" +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" + flat@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.1.tgz#a392059cc382881ff98642f5da4dde0a959f309b" @@ -10182,6 +10579,11 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +flatted@^3.2.9: + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + flow-stoplight@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/flow-stoplight/-/flow-stoplight-1.0.0.tgz#4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b" @@ -10438,6 +10840,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" @@ -10448,6 +10855,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" @@ -10566,7 +10983,7 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^1.0.1, get-caller-file@^1.0.2: +get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== @@ -10604,6 +11021,16 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@ has "^1.0.3" has-symbols "^1.0.3" +get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== + dependencies: + 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" @@ -10822,6 +11249,13 @@ glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -10915,7 +11349,7 @@ glob@^6.0.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.2.3: +glob@^7.0.5, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -10989,6 +11423,13 @@ globals@^11.1.0, globals@^11.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^13.19.0: + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== + dependencies: + type-fest "^0.20.2" + globalthis@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" @@ -10996,7 +11437,7 @@ globalthis@^1.0.3: dependencies: define-properties "^1.1.3" -globby@^11.0.2: +globby@^11.0.2, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -11222,6 +11663,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + graphql-tag@^2.11.0, graphql-tag@^2.12.6: version "2.12.6" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" @@ -11343,6 +11789,13 @@ has-property-descriptors@^1.0.0: dependencies: get-intrinsic "^1.1.1" +has-property-descriptors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== + dependencies: + get-intrinsic "^1.2.2" + has-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" @@ -11414,6 +11867,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: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + hdkey@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-2.1.0.tgz#755b30b73f54e93c31919c1b2f19205a8e57cb92" @@ -11971,6 +12431,13 @@ is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.8.1: dependencies: has "^1.0.3" +is-core-module@^2.13.0, is-core-module@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + 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" @@ -12073,7 +12540,7 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" -is-glob@^4.0.1, is-glob@~4.0.1: +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" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -12161,6 +12628,11 @@ is-object@^1.0.1, is-object@~1.0.1: resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf" integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -12289,6 +12761,13 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: gopd "^1.0.1" has-tostringtag "^1.0.0" +is-typed-array@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== + dependencies: + which-typed-array "^1.1.11" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -13274,6 +13753,13 @@ keyv@^4.0.0: dependencies: json-buffer "3.0.1" +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kind-of@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" @@ -13628,6 +14114,14 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + libnpmaccess@^6.0.3: version "6.0.4" resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-6.0.4.tgz#2dd158bd8a071817e2207d3b201d37cf1ad6ae6b" @@ -14350,7 +14844,7 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -"minimatch@2 || 3", minimatch@^3.0.4, minimatch@^3.1.1: +"minimatch@2 || 3", minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -14378,6 +14872,13 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@9.0.3, minimatch@^9.0.1: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^5.0.1: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" @@ -14385,13 +14886,6 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.1: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -14695,14 +15189,6 @@ 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== -mock-require@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946" - integrity sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg== - dependencies: - get-caller-file "^1.0.2" - normalize-path "^2.1.1" - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -15183,7 +15669,7 @@ normalize-package-data@^4.0.0: semver "^7.3.5" validate-npm-package-license "^3.0.4" -normalize-path@^2.0.1, normalize-path@^2.1.1: +normalize-path@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" integrity sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w== @@ -15446,6 +15932,11 @@ object-inspect@^1.12.3, object-inspect@^1.9.0, 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" @@ -15491,6 +15982,15 @@ object.assign@^4.1.4: has-symbols "^1.0.3" object-keys "^1.1.1" +object.fromentries@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" + integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.6.tgz#5e5c384dd209fa4efffead39e3a0512770ccc312" @@ -15502,6 +16002,16 @@ object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.6 es-abstract "^1.21.2" safe-array-concat "^1.0.0" +object.groupby@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.1.tgz#d41d9f3c8d6c778d9cbac86b4ee9f5af103152ee" + integrity sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + object.omit@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-1.1.0.tgz#9d17ea16778e5057deba7752c6f55f1496829e94" @@ -15518,6 +16028,15 @@ object.omit@^2.0.0: for-own "^0.1.4" is-extendable "^0.1.1" +object.values@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + oboe@2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.4.tgz#20c88cdb0c15371bb04119257d4fdd34b0aa49f6" @@ -15610,6 +16129,18 @@ optionator@^0.8.1, optionator@^0.8.2: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + optjs@~3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/optjs/-/optjs-3.2.2.tgz#69a6ce89c442a44403141ad2f9b370bd5bb6f4ee" @@ -16580,6 +17111,11 @@ precond@0.2: resolved "https://registry.yarnpkg.com/precond/-/precond-0.2.3.tgz#aa9591bcaa24923f1e0f4849d240f47efc1075ac" integrity sha512-QCYG84SgGyGzqJ/vlMsxeXd/pgL/I94ixdNFyh1PusWmTCyVfPJjZ1K1jvHtsbfnXQs2TSkEP2fR7QiMZAnKFQ== +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -17288,6 +17824,15 @@ regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.4.3: define-properties "^1.2.0" functions-have-names "^1.2.3" +regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + set-function-name "^2.0.0" + regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" @@ -17493,7 +18038,7 @@ resolve@1.1.x: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg== -resolve@^1.10.0, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1, resolve@~1.22.1: +resolve@^1.10.0, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.8.1, resolve@~1.22.1: version "1.22.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== @@ -17502,6 +18047,15 @@ resolve@^1.10.0, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.3 path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@^1.22.4: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -17678,6 +18232,16 @@ safe-array-concat@^1.0.0: has-symbols "^1.0.3" isarray "^2.0.5" +safe-array-concat@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.0.tgz#8d0cae9cb806d6d1c06e08ab13d847293ebe0692" + integrity sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg== + dependencies: + call-bind "^1.0.5" + get-intrinsic "^1.2.2" + 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" @@ -17851,6 +18415,11 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" @@ -17937,6 +18506,26 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== +set-function-length@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.0.tgz#2f81dc6c16c7059bda5ab7c82c11f03a515ed8e1" + integrity sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w== + dependencies: + define-data-property "^1.1.1" + function-bind "^1.1.2" + get-intrinsic "^1.2.2" + gopd "^1.0.1" + has-property-descriptors "^1.0.1" + +set-function-name@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== + dependencies: + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" + 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" @@ -18529,6 +19118,15 @@ string.prototype.trim@^1.2.7, string.prototype.trim@~1.2.7: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string.prototype.trimend@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533" @@ -18538,6 +19136,15 @@ string.prototype.trimend@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string.prototype.trimstart@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4" @@ -18547,6 +19154,15 @@ string.prototype.trimstart@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -19264,6 +19880,11 @@ truffle@5.9.0: optionalDependencies: "@truffle/db" "^2.0.24" +ts-api-utils@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" + integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + ts-essentials@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.4.tgz#ce3b5dade5f5d97cf69889c11bf7d2da8555b15a" @@ -19348,6 +19969,16 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +tsconfig-paths@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" + integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.2" + minimist "^1.2.6" + strip-bom "^3.0.0" + tsconfig-paths@^3.8.0: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" @@ -19367,12 +19998,7 @@ tsconfig-paths@^4.1.2: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" - integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== - -tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -19387,84 +20013,11 @@ tslib@~2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== -tslint-config-prettier@^1.18.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" - integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - -tslint-eslint-rules@^5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz#e488cc9181bf193fe5cd7bfca213a7695f1737b5" - integrity sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w== - dependencies: - doctrine "0.7.2" - tslib "1.9.0" - tsutils "^3.0.0" - -tslint-microsoft-contrib@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/tslint-microsoft-contrib/-/tslint-microsoft-contrib-6.2.0.tgz#8aa0f40584d066d05e6a5e7988da5163b85f2ad4" - integrity sha512-6tfi/2tHqV/3CL77pULBcK+foty11Rr0idRDxKnteTaKm6gWF9qmaCNU17HVssOuwlYNyOmd9Jsmjd+1t3a3qw== - dependencies: - tsutils "^2.27.2 <2.29.0" - -tslint-react-hooks@^2.2.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/tslint-react-hooks/-/tslint-react-hooks-2.2.2.tgz#4dc9b3986196802d45c11cc0bf6319a8116fe2ed" - integrity sha512-gtwA14+WevNUtlBhvAD5Ukpxt2qMegYI7IDD8zN/3JXLksdLdEuU/T/oqlI1CtZhMJffqyNn+aqq2oUqUFXiNA== - -tslint-react@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/tslint-react/-/tslint-react-4.2.0.tgz#41b16e0438365f8d3ed4120501f02cabff9fd1e4" - integrity sha512-lO22+FKr9ZZGueGiuALzvZE/8ANoDoCHGCknX1Ge3ALrfcLQHQ1VGdyb1scZXQFdEQEfwBTIU40r5BUlJpn0JA== - dependencies: - tsutils "^3.9.1" - -tslint@^5.20.0: - version "5.20.1" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.20.1.tgz#e401e8aeda0152bc44dd07e614034f3f80c67b7d" - integrity sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.1" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.8.0" - tsutils "^2.29.0" - tsort@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786" integrity sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw== -"tsutils@^2.27.2 <2.29.0": - version "2.28.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.28.0.tgz#6bd71e160828f9d019b6f4e844742228f85169a1" - integrity sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA== - dependencies: - tslib "^1.8.1" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - -tsutils@^3.0.0, tsutils@^3.9.1: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - tunnel-agent@^0.4.0: version "0.4.3" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" @@ -19487,6 +20040,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -19504,6 +20064,11 @@ type-fest@^0.18.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -19567,6 +20132,36 @@ typechain@^4.0.3: ts-essentials "^7.0.1" ts-generator "^0.1.1" +typed-array-buffer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" + integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-typed-array "^1.1.10" + +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" + integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +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" + integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + 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" @@ -19610,15 +20205,6 @@ typescript-logic@^0.0.0: resolved "https://registry.yarnpkg.com/typescript-logic/-/typescript-logic-0.0.0.tgz#66ebd82a2548f2b444a43667bec120b496890196" integrity sha512-zXFars5LUkI3zP492ls0VskH3TtdeHCqu0i7/duGt60i5IGPIpAHE/DWo5FqJ6EjQ15YKXrt+AETjv60Dat34Q== -typescript-tslint-plugin@^0.5.4: - version "0.5.5" - resolved "https://registry.yarnpkg.com/typescript-tslint-plugin/-/typescript-tslint-plugin-0.5.5.tgz#673875c43640251f1ab3d63745d7d49726ff961c" - integrity sha512-tR5igNQP+6FhxaPJYRlUBVsEl0n5cSuXRbg7L1y80mL4B1jUHb8uiIcbQBJ9zWyypJEdFYFUccpXxvMwZR8+AA== - dependencies: - minimatch "^3.0.4" - mock-require "^3.0.3" - vscode-languageserver "^5.2.1" - typescript-tuple@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/typescript-tuple/-/typescript-tuple-2.2.1.tgz#7d9813fb4b355f69ac55032e0363e8bb0f04dad2" @@ -19631,16 +20217,16 @@ typescript@4.4.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324" integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA== -typescript@4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== - "typescript@^3 || ^4": version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" + integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== + typical@^2.6.0, typical@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/typical/-/typical-2.6.1.tgz#5c080e5d661cbbe38259d2e70a3c7253e873881d" @@ -20018,37 +20604,6 @@ viem@^1.0.0: isows "1.0.3" ws "8.13.0" -vscode-jsonrpc@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9" - integrity sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg== - -vscode-languageserver-protocol@3.14.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz#b8aab6afae2849c84a8983d39a1cf742417afe2f" - integrity sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g== - dependencies: - vscode-jsonrpc "^4.0.0" - vscode-languageserver-types "3.14.0" - -vscode-languageserver-types@3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz#d3b5952246d30e5241592b6dde8280e03942e743" - integrity sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A== - -vscode-languageserver@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz#0d2feddd33f92aadf5da32450df498d52f6f14eb" - integrity sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A== - dependencies: - vscode-languageserver-protocol "3.14.1" - vscode-uri "^1.0.6" - -vscode-uri@^1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-1.0.8.tgz#9769aaececae4026fb6e22359cb38946580ded59" - integrity sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ== - vuvuzela@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/vuvuzela/-/vuvuzela-1.0.3.tgz#3be145e58271c73ca55279dd851f12a682114b0b" @@ -21303,6 +21858,17 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== +which-typed-array@^1.1.11, which-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" + integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.4" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + which-typed-array@^1.1.2, which-typed-array@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6" From f85906656fb2447e56e75d08035d786a9692993e Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 23 Jan 2024 13:16:16 +0200 Subject: [PATCH 02/16] use tsconfig/recommended instead of our tsconfig library as base. Fix env tests use of typescript 4.0 for protocol package cannot extend because of bug in ts-node so instead just copy the config. remove tslint.json files --- .eslintrc.js | 2 +- package.json | 1 + packages/celotool/package.json | 1 + .../gcp/remove-leaked-forwarding-rules.ts | 1 + .../src/e2e-tests/governance_tests.ts | 2 +- packages/celotool/tsconfig.json | 2 +- packages/celotool/tslint.json | 19 --------- packages/dev-utils/package.json | 1 + packages/dev-utils/tsconfig.json | 2 +- packages/dev-utils/tslint.json | 9 ---- packages/env-tests/package.json | 3 +- packages/env-tests/tsconfig.json | 2 +- packages/env-tests/tslint.json | 4 -- packages/metadata-crawler/package.json | 1 + packages/metadata-crawler/tsconfig.json | 2 +- packages/protocol/abis/tsconfig.json | 1 + packages/protocol/contractPackages.ts | 10 +++-- packages/protocol/package.json | 1 + .../scripts/make-release-6-changes.ts | 2 +- packages/protocol/tsconfig.json | 42 +++++++------------ packages/protocol/tslint.json | 26 ------------ packages/typescript/package.json | 12 ------ packages/typescript/tsconfig.library.json | 19 --------- tslint-to-eslint-config.log | 31 -------------- yarn.lock | 15 ++++--- 25 files changed, 48 insertions(+), 163 deletions(-) delete mode 100644 packages/celotool/tslint.json delete mode 100644 packages/dev-utils/tslint.json delete mode 100644 packages/env-tests/tslint.json delete mode 100644 packages/protocol/tslint.json delete mode 100644 packages/typescript/package.json delete mode 100644 packages/typescript/tsconfig.library.json delete mode 100644 tslint-to-eslint-config.log diff --git a/.eslintrc.js b/.eslintrc.js index 143888996b4..eff16adcf9f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -45,7 +45,7 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { tsconfigRootDir: `${__dirname}`, - project: ['./packages/typescript/tsconfig.library.json', './packages/*/tsconfig.json'], + project: ['./packages/*/tsconfig.json'], sourceType: 'module', }, plugins: ['eslint-plugin-import', '@typescript-eslint'], diff --git a/package.json b/package.json index e6332be3b7a..78cef72df71 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ ] }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@types/jest": "^29.1.1", "@types/node": "18.7.16", "@types/prompt": "1.1.1", diff --git a/packages/celotool/package.json b/packages/celotool/package.json index 2e56c349d89..bf8f5f95cea 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -49,6 +49,7 @@ "yargs": "17.7.2" }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@celo/dev-utils": "0.0.1", "@celo/protocol": "1.0.2", "@types/bunyan": "1.8.8", diff --git a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts index 3ec996041a6..093654aac3c 100644 --- a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts +++ b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts @@ -49,6 +49,7 @@ export const handler = async (argv: Argv) => { true ) return false + // @ts-expect-error } catch ([error, stdout, stderr]) { if (typeof stdout === 'string') { const healthyInstances = JSON.parse(stdout).length diff --git a/packages/celotool/src/e2e-tests/governance_tests.ts b/packages/celotool/src/e2e-tests/governance_tests.ts index 7690acfd019..3bdffa5fb79 100644 --- a/packages/celotool/src/e2e-tests/governance_tests.ts +++ b/packages/celotool/src/e2e-tests/governance_tests.ts @@ -986,7 +986,7 @@ describe('governance tests', () => { // Connect the validating nodes to the non-validating nodes, to test that announce messages are properly gossiped. await connectBipartiteClique(gethConfig.instances, additionalValidatingNodes, verbose) - console.infoo('wait for new validators to sync') + console.info('wait for new validators to sync') await Promise.all(additionalValidatingNodes.map((i) => waitToFinishInstanceSyncing(i))) validatorAccounts = await getValidatorGroupMembers() diff --git a/packages/celotool/tsconfig.json b/packages/celotool/tsconfig.json index 747699ef2ee..7b8666fd0e4 100644 --- a/packages/celotool/tsconfig.json +++ b/packages/celotool/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@celo/typescript/tsconfig.library.json", + "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { "outDir": "lib", "rootDir": "src", diff --git a/packages/celotool/tslint.json b/packages/celotool/tslint.json deleted file mode 100644 index ae0e82b60fb..00000000000 --- a/packages/celotool/tslint.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": ["@celo/typescript/tslint.json"], - "linterOptions": { - "exclude": ["**/__mocks__/**", "**/lcov-report/**"] - }, - "rules": { - "no-implicit-dependencies": [ - false, - [ - "src" - ] - ], - "no-relative-imports": false, - "max-classes-per-file": [true, 2], - "no-global-arrow-functions": false, - "no-floating-promises": true, - "no-bitwise": false - } -} diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 67bfbdbbffc..cc1e994e999 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -30,6 +30,7 @@ "fs-extra": "^8.1.0" }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@types/fs-extra": "^8.1.0", "@types/targz": "1.0.0" }, diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index f0803492271..db963af1d48 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@celo/typescript/tsconfig.library.json", + "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { "rootDir": "src", "outDir": "lib", diff --git a/packages/dev-utils/tslint.json b/packages/dev-utils/tslint.json deleted file mode 100644 index 036f000683b..00000000000 --- a/packages/dev-utils/tslint.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": ["@celo/typescript/tslint.json"], - "rules": { - "no-global-arrow-functions": false, - "no-console": false, - "member-ordering": false, - "max-classes-per-file": false - } -} diff --git a/packages/env-tests/package.json b/packages/env-tests/package.json index 144beac0a1b..dd5b47baccc 100644 --- a/packages/env-tests/package.json +++ b/packages/env-tests/package.json @@ -30,7 +30,8 @@ "staging-test": "CELO_ENV=staging CELO_PROVIDER=https://staging-forno.celo-networks-dev.org jest --runInBand" }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@jest/globals": "^29.5.0", - "typescript": "4.4.3" + "typescript": "^5.3.3" } } \ No newline at end of file diff --git a/packages/env-tests/tsconfig.json b/packages/env-tests/tsconfig.json index 9125c54a73a..ae4909ad2cb 100644 --- a/packages/env-tests/tsconfig.json +++ b/packages/env-tests/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../typescript/tsconfig.library.json", + "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { "rootDir": "src", "outDir": "lib", diff --git a/packages/env-tests/tslint.json b/packages/env-tests/tslint.json deleted file mode 100644 index e4332b388ff..00000000000 --- a/packages/env-tests/tslint.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["@celo/typescript/tslint.json"], - "rules": {} -} diff --git a/packages/metadata-crawler/package.json b/packages/metadata-crawler/package.json index 7bf08abfe2c..9445cf9aeb7 100644 --- a/packages/metadata-crawler/package.json +++ b/packages/metadata-crawler/package.json @@ -23,6 +23,7 @@ "web3": "1.10.0" }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@types/bunyan": "1.8.8", "@types/dotenv": "^8.2.0", "bunyan-debug-stream": "^2.0.0" diff --git a/packages/metadata-crawler/tsconfig.json b/packages/metadata-crawler/tsconfig.json index 9e6a36d7be4..015d57d38e4 100644 --- a/packages/metadata-crawler/tsconfig.json +++ b/packages/metadata-crawler/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@celo/typescript/tsconfig.library.json", + "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { "rootDir": "src", "outDir": "lib" diff --git a/packages/protocol/abis/tsconfig.json b/packages/protocol/abis/tsconfig.json index 0ee28e1c551..be5e43e42f5 100644 --- a/packages/protocol/abis/tsconfig.json +++ b/packages/protocol/abis/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@tsconfig/recommended/tsconfig.json", "compileOnSave": false, "compilerOptions": { "allowSyntheticDefaultImports": true, diff --git a/packages/protocol/contractPackages.ts b/packages/protocol/contractPackages.ts index 577823d83d4..2c68b9d3a72 100644 --- a/packages/protocol/contractPackages.ts +++ b/packages/protocol/contractPackages.ts @@ -1,3 +1,5 @@ +import { satisfies } from 'semver' + export interface ContractPackage { path?: string folderPath?: string @@ -10,7 +12,7 @@ export interface ContractPackage { proxiesPath?: string } -export const MENTO_PACKAGE: ContractPackage = { +export const MENTO_PACKAGE = { path: 'mento-core', contractsFolder: 'contracts', folderPath: 'lib', @@ -38,9 +40,9 @@ export const MENTO_PACKAGE: ContractPackage = { 'StableTokenProxy', ], truffleConfig: 'truffle-config.js', -} +} satisfies ContractPackage -export const SOLIDITY_08_PACKAGE: ContractPackage = { +export const SOLIDITY_08_PACKAGE = { path: 'contracts-0.8', contractsFolder: '', folderPath: '', @@ -51,4 +53,4 @@ export const SOLIDITY_08_PACKAGE: ContractPackage = { contracts: ['GasPriceMinimum'], proxyContracts: ['GasPriceMinimumProxy'], truffleConfig: 'truffle-config0.8.js', -} +} satisfies ContractPackage diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 5f6f4ae3ea7..7ee1c525c96 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -110,6 +110,7 @@ "truffle-plugin-verify": "^0.6.5" }, "devDependencies": { + "@tsconfig/recommended": "^1.0.3", "@celo/odis-identifiers": "^1.0.0", "@celo/typechain-target-web3-v1-celo": "^1.0.0", "@celo/typescript": "0.0.1", diff --git a/packages/protocol/scripts/make-release-6-changes.ts b/packages/protocol/scripts/make-release-6-changes.ts index 51985211d25..ca9a2658eb0 100644 --- a/packages/protocol/scripts/make-release-6-changes.ts +++ b/packages/protocol/scripts/make-release-6-changes.ts @@ -32,5 +32,5 @@ try { writeJsonSync(argv.output_proposal, makeRelease6Changes(releaseProposal), { spaces: 2 }) console.info(`Modifications made sucessfully; written to ${argv.output_proposal}`) } catch (e) { - console.error(`Something went wrong: ${e}`) + console.error(`Something went wrong: ${e instanceof Error ? JSON.stringify(e) : e?.toString()}`) } diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index 16fd14afe3b..e7f102a8032 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -1,28 +1,18 @@ { - "compileOnSave": false, - "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "baseUrl": ".", - "lib": [ - "es2015", - "es2016" - ], - "module": "commonjs", - "moduleResolution": "node", - "noUnusedLocals": true, - "noUnusedParameters": true, - "removeComments": false, - "skipLibCheck": true, - "sourceMap": true, - "target": "es5", - "downlevelIteration": true, - "resolveJsonModule": true - }, - "exclude": [ - "node_modules", - "wagmi.config.ts", - "abis", - "scripts/**/*.test.ts" - ] + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Recommended", + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": [ + "node_modules", + "wagmi.config.ts", + "abis", + "scripts/**/*.test.ts" + ] } \ No newline at end of file diff --git a/packages/protocol/tslint.json b/packages/protocol/tslint.json deleted file mode 100644 index 59a3611ad0f..00000000000 --- a/packages/protocol/tslint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": ["@celo/typescript/tslint.json"], - "linterOptions": { - "include": ["**/*.ts"], - "exclude": ["types/contracts/*", "lib/**"] - }, - "rules": { - "no-implicit-dependencies": [ - true, - "dev", - [ - "contractPackages", - "@celo/protocol", - "types" - ] - ], - "no-global-arrow-functions": false, - "no-floating-promises": true, - "no-string-literal": false, - "ban": [ - true, - { "name": ["describe", "only"], "message": "don't focus tests" }, - { "name": ["it", "only"], "message": "don't focus tests" } - ] - } -} diff --git a/packages/typescript/package.json b/packages/typescript/package.json deleted file mode 100644 index f8790a9ba71..00000000000 --- a/packages/typescript/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@celo/typescript", - "version": "0.0.1", - "description": "typescript configuration", - "author": "Celo", - "license": "Apache-2.0", - "main": "tsconfig.library.json", - "scripts": { - "build-rules": "tsc" - }, - "devDependencies": {} -} diff --git a/packages/typescript/tsconfig.library.json b/packages/typescript/tsconfig.library.json deleted file mode 100644 index 713cd7ebf01..00000000000 --- a/packages/typescript/tsconfig.library.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "lib": ["es2015", "es2016"], - "target": "es6", - "module": "commonjs", - "moduleResolution": "node", - "composite": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "strict": true, - "declaration": true, - "sourceMap": true, - "skipLibCheck": true, - "noImplicitAny": true, - "noUnusedLocals": true, - "noUnusedParameters": true - } -} diff --git a/tslint-to-eslint-config.log b/tslint-to-eslint-config.log deleted file mode 100644 index 6e85eeaa025..00000000000 --- a/tslint-to-eslint-config.log +++ /dev/null @@ -1,31 +0,0 @@ -9 ESLint rules behave differently from their TSLint counterparts: - * one-var: - - Variables declared in for loops will no longer be checked. - * no-console: - - Custom console methods, if they exist, will no longer be allowed. - * no-underscore-dangle: - - Leading or trailing underscores (_) on identifiers will now be forbidden. - * no-invalid-this: - - Functions in methods will no longer be ignored. - * @typescript-eslint/no-unused-expressions: - - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored. - * prefer-arrow/prefer-arrow-functions: - - ESLint (eslint-plugin-prefer-arrow plugin) does not support allowing named functions defined with the function keyword. - * eqeqeq: - - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons. - * no-redeclare: - - ESLint does not support check-parameters. - * padded-blocks: - - ESLint's padded-blocks rule also bans a blank line before a closing brace. - -Error: multiple output react/jsx-curly-spacing ESLint rule options were generated, but tslint-to-eslint-config doesn't have "merger" logic to deal with this. -Please file an issue at https://github.com/typescript-eslint/tslint-to-eslint-config/issues/new?template=missing_merger.md. Thanks! - -4 rules are not known by tslint-to-eslint-config to have ESLint equivalents: - * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-ex-assign". - * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-extra-boolean-cast". - * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-inner-declarations". - * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "no-promise-as-boolean". - - * import-destructuring-spacing - diff --git a/yarn.lock b/yarn.lock index e01be197605..1af1ac32beb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -937,6 +937,11 @@ dependencies: typechain "^4.0.3" +"@celo/typescript@0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@celo/typescript/-/typescript-0.0.1.tgz#e48a70f4f4af3b13cf492c6ed3e83b1fc225fa87" + integrity sha512-C6IP2wp8DyZDdGNNEIqTfuVsL25AwxNGg3Sqej0ZJjQD/SrjVMaSjJhiEm3KMQ6H+hqDiVVEfMyD2AYCgwCV3Q== + "@celo/utils@^5.0.6": version "5.0.6" resolved "https://registry.yarnpkg.com/@celo/utils/-/utils-5.0.6.tgz#26d57dbbb524f3452c73af7ad5eb46ffff4a767b" @@ -4591,6 +4596,11 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== +"@tsconfig/recommended@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/recommended/-/recommended-1.0.3.tgz#742540ba9170897a44097e838bca411abf56ccd2" + integrity sha512-+jby/Guq9H8O7NWgCv6X8VAiQE8Dr/nccsCtL74xyHKhu2Knu5EAKmOZj3nLCnLm1KooUzKY+5DsnGVqhM8/wQ== + "@types/abstract-leveldown@*": version "7.2.1" resolved "https://registry.yarnpkg.com/@types/abstract-leveldown/-/abstract-leveldown-7.2.1.tgz#bb16403c17754b0c4d5772d71d03b924a03d4c80" @@ -20212,11 +20222,6 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.4.3: - version "4.4.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324" - integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA== - "typescript@^3 || ^4": version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" From ffa56871a8b13dcdbabc1e35aa7856ee69af7010 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 23 Jan 2024 17:38:16 +0200 Subject: [PATCH 03/16] WIP Fix ABIS compiling --- .eslintrc.js | 1 - packages/protocol/abis/package.json | 231 +----------------- packages/protocol/abis/tsconfig-cjs.json | 1 + packages/protocol/abis/tsconfig-esm.json | 3 +- packages/protocol/abis/tsconfig.json | 4 +- packages/protocol/contractPackages.ts | 2 - packages/protocol/scripts/build.ts | 2 + .../prepare-contracts-and-abis-publishing.ts | 21 +- .../protocol/test/compatibility/ast-layout.ts | 2 +- .../test/governance/voting/release_gold.ts | 8 +- packages/protocol/tsconfig.json | 45 ++-- packages/protocol/twilio-config.enc | Bin 229 -> 0 bytes 12 files changed, 63 insertions(+), 257 deletions(-) delete mode 100644 packages/protocol/twilio-config.enc diff --git a/.eslintrc.js b/.eslintrc.js index eff16adcf9f..10c2b632dc1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -33,7 +33,6 @@ module.exports = { 'packages/protocol/truffle-config0.8.js', 'packages/protocol/truffle-config-parent.js', 'packages/protocol/abis', - 'packages/protocol/test/**', 'packages/protocol/wagmi.config.ts', '**/jest.config.js', ], diff --git a/packages/protocol/abis/package.json b/packages/protocol/abis/package.json index d0f6a38d0c6..148f59ac3e7 100644 --- a/packages/protocol/abis/package.json +++ b/packages/protocol/abis/package.json @@ -19,6 +19,11 @@ "!**/*.js.map" ], "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "types": "./dist/types/index.d.ts" + }, "./Accounts.json": { "default": "./dist/Accounts.json" }, @@ -94,12 +99,6 @@ "./MentoFeeHandlerSeller.json": { "default": "./dist/MentoFeeHandlerSeller.json" }, - "./MetaTransactionWallet.json": { - "default": "./dist/MetaTransactionWallet.json" - }, - "./MetaTransactionWalletDeployer.json": { - "default": "./dist/MetaTransactionWalletDeployer.json" - }, "./MultiSig.json": { "default": "./dist/MultiSig.json" }, @@ -267,16 +266,6 @@ "require": "./dist/cjs/MentoFeeHandlerSeller.js", "types": "./dist/types/MentoFeeHandlerSeller.d.ts" }, - "./MetaTransactionWallet": { - "import": "./dist/esm/MetaTransactionWallet.js", - "require": "./dist/cjs/MetaTransactionWallet.js", - "types": "./dist/types/MetaTransactionWallet.d.ts" - }, - "./MetaTransactionWalletDeployer": { - "import": "./dist/esm/MetaTransactionWalletDeployer.js", - "require": "./dist/cjs/MetaTransactionWalletDeployer.js", - "types": "./dist/types/MetaTransactionWalletDeployer.d.ts" - }, "./MultiSig": { "import": "./dist/esm/MultiSig.js", "require": "./dist/cjs/MultiSig.js", @@ -346,216 +335,6 @@ "import": "./dist/esm/Validators.js", "require": "./dist/cjs/Validators.js", "types": "./dist/types/Validators.d.ts" - }, - "./web3/0.8/GasPriceMinimum": { - "import": "./dist/esm/web3/0.8/GasPriceMinimum.js", - "require": "./dist/cjs/web3/0.8/GasPriceMinimum.js", - "types": "./dist/types/web3/0.8/GasPriceMinimum.d.ts" - }, - "./web3/Accounts": { - "import": "./dist/esm/web3/Accounts.js", - "require": "./dist/cjs/web3/Accounts.js", - "types": "./dist/types/web3/Accounts.d.ts" - }, - "./web3/Attestations": { - "import": "./dist/esm/web3/Attestations.js", - "require": "./dist/cjs/web3/Attestations.js", - "types": "./dist/types/web3/Attestations.d.ts" - }, - "./web3/BlockchainParameters": { - "import": "./dist/esm/web3/BlockchainParameters.js", - "require": "./dist/cjs/web3/BlockchainParameters.js", - "types": "./dist/types/web3/BlockchainParameters.d.ts" - }, - "./web3/DoubleSigningSlasher": { - "import": "./dist/esm/web3/DoubleSigningSlasher.js", - "require": "./dist/cjs/web3/DoubleSigningSlasher.js", - "types": "./dist/types/web3/DoubleSigningSlasher.d.ts" - }, - "./web3/DowntimeSlasher": { - "import": "./dist/esm/web3/DowntimeSlasher.js", - "require": "./dist/cjs/web3/DowntimeSlasher.js", - "types": "./dist/types/web3/DowntimeSlasher.d.ts" - }, - "./web3/Election": { - "import": "./dist/esm/web3/Election.js", - "require": "./dist/cjs/web3/Election.js", - "types": "./dist/types/web3/Election.d.ts" - }, - "./web3/EpochRewards": { - "import": "./dist/esm/web3/EpochRewards.js", - "require": "./dist/cjs/web3/EpochRewards.js", - "types": "./dist/types/web3/EpochRewards.d.ts" - }, - "./web3/Escrow": { - "import": "./dist/esm/web3/Escrow.js", - "require": "./dist/cjs/web3/Escrow.js", - "types": "./dist/types/web3/Escrow.d.ts" - }, - "./web3/FederatedAttestations": { - "import": "./dist/esm/web3/FederatedAttestations.js", - "require": "./dist/cjs/web3/FederatedAttestations.js", - "types": "./dist/types/web3/FederatedAttestations.d.ts" - }, - "./web3/FeeCurrencyWhitelist": { - "import": "./dist/esm/web3/FeeCurrencyWhitelist.js", - "require": "./dist/cjs/web3/FeeCurrencyWhitelist.js", - "types": "./dist/types/web3/FeeCurrencyWhitelist.d.ts" - }, - "./web3/FeeHandler": { - "import": "./dist/esm/web3/FeeHandler.js", - "require": "./dist/cjs/web3/FeeHandler.js", - "types": "./dist/types/web3/FeeHandler.d.ts" - }, - "./web3/Freezer": { - "import": "./dist/esm/web3/Freezer.js", - "require": "./dist/cjs/web3/Freezer.js", - "types": "./dist/types/web3/Freezer.d.ts" - }, - "./web3/GasPriceMinimum": { - "import": "./dist/esm/web3/GasPriceMinimum.js", - "require": "./dist/cjs/web3/GasPriceMinimum.js", - "types": "./dist/types/web3/GasPriceMinimum.d.ts" - }, - "./web3/GoldToken": { - "import": "./dist/esm/web3/GoldToken.js", - "require": "./dist/cjs/web3/GoldToken.js", - "types": "./dist/types/web3/GoldToken.d.ts" - }, - "./web3/Governance": { - "import": "./dist/esm/web3/Governance.js", - "require": "./dist/cjs/web3/Governance.js", - "types": "./dist/types/web3/Governance.d.ts" - }, - "./web3/GovernanceApproverMultiSig": { - "import": "./dist/esm/web3/GovernanceApproverMultiSig.js", - "require": "./dist/cjs/web3/GovernanceApproverMultiSig.js", - "types": "./dist/types/web3/GovernanceApproverMultiSig.d.ts" - }, - "./web3/ICeloToken": { - "import": "./dist/esm/web3/ICeloToken.js", - "require": "./dist/cjs/web3/ICeloToken.js", - "types": "./dist/types/web3/ICeloToken.d.ts" - }, - "./web3/ICeloVersionedContract": { - "import": "./dist/esm/web3/ICeloVersionedContract.js", - "require": "./dist/cjs/web3/ICeloVersionedContract.js", - "types": "./dist/types/web3/ICeloVersionedContract.d.ts" - }, - "./web3/IERC20": { - "import": "./dist/esm/web3/IERC20.js", - "require": "./dist/cjs/web3/IERC20.js", - "types": "./dist/types/web3/IERC20.d.ts" - }, - "./web3/LockedGold": { - "import": "./dist/esm/web3/LockedGold.js", - "require": "./dist/cjs/web3/LockedGold.js", - "types": "./dist/types/web3/LockedGold.d.ts" - }, - "./web3/MentoFeeHandlerSeller": { - "import": "./dist/esm/web3/MentoFeeHandlerSeller.js", - "require": "./dist/cjs/web3/MentoFeeHandlerSeller.js", - "types": "./dist/types/web3/MentoFeeHandlerSeller.d.ts" - }, - "./web3/MetaTransactionWallet": { - "import": "./dist/esm/web3/MetaTransactionWallet.js", - "require": "./dist/cjs/web3/MetaTransactionWallet.js", - "types": "./dist/types/web3/MetaTransactionWallet.d.ts" - }, - "./web3/MetaTransactionWalletDeployer": { - "import": "./dist/esm/web3/MetaTransactionWalletDeployer.js", - "require": "./dist/cjs/web3/MetaTransactionWalletDeployer.js", - "types": "./dist/types/web3/MetaTransactionWalletDeployer.d.ts" - }, - "./web3/MultiSig": { - "import": "./dist/esm/web3/MultiSig.js", - "require": "./dist/cjs/web3/MultiSig.js", - "types": "./dist/types/web3/MultiSig.d.ts" - }, - "./web3/OdisPayments": { - "import": "./dist/esm/web3/OdisPayments.js", - "require": "./dist/cjs/web3/OdisPayments.js", - "types": "./dist/types/web3/OdisPayments.d.ts" - }, - "./web3/Proxy": { - "import": "./dist/esm/web3/Proxy.js", - "require": "./dist/cjs/web3/Proxy.js", - "types": "./dist/types/web3/Proxy.d.ts" - }, - "./web3/Random": { - "import": "./dist/esm/web3/Random.js", - "require": "./dist/cjs/web3/Random.js", - "types": "./dist/types/web3/Random.d.ts" - }, - "./web3/Registry": { - "import": "./dist/esm/web3/Registry.js", - "require": "./dist/cjs/web3/Registry.js", - "types": "./dist/types/web3/Registry.d.ts" - }, - "./web3/ReleaseGold": { - "import": "./dist/esm/web3/ReleaseGold.js", - "require": "./dist/cjs/web3/ReleaseGold.js", - "types": "./dist/types/web3/ReleaseGold.d.ts" - }, - "./web3/SortedOracles": { - "import": "./dist/esm/web3/SortedOracles.js", - "require": "./dist/cjs/web3/SortedOracles.js", - "types": "./dist/types/web3/SortedOracles.d.ts" - }, - "./web3/UniswapFeeHandlerSeller": { - "import": "./dist/esm/web3/UniswapFeeHandlerSeller.js", - "require": "./dist/cjs/web3/UniswapFeeHandlerSeller.js", - "types": "./dist/types/web3/UniswapFeeHandlerSeller.d.ts" - }, - "./web3/Validators": { - "import": "./dist/esm/web3/Validators.js", - "require": "./dist/cjs/web3/Validators.js", - "types": "./dist/types/web3/Validators.d.ts" - }, - "./web3/mento/Exchange": { - "import": "./dist/esm/web3/mento/Exchange.js", - "require": "./dist/cjs/web3/mento/Exchange.js", - "types": "./dist/types/web3/mento/Exchange.d.ts" - }, - "./web3/mento/ExchangeBRL": { - "import": "./dist/esm/web3/mento/ExchangeBRL.js", - "require": "./dist/cjs/web3/mento/ExchangeBRL.js", - "types": "./dist/types/web3/mento/ExchangeBRL.d.ts" - }, - "./web3/mento/ExchangeEUR": { - "import": "./dist/esm/web3/mento/ExchangeEUR.js", - "require": "./dist/cjs/web3/mento/ExchangeEUR.js", - "types": "./dist/types/web3/mento/ExchangeEUR.d.ts" - }, - "./web3/mento/GrandaMento": { - "import": "./dist/esm/web3/mento/GrandaMento.js", - "require": "./dist/cjs/web3/mento/GrandaMento.js", - "types": "./dist/types/web3/mento/GrandaMento.d.ts" - }, - "./web3/mento/Reserve": { - "import": "./dist/esm/web3/mento/Reserve.js", - "require": "./dist/cjs/web3/mento/Reserve.js", - "types": "./dist/types/web3/mento/Reserve.d.ts" - }, - "./web3/mento/ReserveSpenderMultiSig": { - "import": "./dist/esm/web3/mento/ReserveSpenderMultiSig.js", - "require": "./dist/cjs/web3/mento/ReserveSpenderMultiSig.js", - "types": "./dist/types/web3/mento/ReserveSpenderMultiSig.d.ts" - }, - "./web3/mento/StableToken": { - "import": "./dist/esm/web3/mento/StableToken.js", - "require": "./dist/cjs/web3/mento/StableToken.js", - "types": "./dist/types/web3/mento/StableToken.d.ts" - }, - "./web3/mento/StableTokenBRL": { - "import": "./dist/esm/web3/mento/StableTokenBRL.js", - "require": "./dist/cjs/web3/mento/StableTokenBRL.js", - "types": "./dist/types/web3/mento/StableTokenBRL.d.ts" - }, - "./web3/mento/StableTokenEUR": { - "import": "./dist/esm/web3/mento/StableTokenEUR.js", - "require": "./dist/cjs/web3/mento/StableTokenEUR.js", - "types": "./dist/types/web3/mento/StableTokenEUR.d.ts" } } } \ No newline at end of file diff --git a/packages/protocol/abis/tsconfig-cjs.json b/packages/protocol/abis/tsconfig-cjs.json index 50bbdbe9f10..89a21125ce7 100644 --- a/packages/protocol/abis/tsconfig-cjs.json +++ b/packages/protocol/abis/tsconfig-cjs.json @@ -3,6 +3,7 @@ "compilerOptions": { "esModuleInterop": false, "declaration": false, + "moduleResolution": "node", "module": "CommonJS", "outDir": "./dist/cjs" }, diff --git a/packages/protocol/abis/tsconfig-esm.json b/packages/protocol/abis/tsconfig-esm.json index 36251a4ed7b..36fe9e2a975 100644 --- a/packages/protocol/abis/tsconfig-esm.json +++ b/packages/protocol/abis/tsconfig-esm.json @@ -1,9 +1,10 @@ { "extends": "./tsconfig.json", "compilerOptions": { + "moduleResolution": "node", "target": "ES2020", "declaration": false, "module": "ES2020", "outDir": "./dist/esm" }, -} \ No newline at end of file +} diff --git a/packages/protocol/abis/tsconfig.json b/packages/protocol/abis/tsconfig.json index be5e43e42f5..9eda90d4674 100644 --- a/packages/protocol/abis/tsconfig.json +++ b/packages/protocol/abis/tsconfig.json @@ -1,5 +1,4 @@ { - "extends": "@tsconfig/recommended/tsconfig.json", "compileOnSave": false, "compilerOptions": { "allowSyntheticDefaultImports": true, @@ -7,6 +6,7 @@ "baseUrl": ".", "strict": true, "moduleResolution": "node16", + "module": "Node16", "noUnusedLocals": true, "noUnusedParameters": true, "removeComments": true, @@ -18,5 +18,5 @@ "declaration": false, "rootDir": "./src-generated", }, - "include": ["./src-generated"], + "include": ["./src-generated", "./src-generated/web3", "./src-generated/web3/0.8"], } \ No newline at end of file diff --git a/packages/protocol/contractPackages.ts b/packages/protocol/contractPackages.ts index 2c68b9d3a72..936064aa317 100644 --- a/packages/protocol/contractPackages.ts +++ b/packages/protocol/contractPackages.ts @@ -1,5 +1,3 @@ -import { satisfies } from 'semver' - export interface ContractPackage { path?: string folderPath?: string diff --git a/packages/protocol/scripts/build.ts b/packages/protocol/scripts/build.ts index 8d5ced816c8..52120f5eb13 100644 --- a/packages/protocol/scripts/build.ts +++ b/packages/protocol/scripts/build.ts @@ -165,6 +165,7 @@ type BuildTargets = Record & { } async function main(buildTargets: BuildTargets) { + console.log('protocol: Building contracts') if (buildTargets.solidity) { compile(buildTargets) } @@ -174,6 +175,7 @@ async function main(buildTargets: BuildTargets) { if (buildTargets.ethersTypes) { generateFilesForEthers(buildTargets) } + console.log('generateFilesForContractKit', buildTargets.web3Types) if (buildTargets.web3Types) { await generateFilesForContractKit(buildTargets) } diff --git a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts index 0f0c2766a94..2263978205a 100644 --- a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts +++ b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts @@ -106,16 +106,24 @@ try { } function createIndex() { - const reExports = PublishContracts.map((contractName) => { + const reExports = PublishContracts.filter((contractName) => { + return fs.existsSync(path.join(ABIS_BUILD_DIR, `${contractName}.ts`)) + }).map((contractName) => { + console.info(`Re-exporting ${contractName}`) return `export * from './${contractName}.js'` }) fs.writeFileSync(path.join(ABIS_BUILD_DIR, 'index.ts'), reExports.join('\n')) } +type Exports = Record< + string, + { import?: string; require?: string; types?: string; default?: string } +> + // Helper functions function prepareTargetTypesExports() { - const exports = {} + const exports: Exports = {} const targets = [BuildTarget.ESM, BuildTarget.CJS, BuildTarget.TYPES] targets.forEach((target) => { @@ -191,7 +199,7 @@ function expectFileExists(relativePath: string) { } function processRawJsonsAndPrepareExports() { - const exports = {} + const exports: Exports = {} log('Removing extraneous fields from generated json files') const fileNames = fs.readdirSync(ABIS_BUILD_DIR) @@ -230,7 +238,10 @@ function processRawJsonsAndPrepareExports() { return exports } -function replacePackageVersionAndMakePublic(packageJsonPath: string, onDone?: (json) => void) { +function replacePackageVersionAndMakePublic( + packageJsonPath: string, + onDone?: (json: Record) => void +) { const json = JSON.parse(fs.readFileSync(packageJsonPath).toString()) if (process.env.RELEASE_VERSION) { @@ -249,7 +260,7 @@ function replacePackageVersionAndMakePublic(packageJsonPath: string, onDone?: (j fs.writeFileSync(packageJsonPath, JSON.stringify(json, null, 2)) } -function prepareAbisPackageJson(exports) { +function prepareAbisPackageJson(exports: Exports) { log('Preparing @celo/abis package.json') const packageJsonPath = path.join(ABIS_PACKAGE_SRC_DIR, 'package.json') diff --git a/packages/protocol/test/compatibility/ast-layout.ts b/packages/protocol/test/compatibility/ast-layout.ts index f36f788641f..4c4520b2bca 100644 --- a/packages/protocol/test/compatibility/ast-layout.ts +++ b/packages/protocol/test/compatibility/ast-layout.ts @@ -56,7 +56,7 @@ const selectReportFor = (report, contractName) => { * @param expectedMatches The regular expressions that each successive error for * `contractName` should match. */ -const assertContractErrorsMatch = (report, contractName, expectedMatches) => { +const assertContractErrorsMatch = (report, contractName: string, expectedMatches) => { const contractReport = selectReportFor(report, contractName) assert.equal(contractReport.errors.length, 1) diff --git a/packages/protocol/test/governance/voting/release_gold.ts b/packages/protocol/test/governance/voting/release_gold.ts index 928d4ba9a53..d94312c9d81 100644 --- a/packages/protocol/test/governance/voting/release_gold.ts +++ b/packages/protocol/test/governance/voting/release_gold.ts @@ -977,9 +977,11 @@ contract('ReleaseGold', (accounts: string[]) => { }) }) }) + type Key = keyof typeof authorizationTestDescriptions describe('authorization tests:', () => { - Object.keys(authorizationTestDescriptions).forEach((key) => { + Object.keys(authorizationTestDescriptions).forEach((key0) => { + const key: Key = key0 as unknown as Key let authorizationTest: any const authorized = accounts[4] // the account that is to be authorized for whatever role let sig: any @@ -1461,7 +1463,7 @@ contract('ReleaseGold', (accounts: string[]) => { }) describe('#lockGold', () => { - let lockAmount = null + let lockAmount: BigNumber = new BigNumber(0) beforeEach(async () => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) @@ -1516,7 +1518,7 @@ contract('ReleaseGold', (accounts: string[]) => { }) describe('#unlockGold', () => { - let lockAmount: any + let lockAmount: BigNumber = new BigNumber(0) beforeEach(async () => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index e7f102a8032..da6a9b44789 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -1,18 +1,31 @@ { - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Recommended", - "compilerOptions": { - "target": "es2015", - "module": "commonjs", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - }, - "exclude": [ - "node_modules", - "wagmi.config.ts", - "abis", - "scripts/**/*.test.ts" - ] + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Recommended", + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "baseUrl": ".", + "lib": [ + "es2015", + "es2016" + ], + "module": "commonjs", + "moduleResolution": "node", + "noUnusedLocals": true, + "noUnusedParameters": true, + "removeComments": false, + "sourceMap": true, + "target": "es5", + "downlevelIteration": true, + "resolveJsonModule": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": [ + "node_modules", + "wagmi.config.ts", + "abis", + "scripts/**/*.test.ts" + ] } \ No newline at end of file diff --git a/packages/protocol/twilio-config.enc b/packages/protocol/twilio-config.enc deleted file mode 100644 index 373cd390f9e7cd1bf293cec44f54805e2cc13f7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 229 zcmVk_=o$N1rS^K_te=KsOVh6z#*^L*3p53Y!+N!>L z?U-{tp-3y)jg`GQRMa_I-;yswNrJX~w7r!!858)*sDqW_dLGz~ACAnqh!fim(+Bu2 zQsxDfq-8F;A>ucO>y@;O*z1tc+ziJ=UfqanT>lmf^TO>mCf5TPE1h29|4;JK0N;m# fU3dro-&WX0opZW|00LLZ;%A;A1pkW2jmup8hwN{+ From a5623a5a5426b0293896c5544846c6f2ad94e860 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 14:08:14 +0200 Subject: [PATCH 04/16] fix lint again --- .eslintrc.js | 1 + .../src/cmds/gcp/remove-leaked-forwarding-rules.ts | 2 +- packages/protocol/lib/contract-dependencies.ts | 4 ++-- packages/protocol/scripts/build.ts | 2 -- .../scripts/prepare-contracts-and-abis-publishing.ts | 8 +++++--- packages/protocol/scripts/utils.ts | 6 +++++- packages/protocol/tsconfig.json | 5 ++++- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 10c2b632dc1..01f74aa0a55 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,6 +29,7 @@ module.exports = { 'packages/protocol/scripts/truffle/**', // ignoring any files that for which "TSConfig does not include this file" error was given 'packages/protocol/scripts/utils.test.ts', + 'packages/protocol/test', 'packages/protocol/truffle-config.js', 'packages/protocol/truffle-config0.8.js', 'packages/protocol/truffle-config-parent.js', diff --git a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts index 093654aac3c..0ea8501a4f8 100644 --- a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts +++ b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts @@ -49,7 +49,7 @@ export const handler = async (argv: Argv) => { true ) return false - // @ts-expect-error + // @ts-expect-error eslint doesn't like the destructuring here } catch ([error, stdout, stderr]) { if (typeof stdout === 'string') { const healthyInstances = JSON.parse(stdout).length diff --git a/packages/protocol/lib/contract-dependencies.ts b/packages/protocol/lib/contract-dependencies.ts index 0897fc3c115..e4f5c2a0fc3 100644 --- a/packages/protocol/lib/contract-dependencies.ts +++ b/packages/protocol/lib/contract-dependencies.ts @@ -7,7 +7,7 @@ export class ContractDependencies { Object.keys(libraries).forEach((lib: string) => { libraries[lib].forEach((contract: string) => { if (this.dependencies.has(contract)) { - this.dependencies.get(contract).push(lib) + this.dependencies.get(contract)!.push(lib) } else { this.dependencies.set(contract, [lib]) } @@ -16,7 +16,7 @@ export class ContractDependencies { } public get = (contract: string): string[] => { - return this.dependencies.has(contract) ? this.dependencies.get(contract) : [] + return this.dependencies.has(contract) ? this.dependencies.get(contract)! : [] } } diff --git a/packages/protocol/scripts/build.ts b/packages/protocol/scripts/build.ts index 52120f5eb13..8d5ced816c8 100644 --- a/packages/protocol/scripts/build.ts +++ b/packages/protocol/scripts/build.ts @@ -165,7 +165,6 @@ type BuildTargets = Record & { } async function main(buildTargets: BuildTargets) { - console.log('protocol: Building contracts') if (buildTargets.solidity) { compile(buildTargets) } @@ -175,7 +174,6 @@ async function main(buildTargets: BuildTargets) { if (buildTargets.ethersTypes) { generateFilesForEthers(buildTargets) } - console.log('generateFilesForContractKit', buildTargets.web3Types) if (buildTargets.web3Types) { await generateFilesForContractKit(buildTargets) } diff --git a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts index 2263978205a..7a58e596dc3 100644 --- a/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts +++ b/packages/protocol/scripts/prepare-contracts-and-abis-publishing.ts @@ -238,14 +238,16 @@ function processRawJsonsAndPrepareExports() { return exports } +type JSON = Record + function replacePackageVersionAndMakePublic( packageJsonPath: string, - onDone?: (json: Record) => void + onDone?: (json: JSON) => void ) { - const json = JSON.parse(fs.readFileSync(packageJsonPath).toString()) + const json: JSON = JSON.parse(fs.readFileSync(packageJsonPath).toString()) if (process.env.RELEASE_VERSION) { - log(`Replacing ${json.name} version with provided RELEASE_VERSION`) + log(`Replacing ${json.name as string} version with provided RELEASE_VERSION`) json.version = process.env.RELEASE_VERSION json.private = false diff --git a/packages/protocol/scripts/utils.ts b/packages/protocol/scripts/utils.ts index 5c5c93e2884..5ddcce2e53b 100644 --- a/packages/protocol/scripts/utils.ts +++ b/packages/protocol/scripts/utils.ts @@ -4,7 +4,11 @@ import { SemVer } from 'semver' const DAILY_RELEASE_TAG = 'canary' const WORKING_RELEASE_BRANCH_PREFIX = 'release/core-contracts/' -export const determineNextVersion = (gitTag: string, gitBranch: string, npmTag: string): SemVer => { +export const determineNextVersion = ( + gitTag: string, + gitBranch: string, + npmTag: string +): SemVer | null => { let nextVersion: SemVer | null = null const matchesReleaseTag = gitTag.match(/core-contracts.v(.+).post-audit/) const matchesPreAuditTag = gitTag.match(/core-contracts.v(.+).pre-audit/) diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index da6a9b44789..c885035c14e 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -20,7 +20,10 @@ "strict": true, "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "@celo/protocol/*": ["./*"], + } }, "exclude": [ "node_modules", From 265175ea7d6db0e24f4c69341b24016c6d3b80d3 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 15:57:42 +0200 Subject: [PATCH 05/16] dont add strict mode, its too brutal, try es6 target (why not?) add package validation --- .../publish-contracts-abi-release.yml | 6 +- packages/protocol/abis/package.json | 200 ++++++++++++++++++ packages/protocol/abis/tsconfig-esm.json | 2 +- packages/protocol/abis/tsconfig.json | 4 +- .../protocol/lib/fed-attestations-utils.ts | 2 +- packages/protocol/package.json | 7 +- .../protocol/scripts/validate-abis-package.ts | 27 +++ packages/protocol/tsconfig.json | 6 +- 8 files changed, 243 insertions(+), 11 deletions(-) create mode 100644 packages/protocol/scripts/validate-abis-package.ts diff --git a/.github/workflows/publish-contracts-abi-release.yml b/.github/workflows/publish-contracts-abi-release.yml index c3d78b6fe06..e7f4e7158a6 100644 --- a/.github/workflows/publish-contracts-abi-release.yml +++ b/.github/workflows/publish-contracts-abi-release.yml @@ -69,7 +69,11 @@ jobs: env: RELEASE_TYPE: ${{ env.RELEASE_TYPE }} RELEASE_VERSION: ${{ env.RELEASE_VERSION }} - + # a safety check especially useful if some package is upgraded + - name: 'Validate ABIS Exports' + shell: bash + run: yarn validate_abis_exports + working-directory: packages/protocol - name: Publish @celo/contracts run: | cat package.json diff --git a/packages/protocol/abis/package.json b/packages/protocol/abis/package.json index 148f59ac3e7..843cc1fc74f 100644 --- a/packages/protocol/abis/package.json +++ b/packages/protocol/abis/package.json @@ -335,6 +335,206 @@ "import": "./dist/esm/Validators.js", "require": "./dist/cjs/Validators.js", "types": "./dist/types/Validators.d.ts" + }, + "./web3/0.8/GasPriceMinimum": { + "import": "./dist/esm/web3/0.8/GasPriceMinimum.js", + "require": "./dist/cjs/web3/0.8/GasPriceMinimum.js", + "types": "./dist/types/web3/0.8/GasPriceMinimum.d.ts" + }, + "./web3/Accounts": { + "import": "./dist/esm/web3/Accounts.js", + "require": "./dist/cjs/web3/Accounts.js", + "types": "./dist/types/web3/Accounts.d.ts" + }, + "./web3/Attestations": { + "import": "./dist/esm/web3/Attestations.js", + "require": "./dist/cjs/web3/Attestations.js", + "types": "./dist/types/web3/Attestations.d.ts" + }, + "./web3/BlockchainParameters": { + "import": "./dist/esm/web3/BlockchainParameters.js", + "require": "./dist/cjs/web3/BlockchainParameters.js", + "types": "./dist/types/web3/BlockchainParameters.d.ts" + }, + "./web3/DoubleSigningSlasher": { + "import": "./dist/esm/web3/DoubleSigningSlasher.js", + "require": "./dist/cjs/web3/DoubleSigningSlasher.js", + "types": "./dist/types/web3/DoubleSigningSlasher.d.ts" + }, + "./web3/DowntimeSlasher": { + "import": "./dist/esm/web3/DowntimeSlasher.js", + "require": "./dist/cjs/web3/DowntimeSlasher.js", + "types": "./dist/types/web3/DowntimeSlasher.d.ts" + }, + "./web3/Election": { + "import": "./dist/esm/web3/Election.js", + "require": "./dist/cjs/web3/Election.js", + "types": "./dist/types/web3/Election.d.ts" + }, + "./web3/EpochRewards": { + "import": "./dist/esm/web3/EpochRewards.js", + "require": "./dist/cjs/web3/EpochRewards.js", + "types": "./dist/types/web3/EpochRewards.d.ts" + }, + "./web3/Escrow": { + "import": "./dist/esm/web3/Escrow.js", + "require": "./dist/cjs/web3/Escrow.js", + "types": "./dist/types/web3/Escrow.d.ts" + }, + "./web3/FederatedAttestations": { + "import": "./dist/esm/web3/FederatedAttestations.js", + "require": "./dist/cjs/web3/FederatedAttestations.js", + "types": "./dist/types/web3/FederatedAttestations.d.ts" + }, + "./web3/FeeCurrencyWhitelist": { + "import": "./dist/esm/web3/FeeCurrencyWhitelist.js", + "require": "./dist/cjs/web3/FeeCurrencyWhitelist.js", + "types": "./dist/types/web3/FeeCurrencyWhitelist.d.ts" + }, + "./web3/FeeHandler": { + "import": "./dist/esm/web3/FeeHandler.js", + "require": "./dist/cjs/web3/FeeHandler.js", + "types": "./dist/types/web3/FeeHandler.d.ts" + }, + "./web3/Freezer": { + "import": "./dist/esm/web3/Freezer.js", + "require": "./dist/cjs/web3/Freezer.js", + "types": "./dist/types/web3/Freezer.d.ts" + }, + "./web3/GasPriceMinimum": { + "import": "./dist/esm/web3/GasPriceMinimum.js", + "require": "./dist/cjs/web3/GasPriceMinimum.js", + "types": "./dist/types/web3/GasPriceMinimum.d.ts" + }, + "./web3/GoldToken": { + "import": "./dist/esm/web3/GoldToken.js", + "require": "./dist/cjs/web3/GoldToken.js", + "types": "./dist/types/web3/GoldToken.d.ts" + }, + "./web3/Governance": { + "import": "./dist/esm/web3/Governance.js", + "require": "./dist/cjs/web3/Governance.js", + "types": "./dist/types/web3/Governance.d.ts" + }, + "./web3/GovernanceApproverMultiSig": { + "import": "./dist/esm/web3/GovernanceApproverMultiSig.js", + "require": "./dist/cjs/web3/GovernanceApproverMultiSig.js", + "types": "./dist/types/web3/GovernanceApproverMultiSig.d.ts" + }, + "./web3/ICeloToken": { + "import": "./dist/esm/web3/ICeloToken.js", + "require": "./dist/cjs/web3/ICeloToken.js", + "types": "./dist/types/web3/ICeloToken.d.ts" + }, + "./web3/ICeloVersionedContract": { + "import": "./dist/esm/web3/ICeloVersionedContract.js", + "require": "./dist/cjs/web3/ICeloVersionedContract.js", + "types": "./dist/types/web3/ICeloVersionedContract.d.ts" + }, + "./web3/IERC20": { + "import": "./dist/esm/web3/IERC20.js", + "require": "./dist/cjs/web3/IERC20.js", + "types": "./dist/types/web3/IERC20.d.ts" + }, + "./web3/LockedGold": { + "import": "./dist/esm/web3/LockedGold.js", + "require": "./dist/cjs/web3/LockedGold.js", + "types": "./dist/types/web3/LockedGold.d.ts" + }, + "./web3/MentoFeeHandlerSeller": { + "import": "./dist/esm/web3/MentoFeeHandlerSeller.js", + "require": "./dist/cjs/web3/MentoFeeHandlerSeller.js", + "types": "./dist/types/web3/MentoFeeHandlerSeller.d.ts" + }, + "./web3/MultiSig": { + "import": "./dist/esm/web3/MultiSig.js", + "require": "./dist/cjs/web3/MultiSig.js", + "types": "./dist/types/web3/MultiSig.d.ts" + }, + "./web3/OdisPayments": { + "import": "./dist/esm/web3/OdisPayments.js", + "require": "./dist/cjs/web3/OdisPayments.js", + "types": "./dist/types/web3/OdisPayments.d.ts" + }, + "./web3/Proxy": { + "import": "./dist/esm/web3/Proxy.js", + "require": "./dist/cjs/web3/Proxy.js", + "types": "./dist/types/web3/Proxy.d.ts" + }, + "./web3/Random": { + "import": "./dist/esm/web3/Random.js", + "require": "./dist/cjs/web3/Random.js", + "types": "./dist/types/web3/Random.d.ts" + }, + "./web3/Registry": { + "import": "./dist/esm/web3/Registry.js", + "require": "./dist/cjs/web3/Registry.js", + "types": "./dist/types/web3/Registry.d.ts" + }, + "./web3/ReleaseGold": { + "import": "./dist/esm/web3/ReleaseGold.js", + "require": "./dist/cjs/web3/ReleaseGold.js", + "types": "./dist/types/web3/ReleaseGold.d.ts" + }, + "./web3/SortedOracles": { + "import": "./dist/esm/web3/SortedOracles.js", + "require": "./dist/cjs/web3/SortedOracles.js", + "types": "./dist/types/web3/SortedOracles.d.ts" + }, + "./web3/UniswapFeeHandlerSeller": { + "import": "./dist/esm/web3/UniswapFeeHandlerSeller.js", + "require": "./dist/cjs/web3/UniswapFeeHandlerSeller.js", + "types": "./dist/types/web3/UniswapFeeHandlerSeller.d.ts" + }, + "./web3/Validators": { + "import": "./dist/esm/web3/Validators.js", + "require": "./dist/cjs/web3/Validators.js", + "types": "./dist/types/web3/Validators.d.ts" + }, + "./web3/mento/Exchange": { + "import": "./dist/esm/web3/mento/Exchange.js", + "require": "./dist/cjs/web3/mento/Exchange.js", + "types": "./dist/types/web3/mento/Exchange.d.ts" + }, + "./web3/mento/ExchangeBRL": { + "import": "./dist/esm/web3/mento/ExchangeBRL.js", + "require": "./dist/cjs/web3/mento/ExchangeBRL.js", + "types": "./dist/types/web3/mento/ExchangeBRL.d.ts" + }, + "./web3/mento/ExchangeEUR": { + "import": "./dist/esm/web3/mento/ExchangeEUR.js", + "require": "./dist/cjs/web3/mento/ExchangeEUR.js", + "types": "./dist/types/web3/mento/ExchangeEUR.d.ts" + }, + "./web3/mento/GrandaMento": { + "import": "./dist/esm/web3/mento/GrandaMento.js", + "require": "./dist/cjs/web3/mento/GrandaMento.js", + "types": "./dist/types/web3/mento/GrandaMento.d.ts" + }, + "./web3/mento/Reserve": { + "import": "./dist/esm/web3/mento/Reserve.js", + "require": "./dist/cjs/web3/mento/Reserve.js", + "types": "./dist/types/web3/mento/Reserve.d.ts" + }, + "./web3/mento/ReserveSpenderMultiSig": { + "import": "./dist/esm/web3/mento/ReserveSpenderMultiSig.js", + "require": "./dist/cjs/web3/mento/ReserveSpenderMultiSig.js", + "types": "./dist/types/web3/mento/ReserveSpenderMultiSig.d.ts" + }, + "./web3/mento/StableToken": { + "import": "./dist/esm/web3/mento/StableToken.js", + "require": "./dist/cjs/web3/mento/StableToken.js", + "types": "./dist/types/web3/mento/StableToken.d.ts" + }, + "./web3/mento/StableTokenBRL": { + "import": "./dist/esm/web3/mento/StableTokenBRL.js", + "require": "./dist/cjs/web3/mento/StableTokenBRL.js", + "types": "./dist/types/web3/mento/StableTokenBRL.d.ts" + }, + "./web3/mento/StableTokenEUR": { + "import": "./dist/esm/web3/mento/StableTokenEUR.js", + "require": "./dist/cjs/web3/mento/StableTokenEUR.js", + "types": "./dist/types/web3/mento/StableTokenEUR.d.ts" } } } \ No newline at end of file diff --git a/packages/protocol/abis/tsconfig-esm.json b/packages/protocol/abis/tsconfig-esm.json index 36fe9e2a975..581d9f10216 100644 --- a/packages/protocol/abis/tsconfig-esm.json +++ b/packages/protocol/abis/tsconfig-esm.json @@ -6,5 +6,5 @@ "declaration": false, "module": "ES2020", "outDir": "./dist/esm" - }, + } } diff --git a/packages/protocol/abis/tsconfig.json b/packages/protocol/abis/tsconfig.json index 9eda90d4674..a99f0c81ddf 100644 --- a/packages/protocol/abis/tsconfig.json +++ b/packages/protocol/abis/tsconfig.json @@ -16,7 +16,7 @@ "downlevelIteration": true, "resolveJsonModule": true, "declaration": false, - "rootDir": "./src-generated", + "rootDir": "./src-generated" }, - "include": ["./src-generated", "./src-generated/web3", "./src-generated/web3/0.8"], + "include": ["./src-generated", "./src-generated/web3", "./src-generated/web3/0.8"] } \ No newline at end of file diff --git a/packages/protocol/lib/fed-attestations-utils.ts b/packages/protocol/lib/fed-attestations-utils.ts index 605125afc66..dee70eb5678 100644 --- a/packages/protocol/lib/fed-attestations-utils.ts +++ b/packages/protocol/lib/fed-attestations-utils.ts @@ -23,7 +23,7 @@ export const getSignatureForAttestation = async ( method: 'eth_signTypedData', params: [signer, typedData], }, - (error, resp) => { + (error: Error, resp: {result: string}) => { if (error) { reject(error) } else { diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 7ee1c525c96..37c0c4293f9 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -6,7 +6,7 @@ "author": "Celo", "license": "LGPL-3.0", "scripts": { - "lint:ts": "DEBUG=* && yarn run --top-level eslint .", + "lint:ts": "yarn run --top-level eslint .", "lint:sol": "solhint './contracts/**/*.sol'", "lint": "yarn run lint:ts && yarn run lint:sol", "clean": "rm -rf ./types/typechain && rm -rf build/* && rm -rf .0x-artifacts/* && rm -rf migrations/*.js* && rm -rf migrations_ts/*.js* && rm -rf test/**/*.js* && rm -f lib/*.js* && rm -f lib/**/*.js* && rm -f scripts/*.js* && yarn clean:foundry", @@ -25,8 +25,9 @@ "build:sol": "yarn pull-submodules && mkdir -p migrations && ts-node --preferTsExts ./scripts/build.ts --solidity ${BUILD_DIR:-./build}", "build": "yarn build:sol && yarn build:ts", "prebuild": "rm -rf ./build", - "determine-release-version": "ts-node ./scripts/determine-release-version.ts", - "prepare_contracts_and_abis_publishing": "ts-node ./scripts/prepare-contracts-and-abis-publishing.ts", + "determine-release-version": "ts-node --preferTsExts ./scripts/determine-release-version.ts", + "prepare_contracts_and_abis_publishing": "ts-node --preferTsExts ./scripts/prepare-contracts-and-abis-publishing.ts", + "validate_abis_exports": "ts-node --preferTsExts ./scripts/validate-abis-package.ts", "sourcify-publish": "ts-node ./scripts/sourcify-publish.ts", "migrate": "./scripts/bash/migrate.sh", "set_block_gas_limit": "./scripts/bash/set_block_gas_limit.sh", diff --git a/packages/protocol/scripts/validate-abis-package.ts b/packages/protocol/scripts/validate-abis-package.ts new file mode 100644 index 00000000000..1b807e3f4b5 --- /dev/null +++ b/packages/protocol/scripts/validate-abis-package.ts @@ -0,0 +1,27 @@ +import PACKAGE from '../abis/package.json' + +if (countOfWeb3ContractExports() === 0) { + console.error('No web3 contracts exported from package') + process.exit(1) +} + +if (countOfJSONExports() === 0) { + console.error('No JSON ABIS were exported from package') + process.exit(1) +} + +console.info('Package exports are valid!') +process.exit(0) + +// utils +function countOfWeb3ContractExports() { + return Object.keys(PACKAGE.exports).filter((key) => { + return key.startsWith('./web3') + }).length +} + +function countOfJSONExports() { + return Object.keys(PACKAGE.exports).filter((key) => { + return key.endsWith('.json') + }).length +} diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index c885035c14e..168a6da59a5 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -14,15 +14,15 @@ "noUnusedParameters": true, "removeComments": false, "sourceMap": true, - "target": "es5", + "target": "es6", "downlevelIteration": true, "resolveJsonModule": true, - "strict": true, + "strict": false, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "paths": { - "@celo/protocol/*": ["./*"], + "@celo/protocol/*": ["./*"] } }, "exclude": [ From 2aff81da5f82cbafcb7cabf0edcfcd03f6a98b76 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 16:23:40 +0200 Subject: [PATCH 06/16] help out future devs with instructions on how to fix error --- .../gcp/remove-leaked-forwarding-rules.ts | 1 - packages/celotool/tsconfig.json | 1 + packages/dev-utils/tsconfig.json | 1 + packages/protocol/scripts/build.ts | 19 ++++++++++++++++--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts index 0ea8501a4f8..3ec996041a6 100644 --- a/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts +++ b/packages/celotool/src/cmds/gcp/remove-leaked-forwarding-rules.ts @@ -49,7 +49,6 @@ export const handler = async (argv: Argv) => { true ) return false - // @ts-expect-error eslint doesn't like the destructuring here } catch ([error, stdout, stderr]) { if (typeof stdout === 'string') { const healthyInstances = JSON.parse(stdout).length diff --git a/packages/celotool/tsconfig.json b/packages/celotool/tsconfig.json index 7b8666fd0e4..79762e77a86 100644 --- a/packages/celotool/tsconfig.json +++ b/packages/celotool/tsconfig.json @@ -4,6 +4,7 @@ "outDir": "lib", "rootDir": "src", "baseUrl": ".", + "strict": false, "lib": ["es7", "es2017", "es2020"], "target": "es2020", "resolveJsonModule": true, diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index db963af1d48..7bd9b851522 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -2,6 +2,7 @@ "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { "rootDir": "src", + "strict": false, "outDir": "lib", "resolveJsonModule": true }, diff --git a/packages/protocol/scripts/build.ts b/packages/protocol/scripts/build.ts index 8d5ced816c8..fafb06ab9cc 100644 --- a/packages/protocol/scripts/build.ts +++ b/packages/protocol/scripts/build.ts @@ -44,9 +44,22 @@ function compile({ coreContractsOnly, solidity: outdir }: BuildTargets) { } // compile everything else - exec( - `yarn run --silent truffle compile --contracts_directory="./contracts/" --build_directory=${outdir}` - ) + try { + exec( + `yarn run --silent truffle compile --contracts_directory="./contracts/" --build_directory=${outdir}` + ) + } catch (e) { + console.error(e) + console.info( + ` + + If error is something like "using solc 0.5.13, but specify "pragma solidity >=0.8.7 <0.8.20". + Then try to delete the 0.8 folder inside of contracts folder (not the contracts-0.8 folder) + + ` + ) + process.exit(1) + } const contracts = coreContractsOnly ? CoreContracts : ImplContracts // check that there were no errors From e0abd76fcaf3edf07e231e149f9f8114564d08a2 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 16:56:53 +0200 Subject: [PATCH 07/16] it works on my machine ok --- packages/celotool/src/cmds/bots/auto-vote.ts | 10 +++++----- packages/celotool/src/cmds/geth/start.ts | 3 +-- packages/celotool/src/cmds/transactions/describe.ts | 2 +- packages/celotool/src/e2e-tests/cip35_tests.ts | 10 +++++----- packages/celotool/src/e2e-tests/replica_tests.ts | 4 ++-- packages/celotool/src/e2e-tests/utils.ts | 8 ++++---- packages/dev-utils/src/ganache-test.ts | 2 +- packages/dev-utils/src/network.ts | 2 +- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/packages/celotool/src/cmds/bots/auto-vote.ts b/packages/celotool/src/cmds/bots/auto-vote.ts index 8c96e0e2a3f..e5e37787294 100644 --- a/packages/celotool/src/cmds/bots/auto-vote.ts +++ b/packages/celotool/src/cmds/bots/auto-vote.ts @@ -175,11 +175,11 @@ async function castVote( return tx.sendAndWaitForReceipt({ from: botAccount }) }) const group = normalizeAddressWith0x(vote.group) - const oldCapacity = groupCapacities.get(group)! + const oldCapacity = groupCapacities.get(group) groupCapacities.set(group, oldCapacity.plus(vote.pending.plus(vote.active))) } - const groupCapacity = groupCapacities.get(voteForGroup)! + const groupCapacity = groupCapacities.get(voteForGroup) const voteAmount = BigNumber.minimum(lockedGoldAmount, groupCapacity) const voteTx = await election.vote(voteForGroup, BigNumber.minimum(voteAmount)) await voteTx.sendAndWaitForReceipt({ from: botAccount }) @@ -218,7 +218,7 @@ async function calculateGroupScores(kit: ContractKit): Promise !!v.affiliation) // Skip unaffiliated const validatorsByGroup = groupBy(validatorAccounts, (validator) => - normalizeAddressWith0x(validator.affiliation!) + normalizeAddressWith0x(validator.affiliation) ) const validatorGroupScores = mapValues(validatorsByGroup, (vals) => { @@ -258,7 +258,7 @@ function getWeightedRandomChoice( const sortedGroupKeys = [...groupWeights.keys()] .filter((k) => groupsToConsider.includes(k)) .sort((a, b) => { - return groupWeights.get(b)!.comparedTo(groupWeights.get(a)!) + return groupWeights.get(b).comparedTo(groupWeights.get(a)) }) let weightTotal = new BigNumber(0) @@ -270,7 +270,7 @@ function getWeightedRandomChoice( let totalSoFar = new BigNumber(0) for (const key of sortedGroupKeys) { - totalSoFar = totalSoFar.plus(groupWeights.get(key)!) + totalSoFar = totalSoFar.plus(groupWeights.get(key)) if (totalSoFar.isGreaterThanOrEqualTo(choice)) { return key } diff --git a/packages/celotool/src/cmds/geth/start.ts b/packages/celotool/src/cmds/geth/start.ts index a0502571e47..fc5a2f05957 100644 --- a/packages/celotool/src/cmds/geth/start.ts +++ b/packages/celotool/src/cmds/geth/start.ts @@ -1,4 +1,3 @@ -/* tslint:disable: no-console */ import { readFileSync } from 'fs' import { addCeloGethMiddleware } from 'src/lib/utils' import yargs from 'yargs' @@ -261,7 +260,7 @@ export const handler = async (argv: StartArgv) => { node.isProxied = true node.proxyAllowPrivateIp = true node.proxies = [ - getEnodeAddress(privateKeyToPublicKey(proxyPrivateKeys[x]), '127.0.0.1', proxy.proxyport!), + getEnodeAddress(privateKeyToPublicKey(proxyPrivateKeys[x]), '127.0.0.1', proxy.proxyport), getEnodeAddress(privateKeyToPublicKey(validatorPrivateKeys[x]), '127.0.0.1', node.port), ] } diff --git a/packages/celotool/src/cmds/transactions/describe.ts b/packages/celotool/src/cmds/transactions/describe.ts index e6df29d4c74..c17814b2a26 100644 --- a/packages/celotool/src/cmds/transactions/describe.ts +++ b/packages/celotool/src/cmds/transactions/describe.ts @@ -69,7 +69,7 @@ export const handler = async (argv: DescribeArgv) => { to: transaction.to ? transaction.to : undefined, from: transaction.from, }, - transaction.blockNumber! + transaction.blockNumber ) if (called.startsWith('0x08c379a')) { diff --git a/packages/celotool/src/e2e-tests/cip35_tests.ts b/packages/celotool/src/e2e-tests/cip35_tests.ts index d6892326440..b31e8f93aae 100644 --- a/packages/celotool/src/e2e-tests/cip35_tests.ts +++ b/packages/celotool/src/e2e-tests/cip35_tests.ts @@ -298,7 +298,7 @@ class TestEnv { if (ethCompatible && !this.cipIsActivated) { it('fails due to being ethereum-compatible', () => { assert.isNull(minedTx, 'Transaction succeeded when it should have failed') - assert.equal(error!, notYetActivatedError) + assert.equal(error, notYetActivatedError) }) } else if (this.cipIsActivated) { if (this.replayProtectionIsNotMandatory) { @@ -310,7 +310,7 @@ class TestEnv { // Replay protection is mandatory, so the transaction should fail it('fails due to replay protection being mandatory', () => { assert.isNull(minedTx, 'Transaction succeeded when it should have failed') - assert.equal(error!, noReplayProtectionError) + assert.equal(error, noReplayProtectionError) }) } } else { @@ -375,7 +375,7 @@ class TestEnv { const signed = await w3.eth.accounts.signTransaction(tx, validatorPrivateKey) raw = signed.rawTransaction! } else { - const signed = await kLocal.connection.wallet!.signTransaction(tx) + const signed = await kLocal.connection.wallet.signTransaction(tx) raw = signed.raw } // Once the transaction is signed and encoded, it doesn't matter whether we send it with web3 or contractkit @@ -406,8 +406,8 @@ class TestEnv { it(`fails with the expected error (${testCase.errorReason})`, () => { assert.notEqual(error, null, "Expected an error but didn't get one") assert.match( - error!, - new RegExp(testCase.errorString!, 'i'), + error, + new RegExp(testCase.errorString, 'i'), `Got "${error}", expected "${testCase.errorString}"` ) }) diff --git a/packages/celotool/src/e2e-tests/replica_tests.ts b/packages/celotool/src/e2e-tests/replica_tests.ts index b7b5a3a4877..6bc6e31d643 100644 --- a/packages/celotool/src/e2e-tests/replica_tests.ts +++ b/packages/celotool/src/e2e-tests/replica_tests.ts @@ -133,7 +133,7 @@ describe('replica swap tests', () => { await restart() - const proxyPubKey = privateKeyToPublicKey(gethConfig.instances[1].nodekey!) + const proxyPubKey = privateKeyToPublicKey(gethConfig.instances[1].nodekey) const replica: GethInstanceConfig = { name: 'validator0-replica0', replica: true, @@ -142,7 +142,7 @@ describe('replica swap tests', () => { port: 30315, rpcport: 8555, privateKey: gethConfig.instances[0].privateKey, - minerValidator: privateKeyToAddress(gethConfig.instances[0].privateKey!), + minerValidator: privateKeyToAddress(gethConfig.instances[0].privateKey), proxy: 'validator0-proxy0', isProxied: true, proxyport: 30304, diff --git a/packages/celotool/src/e2e-tests/utils.ts b/packages/celotool/src/e2e-tests/utils.ts index 357b8083256..df6e0523676 100644 --- a/packages/celotool/src/e2e-tests/utils.ts +++ b/packages/celotool/src/e2e-tests/utils.ts @@ -235,7 +235,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose const proxyNodeKeys = getPrivateKeysFor(AccountType.PROXY, mnemonic, numProxies) const proxyEnodes = proxyNodeKeys.map((x: string, i: number) => [ proxyInstances[i].name, - getEnodeAddress(privateKeyToPublicKey(x), '127.0.0.1', proxyInstances[i].proxyport!), + getEnodeAddress(privateKeyToPublicKey(x), '127.0.0.1', proxyInstances[i].proxyport), getEnodeAddress(privateKeyToPublicKey(x), '127.0.0.1', proxyInstances[i].port), ]) @@ -298,7 +298,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose } if (!instance.minerValidator && (instance.validating || instance.isProxied)) { - instance.minerValidator = privateKeyToAddress(instance.privateKey!) + instance.minerValidator = privateKeyToAddress(instance.privateKey) } } @@ -313,7 +313,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose throw new Error('proxied validator must have exactly one proxy') } - instance.proxiedValidatorAddress = privateKeyToAddress(proxiedValidator[0].privateKey!) + instance.proxiedValidatorAddress = privateKeyToAddress(proxiedValidator[0].privateKey) } } @@ -389,7 +389,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose } if (!instance.minerValidator && (instance.validating || instance.isProxied)) { - instance.minerValidator = privateKeyToAddress(instance.privateKey!) + instance.minerValidator = privateKeyToAddress(instance.privateKey) } await startGeth(gethConfig, gethBinaryPath, instance, verbose) diff --git a/packages/dev-utils/src/ganache-test.ts b/packages/dev-utils/src/ganache-test.ts index 1486d121a2b..673c02357f1 100644 --- a/packages/dev-utils/src/ganache-test.ts +++ b/packages/dev-utils/src/ganache-test.ts @@ -7,7 +7,7 @@ export const NetworkConfig = migrationOverride export function jsonRpcCall(web3: Web3, method: string, params: any[]): Promise { return new Promise((resolve, reject) => { if (web3.currentProvider && typeof web3.currentProvider !== 'string') { - web3.currentProvider.send!( + web3.currentProvider.send( { id: new Date().getTime(), jsonrpc: '2.0', diff --git a/packages/dev-utils/src/network.ts b/packages/dev-utils/src/network.ts index 860bb86e1a3..480b875cd19 100644 --- a/packages/dev-utils/src/network.ts +++ b/packages/dev-utils/src/network.ts @@ -23,7 +23,7 @@ async function execCmd(cmd: string, args: string[], options?: SpawnOptions & { s const process = spawn(cmd, args, { ...spawnOptions, stdio: silent ? 'ignore' : 'inherit' }) process.on('close', (code) => { try { - resolve(code as number) + resolve(code) } catch (error) { reject(error) } From c29af989bc850bd24c2d29acbfc480209ac15970 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 17:09:51 +0200 Subject: [PATCH 08/16] trust but verify. but dont actually trust --- .eslintrc.js | 3 ++- packages/celotool/src/e2e-tests/utils.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 01f74aa0a55..28d68c881d3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,7 +55,8 @@ module.exports = { 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, ], - + // i dont trust this rule + '@typescript-eslint/no-unnecessary-type-assertion': 'off', '@typescript-eslint/no-misused-promises': 'off', '@typescript-eslint/adjacent-overload-signatures': 'error', '@typescript-eslint/array-type': [ diff --git a/packages/celotool/src/e2e-tests/utils.ts b/packages/celotool/src/e2e-tests/utils.ts index df6e0523676..cf73dc47253 100644 --- a/packages/celotool/src/e2e-tests/utils.ts +++ b/packages/celotool/src/e2e-tests/utils.ts @@ -389,7 +389,7 @@ export function getContext(gethConfig: GethRunConfig, verbose: boolean = verbose } if (!instance.minerValidator && (instance.validating || instance.isProxied)) { - instance.minerValidator = privateKeyToAddress(instance.privateKey) + instance.minerValidator = privateKeyToAddress(instance.privateKey!) } await startGeth(gethConfig, gethBinaryPath, instance, verbose) From 088ff2e8d2eb9795e0d152a00f5094703900e512 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 17:23:34 +0200 Subject: [PATCH 09/16] use latest ts-node AND always run yarn ts-node to ensure the project one is used. --- package.json | 2 +- packages/metadata-crawler/package.json | 4 ++-- packages/protocol/package.json | 22 +++++++++++----------- yarn.lock | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 78cef72df71..379397ca63f 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "semver": "7.3.5", "solc": "0.5.8", "ts-jest": "^29.0.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "tsconfig-paths": "^3.8.0", "typescript": "^5.3.3" }, diff --git a/packages/metadata-crawler/package.json b/packages/metadata-crawler/package.json index 9445cf9aeb7..c1665e14469 100644 --- a/packages/metadata-crawler/package.json +++ b/packages/metadata-crawler/package.json @@ -19,7 +19,7 @@ "dotenv": "^8.2.0", "googleapis": "^39.2.0", "pg": "^7.18.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "web3": "1.10.0" }, "devDependencies": { @@ -29,7 +29,7 @@ "bunyan-debug-stream": "^2.0.0" }, "scripts": { - "dev": "ts-node src/crawler.ts", + "dev": "yarn run ts-node src/crawler.ts", "build": "tsc -b .", "clean": "tsc -b . --clean", "clean:all": "yarn clean && rm -rf lib" diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 37c0c4293f9..e2fe3fe37e8 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -12,23 +12,23 @@ "clean": "rm -rf ./types/typechain && rm -rf build/* && rm -rf .0x-artifacts/* && rm -rf migrations/*.js* && rm -rf migrations_ts/*.js* && rm -rf test/**/*.js* && rm -f lib/*.js* && rm -f lib/**/*.js* && rm -f scripts/*.js* && yarn clean:foundry", "clean:foundry": "rm -rf cache out", "test": "rm test/**/*.js ; node runTests.js", - "test:scripts": "ts-node scripts/run-scripts-tests.ts --testPathPattern=scripts/", + "test:scripts": "yarn ts-node scripts/run-scripts-tests.ts --testPathPattern=scripts/", "quicktest": "./scripts/bash/quicktest.sh", "test:coverage": "yarn run test --coverage", "ci:test-make-release": "./scripts/bash/release-on-devchain.sh", "test:release-snapshots": "./scripts/bash/release-snapshots.sh", "test:generate-old-devchain-and-build": "./scripts/bash/generate-old-devchain-and-build.sh", - "build:ts": "rm -f migrations/*.js* && ts-node --preferTsExts ./scripts/build.ts --truffleTypes ./types/typechain && tsc -b && mv migrations_ts/*.js* migrations", + "build:ts": "rm -f migrations/*.js* && yarn ts-node --preferTsExts ./scripts/build.ts --truffleTypes ./types/typechain && tsc -b && mv migrations_ts/*.js* migrations", "gas": "yarn run test --gas", "pull-submodules": "git submodule update --init --recursive", "delete-submodules": "rm -rf $(git submodule | awk '{ print $2 }')", - "build:sol": "yarn pull-submodules && mkdir -p migrations && ts-node --preferTsExts ./scripts/build.ts --solidity ${BUILD_DIR:-./build}", + "build:sol": "yarn pull-submodules && mkdir -p migrations && yarn ts-node --preferTsExts ./scripts/build.ts --solidity ${BUILD_DIR:-./build}", "build": "yarn build:sol && yarn build:ts", "prebuild": "rm -rf ./build", - "determine-release-version": "ts-node --preferTsExts ./scripts/determine-release-version.ts", - "prepare_contracts_and_abis_publishing": "ts-node --preferTsExts ./scripts/prepare-contracts-and-abis-publishing.ts", - "validate_abis_exports": "ts-node --preferTsExts ./scripts/validate-abis-package.ts", - "sourcify-publish": "ts-node ./scripts/sourcify-publish.ts", + "determine-release-version": "yarn ts-node --preferTsExts ./scripts/determine-release-version.ts", + "prepare_contracts_and_abis_publishing": "yarn ts-node --preferTsExts ./scripts/prepare-contracts-and-abis-publishing.ts", + "validate_abis_exports": "yarn ts-node --preferTsExts ./scripts/validate-abis-package.ts", + "sourcify-publish": "yarn ts-node ./scripts/sourcify-publish.ts", "migrate": "./scripts/bash/migrate.sh", "set_block_gas_limit": "./scripts/bash/set_block_gas_limit.sh", "download-artifacts": "./scripts/bash/download_artifacts.sh", @@ -39,17 +39,17 @@ "govern": "./scripts/bash/govern.sh", "console": "./scripts/bash/console.sh", "check-versions": "./scripts/bash/check-versions.sh", - "check-opcodes": "ts-node scripts/check-opcodes.ts", + "check-opcodes": "yarn ts-node scripts/check-opcodes.ts", "make-release": "./scripts/bash/make-release.sh", "verify-deployed": "./scripts/bash/verify-deployed.sh", "verify-release": "./scripts/bash/verify-release.sh", "ganache-dev": "./scripts/bash/ganache.sh", "ganache-devchain": "./scripts/bash/ganache_devchain.sh", "truffle:migrate": "truffle migrate", - "devchain": "ts-node scripts/devchain.ts", + "devchain": "yarn ts-node scripts/devchain.ts", "devchain:reset": "yarn devchain generate-tar .tmp/devchain.tar.gz --upto 28", "view-tags": "git for-each-ref 'refs/tags/core-contracts.*' --sort=-committerdate --format='%(color:magenta)%(committerdate:short) %(color:blue)%(tree) %(color:green)github.com/celo-org/celo-monorepo/releases/tag/%(color:yellow)%(refname:short)'", - "generate-stabletoken-files": "ts-node ./scripts/generate-stabletoken-files.ts", + "generate-stabletoken-files": "yarn ts-node ./scripts/generate-stabletoken-files.ts", "truffle-verify": "yarn truffle run verify" }, "dependencies": { @@ -135,7 +135,7 @@ "targz": "^1.0.1", "tmp": "^0.1.0", "truffle-typings": "^1.0.6", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-generator": "^0.0.8", "typechain": "^4.0.3", "typechain-target-truffle": "^1.0.2", diff --git a/yarn.lock b/yarn.lock index 1af1ac32beb..4568c2e3aa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19960,10 +19960,10 @@ ts-node@8.10.2: source-map-support "^0.5.17" yn "3.1.1" -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== dependencies: "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7" From be0eb1395b98e10895b3de0c004108d19eafa4a8 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 17:26:00 +0200 Subject: [PATCH 10/16] removing patch-package since the only remaining place it was used was had been for tslint most of use dont need to decrypt to dont try automatically --- SETUP.md | 4 ---- package.json | 3 +-- yarn.lock | 55 ++++------------------------------------------------ 3 files changed, 5 insertions(+), 57 deletions(-) diff --git a/SETUP.md b/SETUP.md index 12a511129bf..de5033e8cd8 100644 --- a/SETUP.md +++ b/SETUP.md @@ -161,9 +161,5 @@ yarn build --ignore docs > github.com host key. Clone a repo or add the github host key to > `~/.ssh/known_hosts` and then try again. -> When removing a dependency via `yarn remove some-package`, be sure to also run `yarn postinstall` so -> you aren't left with freshly unpackaged modules. This is because we use `patch-package` -> and the `postinstall` step which uses it is not automatically run after using `yarn remove`. - > The docs package relies on gitbook which has problems off of a fresh install. Running > `yarn build --ignore docs` is a known workaround. \ No newline at end of file diff --git a/package.json b/package.json index 379397ca63f..c13b06db38a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "check-licenses": "yarn licenses list --prod | grep '\\(─ GPL\\|─ (GPL-[1-9]\\.[0-9]\\+ OR GPL-[1-9]\\.[0-9]\\+)\\)' && echo 'Found GPL license(s). Use 'yarn licenses list --prod' to look up the offending package' || echo 'No GPL licenses found'", "report-coverage": "yarn run lerna run test-coverage", "test:watch": "node node_modules/jest/bin/jest.js --watch", - "postinstall": "yarn run lerna run postinstall && patch-package && yarn keys:decrypt", + "postinstall": "yarn run lerna run postinstall", "keys:decrypt": "bash scripts/key_placer.sh decrypt", "keys:encrypt": "bash scripts/key_placer.sh encrypt", "check:packages": "node ./scripts/check-packages.js", @@ -52,7 +52,6 @@ "husky": "^8.0.0", "jest": "^29.0.2", "lerna": "^5.5.0", - "patch-package": "^6.2.2", "prettier": "^2.7.1", "prettier-plugin-solidity": "1.0.0-alpha.35", "pretty-quick": "^2.0.1", diff --git a/yarn.lock b/yarn.lock index 4568c2e3aa5..3cf705a6f0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10537,13 +10537,6 @@ find-up@^6.3.0: locate-path "^7.1.0" path-exists "^5.0.0" -find-yarn-workspace-root@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" - integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== - dependencies: - micromatch "^4.0.2" - findup-sync@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-1.0.0.tgz#6f7e4b57b6ee3a4037b4414eaedea3f58f71e0ec" @@ -10801,7 +10794,7 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.0, fs-extra@^9.1.0: +fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -12834,7 +12827,7 @@ is-windows@^1.0.1: resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== -is-wsl@^2.1.1, is-wsl@^2.2.0: +is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -13794,13 +13787,6 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw-sync@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" - integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== - dependencies: - graceful-fs "^4.1.11" - klaw@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" @@ -14743,7 +14729,7 @@ micromatch@^2.3.11, micromatch@^2.3.7: parse-glob "^3.0.4" regex-cache "^0.4.2" -micromatch@^4.0.2, micromatch@^4.0.4: +micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -16105,14 +16091,6 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" -open@^7.4.2: - version "7.4.2" - resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" - integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== - dependencies: - is-docker "^2.0.0" - is-wsl "^2.1.1" - open@^8.4.0: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" @@ -16597,26 +16575,6 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" -patch-package@^6.2.2: - version "6.5.1" - resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621" - integrity sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA== - dependencies: - "@yarnpkg/lockfile" "^1.1.0" - chalk "^4.1.2" - cross-spawn "^6.0.5" - find-yarn-workspace-root "^2.0.0" - fs-extra "^9.0.0" - is-ci "^2.0.0" - klaw-sync "^6.0.0" - minimist "^1.2.6" - open "^7.4.2" - rimraf "^2.6.3" - semver "^5.6.0" - slash "^2.0.0" - tmp "^0.0.33" - yaml "^1.10.2" - path-case@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/path-case/-/path-case-2.1.1.tgz#94b8037c372d3fe2906e465bb45e25d226e8eea5" @@ -18670,11 +18628,6 @@ sisteransi@^1.0.0, sisteransi@^1.0.5: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -22215,7 +22168,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^1.10.0, yaml@^1.10.2: +yaml@^1.10.0: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== From 08bec6d0ef1cac643801aa0e24ac3a4be0af11a6 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Wed, 24 Jan 2024 17:43:40 +0200 Subject: [PATCH 11/16] i think running in yarn added extra output that broke gh action so try this otherwise revert --- packages/protocol/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/package.json b/packages/protocol/package.json index e2fe3fe37e8..46931435475 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -25,7 +25,7 @@ "build:sol": "yarn pull-submodules && mkdir -p migrations && yarn ts-node --preferTsExts ./scripts/build.ts --solidity ${BUILD_DIR:-./build}", "build": "yarn build:sol && yarn build:ts", "prebuild": "rm -rf ./build", - "determine-release-version": "yarn ts-node --preferTsExts ./scripts/determine-release-version.ts", + "determine-release-version": "yarn --silent ts-node --preferTsExts ./scripts/determine-release-version.ts", "prepare_contracts_and_abis_publishing": "yarn ts-node --preferTsExts ./scripts/prepare-contracts-and-abis-publishing.ts", "validate_abis_exports": "yarn ts-node --preferTsExts ./scripts/validate-abis-package.ts", "sourcify-publish": "yarn ts-node ./scripts/sourcify-publish.ts", From 72118da4d2314330c937dee33c36b0f8dadbe4d2 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 25 Jan 2024 11:23:22 +0200 Subject: [PATCH 12/16] investigate intermediate value is not iterable --- packages/protocol/abis/tsconfig.json | 2 +- packages/protocol/test/common/integration.ts | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/protocol/abis/tsconfig.json b/packages/protocol/abis/tsconfig.json index a99f0c81ddf..77263409e8d 100644 --- a/packages/protocol/abis/tsconfig.json +++ b/packages/protocol/abis/tsconfig.json @@ -18,5 +18,5 @@ "declaration": false, "rootDir": "./src-generated" }, - "include": ["./src-generated", "./src-generated/web3", "./src-generated/web3/0.8"] + "include": ["./src-generated"] } \ No newline at end of file diff --git a/packages/protocol/test/common/integration.ts b/packages/protocol/test/common/integration.ts index 2f39b2912e5..f43ec1f7d17 100644 --- a/packages/protocol/test/common/integration.ts +++ b/packages/protocol/test/common/integration.ts @@ -49,7 +49,10 @@ enum VoteValue { } async function getGroups(election: ElectionInstance) { - const [lst1, lst2] = await election.getTotalVotesForEligibleValidatorGroups() + const response = await election.getTotalVotesForEligibleValidatorGroups() + console.info('response', response) + const lst1 = response[0] + const lst2 = response[1] return zip( (address, value) => { return { address, value } @@ -212,8 +215,9 @@ contract('Integration: Governance slashing', (accounts: string[]) => { }) it('should increment the vote totals', async () => { - const [yes, ,] = await governance.getVoteTotals(proposalId) - assertEqualBN(yes, value) + const response = await governance.getVoteTotals(proposalId) + console.error('response', response) + assertEqualBN(response[0], value) }) }) @@ -386,8 +390,9 @@ contract('Integration: Governance', (accounts: string[]) => { }) it('should increment the vote totals', async () => { - const [yes, ,] = await governance.getVoteTotals(proposalId) - assertEqualBN(yes, value) + const response = await governance.getVoteTotals(proposalId) + console.error('response', response) + assertEqualBN(response[0], value) }) }) From 14707dbbb484721f0fb452021f8d829a99218afa Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 25 Jan 2024 13:09:09 +0200 Subject: [PATCH 13/16] structs fro sol contracts are returned as objects with named keys (as well as number keys) but NOT as arrays. --- packages/protocol/test/common/integration.ts | 2 - .../test/governance/voting/election.ts | 12 +-- .../test/governance/voting/release_gold.ts | 89 +++++++++++++------ 3 files changed, 67 insertions(+), 36 deletions(-) diff --git a/packages/protocol/test/common/integration.ts b/packages/protocol/test/common/integration.ts index f43ec1f7d17..474d93e0d72 100644 --- a/packages/protocol/test/common/integration.ts +++ b/packages/protocol/test/common/integration.ts @@ -216,7 +216,6 @@ contract('Integration: Governance slashing', (accounts: string[]) => { it('should increment the vote totals', async () => { const response = await governance.getVoteTotals(proposalId) - console.error('response', response) assertEqualBN(response[0], value) }) }) @@ -391,7 +390,6 @@ contract('Integration: Governance', (accounts: string[]) => { it('should increment the vote totals', async () => { const response = await governance.getVoteTotals(proposalId) - console.error('response', response) assertEqualBN(response[0], value) }) }) diff --git a/packages/protocol/test/governance/voting/election.ts b/packages/protocol/test/governance/voting/election.ts index 012108ee8b1..3bd117e0eda 100644 --- a/packages/protocol/test/governance/voting/election.ts +++ b/packages/protocol/test/governance/voting/election.ts @@ -104,9 +104,9 @@ contract('Election', (accounts: string[]) => { }) it('should have set electableValidators', async () => { - const [min, max] = await election.getElectableValidators() - assertEqualBN(min, electableValidators.min) - assertEqualBN(max, electableValidators.max) + const actualElectedValidators = await election.getElectableValidators() + assertEqualBN(actualElectedValidators[0], electableValidators.min) + assertEqualBN(actualElectedValidators[1], electableValidators.max) }) it('should have set maxNumGroupsVotedFor', async () => { @@ -158,9 +158,9 @@ contract('Election', (accounts: string[]) => { it('should set the minimum electable valdiators', async () => { await election.setElectableValidators(newElectableValidators.min, newElectableValidators.max) - const [min, max] = await election.getElectableValidators() - assertEqualBN(min, newElectableValidators.min) - assertEqualBN(max, newElectableValidators.max) + const electable = await election.getElectableValidators() + assertEqualBN(electable[0], newElectableValidators.min) + assertEqualBN(electable[1], newElectableValidators.max) }) it('should emit the ElectableValidatorsSet event', async () => { diff --git a/packages/protocol/test/governance/voting/release_gold.ts b/packages/protocol/test/governance/voting/release_gold.ts index d94312c9d81..3ad30cb9a87 100644 --- a/packages/protocol/test/governance/voting/release_gold.ts +++ b/packages/protocol/test/governance/voting/release_gold.ts @@ -76,6 +76,29 @@ interface ReleaseGoldConfig { canVote: boolean } +interface ReleaseSchedule { + // Timestamp (in UNIX time) that releasing begins. + releaseStartTime: number + // Timestamp (in UNIX time) of the releasing cliff. + releaseCliff: number + // Number of release periods. + numReleasePeriods: number + // Duration (in seconds) of one period. + releasePeriod: number + // Amount that is to be released per period. + amountReleasedPerPeriod: number +} +interface RevocationInfo { + // Indicates if the contract is revocable. + revocable: boolean + // Indicates if the contract can expire `EXPIRATION_TIME` after releasing finishes. + canExpire: boolean + // Released gold instance balance at time of revocation. + releasedBalanceAtRevoke: number + // The time at which the release schedule was revoked. + revokeTime: number +} + const Accounts: AccountsContract = artifacts.require('Accounts') const Freezer: FreezerContract = artifacts.require('Freezer') const GoldToken: GoldTokenContract = artifacts.require('GoldToken') @@ -380,36 +403,39 @@ contract('ReleaseGold', (accounts: string[]) => { }) it('should set releaseGold number of periods to releaseGold instance', async () => { - const [, , releaseGoldNumPeriods, ,] = await releaseGoldInstance.releaseSchedule() - assertEqualBN(releaseGoldNumPeriods, releaseGoldDefaultSchedule.numReleasePeriods) + const { numReleasePeriods } = + (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + assertEqualBN(numReleasePeriods, releaseGoldDefaultSchedule.numReleasePeriods) }) it('should set releaseGold amount per period to releaseGold instance', async () => { - const [, , , , releasedAmountPerPeriod] = await releaseGoldInstance.releaseSchedule() - assertEqualBN(releasedAmountPerPeriod, releaseGoldDefaultSchedule.amountReleasedPerPeriod) + const { amountReleasedPerPeriod } = + (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + assertEqualBN(amountReleasedPerPeriod, releaseGoldDefaultSchedule.amountReleasedPerPeriod) }) it('should set releaseGold period to releaseGold instance', async () => { - const [, , , releaseGoldPeriodSec] = await releaseGoldInstance.releaseSchedule() - assertEqualBN(releaseGoldPeriodSec, releaseGoldDefaultSchedule.releasePeriod) + const { releasePeriod } = (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + assertEqualBN(releasePeriod, releaseGoldDefaultSchedule.releasePeriod) }) it('should set releaseGold start time to releaseGold instance', async () => { - const [releaseGoldStartTime, , , ,] = await releaseGoldInstance.releaseSchedule() - assertEqualBN(releaseGoldStartTime, releaseGoldDefaultSchedule.releaseStartTime) + const { releaseStartTime } = + (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + assertEqualBN(releaseStartTime, releaseGoldDefaultSchedule.releaseStartTime) }) it('should set releaseGold cliff to releaseGold instance', async () => { - const [, releaseGoldCliffStartTime, , ,] = await releaseGoldInstance.releaseSchedule() + const { releaseCliff } = (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule const releaseGoldCliffStartTimeComputed = new BigNumber( releaseGoldDefaultSchedule.releaseStartTime ).plus(releaseGoldDefaultSchedule.releaseCliffTime) - assertEqualBN(releaseGoldCliffStartTime, releaseGoldCliffStartTimeComputed) + assertEqualBN(releaseCliff, releaseGoldCliffStartTimeComputed) }) it('should set revocable flag to releaseGold instance', async () => { - const [releaseGoldRevocable, , ,] = await releaseGoldInstance.revocationInfo() - assert.equal(releaseGoldRevocable, releaseGoldDefaultSchedule.revocable) + const revocationInfo = await releaseGoldInstance.revocationInfo() + assert.equal(revocationInfo[0], releaseGoldDefaultSchedule.revocable) }) it('should set releaseOwner to releaseGold instance', async () => { @@ -430,12 +456,13 @@ contract('ReleaseGold', (accounts: string[]) => { it('should be unrevoked on init and have revoke time equal zero', async () => { const isRevoked = await releaseGoldInstance.isRevoked() assert.equal(isRevoked, false) - const [, , , revokeTime] = await releaseGoldInstance.revocationInfo() + const { revokeTime } = (await releaseGoldInstance.revocationInfo()) as RevocationInfo assertEqualBN(revokeTime, 0) }) it('should have releaseGoldBalanceAtRevoke on init equal to zero', async () => { - const [, , releasedBalanceAtRevoke] = await releaseGoldInstance.revocationInfo() + const { releasedBalanceAtRevoke } = + (await releaseGoldInstance.revocationInfo()) as RevocationInfo assertEqualBN(releasedBalanceAtRevoke, 0) }) @@ -1214,8 +1241,8 @@ contract('ReleaseGold', (accounts: string[]) => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) const releaseOwnereleaseGoldTx = await releaseGoldInstance.revoke({ from: releaseOwner }) const revokeBlockTimestamp = await getCurrentBlockchainTimestamp(web3) - const [, , , releaseGoldRevokeTime] = await releaseGoldInstance.revocationInfo() - assertEqualBN(revokeBlockTimestamp, releaseGoldRevokeTime) + const { revokeTime } = (await releaseGoldInstance.revocationInfo()) as RevocationInfo + assertEqualBN(revokeBlockTimestamp, revokeTime) assert.isTrue(await releaseGoldInstance.isRevoked()) assertLogMatches(releaseOwnereleaseGoldTx.logs[0], 'ReleaseScheduleRevoked', { revokeTimestamp: revokeBlockTimestamp, @@ -1269,7 +1296,8 @@ contract('ReleaseGold', (accounts: string[]) => { describe('when the contract has finished releasing', () => { beforeEach(async () => { - const [, , numReleasePeriods, releasePeriod] = await releaseGoldInstance.releaseSchedule() + const [, , numReleasePeriods, releasePeriod] = + (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule const grantTime = numReleasePeriods .times(releasePeriod) .plus(5 * MINUTE) @@ -1317,7 +1345,8 @@ contract('ReleaseGold', (accounts: string[]) => { }) it('should set the released balance at revocation to total withdrawn', async () => { - const [, , releasedBalanceAtRevoke] = await releaseGoldInstance.revocationInfo() + const { releasedBalanceAtRevoke } = + (await releaseGoldInstance.revocationInfo()) as RevocationInfo // 0 gold withdrawn at this point assertEqualBN(releasedBalanceAtRevoke, 0) }) @@ -1345,7 +1374,8 @@ contract('ReleaseGold', (accounts: string[]) => { }) it('should set the released balance at revocation to total withdrawn', async () => { - const [, , releasedBalanceAtRevoke] = await releaseGoldInstance.revocationInfo() + const { releasedBalanceAtRevoke } = + (await releaseGoldInstance.revocationInfo()) as RevocationInfo // half of gold withdrawn at this point assertEqualBN(releasedBalanceAtRevoke, TOTAL_AMOUNT.div(2)) }) @@ -1369,7 +1399,8 @@ contract('ReleaseGold', (accounts: string[]) => { beforeEach(async () => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) await releaseGoldInstance.setCanExpire(false, { from: beneficiary }) - const [, , numReleasePeriods, releasePeriod] = await releaseGoldInstance.releaseSchedule() + const [, , numReleasePeriods, releasePeriod] = + (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule const expirationTime = await releaseGoldInstance.EXPIRATION_TIME() const grantTime = numReleasePeriods.times(releasePeriod).plus(5 * MINUTE) const timeToTravel = grantTime.plus(expirationTime).toNumber() @@ -1423,7 +1454,8 @@ contract('ReleaseGold', (accounts: string[]) => { it('should transfer gold proportions to both beneficiary and refundAddress when no gold locked', async () => { const beneficiaryBalanceBefore = await goldTokenInstance.balanceOf(beneficiary) const refundAddressBalanceBefore = await goldTokenInstance.balanceOf(refundAddress) - const [, , releasedBalanceAtRevoke] = await releaseGoldInstance.revocationInfo() + const { releasedBalanceAtRevoke } = + (await releaseGoldInstance.revocationInfo()) as RevocationInfo const beneficiaryRefundAmount = new BigNumber(releasedBalanceAtRevoke).minus( await releaseGoldInstance.totalWithdrawn() ) @@ -1626,9 +1658,9 @@ contract('ReleaseGold', (accounts: string[]) => { }) it('should remove the pending withdrawal', async () => { - const [values, timestamps] = await lockedGoldInstance.getPendingWithdrawals( - releaseGoldInstance.address - ) + const data = await lockedGoldInstance.getPendingWithdrawals(releaseGoldInstance.address) + const values = data[0] + const timestamps = data[1] assert.equal(values.length, 0) assert.equal(timestamps.length, 0) assertEqualBN(await releaseGoldInstance.getRemainingLockedBalance(), 0) @@ -1706,9 +1738,9 @@ contract('ReleaseGold', (accounts: string[]) => { }) it('should remove the pending withdrawal', async () => { - const [values, timestamps] = await lockedGoldInstance.getPendingWithdrawals( - releaseGoldInstance.address - ) + const data = await lockedGoldInstance.getPendingWithdrawals(releaseGoldInstance.address) + const values = data[0] + const timestamps = data[1] assert.equal(values.length, 0) assert.equal(timestamps.length, 0) }) @@ -1980,7 +2012,8 @@ contract('ReleaseGold', (accounts: string[]) => { const timeToTravel = 6 * MONTH + 1 * DAY await timeTravel(timeToTravel, web3) await releaseGoldInstance.revoke({ from: releaseOwner }) - const [, , expectedWithdrawalAmount] = await releaseGoldInstance.revocationInfo() + const info = (await releaseGoldInstance.revocationInfo()) as RevocationInfo + const expectedWithdrawalAmount = info[2] await releaseGoldInstance.withdraw(expectedWithdrawalAmount, { from: beneficiary }) const totalWithdrawn = await releaseGoldInstance.totalWithdrawn() const beneficiaryBalanceAfter = await goldTokenInstance.balanceOf(beneficiary) From cedfcb927c448a46dab314afa085acceb4c1861d Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 25 Jan 2024 14:01:27 +0200 Subject: [PATCH 14/16] fix a few more missed issues --- .../test/governance/voting/release_gold.ts | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/packages/protocol/test/governance/voting/release_gold.ts b/packages/protocol/test/governance/voting/release_gold.ts index 3ad30cb9a87..3c49c1555c0 100644 --- a/packages/protocol/test/governance/voting/release_gold.ts +++ b/packages/protocol/test/governance/voting/release_gold.ts @@ -82,7 +82,7 @@ interface ReleaseSchedule { // Timestamp (in UNIX time) of the releasing cliff. releaseCliff: number // Number of release periods. - numReleasePeriods: number + numReleasePeriods: BigNumber // Duration (in seconds) of one period. releasePeriod: number // Amount that is to be released per period. @@ -94,7 +94,7 @@ interface RevocationInfo { // Indicates if the contract can expire `EXPIRATION_TIME` after releasing finishes. canExpire: boolean // Released gold instance balance at time of revocation. - releasedBalanceAtRevoke: number + releasedBalanceAtRevoke: BigNumber // The time at which the release schedule was revoked. revokeTime: number } @@ -404,29 +404,31 @@ contract('ReleaseGold', (accounts: string[]) => { it('should set releaseGold number of periods to releaseGold instance', async () => { const { numReleasePeriods } = - (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule assertEqualBN(numReleasePeriods, releaseGoldDefaultSchedule.numReleasePeriods) }) it('should set releaseGold amount per period to releaseGold instance', async () => { const { amountReleasedPerPeriod } = - (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule assertEqualBN(amountReleasedPerPeriod, releaseGoldDefaultSchedule.amountReleasedPerPeriod) }) it('should set releaseGold period to releaseGold instance', async () => { - const { releasePeriod } = (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + const { releasePeriod } = + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule assertEqualBN(releasePeriod, releaseGoldDefaultSchedule.releasePeriod) }) it('should set releaseGold start time to releaseGold instance', async () => { const { releaseStartTime } = - (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule assertEqualBN(releaseStartTime, releaseGoldDefaultSchedule.releaseStartTime) }) it('should set releaseGold cliff to releaseGold instance', async () => { - const { releaseCliff } = (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + const { releaseCliff } = + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule const releaseGoldCliffStartTimeComputed = new BigNumber( releaseGoldDefaultSchedule.releaseStartTime ).plus(releaseGoldDefaultSchedule.releaseCliffTime) @@ -456,13 +458,14 @@ contract('ReleaseGold', (accounts: string[]) => { it('should be unrevoked on init and have revoke time equal zero', async () => { const isRevoked = await releaseGoldInstance.isRevoked() assert.equal(isRevoked, false) - const { revokeTime } = (await releaseGoldInstance.revocationInfo()) as RevocationInfo + const { revokeTime } = + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo assertEqualBN(revokeTime, 0) }) it('should have releaseGoldBalanceAtRevoke on init equal to zero', async () => { const { releasedBalanceAtRevoke } = - (await releaseGoldInstance.revocationInfo()) as RevocationInfo + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo assertEqualBN(releasedBalanceAtRevoke, 0) }) @@ -1241,7 +1244,8 @@ contract('ReleaseGold', (accounts: string[]) => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) const releaseOwnereleaseGoldTx = await releaseGoldInstance.revoke({ from: releaseOwner }) const revokeBlockTimestamp = await getCurrentBlockchainTimestamp(web3) - const { revokeTime } = (await releaseGoldInstance.revocationInfo()) as RevocationInfo + const { revokeTime } = + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo assertEqualBN(revokeBlockTimestamp, revokeTime) assert.isTrue(await releaseGoldInstance.isRevoked()) assertLogMatches(releaseOwnereleaseGoldTx.logs[0], 'ReleaseScheduleRevoked', { @@ -1296,8 +1300,8 @@ contract('ReleaseGold', (accounts: string[]) => { describe('when the contract has finished releasing', () => { beforeEach(async () => { - const [, , numReleasePeriods, releasePeriod] = - (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + const { releasePeriod, numReleasePeriods } = + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule const grantTime = numReleasePeriods .times(releasePeriod) .plus(5 * MINUTE) @@ -1346,7 +1350,7 @@ contract('ReleaseGold', (accounts: string[]) => { it('should set the released balance at revocation to total withdrawn', async () => { const { releasedBalanceAtRevoke } = - (await releaseGoldInstance.revocationInfo()) as RevocationInfo + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo // 0 gold withdrawn at this point assertEqualBN(releasedBalanceAtRevoke, 0) }) @@ -1375,7 +1379,7 @@ contract('ReleaseGold', (accounts: string[]) => { it('should set the released balance at revocation to total withdrawn', async () => { const { releasedBalanceAtRevoke } = - (await releaseGoldInstance.revocationInfo()) as RevocationInfo + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo // half of gold withdrawn at this point assertEqualBN(releasedBalanceAtRevoke, TOTAL_AMOUNT.div(2)) }) @@ -1399,8 +1403,8 @@ contract('ReleaseGold', (accounts: string[]) => { beforeEach(async () => { await createNewReleaseGoldInstance(releaseGoldDefaultSchedule, web3) await releaseGoldInstance.setCanExpire(false, { from: beneficiary }) - const [, , numReleasePeriods, releasePeriod] = - (await releaseGoldInstance.releaseSchedule()) as ReleaseSchedule + const { numReleasePeriods, releasePeriod } = + (await releaseGoldInstance.releaseSchedule()) as unknown as ReleaseSchedule const expirationTime = await releaseGoldInstance.EXPIRATION_TIME() const grantTime = numReleasePeriods.times(releasePeriod).plus(5 * MINUTE) const timeToTravel = grantTime.plus(expirationTime).toNumber() @@ -1455,7 +1459,7 @@ contract('ReleaseGold', (accounts: string[]) => { const beneficiaryBalanceBefore = await goldTokenInstance.balanceOf(beneficiary) const refundAddressBalanceBefore = await goldTokenInstance.balanceOf(refundAddress) const { releasedBalanceAtRevoke } = - (await releaseGoldInstance.revocationInfo()) as RevocationInfo + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo const beneficiaryRefundAmount = new BigNumber(releasedBalanceAtRevoke).minus( await releaseGoldInstance.totalWithdrawn() ) @@ -1569,9 +1573,9 @@ contract('ReleaseGold', (accounts: string[]) => { from: beneficiary, }) - const [values, timestamps] = await lockedGoldInstance.getPendingWithdrawals( - releaseGoldInstance.address - ) + const data = await lockedGoldInstance.getPendingWithdrawals(releaseGoldInstance.address) + const values = data[0] + const timestamps = data[1] assert.equal(values.length, 1) assert.equal(timestamps.length, 1) assertEqualBN(values[0], lockAmount) @@ -2012,7 +2016,7 @@ contract('ReleaseGold', (accounts: string[]) => { const timeToTravel = 6 * MONTH + 1 * DAY await timeTravel(timeToTravel, web3) await releaseGoldInstance.revoke({ from: releaseOwner }) - const info = (await releaseGoldInstance.revocationInfo()) as RevocationInfo + const info = (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo const expectedWithdrawalAmount = info[2] await releaseGoldInstance.withdraw(expectedWithdrawalAmount, { from: beneficiary }) const totalWithdrawn = await releaseGoldInstance.totalWithdrawn() @@ -2028,14 +2032,12 @@ contract('ReleaseGold', (accounts: string[]) => { const timeToTravel = 6 * MONTH + 1 * DAY await timeTravel(timeToTravel, web3) await releaseGoldInstance.revoke({ from: releaseOwner }) - const [, , expectedWithdrawalAmount] = await releaseGoldInstance.revocationInfo() + const { releasedBalanceAtRevoke } = + (await releaseGoldInstance.revocationInfo()) as unknown as RevocationInfo await assertTransactionRevertWithReason( - releaseGoldInstance.withdraw( - new BigNumber(expectedWithdrawalAmount).multipliedBy(1.1), - { - from: beneficiary, - } - ), + releaseGoldInstance.withdraw(new BigNumber(releasedBalanceAtRevoke).multipliedBy(1.1), { + from: beneficiary, + }), 'Requested amount is greater than available released funds' ) }) From a87d99d206f4c28a33fe630e92471478ae37f487 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 25 Jan 2024 15:27:31 +0200 Subject: [PATCH 15/16] just curious --- packages/protocol/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index 168a6da59a5..5b0a547e95a 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -14,7 +14,7 @@ "noUnusedParameters": true, "removeComments": false, "sourceMap": true, - "target": "es6", + "target": "es2020", "downlevelIteration": true, "resolveJsonModule": true, "strict": false, From 971177ae1e87df813e4ca7eb1c2132390178170f Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Thu, 25 Jan 2024 17:04:04 +0200 Subject: [PATCH 16/16] not really any reason to move to change the target so instead of fixing all the bugs jut keep as is and sourcemaps are not needed for this package --- packages/protocol/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json index 5b0a547e95a..c34fafaf657 100644 --- a/packages/protocol/tsconfig.json +++ b/packages/protocol/tsconfig.json @@ -13,8 +13,8 @@ "noUnusedLocals": true, "noUnusedParameters": true, "removeComments": false, - "sourceMap": true, - "target": "es2020", + "sourceMap": false, + "target": "es5", "downlevelIteration": true, "resolveJsonModule": true, "strict": false,