From eefeca1bc7978ce2067fcd2ce318b3051c7a2875 Mon Sep 17 00:00:00 2001 From: "pull[bot]" <39814207+pull[bot]@users.noreply.github.com> Date: Fri, 18 Jun 2021 09:57:09 -0700 Subject: [PATCH] [pull] develop from ethereum-optimism:develop (#74) * chore: reduce hardhat timeout to 20 seconds (#968) * fix: force LF line endings for scripts to avoid docker problems on Windows (#974) * fix: use correct line endings for windows * chore: add changeset * feat: add hardhat deploy instructions to readme (#965) * feat: add deployment instructions to readme * Add changeset * fix style * Update README.md * feat: fees v2 (#976) * l2 geth: new fee logic * l2 geth: migrate to fees package * core-utils: new fee scheme * chore: add changeset * l2geth: delete dead code * integration-tests: fix typo * integration-tests: fixes * fees: use fee scalar * lint: fix * rollup: correct gas payment comparison * fix(integration-tests): do not hardcode gas price * core-utils: update with new scheme * l2geth: refactor rollup oracle * l2geth: clean up DoEstimateGas * l2geth: implement latest scheme * tests: fix up * lint: fix * l2geth: better sycn service test * optimism: rename to TxGasLimit * fee: fix docstring * tests: fix * variables: rename * l2geth: prevent users from sending txs with too high of a fee * integration-tests: fix import * integration-tests: fix type * integration-tests: fix gas limits * lint: fix * l2geth: log error Co-authored-by: Georgios Konstantopoulos * Add static analysis action (#848) * Add static analysis github action setup python and install slither * Add nvmrc file for setting node to v14.17 * Update slither command run to link missing contract packages from monorepo root * Add steps for installing dependencies * Add yarn build step to github action * Enable colour in github action for static analysis * Disable certain detectors * Ensure slither does not fail build * Add instructions on running static analysis to monorepo readme * build(deps): bump ws from 7.4.4 to 7.4.6 in /ops/docker/hardhat (#987) Bumps [ws](https://github.com/websockets/ws) from 7.4.4 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.4.4...7.4.6) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat[message-relayer]: relay tx generator (#952) * feat[message-relayer]: relay tx generator * whoops, I burned our infura key * fix minor bug * add comments * add more comments and clean stuff up * add empty test descriptions * add tests * move smock to dev deps * chore: add changeset * minor cleanup to merkle tree proof function * use bignumber math to avoid nested await * use a better interface * minor fixes and simplifications * backwards compatible dtl syncing (#986) * kovan: fix attempt * kovan: db fix * kovan: types are strings from db * l2geth: parse things as strings * chore: add changeset * dtl: also stringify the range query * geth: dereference * geth: assign err * dtl: handle null * dtl: fix unit tests * fix[smock]: fix broken call assertions for overloaded functions (#996) * fix[smock]: fix broken call assertions for overloaded functions * chore: add changeset * minor correction and add a test * add a test for non-overloaded functions * fix[message-relayer]: remove spreadsheet mode (#998) * fix[message-relayer]: remove spreadsheet mode * chore: add changeset * Lower local rollup timestamp refresh (#985) * update rollup timestamp refresh * increase refresh time to 5s * feat: fees v3 (#999) * core-utils: fee impl v3 * l2geth: fees v3 impl * integration-tests: update for fees v3 * chore: add changeset * fix: typo * integration-tests: fix and generalize * fees: update fee scalar * l2geth: check gas in the mempool behind usingovm * tests: fix up * l2geth: remove dead var * truffle: fix config * fix: remove dead coders (#1001) * chore: delete dead coders * chore: add changeset * dtl: remove dead imports * core-utils: delete dead tests * batch-submitter: remove txtype * chore: add changeset * docs[message-relayer]: add a README and improve the interface for generating proofs (#1002) * docs[message-relayer]: add basic docs and clean up an interface * chore: add changeset * dtl: log error stack for failed http request (#995) * dtl: log error stack for failed http request * chore: add changeset * Add rpc-proxy service for whitelisting JSON RPC methods to the sequencer. (#945) * Add healthcheck endpoint for rpc-proxy Added ethereum-nginx-proxy source updated README and docker image build * Check ETH_CALLS_ALLOWED is set, clean up comments, remove old Dockerfile * feat: deployment config for fee oracle contract (#936) * feat[contracts]: add GasPriceOracle w/o predeploy Based on #912 * feat[contracts]: congestion price oracle * chore: add changeset * contracts: gas price oracle (#917) * contracts: gas price oracle * tests: update * fees: fix tests * contracts: simplify gas price oracle * lint: fix * test: execution price is at the 1st storage slot * chore: rename predeploy to GasPriceOracle * chore: rename gas price oracle test name Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos * Add an L2 deploy script for gas oracle contract * Add a kovan deployment artifact * Add deployment to readme * Add extra validation & initial execution price * Update README.md * Fix execution price logic * Perform new deployment with final contract * contracts: better require in ovm gas price oracle * Deploy L2GasPriceOracle * Update contract to use new fee logic & rename to gas * Deploy updated contract * Fix lint * gas price oracle: do not restrict gas price * gas price oracle: new deployment * tests: delete dead test Co-authored-by: smartcontracts Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos * ops: expose debug namespace (#1007) * fix(sync-service): prevent underflows (#1015) * fix(sync-service): prevent underflows * chore: add changeset * chore: remove dead confirmation depth * chore: remove eth1conf depth from rollup config * test: remove duplicate value in array (#1014) * ci: tag docker image for canary with abbreviated GITHUB_SHA (#1006) * ci: tag docker image for canary with abbreviated GITHUB_SHA * ci: update from 6 bytes to 8 bytes of abbreviation * refactor: improve logging for transactions being submitted to chain with gasPrice (#1016) * refactor: improve logging for transactions being submitted to chain with gasPrice * lint: apply lint autofixes * ci: upload logs for failed integration tests (#1020) * fix(dtl): improve slow blocking JSON parsing that occurs during l2 sync (#1019) The use of eth_getBlockRange returns a large response which is very slow to parse in ethersjs, and can block the event loop for upwards of multiple seconds. When this happens, incoming http requests will likely timeout and fail. Instead, we will parse the incoming http stream directly with the bfj package, which yields the event loop periodically so that we don't fail to serve requests. * fix: lint errors in dtl (#1025) * fix[dtl]: fix dtl bug breaking verifiers (#1011) * fix[dtl]: fix dtl bug breaking verifiers * tweaks so tests pass * chore: add changeset * fix: deterministic blockhashes (#1032) * config: set etherbase * l2geth: add deterministic clique key * l2geth: default value * chore: add changeset * test: add sync test for deterministic blockhash Co-authored-by: Kevin Ho * Version Packages (#978) Co-authored-by: github-actions[bot] * ci: add sync test's own workflow (#1031) * fix(dtl): incorrect parsing of eth_getBlockRange result (#1037) * Version Packages (#1045) Co-authored-by: github-actions[bot] * build(deps): bump glob-parent from 5.1.1 to 5.1.2 (#1036) Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: smartcontracts Co-authored-by: Liam Horne * l2geth: optimize loops (#1027) * l2geth: optimize loops * l2geth: stop ticker when done * l2geth: don't wait for first tick * chore: add changeset * Enable custom tagging of release docker image (#1048) * ci: enable custom tagging of release docker image * ci: refactor to add prerelease prefix for secuirty * doc: typo * ci: fix indentation issue of canary workflow * ci: fix typo with GITHUB_SHA * fix: typo in USE_HARDHAT config (#1023) * l2geth: bump to go 1.15 (#1058) * l2geth: bump to go 1.15 * chore: add changeset * Change monotonicity band-aid code to log warnings not errors (#1060) * refactor: change monotonicity band-aid code to log warnings not errors * build: add changeset * Ensure Sentry is correctly set up for DTL and MR (#1054) * refactor: add logger and metrics to options for BaseService * refactor: thread sentryOptions through from message-relayer into BaseService * refactor: ensure DTL Logger is using Sentry for errors * style: lint base-service.ts * refactor: init Sentry on batch-submitter too * refactor: init Sentry on message-relayer too * refactor: pass in basic logger to MessageRelayerService * build: provide changeset * fix: correct usage of use-sentry boolean config * refactor: appropriately type loggingOptions * build: add @sentry/node * build: add @sentry/node to message-relayer and fix linting issue * Add more logging information to monotonicity violation logs (#1066) * refactor: log idx of monotonicity violation from batch * build: add changeset * fix: monotonicity auto healer (#1070) * fix: monotonicity auto healer * add: changeset * Version Packages (#1053) Co-authored-by: github-actions[bot] * fix: comment out codeowners (#1073) * fix[l2geth]: off-by-one sometimes breaking replica sync (#1082) * fix[l2geth]: off-by-one sometimes breaking replica sync * chore: add changeset * fix(l2geth): Log 'end of OVM execution' correctly (#1080) * fix[bs]: disambiguate generic submission errors (#1051) * fix[bs]: disambiguate generic submission errors * add cases for errors * separate out errors from transaction reverts with reasons * remove extraneous errors * Version Packages (#1089) Co-authored-by: github-actions[bot] * fix: use -z flag for var unset in canary * Use Eslint instead of Tslint (#1005) * removed tslint * forgot to commit files * made .eslintrc.js consistent for all subdirs and other cleanup * [removed] includes and files keys from tsconfig.json * removed file level linting exceptions and added details to line level * added changeset * fixed newly introduced linting errors from rebase * enable json import for batch submitter * removed ecdsa-coder * maybe a tsconfig issue? * Update deploy.ts Co-authored-by: smartcontracts Co-authored-by: platocrat <37757724+platocrat@users.noreply.github.com> * metrics[batch-submitter]: add new batch submitter metrics (#1074) * metrics[batch-submitter]: add new batch submitter metrics * chore: changeset * account for failed submissions * feat[ci]: upload logs for sync tests if failure (#1098) * fix[dtl]: defend against RPC provider missing events (#1084) * fix[dtl]: defend against RPC provider missing events * chore: add changeset * respond to review comments * better error handling for missing handlers * maintenance[monorepo]: first pass update to README (#1106) * maintenance[monorepo]: first pass update to README Doing some relatively minor updates to the README just to clean things up a bit. * replying to review comments * Move the metric prefix string to a label (#1047) Added changeset and fixes Changeset to patch * fix[smock]: add support for hardhat 2.4.0 (#1112) * fix[smock]: add support for hardhat 2.4.0 * chore: add changeset * lint: fix Co-authored-by: Maurelian Co-authored-by: smartcontracts Co-authored-by: Karl Floersch Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos Co-authored-by: Elena Gesheva Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kevin Ho Co-authored-by: Ben Wilson <82120899+optimisticben@users.noreply.github.com> Co-authored-by: Liam Horne Co-authored-by: Tim Myers Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Annie Ke Co-authored-by: Rajiv Patel-O'Connor Co-authored-by: platocrat <37757724+platocrat@users.noreply.github.com> --- .changeset/brown-boxes-compete.md | 5 + .changeset/calm-fans-travel.md | 5 + .changeset/nice-terms-walk.md | 5 + .changeset/olive-planets-clean.md | 5 + .changeset/sour-adults-worry.md | 7 + .eslintrc.js | 186 ++++++++++++++++++ examples/truffle/test/erc20.spec.js | 3 +- integration-tests/.eslintrc.js | 3 + integration-tests/package.json | 14 +- integration-tests/tsconfig.json | 2 +- integration-tests/tslint.json | 7 - packages/batch-submitter/.eslintrc.js | 3 + .../src/batch-submitter/batch-submitter.ts | 51 ++++- .../src/batch-submitter/tx-batch-submitter.ts | 4 +- .../src/exec/run-batch-submitter.ts | 32 ++- packages/batch-submitter/tsconfig.json | 9 +- packages/batch-submitter/tslint.json | 3 - packages/common-ts/.eslintrc.js | 3 + packages/common-ts/package.json | 16 +- packages/common-ts/src/base-service.ts | 6 +- packages/common-ts/src/common/metrics.ts | 2 +- packages/common-ts/tslint.json | 3 - packages/contracts/.eslintrc.js | 7 + packages/contracts/bin/deploy.ts | 56 +++--- packages/contracts/package.json | 16 +- packages/contracts/src/predeploys.ts | 6 +- .../contracts/src/state-dump/make-dump.ts | 2 + .../assets/OVM_L2DepositedERC20.spec.ts | 3 +- .../OVM_StateTransitioner.spec.ts | 1 - .../libraries/codec/Lib_EIP155Tx.spec.ts | 1 - .../libraries/codec/Lib_OVMCodec.spec.ts | 1 - .../libraries/rlp/Lib_RLPWriter.spec.ts | 1 - .../libraries/utils/Lib_EthUtils.spec.ts | 3 +- packages/contracts/test/helpers/constants.ts | 2 +- .../test/helpers/test-runner/test-runner.ts | 2 +- packages/contracts/tsconfig.json | 4 +- packages/contracts/tslint.json | 8 - packages/core-utils/.eslintrc.js | 3 + packages/core-utils/package.json | 16 +- packages/core-utils/src/common/hex-strings.ts | 5 + packages/core-utils/src/common/misc.ts | 1 + .../test/coders/batch-encoder.spec.ts | 1 + packages/core-utils/tslint.json | 3 - packages/data-transport-layer/.eslintrc.js | 3 + .../data-transport-layer/src/client/client.ts | 2 +- .../services/l1-ingestion/handlers/errors.ts | 10 + .../handlers/sequencer-batch-appended.ts | 14 ++ .../handlers/state-batch-appended.ts | 14 ++ .../handlers/transaction-enqueued.ts | 12 ++ .../src/services/l2-ingestion/service.ts | 1 + .../src/services/server/service.ts | 3 +- .../data-transport-layer/src/utils/common.ts | 1 + packages/data-transport-layer/tslint.json | 3 - packages/hardhat-ovm/.eslintrc.js | 3 + packages/hardhat-ovm/package.json | 18 +- packages/hardhat-ovm/src/index.ts | 3 +- packages/hardhat-ovm/tslint.json | 3 - packages/message-relayer/.eslintrc.js | 3 + packages/message-relayer/src/service.ts | 1 + packages/message-relayer/tslint.json | 3 - packages/smock/.eslintrc.js | 7 + packages/smock/package.json | 22 ++- packages/smock/src/common/hardhat-common.ts | 3 + packages/smock/src/smockit/smockit.ts | 3 + packages/smock/src/smoddit/smoddit.ts | 1 + packages/smock/src/smoddit/storage.ts | 4 + packages/smock/tsconfig.json | 5 +- packages/smock/tslint.json | 3 - 68 files changed, 519 insertions(+), 142 deletions(-) create mode 100644 .changeset/brown-boxes-compete.md create mode 100644 .changeset/calm-fans-travel.md create mode 100644 .changeset/nice-terms-walk.md create mode 100644 .changeset/olive-planets-clean.md create mode 100644 .changeset/sour-adults-worry.md create mode 100644 .eslintrc.js create mode 100644 integration-tests/.eslintrc.js delete mode 100644 integration-tests/tslint.json create mode 100644 packages/batch-submitter/.eslintrc.js delete mode 100644 packages/batch-submitter/tslint.json create mode 100644 packages/common-ts/.eslintrc.js delete mode 100644 packages/common-ts/tslint.json create mode 100644 packages/contracts/.eslintrc.js delete mode 100644 packages/contracts/tslint.json create mode 100644 packages/core-utils/.eslintrc.js delete mode 100644 packages/core-utils/tslint.json create mode 100644 packages/data-transport-layer/.eslintrc.js create mode 100644 packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts delete mode 100644 packages/data-transport-layer/tslint.json create mode 100644 packages/hardhat-ovm/.eslintrc.js delete mode 100644 packages/hardhat-ovm/tslint.json create mode 100644 packages/message-relayer/.eslintrc.js delete mode 100644 packages/message-relayer/tslint.json create mode 100644 packages/smock/.eslintrc.js delete mode 100644 packages/smock/tslint.json diff --git a/.changeset/brown-boxes-compete.md b/.changeset/brown-boxes-compete.md new file mode 100644 index 000000000000..c5a2c95c8aa9 --- /dev/null +++ b/.changeset/brown-boxes-compete.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Adds additional code into the DTL to defend against situations where an RPC provider might be missing an event. diff --git a/.changeset/calm-fans-travel.md b/.changeset/calm-fans-travel.md new file mode 100644 index 000000000000..b579a850af27 --- /dev/null +++ b/.changeset/calm-fans-travel.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Migrated from tslint to eslint. The preference for lint exceptions is as follows: line level, block level, file level, package level. diff --git a/.changeset/nice-terms-walk.md b/.changeset/nice-terms-walk.md new file mode 100644 index 000000000000..98581e283868 --- /dev/null +++ b/.changeset/nice-terms-walk.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/smock': patch +--- + +Minor smock patch to add support for hardhat 2.4.0 and up diff --git a/.changeset/olive-planets-clean.md b/.changeset/olive-planets-clean.md new file mode 100644 index 000000000000..27ddbce53227 --- /dev/null +++ b/.changeset/olive-planets-clean.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Add failure metrics to batch submitter diff --git a/.changeset/sour-adults-worry.md b/.changeset/sour-adults-worry.md new file mode 100644 index 000000000000..bd3031690f86 --- /dev/null +++ b/.changeset/sour-adults-worry.md @@ -0,0 +1,7 @@ +--- +'@eth-optimism/batch-submitter': patch +'@eth-optimism/common-ts': patch +'@eth-optimism/data-transport-layer': patch +--- + +Move the metric prefix string to a label #1047 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..d3f6ef0b358a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,186 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "prettier", + ], + "ignorePatterns": ["dist/**/*.ts"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "eslint-plugin-import", + "eslint-plugin-unicorn", + "eslint-plugin-jsdoc", + "eslint-plugin-prefer-arrow", + "eslint-plugin-react", + "@typescript-eslint", + ], + "rules": { + "@typescript-eslint/adjacent-overload-signatures": "error", + "@typescript-eslint/array-type": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-assertions": "error", + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/indent": "off", + "@typescript-eslint/member-delimiter-style": [ + "off", + { + "multiline": { + "delimiter": "none", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/member-ordering": "off", + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-empty-function": "error", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", + "@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": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-var-requires": "error", + "@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/unified-signatures": "error", + "arrow-parens": [ + "off", + "always" + ], + "brace-style": [ + "off", + "off" + ], + "comma-dangle": "off", + "complexity": "off", + "constructor-super": "error", + "curly": "error", + "dot-notation": "off", + "eol-last": "off", + "eqeqeq": [ + "error", + "smart" + ], + "guard-for-in": "error", + "id-blacklist": "off", + "id-match": "off", + "import/no-extraneous-dependencies": [ + "error" + ], + "import/no-internal-modules": "off", + "import/order": "off", + "indent": "off", + "jsdoc/check-alignment": "error", + "jsdoc/check-indentation": "error", + "jsdoc/newline-after-description": "error", + "linebreak-style": "off", + "max-classes-per-file": "off", + "max-len": "off", + "new-parens": "off", + "newline-per-chained-call": "off", + "no-bitwise": "off", + "no-caller": "error", + "no-cond-assign": "error", + "no-console": "off", + "no-debugger": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-empty": "error", + "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-return-await": "error", + "no-sequences": "error", + "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": "off", + "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": [ + "error", + "never" + ], + "padded-blocks": [ + "off", + { + "blocks": "never" + }, + { + "allowSingleLineBlocks": true + } + ], + "prefer-arrow/prefer-arrow-functions": "error", + "prefer-const": "error", + "prefer-object-spread": "error", + "quote-props": "off", + "quotes": "off", + "radix": "error", + "react/jsx-curly-spacing": "off", + "react/jsx-equals-spacing": "off", + "react/jsx-tag-spacing": [ + "off", + { + "afterOpening": "allow", + "closingSlash": "allow" + } + ], + "react/jsx-wrap-multilines": "off", + "semi": "off", + "space-before-blocks": "error", + "space-before-function-paren": "off", + "space-in-parens": [ + "off", + "never" + ], + "unicorn/prefer-ternary": "off", + "use-isnan": "error", + "valid-typeof": "off" + } +}; diff --git a/examples/truffle/test/erc20.spec.js b/examples/truffle/test/erc20.spec.js index 4a8e284881b9..1258d0be7d4e 100644 --- a/examples/truffle/test/erc20.spec.js +++ b/examples/truffle/test/erc20.spec.js @@ -211,8 +211,7 @@ contract('ERC20', (accounts) => { const balance02 = await token.balanceOf.call(accounts[ 0 ]) assert.strictEqual(balance02.toNumber(), 9980) }) - - /* eslint-disable no-underscore-dangle */ + it('events: should fire Transfer event properly', async () => { const res = await token.transfer(accounts[ 1 ], '2666', { from: accounts[ 0 ], gasPrice: 0 }) const transferLog = res.logs.find( diff --git a/integration-tests/.eslintrc.js b/integration-tests/.eslintrc.js new file mode 100644 index 000000000000..004cfa55aac8 --- /dev/null +++ b/integration-tests/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../.eslintrc.js" +} diff --git a/integration-tests/package.json b/integration-tests/package.json index ca67edcc4fcf..12061c3b9d4a 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -8,7 +8,7 @@ "scripts": { "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config ./.prettierrc.json --write 'test/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "build:integration": "./scripts/build.sh", "build:contracts": "hardhat compile", "build:contracts:ovm": "hardhat compile --network optimism", @@ -23,15 +23,25 @@ "@ethersproject/providers": "^5.0.24", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", - "@types/chai-as-promised": "^7.1.3", "@types/chai": "^4.2.17", + "@types/chai-as-promised": "^7.1.3", "@types/mocha": "^8.2.2", "@types/rimraf": "^3.0.0", "@types/shelljs": "^0.8.8", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.3", "chai-as-promised": "^7.1.1", "docker-compose": "^0.23.8", "envalid": "^7.1.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.32", "hardhat": "^2.2.1", diff --git a/integration-tests/tsconfig.json b/integration-tests/tsconfig.json index 758c942d51a9..fb827e9e7179 100644 --- a/integration-tests/tsconfig.json +++ b/integration-tests/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "resolveJsonModule": true }, - "include": ["./test", "sync-tests/*.ts"], + "include": ["./test", "sync-tests/*.ts", "./artifacts/**/*.json", "./artifacts-ovm/**/*.json"], "files": ["./hardhat.config.ts"] } diff --git a/integration-tests/tslint.json b/integration-tests/tslint.json deleted file mode 100644 index d6d9b0e0ca6b..000000000000 --- a/integration-tests/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../tslint.base.json", - "rules": { - "array-type": false, - "class-name": false - } -} diff --git a/packages/batch-submitter/.eslintrc.js b/packages/batch-submitter/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/batch-submitter/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts index c2e2fb64f861..c487d86dfac9 100644 --- a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts @@ -1,7 +1,7 @@ /* External Imports */ import { Contract, Signer, utils, providers } from 'ethers' import { TransactionReceipt } from '@ethersproject/abstract-provider' -import { Gauge, Histogram } from 'prom-client' +import { Gauge, Histogram, Counter } from 'prom-client' import * as ynatm from '@eth-optimism/ynatm' import { RollupInfo } from '@eth-optimism/core-utils' import { Logger, Metrics } from '@eth-optimism/common-ts' @@ -24,6 +24,9 @@ interface BatchSubmitterMetrics { numTxPerBatch: Histogram submissionTimestamp: Histogram submissionGasUsed: Histogram + batchesSubmitted: Counter + failedSubmissions: Counter + malformedBatches: Counter } export abstract class BatchSubmitter { @@ -232,14 +235,35 @@ export abstract class BatchSubmitter { gasRetryIncrement: this.gasRetryIncrement, } - const receipt = await BatchSubmitter.getReceiptWithResubmission( - txFunc, - resubmissionConfig, - this.logger - ) + let receipt: TransactionReceipt + try { + receipt = await BatchSubmitter.getReceiptWithResubmission( + txFunc, + resubmissionConfig, + this.logger + ) + } catch (err) { + this.metrics.failedSubmissions.inc() + if (err.reason) { + this.logger.error(`Transaction invalid: ${err.reason}, aborting`, { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + return + } + + this.logger.error('Encountered error at submission, aborting', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + return + } this.logger.info('Received transaction receipt', { receipt }) this.logger.info(successMessage) + this.metrics.batchesSubmitted.inc() this.metrics.submissionGasUsed.observe(receipt.gasUsed.toNumber()) this.metrics.submissionTimestamp.observe(Date.now()) return receipt @@ -274,6 +298,21 @@ export abstract class BatchSubmitter { help: 'Gas used to submit each batch', registers: [metrics.registry], }), + batchesSubmitted: new metrics.client.Counter({ + name: 'batches_submitted', + help: 'Count of batches submitted', + registers: [metrics.registry], + }), + failedSubmissions: new metrics.client.Counter({ + name: 'failed_submissions', + help: 'Count of failed batch submissions', + registers: [metrics.registry], + }), + malformedBatches: new metrics.client.Counter({ + name: 'malformed_batches', + help: 'Count of malformed batches', + registers: [metrics.registry], + }), } } } diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index 6d349a44520a..da93ae6eda0d 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -300,8 +300,8 @@ export class TransactionBatchSubmitter extends BatchSubmitter { // Fix our batches if we are configured to. TODO: Remove this. batch = await this._fixBatch(batch) if (!(await this._validateBatch(batch))) { - this.logger.error('Batch is malformed! Cannot submit next batch!') - throw new Error('Batch is malformed! Cannot submit next batch!') + this.metrics.malformedBatches.inc() + return } let sequencerBatchParams = await this._getSequencerBatchParams( startBlock, diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index e3f21a3139cd..3eda27d655dc 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -84,6 +84,7 @@ export const run = async () => { const env = process.env const environment = config.str('node-env', env.NODE_ENV) const network = config.str('eth-network-name', env.ETH_NETWORK_NAME) + const service = `batch-submitter` const release = `batch-submitter@${env.npm_package_version}` const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN) const sentryTraceRate = config.ufloat( @@ -181,8 +182,7 @@ export const run = async () => { /* Metrics */ const metrics = new Metrics({ - prefix: name, - labels: { environment, release, network }, + labels: { environment, release, network, service }, }) const FRAUD_SUBMISSION_ADDRESS = config.str( @@ -441,11 +441,29 @@ export const run = async () => { try { await func() } catch (err) { - logger.error('Error submitting batch', { - message: err.toString(), - stack: err.stack, - code: err.code, - }) + switch (err.code) { + case 'SERVER_ERROR': + logger.error(`Encountered server error with status ${err.status}`, { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + case 'NETWORK_ERROR': + logger.error('Could not detect network', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + default: + logger.error('Unhandled exception during batch submission', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + } logger.info('Retrying...') } // Sleep diff --git a/packages/batch-submitter/tsconfig.json b/packages/batch-submitter/tsconfig.json index 17100a25bcda..f2bd005dfc51 100644 --- a/packages/batch-submitter/tsconfig.json +++ b/packages/batch-submitter/tsconfig.json @@ -1,6 +1,7 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "resolveJsonModule": true - } + "extends": "../../tsconfig.json", + "compilerOptions": { + "resolveJsonModule": true + } } + \ No newline at end of file diff --git a/packages/batch-submitter/tslint.json b/packages/batch-submitter/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/batch-submitter/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/common-ts/.eslintrc.js b/packages/common-ts/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/common-ts/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/common-ts/package.json b/packages/common-ts/package.json index ac3f92b2d573..9388e2d30e36 100644 --- a/packages/common-ts/package.json +++ b/packages/common-ts/package.json @@ -14,7 +14,7 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "ts-mocha test/*.spec.ts" }, "devDependencies": { @@ -24,15 +24,21 @@ "@types/pino": "^6.3.6", "@types/pino-multi-stream": "^5.1.1", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.4", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "mocha": "^8.4.0", "prettier": "^2.2.1", "supertest": "^6.1.3", "ts-mocha": "^8.0.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" }, "dependencies": { diff --git a/packages/common-ts/src/base-service.ts b/packages/common-ts/src/base-service.ts index 1f1fee6bfd7b..5e8d74fd5859 100644 --- a/packages/common-ts/src/base-service.ts +++ b/packages/common-ts/src/base-service.ts @@ -109,10 +109,10 @@ export class BaseService { /** * Combines user provided and default options. */ -function mergeDefaultOptions( +const mergeDefaultOptions = ( options: T, optionSettings: OptionSettings -): T { +): T => { for (const optionName of Object.keys(optionSettings)) { const optionDefault = optionSettings[optionName].default if (optionDefault === undefined) { @@ -132,7 +132,7 @@ function mergeDefaultOptions( /** * Performs option validation against the option settings */ -function validateOptions(options: T, optionSettings: OptionSettings) { +const validateOptions = (options: T, optionSettings: OptionSettings) => { for (const optionName of Object.keys(optionSettings)) { const optionValidationFunction = optionSettings[optionName].validate if (optionValidationFunction === undefined) { diff --git a/packages/common-ts/src/common/metrics.ts b/packages/common-ts/src/common/metrics.ts index d8ac45bfd0df..99082dd7c5b8 100644 --- a/packages/common-ts/src/common/metrics.ts +++ b/packages/common-ts/src/common/metrics.ts @@ -9,7 +9,7 @@ import { Server } from 'net' import { Logger } from './logger' export interface MetricsOptions { - prefix: string + prefix?: string labels?: Object } diff --git a/packages/common-ts/tslint.json b/packages/common-ts/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/common-ts/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/contracts/.eslintrc.js b/packages/contracts/.eslintrc.js new file mode 100644 index 000000000000..566e53edb505 --- /dev/null +++ b/packages/contracts/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "extends": "../../.eslintrc.js", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + } +} diff --git a/packages/contracts/bin/deploy.ts b/packages/contracts/bin/deploy.ts index 7ac14d6615e1..28cd4680d134 100755 --- a/packages/contracts/bin/deploy.ts +++ b/packages/contracts/bin/deploy.ts @@ -18,8 +18,32 @@ import hre from 'hardhat' const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) -const main = async () => { +const parseEnv = () => { + const ensure = (env, type) => { + if (typeof process.env[env] === 'undefined') { + return undefined + } + if (type === 'number') { + return parseInt(process.env[env], 10) + } + return process.env[env] + } + + return { + l1BlockTimeSeconds: ensure('BLOCK_TIME_SECONDS', 'number'), + ctcForceInclusionPeriodSeconds: ensure('FORCE_INCLUSION_PERIOD_SECONDS', 'number'), + ctcMaxTransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), + emMinTransactionGasLimit: ensure('MIN_TRANSACTION_GAS_LIMIT', 'number'), + emMaxtransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), + emMaxGasPerQueuePerEpoch: ensure('MAX_GAS_PER_QUEUE_PER_EPOCH', 'number'), + emSecondsPerEpoch: ensure('ECONDS_PER_EPOCH', 'number'), + emOvmChainId: ensure('CHAIN_ID', 'number'), + sccFraudProofWindow: ensure('FRAUD_PROOF_WINDOW_SECONDS', 'number'), + sccSequencerPublishWindow: ensure('SEQUENCER_PUBLISH_WINDOW_SECONDS', 'number'), + } +} +const main = async () => { const config = parseEnv() await hre.run('deploy', { @@ -52,11 +76,12 @@ const main = async () => { path.resolve(__dirname, `../deployments/custom`) ).children.filter((child) => { return child.extension === '.json' - }).reduce((contracts, child) => { + }).reduce((contractsAccumulator, child) => { const contractName = child.name.replace('.json', '') + // eslint-disable-next-line @typescript-eslint/no-var-requires const artifact = require(path.resolve(__dirname, `../deployments/custom/${child.name}`)) - contracts[nicknames[contractName] || contractName] = artifact.address - return contracts + contractsAccumulator[nicknames[contractName] || contractName] = artifact.address + return contractsAccumulator }, {}) contracts.OVM_Sequencer = await sequencer.getAddress() @@ -79,26 +104,3 @@ main() ) process.exit(1) }) - -function parseEnv() { - function ensure(env, type) { - if (typeof process.env[env] === 'undefined') - return undefined - if (type === 'number') - return parseInt(process.env[env], 10) - return process.env[env] - } - - return { - l1BlockTimeSeconds: ensure('BLOCK_TIME_SECONDS', 'number'), - ctcForceInclusionPeriodSeconds: ensure('FORCE_INCLUSION_PERIOD_SECONDS', 'number'), - ctcMaxTransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), - emMinTransactionGasLimit: ensure('MIN_TRANSACTION_GAS_LIMIT', 'number'), - emMaxtransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), - emMaxGasPerQueuePerEpoch: ensure('MAX_GAS_PER_QUEUE_PER_EPOCH', 'number'), - emSecondsPerEpoch: ensure('ECONDS_PER_EPOCH', 'number'), - emOvmChainId: ensure('CHAIN_ID', 'number'), - sccFraudProofWindow: ensure('FRAUD_PROOF_WINDOW_SECONDS', 'number'), - sccSequencerPublishWindow: ensure('SEQUENCER_PUBLISH_WINDOW_SECONDS', 'number'), - } -} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index eb4e94dddf50..ee109fe460d7 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -39,7 +39,7 @@ "lint:fix": "yarn run lint:fix:typescript", "lint:fix:typescript": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "lint:check": "yarn run lint:typescript", - "lint:typescript": "tslint --format stylish --project .", + "lint:typescript": "eslint -c .eslintrc.js --ext .ts --format stylish .", "clean": "rm -rf ./dist ./artifacts ./artifacts-ovm ./cache ./cache-ovm ./tsconfig.build.tsbuildinfo", "deploy": "ts-node \"./bin/deploy.ts\" && yarn generate-markdown", "serve": "./bin/serve_dump.sh", @@ -74,11 +74,21 @@ "@types/mkdirp": "^1.0.1", "@types/mocha": "^8.2.2", "@types/yargs": "^16.0.1", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "buffer-xor": "^2.0.2", "chai": "^4.3.1", "copyfiles": "^2.3.0", "directory-tree": "^2.2.7", "dotenv": "^8.2.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", "ganache-core": "^2.13.2", @@ -96,10 +106,6 @@ "solidity-coverage": "^0.7.16", "ts-generator": "0.0.8", "ts-node": "^9.1.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typechain": "2.0.0", "yargs": "^16.2.0" }, diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index 05bc306ea752..3fbe691bd14a 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -3,9 +3,9 @@ * various useful functions. * * Notes: - * - 0x42...04 was the address of the OVM_ProxySequencerEntrypoint. This contract is no longer in - * use and has therefore been removed. We may place a new predeployed contract at this address - * in the future. See https://github.com/ethereum-optimism/optimism/pull/549 for more info. + * 0x42...04 was the address of the OVM_ProxySequencerEntrypoint. This contract is no longer in + * use and has therefore been removed. We may place a new predeployed contract at this address + * in the future. See https://github.com/ethereum-optimism/optimism/pull/549 for more info. */ export const predeploys = { OVM_L2ToL1MessagePasser: '0x4200000000000000000000000000000000000000', diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index d37361a698d5..1dfdddde920d 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -12,6 +12,7 @@ import { predeploys } from '../predeploys' /** * Generates a storage dump for a given address. + * * @param cStateManager Instance of the callback-based internal vm StateManager. * @param address Address to generate a state dump for. */ @@ -44,6 +45,7 @@ const getStorageDump = async ( /** * Replaces old addresses found in a storage dump with new ones. + * * @param storageDump Storage dump to sanitize. * @param accounts Set of accounts to sanitize with. * @returns Sanitized storage dump. diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts index 2d30b1456a19..5c2b4a52371e 100644 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts @@ -35,8 +35,7 @@ describe('OVM_L2DepositedERC20', () => { let finalizeWithdrawalGasLimit: number beforeEach(async () => { // Create a special signer which will enable us to send messages from the L2Messenger contract - let l2MessengerImpersonator: Signer - ;[l2MessengerImpersonator] = await ethers.getSigners() + const [l2MessengerImpersonator] = await ethers.getSigners() // Get a new mock L2 messenger Mock__OVM_L2CrossDomainMessenger = await smockit( diff --git a/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts b/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts index 880343452b9e..633f6918500c 100644 --- a/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts +++ b/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ diff --git a/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts index 021f14edcb19..844b92ab7df2 100644 --- a/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts +++ b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import '../../../setup' /* Internal Imports */ diff --git a/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts b/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts index 39310cdc31ba..f381372e1c15 100644 --- a/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts +++ b/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import '../../../setup' /* Internal Imports */ diff --git a/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts b/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts index ad439c79138b..608fc0725b26 100644 --- a/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts +++ b/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ diff --git a/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts b/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts index ab6d3aca62b1..10e620b61c9c 100644 --- a/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts +++ b/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ @@ -300,6 +299,7 @@ describe('Lib_EthUtils', () => { }) }) + /* eslint-disable @typescript-eslint/no-empty-function */ describe('getCode(address)', () => { describe('when the contract does not exist', () => {}) @@ -359,4 +359,5 @@ describe('Lib_EthUtils', () => { }) }) }) + /* eslint-enable @typescript-eslint/no-empty-function */ }) diff --git a/packages/contracts/test/helpers/constants.ts b/packages/contracts/test/helpers/constants.ts index a2573a90ae00..1464b17b9ca2 100644 --- a/packages/contracts/test/helpers/constants.ts +++ b/packages/contracts/test/helpers/constants.ts @@ -45,7 +45,7 @@ try { len = fromHexString( getContractDefinition('Helper_TestRunner').deployedBytecode ).byteLength - /* tslint:disable:no-empty */ + // eslint-disable-next-line no-empty } catch {} export const Helper_TestRunner_BYTELEN = len diff --git a/packages/contracts/test/helpers/test-runner/test-runner.ts b/packages/contracts/test/helpers/test-runner/test-runner.ts index 580d117c4610..b07e0f1af9b0 100644 --- a/packages/contracts/test/helpers/test-runner/test-runner.ts +++ b/packages/contracts/test/helpers/test-runner/test-runner.ts @@ -97,10 +97,10 @@ export class ExecutionManagerTestRunner { } public run(test: TestDefinition) { - // tslint:disable-next-line:ban-comma-operator ;(test.preState = merge( cloneDeep(this.defaultPreState), cloneDeep(test.preState) + // eslint-disable-next-line no-sequences )), (test.postState = test.postState || {}) diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 9622d152c5da..aa33388023ee 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -2,7 +2,5 @@ "extends": "../../tsconfig.json", "compilerOptions": { "resolveJsonModule": true - }, - "include": ["./test", "src/**/*", "deployments"], - "files": ["./hardhat.config.ts"] + } } diff --git a/packages/contracts/tslint.json b/packages/contracts/tslint.json deleted file mode 100644 index 08c0a483cadc..000000000000 --- a/packages/contracts/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tslint.base.json", - "rules": { - "array-type": false, - "class-name": false, - "no-var-requires": false - } -} diff --git a/packages/core-utils/.eslintrc.js b/packages/core-utils/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/core-utils/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/core-utils/package.json b/packages/core-utils/package.json index 74166fb352bd..90407cc36c81 100644 --- a/packages/core-utils/package.json +++ b/packages/core-utils/package.json @@ -15,7 +15,7 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "ts-mocha test/**/*.spec.ts" }, "devDependencies": { @@ -23,14 +23,20 @@ "@types/lodash": "^4.14.168", "@types/mocha": "^8.2.2", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "mocha": "^8.3.0", "prettier": "^2.2.1", "ts-mocha": "^8.0.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" }, "dependencies": { diff --git a/packages/core-utils/src/common/hex-strings.ts b/packages/core-utils/src/common/hex-strings.ts index 71b412c76b56..aab9e9ebca80 100644 --- a/packages/core-utils/src/common/hex-strings.ts +++ b/packages/core-utils/src/common/hex-strings.ts @@ -3,6 +3,7 @@ import { BigNumber } from 'ethers' /** * Removes "0x" from start of a string if it exists. + * * @param str String to modify. * @returns the string without "0x". */ @@ -15,6 +16,7 @@ export const remove0x = (str: string): string => { /** * Adds "0x" to the start of a string if necessary. + * * @param str String to modify. * @returns the string with "0x". */ @@ -27,6 +29,7 @@ export const add0x = (str: string): string => { /** * Returns whether or not the provided string is a hex string. + * * @param str The string to test. * @returns True if the provided string is a hex string, false otherwise. */ @@ -36,6 +39,7 @@ export const isHexString = (inp: any): boolean => { /** * Casts a hex string to a buffer. + * * @param inp Input to cast to a buffer. * @return Input cast as a buffer. */ @@ -49,6 +53,7 @@ export const fromHexString = (inp: Buffer | string): Buffer => { /** * Casts an input to a hex string. + * * @param inp Input to cast to a hex string. * @return Input cast as a hex string. */ diff --git a/packages/core-utils/src/common/misc.ts b/packages/core-utils/src/common/misc.ts index 1a5fada81643..13d6a479adbb 100644 --- a/packages/core-utils/src/common/misc.ts +++ b/packages/core-utils/src/common/misc.ts @@ -1,5 +1,6 @@ /** * Basic timeout-based async sleep function. + * * @param ms Number of milliseconds to sleep. */ export const sleep = async (ms: number): Promise => { diff --git a/packages/core-utils/test/coders/batch-encoder.spec.ts b/packages/core-utils/test/coders/batch-encoder.spec.ts index ce277a72d051..473443e2a97c 100644 --- a/packages/core-utils/test/coders/batch-encoder.spec.ts +++ b/packages/core-utils/test/coders/batch-encoder.spec.ts @@ -42,6 +42,7 @@ describe('BatchEncoder', () => { }) it('should work with mainnet calldata', () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires const data = require('../fixtures/appendSequencerBatch.json') for (const calldata of data.calldata) { const decoded = sequencerBatch.decode(calldata) diff --git a/packages/core-utils/tslint.json b/packages/core-utils/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/core-utils/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/data-transport-layer/.eslintrc.js b/packages/data-transport-layer/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/data-transport-layer/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/data-transport-layer/src/client/client.ts b/packages/data-transport-layer/src/client/client.ts index 63dc3277c43e..724c72c30295 100644 --- a/packages/data-transport-layer/src/client/client.ts +++ b/packages/data-transport-layer/src/client/client.ts @@ -1,9 +1,9 @@ // Only load if not in browser. import { isNode } from 'browser-or-node' +// eslint-disable-next-line no-var declare var window: any -/* tslint:disable-next-line:no-var-requires */ const fetch = isNode ? require('node-fetch') : window.fetch import { diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts new file mode 100644 index 000000000000..383fb3f36806 --- /dev/null +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts @@ -0,0 +1,10 @@ +export type EventName = + | 'TransactionEnqueued' + | 'SequencerBatchAppended' + | 'StateBatchAppended' + +export class MissingElementError extends Error { + constructor(public name: EventName) { + super(`missing event: ${name}`) + } +} diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 114e04f3c5c1..76cb9050b6c0 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -22,6 +22,7 @@ import { SEQUENCER_GAS_LIMIT, parseSignatureVParam, } from '../../../utils' +import { MissingElementError } from './errors' export const handleEventsSequencerBatchAppended: EventHandlerSet< EventArgsSequencerBatchAppended, @@ -181,6 +182,19 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.transactionBatchEntry.index > 0) { + const prevTransactionBatchEntry = await db.getTransactionBatchByIndex( + entry.transactionBatchEntry.index - 1 + ) + + // We should *always* have a previous transaction batch here. + if (prevTransactionBatchEntry === null) { + throw new MissingElementError('SequencerBatchAppended') + } + } + await db.putTransactionBatchEntries([entry.transactionBatchEntry]) await db.putTransactionEntries(entry.transactionEntries) diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts index 744ebc1f5284..9f822fc72846 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts @@ -11,6 +11,7 @@ import { StateRootEntry, EventHandlerSet, } from '../../../types' +import { MissingElementError } from './errors' export const handleEventsStateBatchAppended: EventHandlerSet< EventArgsStateBatchAppended, @@ -67,6 +68,19 @@ export const handleEventsStateBatchAppended: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.stateRootBatchEntry.index > 0) { + const prevStateRootBatchEntry = await db.getStateRootBatchByIndex( + entry.stateRootBatchEntry.index - 1 + ) + + // We should *always* have a previous batch entry here. + if (prevStateRootBatchEntry === null) { + throw new MissingElementError('StateBatchAppended') + } + } + await db.putStateRootBatchEntries([entry.stateRootBatchEntry]) await db.putStateRootEntries(entry.stateRootEntries) }, diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts index 7e6bcb9b2b66..415d65fa1ef6 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts @@ -3,6 +3,7 @@ import { EventArgsTransactionEnqueued } from '@eth-optimism/core-utils' /* Imports: Internal */ import { BigNumber } from 'ethers' import { EnqueueEntry, EventHandlerSet } from '../../../types' +import { MissingElementError } from './errors' export const handleEventsTransactionEnqueued: EventHandlerSet< EventArgsTransactionEnqueued, @@ -25,6 +26,17 @@ export const handleEventsTransactionEnqueued: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.index > 0) { + const prevEnqueueEntry = await db.getEnqueueByIndex(entry.index - 1) + + // We should *alwaus* have a previous enqueue entry here. + if (prevEnqueueEntry === null) { + throw new MissingElementError('TransactionEnqueued') + } + } + await db.putEnqueueEntries([entry]) }, } diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 218071e1ee4d..3be21abf201b 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -132,6 +132,7 @@ export class L2IngestionService extends BaseService { /** * Synchronizes unconfirmed transactions from a range of sequencer blocks. + * * @param startBlockNumber Block to start querying from. * @param endBlockNumber Block to query to. */ diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index fd418656e6c8..82a3a46d5916 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService { */ private _initMetrics() { this.metrics = new Metrics({ - prefix: this.name, labels: { environment: this.options.nodeEnv, network: this.options.ethNetworkName, release: this.options.release, + service: this.name, }, }) const metricsMiddleware = promBundle({ @@ -169,6 +169,7 @@ export class L1TransportServer extends BaseService { /** * Registers a route on the server. + * * @param method Http method type. * @param route Route to register. * @param handler Handler called and is expected to return a JSON response. diff --git a/packages/data-transport-layer/src/utils/common.ts b/packages/data-transport-layer/src/utils/common.ts index f659b4f6ef27..30838461b861 100644 --- a/packages/data-transport-layer/src/utils/common.ts +++ b/packages/data-transport-layer/src/utils/common.ts @@ -2,6 +2,7 @@ import { toHexString } from '@eth-optimism/core-utils' /** * Basic timeout-based async sleep function. + * * @param ms Number of milliseconds to sleep. */ export const sleep = async (ms: number): Promise => { diff --git a/packages/data-transport-layer/tslint.json b/packages/data-transport-layer/tslint.json deleted file mode 100644 index a6e3c32c8f70..000000000000 --- a/packages/data-transport-layer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/hardhat-ovm/.eslintrc.js b/packages/hardhat-ovm/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/hardhat-ovm/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/hardhat-ovm/package.json b/packages/hardhat-ovm/package.json index b6fbeb975873..ac896191a73a 100644 --- a/packages/hardhat-ovm/package.json +++ b/packages/hardhat-ovm/package.json @@ -13,7 +13,7 @@ "build": "tsc -p tsconfig.build.json", "lint": "yarn run lint:fix && yarn run lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"{src,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project ." + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish ." }, "dependencies": { "node-fetch": "^2.6.1" @@ -25,10 +25,16 @@ "devDependencies": { "@types/mocha": "^8.2.2", "@types/node-fetch": "^2.5.10", - "prettier": "^2.2.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0" + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", + "prettier": "^2.2.1" } } diff --git a/packages/hardhat-ovm/src/index.ts b/packages/hardhat-ovm/src/index.ts index 1284016a2455..1e13fec51d4c 100644 --- a/packages/hardhat-ovm/src/index.ts +++ b/packages/hardhat-ovm/src/index.ts @@ -35,6 +35,7 @@ const OVM_POLLING_INTERVAL = 50 /** * Find or generate an OVM soljson.js compiler file and return the path of this file. * We pass the path to this file into hardhat. + * * @param version Solidity compiler version to get a path for in the format `X.Y.Z`. * @return Path to the downloaded soljson.js file. */ @@ -289,7 +290,7 @@ extendEnvironment(async (hre) => { } ;(hre as any).ethers.getSigners = () => signers - /* tslint:disable:no-empty */ + // eslint-disable-next-line no-empty } catch (e) {} // Update the provider at the very end to avoid any weird issues. diff --git a/packages/hardhat-ovm/tslint.json b/packages/hardhat-ovm/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/hardhat-ovm/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/message-relayer/.eslintrc.js b/packages/message-relayer/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/message-relayer/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/message-relayer/src/service.ts b/packages/message-relayer/src/service.ts index c69305fd262c..9052e946f6b3 100644 --- a/packages/message-relayer/src/service.ts +++ b/packages/message-relayer/src/service.ts @@ -367,6 +367,7 @@ export class MessageRelayerService extends BaseService { /** * Returns all sent message events between some start height (inclusive) and an end height * (exclusive). + * * @param startHeight Start height to start finding messages from. * @param endHeight End height to finish finding messages at. * @returns All sent messages between start and end height, sorted by transaction index in diff --git a/packages/message-relayer/tslint.json b/packages/message-relayer/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/message-relayer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/smock/.eslintrc.js b/packages/smock/.eslintrc.js new file mode 100644 index 000000000000..5f329b2b72e5 --- /dev/null +++ b/packages/smock/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "extends": "../../.eslintrc.js", + "parserOptions": { + "project": "./tsconfig.json", + "sourceType": "module" + } +} diff --git a/packages/smock/package.json b/packages/smock/package.json index 4a41c1d58444..be16bcf0c645 100644 --- a/packages/smock/package.json +++ b/packages/smock/package.json @@ -13,7 +13,7 @@ "test": "hardhat test --show-stack-traces", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config ./.prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "clean": "rimraf ./artifacts ./cache ./dist ./tsconfig.build.tsbuildinfo" }, "peerDependencies": { @@ -23,7 +23,7 @@ "@nomiclabs/ethereumjs-vm": "^4", "@nomiclabs/hardhat-ethers": "^2", "ethers": "^5", - "hardhat": "^2.2.1" + "hardhat": "^2" }, "dependencies": { "@eth-optimism/core-utils": "^0.4.5", @@ -41,15 +41,21 @@ "@types/glob": "^7.1.3", "@types/lodash": "^4.14.161", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", - "hardhat": "^2.2.1", + "hardhat": "^2.4.0", "lodash": "^4.17.20", - "prettier": "^2.2.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0" + "prettier": "^2.2.1" } } diff --git a/packages/smock/src/common/hardhat-common.ts b/packages/smock/src/common/hardhat-common.ts index dd692caf1350..cf4f96f0c8db 100644 --- a/packages/smock/src/common/hardhat-common.ts +++ b/packages/smock/src/common/hardhat-common.ts @@ -13,6 +13,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils' * This object has direct access to the node (provider._node), which in turn has direct access to * the ethereumjs-vm instance (provider._node._vm). So it's quite useful to be able to find this * object reliably! + * * @param hre hardhat runtime environment to pull the base provider from. * @return base hardhat network provider */ @@ -49,6 +50,7 @@ export const findBaseHardhatProvider = ( /** * Converts a string into the fancy new address thing that ethereumjs-vm v5 expects while also * maintaining backwards compatibility with ethereumjs-vm v4. + * * @param address String address to convert into the fancy new address type. * @returns Fancified address. */ @@ -67,6 +69,7 @@ export const toFancyAddress = (address: string): any => { /** * Same as toFancyAddress but in the opposite direction. + * * @param fancyAddress Fancy address to turn into a string. * @returns Way more boring address. */ diff --git a/packages/smock/src/smockit/smockit.ts b/packages/smock/src/smockit/smockit.ts index 5403b02915be..14a1bf078ff4 100644 --- a/packages/smock/src/smockit/smockit.ts +++ b/packages/smock/src/smockit/smockit.ts @@ -23,6 +23,7 @@ import { findBaseHardhatProvider } from '../common' /** * Generates an ethers Interface instance when given a smock spec. Meant for standardizing the * various input types we might reasonably want to support. + * * @param spec Smock specification object. Thing you want to base the interface on. * @param hre Hardhat runtime environment. Used so we can * @return Interface generated from the spec. @@ -57,6 +58,7 @@ const makeContractInterfaceFromSpec = async ( /** * Creates a mock contract function from a real contract function. + * * @param contract Contract object to make a mock function for. * @param functionName Name of the function to mock. * @param vm Virtual machine reference, necessary for call assertions to work. @@ -137,6 +139,7 @@ const smockifyFunction = ( /** * Turns a specification into a mock contract. + * * @param spec Smock contract specification. * @param opts Optional additional settings. */ diff --git a/packages/smock/src/smoddit/smoddit.ts b/packages/smock/src/smoddit/smoddit.ts index 19410e98fda5..8afc33e8d33d 100644 --- a/packages/smock/src/smoddit/smoddit.ts +++ b/packages/smock/src/smoddit/smoddit.ts @@ -10,6 +10,7 @@ import { findBaseHardhatProvider, toFancyAddress } from '../common' /** * Creates a modifiable contract factory. + * * @param name Name of the contract to smoddify. * @param signer Optional signer to attach to the factory. * @returns Smoddified contract factory. diff --git a/packages/smock/src/smoddit/storage.ts b/packages/smock/src/smoddit/storage.ts index e97bd3239a0c..24c7eecc6439 100644 --- a/packages/smock/src/smoddit/storage.ts +++ b/packages/smock/src/smoddit/storage.ts @@ -21,6 +21,7 @@ interface StorageSlot { /** * Reads the storage layout of a contract. + * * @param name Name of the contract to get a storage layout for. * @return Storage layout for the given contract name. */ @@ -43,6 +44,7 @@ export const getStorageLayout = async (name: string): Promise => { /** * Converts storage into a list of storage slots. + * * @param storageLayout Contract storage layout. * @param obj Storage object to convert. * @returns List of storage slots. @@ -108,6 +110,7 @@ export const getStorageSlots = ( /** * Flattens an object. + * * @param obj Object to flatten. * @param prefix Current object prefix (used recursively). * @param res Current result (used recursively). @@ -143,6 +146,7 @@ const flattenObject = ( /** * Gets the slot positions for a provided variable type. + * * @param storageLayout Contract's storage layout. * @param inputTypeName Variable type name. * @returns Slot positions. diff --git a/packages/smock/tsconfig.json b/packages/smock/tsconfig.json index 8a032ca1110a..4082f16a5d91 100644 --- a/packages/smock/tsconfig.json +++ b/packages/smock/tsconfig.json @@ -1,6 +1,3 @@ { - "extends": "../../tsconfig.json", - "files": [ - "./hardhat.config.ts" - ] + "extends": "../../tsconfig.json" } diff --git a/packages/smock/tslint.json b/packages/smock/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/smock/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -}