diff --git a/.githooks/pre-push b/.githooks/pre-push index a322247004..b041485989 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -1,3 +1,3 @@ #!/usr/bin/env sh -npm run lint:diff --workspaces +npm run lint:diff diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 22e4c624a8..b717f24896 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -46,5 +46,5 @@ jobs: working-directory: ${{ github.workspace }} - - run: npm run lint --workspaces --if-present + - run: npm run lint working-directory: ${{ github.workspace }} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 66465ef790..0000000000 --- a/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -.coverage -coverage -dist -docs -packages/ethereum-tests diff --git a/biome.json b/biome.json new file mode 100644 index 0000000000..889f9cfcb0 --- /dev/null +++ b/biome.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": true, + "ignore": [ + "**/node_modules/**", + "**/dist/**", + "**/coverage/**", + "**/ethereum-tests/**", + "**/config/**", + "**/4844-interop/**", + "**/scripts/**", + "**/rlp/bin/**", + "**/benchmarks/fixture/**" + ] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 100 + }, + "organizeImports": { + "enabled": false + }, + "linter": { + "enabled": false, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "asNeeded" + } + } +} diff --git a/config/cli/lint-diff.sh b/config/cli/lint-diff.sh index 514bc5d2ba..e63e386cff 100755 --- a/config/cli/lint-diff.sh +++ b/config/cli/lint-diff.sh @@ -2,9 +2,9 @@ REMOTE=$(git rev-parse --symbolic-full-name --abbrev-ref @{u}) if [ -z "$REMOTE" ]; then - FILESCHANGED=". --ext .js,.jsx,.ts,.tsx" + FILESCHANGED=". --ext .js,.ts" else - FILESCHANGED=$(git diff --diff-filter=d --name-only --relative $REMOTE | grep -E '\.(js|jsx|ts|tsx)') + FILESCHANGED=$(git diff --diff-filter=d --name-only --relative $REMOTE | grep -E '\.(js|ts)') fi echo $FILESCHANGED @@ -25,8 +25,8 @@ dim() { echo "${DIM}$1${NOCOLOR}" } -dim "> eslint --format codeframe --config ./.eslintrc.cjs . \\ " -dim "\t --ext .js,.jsx,.ts,.tsx \\ " +dim "> eslint --format codeframe --config ./config/eslint.cjs . \\ " +dim "\t --ext .js,.ts \\ " blue "[Lint]${NOCOLOR} checking..." @@ -35,7 +35,7 @@ if [ -z "$FILESCHANGED" ]; then exit fi -eslint --format codeframe --config ./.eslintrc.cjs $FILESCHANGED +eslint --format codeframe --config ./config/eslint.cjs $FILESCHANGED RETURN_CODE=$? diff --git a/config/cli/lint-fix.sh b/config/cli/lint-fix.sh deleted file mode 100755 index f4e092a10b..0000000000 --- a/config/cli/lint-fix.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -BLUE="\033[0;34m" -GREEN="\033[0;32m" -YELLOW="\033[0;33m" -RED="\033[0;31m" -NOCOLOR="\033[0m" -DIM="\033[2m" - -blue() { - echo "${BLUE}$1${NOCOLOR}" -} -green() { - echo "${GREEN}$1${NOCOLOR}" -} -dim() { - echo "${DIM}$1${NOCOLOR}" -} - -dim "> eslint --fix --config ./.eslintrc.cjs . \\ " -dim "\t --ext .js,.jsx,.ts,.tsx \\ " - -blue "[Lint]${NOCOLOR} fixing..." - -eslint --fix --config ./.eslintrc.cjs . --ext .js,.jsx,.ts,.tsx - -RETURN_CODE=$? - -if [ $RETURN_CODE -eq 0 ]; then - blue "[Lint]${GREEN} DONE." -else - exit $RETURN_CODE -fi \ No newline at end of file diff --git a/config/cli/lint.sh b/config/cli/lint.sh deleted file mode 100755 index 5a5ef932e7..0000000000 --- a/config/cli/lint.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -BLUE="\033[0;34m" -GREEN="\033[0;32m" -YELLOW="\033[0;33m" -RED="\033[0;31m" -NOCOLOR="\033[0m" -DIM="\033[2m" - -blue() { - echo "${BLUE}$1${NOCOLOR}" -} -green() { - echo "${GREEN}$1${NOCOLOR}" -} -dim() { - echo "${DIM}$1${NOCOLOR}" -} - -dim "> eslint --format codeframe --config ./.eslintrc.cjs . \\ " -dim "\t --ext .js,.jsx,.ts,.tsx \\ " - -blue "[Lint]${NOCOLOR} checking..." - -eslint --format codeframe --config ./.eslintrc.cjs . --ext .js,.jsx,.ts,.tsx - -RETURN_CODE=$? - -if [ $RETURN_CODE -eq 0 ]; then - blue "[Lint]${GREEN} DONE." -else - exit $RETURN_CODE -fi diff --git a/config/eslint.cjs b/config/eslint.cjs index d2f97618a8..ecb3213baf 100644 --- a/config/eslint.cjs +++ b/config/eslint.cjs @@ -5,7 +5,6 @@ module.exports = { 'github', 'implicit-dependencies', 'import', - 'prettier', 'simple-import-sort', 'ethereumjs', ], @@ -20,22 +19,27 @@ module.exports = { 'coverage', 'dist', 'node_modules', - 'prettier.config.js', 'recipes', 'rlp.cjs', 'scripts', 'typedoc.js', - 'webpack.config.js', 'vitest.config.ts', 'vitest.config.browser.ts', - 'vitest.config.unit.ts' + 'vitest.config.unit.ts', + 'vite.*.ts', + 'ethereum-tests', + 'archive', + 'devnets', + 'eslint', + 'lint-staged.config.js', + 'tsconfig.lint.json', + 'package.json', ], extends: [ 'typestrict', 'eslint:recommended', 'plugin:import/recommended', 'plugin:import/typescript', - 'prettier', ], rules: { 'no-restricted-imports': ['error', 'ethereum-cryptography/utils.js'], @@ -62,17 +66,18 @@ module.exports = { '@typescript-eslint/restrict-plus-operands': 'off', '@typescript-eslint/return-await': 'error', '@typescript-eslint/strict-boolean-expressions': ['error'], + '@typescript-eslint/no-use-before-define': 'warn', // TODO: decide if we care eqeqeq: 'error', 'github/array-foreach': 'error', 'implicit-dependencies/no-implicit': ['error', { peer: true, dev: true, optional: true }], - 'import/default': 'error', + 'import/default': 'off', 'import/export': 'error', 'import/exports-last': 'off', // TODO: set to `warn` for fixing and then `error` 'import/extensions': ['error','ignorePackages'], 'import/first': 'error', 'import/group-exports': 'off', - 'import/named': 'error', - 'import/namespace': 'error', + 'import/named': 'off', + 'import/namespace': 'off', 'import/no-absolute-path': 'error', 'import/no-anonymous-default-export': 'error', 'import/no-cycle': 'off', // TODO: set to `warn` for fixing and then `error` @@ -103,26 +108,53 @@ module.exports = { 'no-dupe-class-members': 'off', 'no-extra-semi': 'off', 'no-redeclare': 'off', + 'no-undef': 'off', 'no-unused-vars': 'off', 'no-var': 'error', 'object-shorthand': 'error', 'prefer-const': 'error', - 'prettier/prettier': 'error', 'simple-import-sort/exports': 'error', 'sort-imports': ['error', { ignoreDeclarationSort: true }], 'ethereumjs/noBuffer': 'error', + 'no-restricted-syntax': 'off', }, parserOptions: { extraFileExtensions: ['.json'], sourceType: 'module', - project: './tsconfig.lint.json', + project: './config/tsconfig.lint.json', }, overrides: [ { - files: ['test/**/*.ts', 'tests/**/*.ts', 'examples/**/*.ts'], + files: ['**/test/**/*.ts', '**/bin/**.ts', ], rules: { 'implicit-dependencies/no-implicit': 'off', 'import/no-extraneous-dependencies': 'off', + 'no-console': 'off', + '@typescript-eslint/no-floating-promises': 'warn', + }, + }, + { + files: ['**/examples/**/*', '**/benchmarks/*.ts', ], + rules: { + 'implicit-dependencies/no-implicit': 'off', + 'import/no-extraneous-dependencies': 'off', + 'no-console': 'off', + '@typescript-eslint/no-unused-vars': 'off', + }, + }, + { + files: ['packages/statemanager/src/**', 'packages/vm/src/**', ], + rules: { + '@typescript-eslint/no-use-before-define': 'off', + 'no-invalid-this': 'off', + 'no-restricted-syntax': 'off', + }, + }, + { + files: ['packages/wallet/**'], + rules: { + 'github/array-foreach': 'warn', + 'no-prototype-builtins': 'warn', }, }, ], diff --git a/config/prettier.config.js b/config/prettier.config.js deleted file mode 100644 index 1d6075423c..0000000000 --- a/config/prettier.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - semi: false, - singleQuote: true, - printWidth: 100, -} diff --git a/config/tsconfig.lint.json b/config/tsconfig.lint.json index 574cc64e1f..94fa4dd345 100644 --- a/config/tsconfig.lint.json +++ b/config/tsconfig.lint.json @@ -1,14 +1,12 @@ { "extends": "./tsconfig.json", "include": [ - "../packages/**/src/**/*.ts", - "../packages/**/test/**/*.ts", - "../packages/**/examples/**/*.ts", - "../packages/**/examples/**/*.cjs", - "../packages/**/examples/**/*.js", - "../packages/**/benchmarks/**/*.ts", - "../packages/**/bin/**/*.ts" + "../packages/**/*.ts", + "../packages/**/*.js", + "../packages/ethereum-tests/**/*.js", + "package.json" ], + "exclude": ["../packages/client/devnets", "../packages/client/archive", "**/ethereum-tests/**/*", "package.json"], "compilerOptions": { "noEmit": true } diff --git a/eslint/index.js b/eslint/index.js index 0ca9f414d7..9fb2499113 100644 --- a/eslint/index.js +++ b/eslint/index.js @@ -6,7 +6,7 @@ const ruleFiles = fs .filter((file) => file !== 'index.js' && !file.endsWith('test.js')) const rules = Object.fromEntries( - ruleFiles.map((file) => [path.basename(file, '.js'), require('./' + file)]) + ruleFiles.map((file) => [path.basename(file, '.js'), require('./' + file)]), ) module.exports = { rules } diff --git a/eslint/package.json b/eslint/package.json index 5d8638880e..d83531aa88 100644 --- a/eslint/package.json +++ b/eslint/package.json @@ -1,9 +1,6 @@ { "name": "eslint-plugin-ethereumjs", "version": "0.1.0", - "files": [ - "index.js", - "noBuffer.js" - ], + "files": ["index.js", "noBuffer.js"], "main": "index.js" } diff --git a/lint-staged.config.js b/lint-staged.config.js index 42df57fbba..03fa16e0b7 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,3 +1,3 @@ module.exports = { - '*.{js,json,md,ts}': 'prettier --ignore-unknown --write', + '*.{js,json,md,ts}': 'npx @biomejs/biome check --write', } diff --git a/package-lock.json b/package-lock.json index aa45da5669..964e8354a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "packages/*" ], "devDependencies": { + "@biomejs/biome": "1.9.4", "@types/estree": "^1.0.1", "@types/node": "18.11.9", "@types/tape": "4.13.2", @@ -21,19 +22,16 @@ "cspell": "^8.13.3", "embedme": "1.22.1", "eslint": "8.57.0", - "eslint-config-prettier": "^9.1.0", "eslint-config-typestrict": "^1.0.5", "eslint-formatter-codeframe": "7.32.1", "eslint-plugin-ethereumjs": "file:./eslint", "eslint-plugin-github": "4.9.2", "eslint-plugin-implicit-dependencies": "1.1.1", "eslint-plugin-import": "2.26.0", - "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-simple-import-sort": "7.0.0", "eslint-plugin-sonarjs": "0.19.0", "lint-staged": "13.0.3", "lockfile-lint-api": "^5.5.1", - "prettier": "^3.3.3", "sort-package-json": "1.57.0", "tape": "5.6.0", "tsx": "^4.6.2", @@ -507,6 +505,161 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@biomejs/biome": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@bundled-es-modules/cookie": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz", diff --git a/package.json b/package.json index ddbc1811ce..a6fcb75496 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,9 @@ { "name": "root", "private": true, - "workspaces": [ - "packages/*" - ], + "workspaces": ["packages/*"], "scripts": { + "biome": "npx @biomejs/biome check --write", "checkNpmVersion": "./scripts/check-npm-version.sh", "clean": "./config/cli/clean-root.sh", "cspell": "npm run cspell:ts && npm run cspell:md", @@ -16,19 +15,20 @@ "e2e:resolutions": "node ./scripts/e2e-resolutions.js", "examples": "npm run examples --workspaces --if-present", "examples:build": "npm run examples:build --workspaces --if-present", - "lint": "npm run lint --workspaces --if-present", - "lint:fix": "npm run lint:fix --workspaces --if-present", + "lint": "eslint --format codeframe --config ./config/eslint.cjs . --ext .js,.ts", + "lint:fix": "eslint --fix --config ./config/eslint.cjs . --ext .js,.ts", + "lint:diff": "./config/cli/lint-diff.sh", "test": "npm run test --workspaces --if-present", "test:node": "npm run test:node --workspaces --if-present", "test:browser": "npm run test:browser --workspaces --if-present", "preinstall": "npm run checkNpmVersion", "postinstall": "npm run build --workspaces", "prepare": "git config --local core.hooksPath .githooks", - "prettier": "prettier --write \"./**/*.{js,json,md,ts,yml}\"", "sort-package-json": "sort-package-json \"package.json\" \"packages/*/package.json\"", "install-browser-deps": "npm install webdriverio@9.2.6 @vitest/browser@2.1.0" }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@types/estree": "^1.0.1", "@types/node": "18.11.9", "@types/tape": "4.13.2", @@ -40,19 +40,16 @@ "cspell": "^8.13.3", "embedme": "1.22.1", "eslint": "8.57.0", - "eslint-config-prettier": "^9.1.0", "eslint-config-typestrict": "^1.0.5", "eslint-formatter-codeframe": "7.32.1", "eslint-plugin-ethereumjs": "file:./eslint", "eslint-plugin-github": "4.9.2", "eslint-plugin-implicit-dependencies": "1.1.1", "eslint-plugin-import": "2.26.0", - "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-simple-import-sort": "7.0.0", "eslint-plugin-sonarjs": "0.19.0", "lint-staged": "13.0.3", "lockfile-lint-api": "^5.5.1", - "prettier": "^3.3.3", "sort-package-json": "1.57.0", "tape": "5.6.0", "tsx": "^4.6.2", diff --git a/packages/block/.eslintrc.cjs b/packages/block/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/block/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/block/.prettierignore b/packages/block/.prettierignore deleted file mode 100644 index 9fba258408..0000000000 --- a/packages/block/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules diff --git a/packages/block/package.json b/packages/block/package.json index b207bb7171..828c284527 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/block", "version": "6.0.0-alpha.1", "description": "Provides Block serialization and help functions", - "keywords": [ - "ethereum", - "block" - ], + "keywords": ["ethereum", "block"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+block%22" @@ -26,10 +23,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -37,9 +31,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- block", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=../../config/vitest.config.browser.mts", diff --git a/packages/block/tsconfig.lint.json b/packages/block/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/block/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/blockchain/.eslintrc.cjs b/packages/blockchain/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/blockchain/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/blockchain/.prettierignore b/packages/blockchain/.prettierignore deleted file mode 100644 index 25055766ed..0000000000 --- a/packages/blockchain/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules \ No newline at end of file diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 86fdbaaee9..013b27c979 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/blockchain", "version": "8.0.0-alpha.1", "description": "A module to store and interact with blocks", - "keywords": [ - "ethereum", - "blockchain" - ], + "keywords": ["ethereum", "blockchain"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/blockchain#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+blockchain%22" @@ -26,10 +23,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -37,9 +31,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- blockchain", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=./vitest.config.browser.mts", diff --git a/packages/blockchain/tsconfig.lint.json b/packages/blockchain/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/blockchain/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/blockchain/vitest.config.browser.mts b/packages/blockchain/vitest.config.browser.mts index 77a0ef5148..c477435388 100644 --- a/packages/blockchain/vitest.config.browser.mts +++ b/packages/blockchain/vitest.config.browser.mts @@ -1,10 +1,4 @@ - import { defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' -export default mergeConfig( - baseConfig, - defineConfig({ - - }) -) \ No newline at end of file +export default mergeConfig(baseConfig, defineConfig({})) diff --git a/packages/client/.eslintignore b/packages/client/.eslintignore deleted file mode 100644 index 3fa47340d9..0000000000 --- a/packages/client/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -devnets/**/*.ts -archive/**/*.ts \ No newline at end of file diff --git a/packages/client/.eslintrc.cjs b/packages/client/.eslintrc.cjs deleted file mode 100644 index 43d2c22619..0000000000 --- a/packages/client/.eslintrc.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['bin/**.ts', 'test/sim/**.ts', 'examples/**/*.ts'], - rules: { - 'no-console': 'off', - }, - }, - ], -} diff --git a/packages/client/package.json b/packages/client/package.json index 930df5d963..29766b2aab 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -2,14 +2,7 @@ "name": "@ethereumjs/client", "version": "0.10.3", "description": "EthereumJS Execution Layer (EL) Client Implementation", - "keywords": [ - "ethereum", - "ethereumjs", - "client", - "blockchain", - "light sync", - "full sync" - ], + "keywords": ["ethereum", "ethereumjs", "client", "blockchain", "light sync", "full sync"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/client#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+client%22" @@ -26,9 +19,7 @@ "bin": { "ethereumjs": "dist/esm/bin/cli.js" }, - "files": [ - "dist" - ], + "files": ["dist"], "scripts": { "binWorkaround": "test -f dist/bin/cli.js || echo 'install fails if bin script does not exist (https://github.com/npm/cli/issues/2632), creating placeholder file at \"dist/bin/cli.js\"' && mkdir -p 'dist/bin' && touch dist/bin/cli.js", "build": "npm run build:common && mkdir -p ./src/trustedSetup/ && cp -Rf ./src/trustedSetups ./dist/src/", @@ -43,9 +34,6 @@ "coverage": "npx vitest --coverage --coverage.include=src --coverage.reporter=lcov run test/* -c=./vitest.config.unit.ts", "docs:build": "typedoc --options typedoc.cjs --tsconfig tsconfig.prod.cjs.json", "examples": "tsx ../../scripts/examples-runner.ts -- client", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "preinstall": "npm run binWorkaround", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:unit && npm run test:integration", diff --git a/packages/client/src/util/rpc.ts b/packages/client/src/util/rpc.ts index 763e036ff0..8c28294202 100644 --- a/packages/client/src/util/rpc.ts +++ b/packages/client/src/util/rpc.ts @@ -235,7 +235,6 @@ export function createWsRPCServerListener(opts: CreateWSServerOpts): HttpServer socket.destroy() } } - ;(wss as any).handleUpgrade(req, socket, head, (ws: any) => { ;(wss as any).emit('connection', ws, req) }) diff --git a/packages/client/test/miner/miner.spec.ts b/packages/client/test/miner/miner.spec.ts index 65acf90ed3..4476c69fc9 100644 --- a/packages/client/test/miner/miner.spec.ts +++ b/packages/client/test/miner/miner.spec.ts @@ -463,7 +463,6 @@ describe('assembleBlocks() -> should not include tx under the baseFee', async () } catch { assert.fail('txPool should throw trying to add a tx with an invalid maxFeePerGas') } - // disable consensus to skip PoA block signer validation ;(vm.blockchain as any)._validateConsensus = false ;(service.synchronizer as FullSynchronizer).handleNewBlock = async (block: Block) => { diff --git a/packages/client/test/net/server/rlpxserver.spec.ts b/packages/client/test/net/server/rlpxserver.spec.ts index 3732404a18..5e26f6801d 100644 --- a/packages/client/test/net/server/rlpxserver.spec.ts +++ b/packages/client/test/net/server/rlpxserver.spec.ts @@ -138,7 +138,6 @@ describe('should return rlpx server info with ip4 as default', async () => { bootnodes: '10.0.0.1:1234,10.0.0.2:1234', }) as any const _nodeInfo = server.getRlpxInfo() - ;(server as any).initDpt = vi.fn() ;(server as any).initRlpx = vi.fn() server.dpt = { diff --git a/packages/client/test/rpc/eth/estimateGas.spec.ts b/packages/client/test/rpc/eth/estimateGas.spec.ts index 3ad3cc9ba8..aae630f830 100644 --- a/packages/client/test/rpc/eth/estimateGas.spec.ts +++ b/packages/client/test/rpc/eth/estimateGas.spec.ts @@ -15,36 +15,34 @@ import type { PrefixedHexString } from '@ethereumjs/util' const method = 'eth_estimateGas' -describe( - method, - () => { - it('call with valid arguments', async () => { - // Use custom genesis so we can test EIP1559 txs more easily - const { RPCTestnetData } = await import('../../testdata/geth-genesis/rpctestnet.js') - const common = createCommonFromGethGenesis(RPCTestnetData, { - chain: 'testnet', - hardfork: 'berlin', - }) - const blockchain = await createBlockchain({ - common, - validateBlocks: false, - validateConsensus: false, - }) - - const client = await createClient({ blockchain, commonChain: common, includeVM: true }) - const manager = createManager(client) - const rpc = getRPCClient(startRPC(manager.getMethods())) - - const { execution } = client.service - assert.notEqual(execution, undefined, 'should have valid execution') - const { vm } = execution - await vm.stateManager.generateCanonicalGenesis!(getGenesis(1)) - - // genesis address with balance - const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') - - // contract: - /* +describe(method, () => { + it('call with valid arguments', async () => { + // Use custom genesis so we can test EIP1559 txs more easily + const { RPCTestnetData } = await import('../../testdata/geth-genesis/rpctestnet.js') + const common = createCommonFromGethGenesis(RPCTestnetData, { + chain: 'testnet', + hardfork: 'berlin', + }) + const blockchain = await createBlockchain({ + common, + validateBlocks: false, + validateConsensus: false, + }) + + const client = await createClient({ blockchain, commonChain: common, includeVM: true }) + const manager = createManager(client) + const rpc = getRPCClient(startRPC(manager.getMethods())) + + const { execution } = client.service + assert.notEqual(execution, undefined, 'should have valid execution') + const { vm } = execution + await vm.stateManager.generateCanonicalGenesis!(getGenesis(1)) + + // genesis address with balance + const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') + + // contract: + /* // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; @@ -54,164 +52,162 @@ describe( } } */ - const data = - '0x6080604052348015600f57600080fd5b50609d8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806326b85ee114602d575b600080fd5b6033605f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60003390509056fea2646970667358221220455a67424337c6c5783846576348cb04caa9cf6f3e7def201c1f3fbc54aa373a64736f6c63430007060033' - - // construct block with tx - const gasLimit = 2000000 - const tx = createLegacyTx({ gasLimit, data }, { common, freeze: false }) - tx.getSenderAddress = () => { - return address - } - const parent = await blockchain.getCanonicalHeadHeader() - const block = createBlock( - { - header: { - parentHash: parent.hash(), - number: 1, - gasLimit, - }, - }, - { common, calcDifficultyFromHeader: parent }, - ) - block.transactions[0] = tx - - // deploy contract - let ranBlock: Block | undefined = undefined - vm.events.once('afterBlock', (result: any) => (ranBlock = result.block)) - const result = await runBlock(vm, { block, generate: true, skipBlockValidation: true }) - const { createdAddress } = result.results[0] - await vm.blockchain.putBlock(ranBlock!) - - // get gas estimate - const funcHash = '26b85ee1' // myAddress() - const estimateTxData = { - to: createdAddress!.toString(), - from: address.toString(), - data: `0x${funcHash}` as PrefixedHexString, - gasLimit: bigIntToHex(BigInt(53000)), - gasPrice: bigIntToHex(BigInt(1000000000)), - } - const estimateTx = createLegacyTx(estimateTxData, { freeze: false }) - estimateTx.getSenderAddress = () => { - return address - } - const vmCopy = await vm.shallowCopy() - const { totalGasSpent } = await runTx(vmCopy, { - tx: estimateTx, - skipNonce: true, - skipBalance: true, - skipBlockGasLimitValidation: true, - skipHardForkValidation: true, - }) - - // verify estimated gas is accurate - const res = await rpc.request(method, [ - { ...estimateTxData, gas: estimateTxData.gasLimit }, - 'latest', - ]) - assert.equal( - res.result, - '0x' + totalGasSpent.toString(16), - 'should return the correct gas estimate', - ) - - // Test without blockopt as its optional and should default to latest - const res2 = await rpc.request(method, [{ ...estimateTxData, gas: estimateTxData.gasLimit }]) - assert.equal( - res2.result, - '0x' + totalGasSpent.toString(16), - 'should return the correct gas estimate', - ) - // Setup chain to run an EIP1559 tx - const service = client.service - service.execution.vm.common.setHardfork('london') - service.chain.config.chainCommon.setHardfork('london') - const headBlock = await service.chain.getCanonicalHeadBlock() - const londonBlock = createBlock( - { - header: createBlockHeader( - { - baseFeePerGas: Units.gwei(1), - number: 2n, - parentHash: headBlock.header.hash(), - }, - { - common: service.chain.config.chainCommon, - skipConsensusFormatValidation: true, - calcDifficultyFromHeader: headBlock.header, - }, - ), - }, - { common: service.chain.config.chainCommon }, - ) - - vm.events.once('afterBlock', (result: any) => (ranBlock = result.block)) - await runBlock(vm, { block: londonBlock, generate: true, skipBlockValidation: true }) - await vm.blockchain.putBlock(ranBlock!) - - // Test EIP1559 tx - const EIP1559res = await rpc.request(method, [ - { ...estimateTxData, type: 2, maxFeePerGas: '0x' + 10000000000n.toString(16) }, - ]) - assert.equal( - EIP1559res.result, - '0x' + totalGasSpent.toString(16), - 'should return the correct gas estimate for EIP1559 tx', - ) - - // Test EIP1559 tx with no maxFeePerGas - const EIP1559reqNoGas = await rpc.request(method, [ - { - ...estimateTxData, - type: 2, - maxFeePerGas: undefined, - gasLimit: undefined, - gasPrice: undefined, + const data = + '0x6080604052348015600f57600080fd5b50609d8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806326b85ee114602d575b600080fd5b6033605f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60003390509056fea2646970667358221220455a67424337c6c5783846576348cb04caa9cf6f3e7def201c1f3fbc54aa373a64736f6c63430007060033' + + // construct block with tx + const gasLimit = 2000000 + const tx = createLegacyTx({ gasLimit, data }, { common, freeze: false }) + tx.getSenderAddress = () => { + return address + } + const parent = await blockchain.getCanonicalHeadHeader() + const block = createBlock( + { + header: { + parentHash: parent.hash(), + number: 1, + gasLimit, }, - ]) - assert.equal( - EIP1559reqNoGas.result, - '0x' + totalGasSpent.toString(16), - 'should return the correct gas estimate', - ) - - // Test legacy tx with London head block - const legacyTxNoGas = await rpc.request(method, [ - { ...estimateTxData, maxFeePerGas: undefined, gasLimit: undefined, gasPrice: undefined }, - ]) - assert.equal( - legacyTxNoGas.result, - '0x' + totalGasSpent.toString(16), - 'should return the correct gas estimate', - ) + }, + { common, calcDifficultyFromHeader: parent }, + ) + block.transactions[0] = tx + + // deploy contract + let ranBlock: Block | undefined = undefined + vm.events.once('afterBlock', (result: any) => (ranBlock = result.block)) + const result = await runBlock(vm, { block, generate: true, skipBlockValidation: true }) + const { createdAddress } = result.results[0] + await vm.blockchain.putBlock(ranBlock!) + + // get gas estimate + const funcHash = '26b85ee1' // myAddress() + const estimateTxData = { + to: createdAddress!.toString(), + from: address.toString(), + data: `0x${funcHash}` as PrefixedHexString, + gasLimit: bigIntToHex(BigInt(53000)), + gasPrice: bigIntToHex(BigInt(1000000000)), + } + const estimateTx = createLegacyTx(estimateTxData, { freeze: false }) + estimateTx.getSenderAddress = () => { + return address + } + const vmCopy = await vm.shallowCopy() + const { totalGasSpent } = await runTx(vmCopy, { + tx: estimateTx, + skipNonce: true, + skipBalance: true, + skipBlockGasLimitValidation: true, + skipHardForkValidation: true, }) - it('call with unsupported block argument', async () => { - const blockchain = await createBlockchain() - - const client = await createClient({ blockchain, includeVM: true }) - const manager = createManager(client) - const rpc = getRPCClient(startRPC(manager.getMethods())) - - // genesis address with balance - const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') - - const funcHash = '26b85ee1' // borrowed from valid test above - const estimateTxData = { - to: address.toString(), - from: address.toString(), - data: `0x${funcHash}`, - gasLimit: bigIntToHex(BigInt(53000)), - } - - const res = await rpc.request(method, [ - { ...estimateTxData, gas: estimateTxData.gasLimit }, - 'pending', - ]) - assert.equal(res.error.code, INVALID_PARAMS) - assert.ok(res.error.message.includes('"pending" is not yet supported')) - }) - }, - 20000, -) + // verify estimated gas is accurate + const res = await rpc.request(method, [ + { ...estimateTxData, gas: estimateTxData.gasLimit }, + 'latest', + ]) + assert.equal( + res.result, + '0x' + totalGasSpent.toString(16), + 'should return the correct gas estimate', + ) + + // Test without blockopt as its optional and should default to latest + const res2 = await rpc.request(method, [{ ...estimateTxData, gas: estimateTxData.gasLimit }]) + assert.equal( + res2.result, + '0x' + totalGasSpent.toString(16), + 'should return the correct gas estimate', + ) + // Setup chain to run an EIP1559 tx + const service = client.service + service.execution.vm.common.setHardfork('london') + service.chain.config.chainCommon.setHardfork('london') + const headBlock = await service.chain.getCanonicalHeadBlock() + const londonBlock = createBlock( + { + header: createBlockHeader( + { + baseFeePerGas: Units.gwei(1), + number: 2n, + parentHash: headBlock.header.hash(), + }, + { + common: service.chain.config.chainCommon, + skipConsensusFormatValidation: true, + calcDifficultyFromHeader: headBlock.header, + }, + ), + }, + { common: service.chain.config.chainCommon }, + ) + + vm.events.once('afterBlock', (result: any) => (ranBlock = result.block)) + await runBlock(vm, { block: londonBlock, generate: true, skipBlockValidation: true }) + await vm.blockchain.putBlock(ranBlock!) + + // Test EIP1559 tx + const EIP1559res = await rpc.request(method, [ + { ...estimateTxData, type: 2, maxFeePerGas: '0x' + 10000000000n.toString(16) }, + ]) + assert.equal( + EIP1559res.result, + '0x' + totalGasSpent.toString(16), + 'should return the correct gas estimate for EIP1559 tx', + ) + + // Test EIP1559 tx with no maxFeePerGas + const EIP1559reqNoGas = await rpc.request(method, [ + { + ...estimateTxData, + type: 2, + maxFeePerGas: undefined, + gasLimit: undefined, + gasPrice: undefined, + }, + ]) + assert.equal( + EIP1559reqNoGas.result, + '0x' + totalGasSpent.toString(16), + 'should return the correct gas estimate', + ) + + // Test legacy tx with London head block + const legacyTxNoGas = await rpc.request(method, [ + { ...estimateTxData, maxFeePerGas: undefined, gasLimit: undefined, gasPrice: undefined }, + ]) + assert.equal( + legacyTxNoGas.result, + '0x' + totalGasSpent.toString(16), + 'should return the correct gas estimate', + ) + }) + + it('call with unsupported block argument', async () => { + const blockchain = await createBlockchain() + + const client = await createClient({ blockchain, includeVM: true }) + const manager = createManager(client) + const rpc = getRPCClient(startRPC(manager.getMethods())) + + // genesis address with balance + const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') + + const funcHash = '26b85ee1' // borrowed from valid test above + const estimateTxData = { + to: address.toString(), + from: address.toString(), + data: `0x${funcHash}`, + gasLimit: bigIntToHex(BigInt(53000)), + } + + const res = await rpc.request(method, [ + { ...estimateTxData, gas: estimateTxData.gasLimit }, + 'pending', + ]) + assert.equal(res.error.code, INVALID_PARAMS) + assert.ok(res.error.message.includes('"pending" is not yet supported')) + }) +}, 20000) diff --git a/packages/client/test/rpc/eth/getBalance.spec.ts b/packages/client/test/rpc/eth/getBalance.spec.ts index 767871eda8..0a3fdc29cb 100644 --- a/packages/client/test/rpc/eth/getBalance.spec.ts +++ b/packages/client/test/rpc/eth/getBalance.spec.ts @@ -12,99 +12,92 @@ import { createClient, createManager, getRPCClient, startRPC } from '../helpers. const method = 'eth_getBalance' -describe( - method, - () => { - it('ensure balance deducts after a tx', async () => { - const common = new Common({ chain: Mainnet, hardfork: Hardfork.Chainstart }) - const blockchain = await createBlockchain({ common }) - - const client = await createClient({ blockchain, commonChain: common, includeVM: true }) - const manager = createManager(client) - - const rpc = getRPCClient(startRPC(manager.getMethods())) - - const { execution } = client.service - assert.notEqual(execution, undefined, 'should have valid execution') - const { vm } = execution - - // since synchronizer.run() is not executed in the mock setup, - // manually run stateManager.generateCanonicalGenesis() - await vm.stateManager.generateCanonicalGenesis!(getGenesis(1)) - - // genesis address with balance - const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') - - // verify balance is genesis amount - const genesisBalance = BigInt(0x15ac56edc4d12c0000) - let res = await rpc.request(method, [address.toString(), 'latest']) - - assert.equal( - res.result, - bigIntToHex(genesisBalance), - 'should return the correct genesis balance', - ) - - // construct block with tx - const tx = createLegacyTx({ gasLimit: 53000 }, { common, freeze: false }) - tx.getSenderAddress = () => { - return address - } - const block = createBlock({}, { common }) - block.transactions[0] = tx - - const result = await runBlock(vm, { block, generate: true, skipBlockValidation: true }) - const { amountSpent } = result.results[0] - - // verify balance is genesis amount minus amountSpent - const expectedNewBalance = genesisBalance - amountSpent - res = await rpc.request(method, [address.toString(), 'latest']) - assert.equal( - res.result, - bigIntToHex(expectedNewBalance), - 'should return the correct balance after a tx', - ) - - // verify we can query with "earliest" - res = await rpc.request(method, [address.toString(), 'earliest']) - assert.equal( - res.result, - bigIntToHex(genesisBalance), - "should return the correct balance with 'earliest'", - ) - - // verify we can query with a past block number - res = await rpc.request(method, [address.toString(), '0x0']) - assert.equal( - res.result, - bigIntToHex(genesisBalance), - 'should return the correct balance with a past block number', - ) - - // call with height that exceeds chain height - res = await rpc.request(method, [address.toString(), '0x1']) - assert.equal(res.error.code, INVALID_PARAMS) - assert.ok(res.error.message.includes('specified block greater than current height')) - - // call with nonexistent account - res = await rpc.request(method, [`0x${'11'.repeat(20)}`, 'latest']) - assert.equal(res.result, `0x0`, 'should return 0x0 for nonexistent account') - }) - - it('call with unsupported block argument', async () => { - const blockchain = await createBlockchain() - - const client = await createClient({ blockchain, includeVM: true }) - const manager = createManager(client) - const rpc = getRPCClient(startRPC(manager.getMethods())) - - const res = await rpc.request(method, [ - '0xccfd725760a68823ff1e062f4cc97e1360e8d997', - 'pending', - ]) - assert.equal(res.error.code, INVALID_PARAMS) - assert.ok(res.error.message.includes('"pending" is not yet supported')) - }) - }, - 40000, -) +describe(method, () => { + it('ensure balance deducts after a tx', async () => { + const common = new Common({ chain: Mainnet, hardfork: Hardfork.Chainstart }) + const blockchain = await createBlockchain({ common }) + + const client = await createClient({ blockchain, commonChain: common, includeVM: true }) + const manager = createManager(client) + + const rpc = getRPCClient(startRPC(manager.getMethods())) + + const { execution } = client.service + assert.notEqual(execution, undefined, 'should have valid execution') + const { vm } = execution + + // since synchronizer.run() is not executed in the mock setup, + // manually run stateManager.generateCanonicalGenesis() + await vm.stateManager.generateCanonicalGenesis!(getGenesis(1)) + + // genesis address with balance + const address = createAddressFromString('0xccfd725760a68823ff1e062f4cc97e1360e8d997') + + // verify balance is genesis amount + const genesisBalance = BigInt(0x15ac56edc4d12c0000) + let res = await rpc.request(method, [address.toString(), 'latest']) + + assert.equal( + res.result, + bigIntToHex(genesisBalance), + 'should return the correct genesis balance', + ) + + // construct block with tx + const tx = createLegacyTx({ gasLimit: 53000 }, { common, freeze: false }) + tx.getSenderAddress = () => { + return address + } + const block = createBlock({}, { common }) + block.transactions[0] = tx + + const result = await runBlock(vm, { block, generate: true, skipBlockValidation: true }) + const { amountSpent } = result.results[0] + + // verify balance is genesis amount minus amountSpent + const expectedNewBalance = genesisBalance - amountSpent + res = await rpc.request(method, [address.toString(), 'latest']) + assert.equal( + res.result, + bigIntToHex(expectedNewBalance), + 'should return the correct balance after a tx', + ) + + // verify we can query with "earliest" + res = await rpc.request(method, [address.toString(), 'earliest']) + assert.equal( + res.result, + bigIntToHex(genesisBalance), + "should return the correct balance with 'earliest'", + ) + + // verify we can query with a past block number + res = await rpc.request(method, [address.toString(), '0x0']) + assert.equal( + res.result, + bigIntToHex(genesisBalance), + 'should return the correct balance with a past block number', + ) + + // call with height that exceeds chain height + res = await rpc.request(method, [address.toString(), '0x1']) + assert.equal(res.error.code, INVALID_PARAMS) + assert.ok(res.error.message.includes('specified block greater than current height')) + + // call with nonexistent account + res = await rpc.request(method, [`0x${'11'.repeat(20)}`, 'latest']) + assert.equal(res.result, `0x0`, 'should return 0x0 for nonexistent account') + }) + + it('call with unsupported block argument', async () => { + const blockchain = await createBlockchain() + + const client = await createClient({ blockchain, includeVM: true }) + const manager = createManager(client) + const rpc = getRPCClient(startRPC(manager.getMethods())) + + const res = await rpc.request(method, ['0xccfd725760a68823ff1e062f4cc97e1360e8d997', 'pending']) + assert.equal(res.error.code, INVALID_PARAMS) + assert.ok(res.error.message.includes('"pending" is not yet supported')) + }) +}, 40000) diff --git a/packages/client/test/sim/snapsync.spec.ts b/packages/client/test/sim/snapsync.spec.ts index 7acfebc947..ba480b905b 100644 --- a/packages/client/test/sim/snapsync.spec.ts +++ b/packages/client/test/sim/snapsync.spec.ts @@ -128,22 +128,21 @@ describe('simple mainnet test run', async () => { peerConnectedPromise, snapSyncCompletedPromise, beaconSyncRelayer: relayer, - } = + } = (await createSnapClient( // eslint-disable-next-line @typescript-eslint/no-use-before-define - (await createSnapClient( - common, - customGenesisState, - [nodeInfo.enode], - peerBeaconUrl, - '', - ).catch((e) => { - console.log(e) - return null - })) ?? { - ejsInlineClient: null, - peerConnectedPromise: Promise.reject('Client creation error'), - beaconSyncRelayer: null, - } + common, + customGenesisState, + [nodeInfo.enode], + peerBeaconUrl, + '', + ).catch((e) => { + console.log(e) + return null + })) ?? { + ejsInlineClient: null, + peerConnectedPromise: Promise.reject('Client creation error'), + beaconSyncRelayer: null, + } ejsClient = ejsInlineClient beaconSyncRelayer = relayer diff --git a/packages/client/test/sync/fetcher/storagefetcher.spec.ts b/packages/client/test/sync/fetcher/storagefetcher.spec.ts index ed77a2dcfa..3995c6304e 100644 --- a/packages/client/test/sync/fetcher/storagefetcher.spec.ts +++ b/packages/client/test/sync/fetcher/storagefetcher.spec.ts @@ -20,7 +20,6 @@ import type { StorageFetcherOptions } from '../../../src/sync/fetcher/storagefet const _storageRangesRLP = '0xf83e0bf83af838f7a0290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639594053cd080a26cb03d5e6d2956cebb31c56e7660cac0' - ;(BigInt.prototype as any).toJSON = function () { return this.toString() } @@ -491,7 +490,6 @@ describe('[StorageFetcher]', async () => { `verifyRangeProof correctly failed on invalid proof, Error: ${(e as Error).message}`, ) } - // send end of range input to store ;(fetcher as any)['destroyWhenDone'] = false await fetcher.store([Object.create(null)] as any) diff --git a/packages/client/test/sync/txpool.spec.ts b/packages/client/test/sync/txpool.spec.ts index d0784c90c5..af49cc23a0 100644 --- a/packages/client/test/sync/txpool.spec.ts +++ b/packages/client/test/sync/txpool.spec.ts @@ -611,7 +611,6 @@ describe('[TxPool]', async () => { ) const { pool } = setup() - ;(pool).service.chain.getCanonicalHeadHeader = () => ({ baseFeePerGas: BigInt(3000000000), }) @@ -635,7 +634,6 @@ describe('[TxPool]', async () => { ) const { pool } = setup() - ;(pool).service.chain.getCanonicalHeadHeader = () => ({ gasLimit: BigInt(5000), }) diff --git a/packages/client/tsconfig.lint.json b/packages/client/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/client/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/common/.eslintrc.cjs b/packages/common/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/common/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/common/.prettierignore b/packages/common/.prettierignore deleted file mode 100644 index 25055766ed..0000000000 --- a/packages/common/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules \ No newline at end of file diff --git a/packages/common/package.json b/packages/common/package.json index 995ebcbbb4..26ce40d7be 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -36,10 +36,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -47,9 +44,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- common", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=../../config/vitest.config.browser.mts", diff --git a/packages/common/tsconfig.lint.json b/packages/common/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/common/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/devp2p/.eslintrc.cjs b/packages/devp2p/.eslintrc.cjs deleted file mode 100644 index 9c3e67209e..0000000000 --- a/packages/devp2p/.eslintrc.cjs +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - rules: { - '@typescript-eslint/no-floating-promises': 'off', - 'no-redeclare': 'off', - 'no-undef': 'off', // temporary until fixed: 'NodeJS' is not defined - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], -} diff --git a/packages/devp2p/.prettierignore b/packages/devp2p/.prettierignore deleted file mode 100644 index a69149e289..0000000000 --- a/packages/devp2p/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -.vscode -package.json -dist -.nyc_output diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index 921cf1b240..2e742d927f 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -39,10 +39,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -50,9 +47,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- devp2p", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "vitest run", "test:node": "npm run test", diff --git a/packages/devp2p/src/dpt/dpt.ts b/packages/devp2p/src/dpt/dpt.ts index a0667b145f..d736f07d6f 100644 --- a/packages/devp2p/src/dpt/dpt.ts +++ b/packages/devp2p/src/dpt/dpt.ts @@ -106,17 +106,17 @@ export class DPT { for (const peer of oldPeers) { this._server .ping(peer) - .catch((_err: Error) => { - this._banlist.add(peer, 300000) // 5 min * 60 * 1000 - this._kbucket.remove(peer) - err = err ?? _err - }) .then(() => { if (++count < oldPeers.length) return if (err === null) this._banlist.add(newPeer, 300000) // 5 min * 60 * 1000 else this._kbucket.add(newPeer) }) + .catch((_err: Error) => { + this._banlist.add(peer, 300000) // 5 min * 60 * 1000 + this._kbucket.remove(peer) + err = err ?? _err + }) } } diff --git a/packages/devp2p/test/integration/rlpx-simulator.spec.ts b/packages/devp2p/test/integration/rlpx-simulator.spec.ts index caa576a77d..355f514ee5 100644 --- a/packages/devp2p/test/integration/rlpx-simulator.spec.ts +++ b/packages/devp2p/test/integration/rlpx-simulator.spec.ts @@ -84,8 +84,8 @@ describe('RLPx simulator tests', () => { }, 30000) it('RLPX: remove node', async () => { const { rlpxs, peer } = util.initTwoPeerRLPXSetup(undefined, undefined, undefined, 40504) - rlpxs[0] - ['_dpt']!.addPeer(peer) + // biome-ignore format: the linter doesn't like when you format this + rlpxs[0]['_dpt']!.addPeer(peer) .then((peer1) => { rlpxs[0].disconnect(peer1['id']!) }) diff --git a/packages/devp2p/tsconfig.lint.json b/packages/devp2p/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/devp2p/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/ethash/.eslintrc.cjs b/packages/ethash/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/ethash/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/ethash/.prettierignore b/packages/ethash/.prettierignore deleted file mode 100644 index 9fba258408..0000000000 --- a/packages/ethash/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules diff --git a/packages/ethash/package.json b/packages/ethash/package.json index d988c4a19e..dd36d077a2 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -2,11 +2,7 @@ "name": "@ethereumjs/ethash", "version": "4.0.0-alpha.1", "description": "An implementation of the Ethash consensus algorithm in JavaScript", - "keywords": [ - "ethash", - "ethereum", - "POW" - ], + "keywords": ["ethash", "ethereum", "POW"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/ethash#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+ethash%22" @@ -27,10 +23,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -38,9 +31,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- ethash", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npx vitest run", "tsc": "../../config/cli/ts-compile.sh" diff --git a/packages/evm/.eslintrc.cjs b/packages/evm/.eslintrc.cjs deleted file mode 100644 index 10790297fc..0000000000 --- a/packages/evm/.eslintrc.cjs +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - rules: { - '@typescript-eslint/no-use-before-define': 'off', - 'no-invalid-this': 'off', - 'no-restricted-syntax': 'off', - }, - overrides: [ - { - files: ['test/util.ts', 'test/tester/**/*.ts', 'examples/**/*.ts'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], -} diff --git a/packages/evm/.prettierignore b/packages/evm/.prettierignore deleted file mode 100644 index 9fba258408..0000000000 --- a/packages/evm/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules diff --git a/packages/evm/package.json b/packages/evm/package.json index f2e38b4014..c32967b49f 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -2,12 +2,7 @@ "name": "@ethereumjs/evm", "version": "4.0.0-alpha.1", "description": "JavaScript Ethereum Virtual Machine (EVM) implementation", - "keywords": [ - "ethereum", - "EVM", - "JavaScript", - "TypeScript" - ], + "keywords": ["ethereum", "EVM", "JavaScript", "TypeScript"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/evm#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+evm%22" @@ -18,9 +13,7 @@ }, "license": "MPL-2.0", "author": "EthereumJS", - "contributors": [ - "Alex Beregszaszi " - ], + "contributors": ["Alex Beregszaszi "], "type": "module", "sideEffects": false, "main": "dist/cjs/index.js", @@ -31,10 +24,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -44,9 +34,6 @@ "examples": "tsx ../../scripts/examples-runner.ts -- evm", "examples:build": "npx embedme README.md", "formatTest": "node ./scripts/formatTest", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "profiling": "0x ./benchmarks/run.js profiling", "test": "npm run test:node && npm run test:browser", diff --git a/packages/evm/src/precompiles/09-blake2f.ts b/packages/evm/src/precompiles/09-blake2f.ts index 8a5943389f..2cc21f6350 100644 --- a/packages/evm/src/precompiles/09-blake2f.ts +++ b/packages/evm/src/precompiles/09-blake2f.ts @@ -103,10 +103,21 @@ function B2B_G( // Initialization Vector // prettier-ignore -const BLAKE2B_IV32 = new Uint32Array([0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,]) +const BLAKE2B_IV32 = new Uint32Array([ + 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, + 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19, +]) // prettier-ignore -const SIGMA8 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,] +const SIGMA8 = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, + 7, 5, 3, 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, + 5, 10, 4, 0, 15, 8, 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, 2, 12, 6, 10, 0, 11, 8, + 3, 4, 13, 7, 5, 15, 14, 1, 9, 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, 13, 11, 7, 14, + 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, 10, + 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, +] // These are offsets into a uint64 buffer. // Multiply them all by 2 to make them offsets into a uint32 buffer, diff --git a/packages/evm/tsconfig.lint.json b/packages/evm/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/evm/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/evm/vitest.config.browser.mts b/packages/evm/vitest.config.browser.mts index d96caec834..4abba4dff3 100644 --- a/packages/evm/vitest.config.browser.mts +++ b/packages/evm/vitest.config.browser.mts @@ -1,4 +1,3 @@ - import { configDefaults, defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' @@ -10,7 +9,7 @@ export default mergeConfig( ...configDefaults.exclude, // readDirSync method not provided fs mock for vite 'test/precompiles/eip-2537-bls.spec.ts', - ] + ], }, - }) -) \ No newline at end of file + }), +) diff --git a/packages/genesis/.eslintrc.cjs b/packages/genesis/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/genesis/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/genesis/.prettierignore b/packages/genesis/.prettierignore deleted file mode 100644 index 25055766ed..0000000000 --- a/packages/genesis/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules \ No newline at end of file diff --git a/packages/genesis/package.json b/packages/genesis/package.json index e486f5a564..65d7b99f09 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/genesis", "version": "0.3.0-alpha.1", "description": "A module to provide genesis states of well known networks", - "keywords": [ - "ethereum", - "genesis" - ], + "keywords": ["ethereum", "genesis"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/genesis#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+genesis%22" @@ -38,10 +35,7 @@ "require": "./dist/cjs/genesisStates/sepolia.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -49,9 +43,6 @@ "examples": "tsx ../../scripts/examples-runner.ts -- genesis", "examples:build": "npx embedme README.md", "docs:build": "typedoc --options typedoc.cjs", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node", "test:browser": "npx vitest run --config=../../config/vitest.config.browser.mts", diff --git a/packages/genesis/tsconfig.lint.json b/packages/genesis/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/genesis/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/mpt/.eslintrc.cjs b/packages/mpt/.eslintrc.cjs deleted file mode 100644 index 4a13163a7d..0000000000 --- a/packages/mpt/.eslintrc.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['benchmarks/*.ts', 'examples/**/*'], - rules: { - 'no-console': 'off', - }, - }, - ], -} diff --git a/packages/mpt/.prettierignore b/packages/mpt/.prettierignore deleted file mode 100644 index 9fa0fb74e1..0000000000 --- a/packages/mpt/.prettierignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -.vscode -dist -.nyc_output -*.json -docs \ No newline at end of file diff --git a/packages/mpt/package.json b/packages/mpt/package.json index 29b81bb259..6b527167da 100644 --- a/packages/mpt/package.json +++ b/packages/mpt/package.json @@ -2,12 +2,7 @@ "name": "@ethereumjs/mpt", "version": "7.0.0-alpha.1", "description": "Implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper.", - "keywords": [ - "merkle", - "radix", - "trie", - "ethereum" - ], + "keywords": ["merkle", "radix", "trie", "ethereum"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/mpt#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+mpt%22" @@ -18,9 +13,7 @@ }, "license": "MPL-2.0", "author": "EthereumJS Team", - "contributors": [ - "Aaron Kumavis (https://github.com/kumavis)" - ], + "contributors": ["Aaron Kumavis (https://github.com/kumavis)"], "type": "module", "sideEffects": false, "main": "dist/cjs/index.js", @@ -31,10 +24,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "benchmarks": "node -r tsx/register --max-old-space-size=8024 benchmarks", "build": "../../config/cli/ts-build.sh", @@ -43,9 +33,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- mpt", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "profiling": "tsc --target ES5 benchmarks/random.ts && 0x benchmarks/random.js", "test": "npm run test:node && npm run test:browser", diff --git a/packages/mpt/tsconfig.lint.json b/packages/mpt/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/mpt/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/mpt/vitest.config.browser.mts b/packages/mpt/vitest.config.browser.mts index 04eea8e459..3242d26af2 100644 --- a/packages/mpt/vitest.config.browser.mts +++ b/packages/mpt/vitest.config.browser.mts @@ -1,4 +1,3 @@ - import { configDefaults, defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' @@ -9,8 +8,8 @@ export default mergeConfig( exclude: [ ...configDefaults.exclude, // process.nextTick is not a function - 'test/stream.spec.ts' + 'test/stream.spec.ts', ], }, - } - )) \ No newline at end of file + }), +) diff --git a/packages/rlp/.eslintrc.cjs b/packages/rlp/.eslintrc.cjs deleted file mode 100644 index 092291ee94..0000000000 --- a/packages/rlp/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - rules: { - '@typescript-eslint/no-use-before-define': 'off', - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], -} diff --git a/packages/rlp/.prettierignore b/packages/rlp/.prettierignore deleted file mode 100644 index 03abf45412..0000000000 --- a/packages/rlp/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -.vscode -package.json -dist -.nyc_output \ No newline at end of file diff --git a/packages/rlp/package.json b/packages/rlp/package.json index 7448b879fc..90918755de 100644 --- a/packages/rlp/package.json +++ b/packages/rlp/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/rlp", "version": "6.0.0-alpha.1", "description": "Recursive Length Prefix Encoding Module", - "keywords": [ - "rlp", - "ethereum" - ], + "keywords": ["rlp", "ethereum"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/rlp#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+rlp%22" @@ -37,11 +34,7 @@ "bin": { "rlp": "bin/rlp.cjs" }, - "files": [ - "dist", - "bin", - "src" - ], + "files": ["dist", "bin", "src"], "scripts": { "benchmarks": "node ./benchmarks/index.js", "build": "../../config/cli/ts-build.sh node", @@ -50,9 +43,6 @@ "coverage": "npx vitest --coverage --coverage.include=src run", "examples": "tsx ../../scripts/examples-runner.ts -- rlp", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=./vitest.config.browser.mts", diff --git a/packages/rlp/test/dataTypes.spec.ts b/packages/rlp/test/dataTypes.spec.ts index 20105c0563..fbc3e9a36b 100644 --- a/packages/rlp/test/dataTypes.spec.ts +++ b/packages/rlp/test/dataTypes.spec.ts @@ -9,7 +9,32 @@ const { bytesToHex, concatBytes, hexToBytes, utf8ToBytes } = utils describe('invalid RLPs', () => { const errCases = [ // prettier-ignore - { input: Uint8Array.from([239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, 29, 239, 191, 189, 77, 239, 191, 189, 239, 191, 189, 239, 191, 189, 93, 122, 239, 191, 189, 239, 191, 189, 239, 191, 189, 103, 239, 191, 189, 239, 191, 189, 239, 191, 189, 26, 239, 191, 189, 18, 69, 27, 239, 191, 189, 239, 191, 189, 116, 19, 239, 191, 189, 239, 191, 189, 66, 239, 191, 189, 64, 212, 147, 71, 239, 191, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, 11, 222, 155, 122, 54, 42, 194, 169, 239, 191, 189, 70, 239, 191, 189, 72, 239, 191, 189, 239, 191, 189, 54, 53, 239, 191, 189, 100, 73, 239, 191, 189, 55, 239, 191, 189, 239, 191, 189, 59, 1, 239, 191, 189, 109, 239, 191, 189, 239, 191, 189, 93, 239, 191, 189, 208, 128, 239, 191, 189, 239, 191, 189, 0, 239, 191, 189, 239, 191, 189, 239, 191, 189, 15, 66, 64, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 4, 239, 191, 189, 79, 103, 239, 191, 189, 85, 239, 191, 189, 239, 191, 189, 239, 191, 189, 74, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 54, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 83, 239, 191, 189, 14, 239, 191, 189, 239, 191, 189, 239, 191, 189, 4, 63, 239, 191, 189, 63, 239, 191, 189, 41, 239, 191, 189, 239, 191, 189, 239, 191, 189, 67, 28, 239, 191, 189, 239, 191, 189, 11, 239, 191, 189, 31, 239, 191, 189, 239, 191, 189, 104, 96, 100, 239, 191, 189, 239, 191, 189, 12, 239, 191, 189, 239, 191, 189, 206, 152, 239, 191, 189, 239, 191, 189, 31, 112, 111, 239, 191, 189, 239, 191, 189, 65, 239, 191, 189, 41, 239, 191, 189, 239, 191, 189, 53, 84, 11, 239, 191, 189, 239, 191, 189, 12, 102, 24, 12, 42, 105, 109, 239, 191, 189, 58, 239, 191, 189, 4, 239, 191, 189, 104, 82, 9, 239, 191, 189, 6, 66, 91, 43, 38, 102, 117, 239, 191, 189, 105, 239, 191, 189, 239, 191, 189, 239, 191, 189, 89, 127, 239, 191, 189, 114]) }, + { + input: Uint8Array.from([ + 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, + 29, 239, 191, 189, 77, 239, 191, 189, 239, 191, 189, 239, 191, 189, 93, 122, 239, 191, 189, + 239, 191, 189, 239, 191, 189, 103, 239, 191, 189, 239, 191, 189, 239, 191, 189, 26, 239, + 191, 189, 18, 69, 27, 239, 191, 189, 239, 191, 189, 116, 19, 239, 191, 189, 239, 191, 189, + 66, 239, 191, 189, 64, 212, 147, 71, 239, 191, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 239, 191, 189, 11, 222, 155, 122, 54, 42, 194, 169, 239, 191, 189, 70, + 239, 191, 189, 72, 239, 191, 189, 239, 191, 189, 54, 53, 239, 191, 189, 100, 73, 239, 191, + 189, 55, 239, 191, 189, 239, 191, 189, 59, 1, 239, 191, 189, 109, 239, 191, 189, 239, 191, + 189, 93, 239, 191, 189, 208, 128, 239, 191, 189, 239, 191, 189, 0, 239, 191, 189, 239, 191, + 189, 239, 191, 189, 15, 66, 64, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, + 4, 239, 191, 189, 79, 103, 239, 191, 189, 85, 239, 191, 189, 239, 191, 189, 239, 191, 189, + 74, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 54, 239, 191, 189, 239, 191, + 189, 239, 191, 189, 239, 191, 189, 239, 191, 189, 83, 239, 191, 189, 14, 239, 191, 189, 239, + 191, 189, 239, 191, 189, 4, 63, 239, 191, 189, 63, 239, 191, 189, 41, 239, 191, 189, 239, + 191, 189, 239, 191, 189, 67, 28, 239, 191, 189, 239, 191, 189, 11, 239, 191, 189, 31, 239, + 191, 189, 239, 191, 189, 104, 96, 100, 239, 191, 189, 239, 191, 189, 12, 239, 191, 189, 239, + 191, 189, 206, 152, 239, 191, 189, 239, 191, 189, 31, 112, 111, 239, 191, 189, 239, 191, + 189, 65, 239, 191, 189, 41, 239, 191, 189, 239, 191, 189, 53, 84, 11, 239, 191, 189, 239, + 191, 189, 12, 102, 24, 12, 42, 105, 109, 239, 191, 189, 58, 239, 191, 189, 4, 239, 191, 189, + 104, 82, 9, 239, 191, 189, 6, 66, 91, 43, 38, 102, 117, 239, 191, 189, 105, 239, 191, 189, + 239, 191, 189, 239, 191, 189, 89, 127, 239, 191, 189, 114, + ]), + }, { input: hexToBytes('efdebd'), // cspell:disable-line msg: 'invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds', @@ -158,7 +183,9 @@ describe('RLP decoding (string)', () => { it('array', () => { // prettier-ignore - const decodedBufferArray = RLP.decode(Uint8Array.from([204, 131, 100, 111, 103, 131, 103, 111, 100, 131, 99, 97, 116])) + const decodedBufferArray = RLP.decode( + Uint8Array.from([204, 131, 100, 111, 103, 131, 103, 111, 100, 131, 99, 97, 116]), + ) assert.deepEqual(decodedBufferArray, [ utf8ToBytes('dog'), utf8ToBytes('god'), @@ -215,7 +242,34 @@ describe('strings over 55 bytes long', () => { describe('list over 55 bytes long', () => { // prettier-ignore - const testString = ['This', 'function', 'takes', 'in', 'a', 'data', 'convert', 'it', 'to', 'bytes', 'if', 'not', 'and', 'a', 'length', 'for', 'recursion', 'a1', 'a2', 'a3', 'ia4', 'a5', 'a6', 'a7', 'a8', 'ba9'] + const testString = [ + 'This', + 'function', + 'takes', + 'in', + 'a', + 'data', + 'convert', + 'it', + 'to', + 'bytes', + 'if', + 'not', + 'and', + 'a', + 'length', + 'for', + 'recursion', + 'a1', + 'a2', + 'a3', + 'ia4', + 'a5', + 'a6', + 'a7', + 'a8', + 'ba9', + ] let encoded: Uint8Array it('should encode it', () => { @@ -231,18 +285,7 @@ describe('list over 55 bytes long', () => { describe('nested lists:', () => { // prettier-ignore - const nestedList = [ - [], - [ - [] - ], - [ - [], - [ - [] - ] - ] - ] + const nestedList = [[], [[]], [[], [[]]]] const valueList = [ [1, 2, 3], [ @@ -265,7 +308,13 @@ describe('nested lists:', () => { it('should encode a list with values', () => { const valueEncoded = RLP.encode(valueList) // prettier-ignore - assert.deepEqual(valueEncoded, Uint8Array.from([0xd2, 0xc3, 0x01, 0x02, 0x03, 0xcd, 0x83, 0x04, 0x05, 0x06, 0x83, 0x07, 0x08, 0x09, 0xc4, 0x00, 0x82, 0xab, 0xcd])) + assert.deepEqual( + valueEncoded, + Uint8Array.from([ + 0xd2, 0xc3, 0x01, 0x02, 0x03, 0xcd, 0x83, 0x04, 0x05, 0x06, 0x83, 0x07, 0x08, 0x09, 0xc4, + 0x00, 0x82, 0xab, 0xcd, + ]), + ) }) }) @@ -283,7 +332,13 @@ describe('typed lists:', () => { it('encode a nested list', () => { const valueEncoded = RLP.encode(valueList) // prettier-ignore - assert.deepEqual(valueEncoded, Uint8Array.from([0xd2, 0xc3, 0x01, 0x02, 0x03, 0xcd, 0x83, 0x04, 0x05, 0x06, 0x83, 0x07, 0x08, 0x09, 0xc4, 0x00, 0x82, 0xab, 0xcd])) + assert.deepEqual( + valueEncoded, + Uint8Array.from([ + 0xd2, 0xc3, 0x01, 0x02, 0x03, 0xcd, 0x83, 0x04, 0x05, 0x06, 0x83, 0x07, 0x08, 0x09, 0xc4, + 0x00, 0x82, 0xab, 0xcd, + ]), + ) }) }) @@ -405,8 +460,11 @@ describe('hex prefix', () => { describe('recursive typings', () => { it('should not throw compilation error', () => { - type IsType = - Exclude extends never ? (Exclude extends never ? true : false) : false + type IsType = Exclude extends never + ? Exclude extends never + ? true + : false + : false const assertType = (isTrue: IsType) => { return isTrue } diff --git a/packages/rlp/tsconfig.lint.json b/packages/rlp/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/rlp/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/rlp/vitest.config.browser.mts b/packages/rlp/vitest.config.browser.mts index 77143d878e..56ae9d312c 100644 --- a/packages/rlp/vitest.config.browser.mts +++ b/packages/rlp/vitest.config.browser.mts @@ -8,5 +8,5 @@ export default mergeConfig( exclude: ['test/cli.spec.ts'], testTimeout: 180000, }, - }) -) \ No newline at end of file + }), +) diff --git a/packages/statemanager/.eslintrc.cjs b/packages/statemanager/.eslintrc.cjs deleted file mode 100644 index 9c5b0dcd15..0000000000 --- a/packages/statemanager/.eslintrc.cjs +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - rules: { - '@typescript-eslint/no-use-before-define': 'off', - 'no-invalid-this': 'off', - 'no-restricted-syntax': 'off', - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], -} diff --git a/packages/statemanager/.prettierignore b/packages/statemanager/.prettierignore deleted file mode 100644 index 9fba258408..0000000000 --- a/packages/statemanager/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index d93a9bb244..44c77506e8 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/statemanager", "version": "3.0.0-alpha.1", "description": "An Ethereum statemanager implementation", - "keywords": [ - "ethereum", - "statemanager" - ], + "keywords": ["ethereum", "statemanager"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/statemanager#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+statemanager%22" @@ -16,9 +13,7 @@ }, "license": "MPL-2.0", "author": "EthereumJS Team", - "contributors": [ - "g11tech " - ], + "contributors": ["g11tech "], "type": "module", "sideEffects": false, "main": "dist/cjs/index.js", @@ -29,10 +24,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -40,9 +32,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- statemanager", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh && npm run test:node", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=./vitest.config.browser.mts", diff --git a/packages/statemanager/tsconfig.lint.json b/packages/statemanager/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/statemanager/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/statemanager/vitest.config.browser.mts b/packages/statemanager/vitest.config.browser.mts index 6320475863..faf60e7bd4 100644 --- a/packages/statemanager/vitest.config.browser.mts +++ b/packages/statemanager/vitest.config.browser.mts @@ -1,4 +1,3 @@ - import { configDefaults, defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' @@ -14,5 +13,5 @@ export default mergeConfig( 'test/rpcStateManager.spec.ts', ], }, - }) -) \ No newline at end of file + }), +) diff --git a/packages/tx/.eslintrc.cjs b/packages/tx/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/tx/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/tx/.prettierignore b/packages/tx/.prettierignore deleted file mode 100644 index 25055766ed..0000000000 --- a/packages/tx/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules \ No newline at end of file diff --git a/packages/tx/package.json b/packages/tx/package.json index ba24bbdaa5..6b8aeac09d 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/tx", "version": "6.0.0-alpha.1", "description": "Implementation of the various Ethereum Transaction Types", - "keywords": [ - "ethereum", - "transactions" - ], + "keywords": ["ethereum", "transactions"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+tx%22" @@ -33,10 +30,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -44,9 +38,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- tx", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=./vitest.config.browser.mts", diff --git a/packages/tx/src/features/util.ts b/packages/tx/src/features/util.ts index 4c4f5976d0..36bd954618 100644 --- a/packages/tx/src/features/util.ts +++ b/packages/tx/src/features/util.ts @@ -24,7 +24,8 @@ export function getCommon(common?: Common): Common { * @param bits Number of bits to check (64 or 256) * @param cannotEqual Pass true if the number also cannot equal one less the maximum value */ -export function valueBoundaryCheck( // TODO: better method name +export function valueBoundaryCheck( + // TODO: better method name values: { [key: string]: bigint | undefined }, bits = 256, cannotEqual = false, diff --git a/packages/tx/tsconfig.lint.json b/packages/tx/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/tx/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/tx/vitest.config.browser.mts b/packages/tx/vitest.config.browser.mts index bb490f9086..d4132d5a33 100644 --- a/packages/tx/vitest.config.browser.mts +++ b/packages/tx/vitest.config.browser.mts @@ -1,4 +1,3 @@ - import { configDefaults, defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' @@ -7,13 +6,13 @@ export default mergeConfig( defineConfig({ test: { exclude: [ - ...configDefaults.exclude, // default export for minimist // wrong ethereum-tests path reference (../ is stripped) 'test/transactionRunner.spec.ts', 'test/eip4844.spec.ts', - 'test/t9n.spec.ts' + 'test/t9n.spec.ts', ], - } - })) \ No newline at end of file + }, + }), +) diff --git a/packages/util/.eslintrc.cjs b/packages/util/.eslintrc.cjs deleted file mode 100644 index ed6ce7f539..0000000000 --- a/packages/util/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['examples/**/*'], - rules: { - 'no-console': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, - }, - ], - } \ No newline at end of file diff --git a/packages/util/.prettierignore b/packages/util/.prettierignore deleted file mode 100644 index 60ddad862c..0000000000 --- a/packages/util/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -.vscode -package.json -dist -.nyc_output -test/testdata -docs diff --git a/packages/util/package.json b/packages/util/package.json index dbce2f2148..8f02935a23 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -2,11 +2,7 @@ "name": "@ethereumjs/util", "version": "10.0.0-alpha.1", "description": "A collection of utility functions for Ethereum", - "keywords": [ - "ethereum", - "utilities", - "utils" - ], + "keywords": ["ethereum", "utilities", "utils"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+util%22" @@ -71,10 +67,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -82,9 +75,6 @@ "docs:build": "npx typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- util", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=../../config/vitest.config.browser.mts", diff --git a/packages/util/test/address.spec.ts b/packages/util/test/address.spec.ts index 1496ef0081..2af1d07233 100644 --- a/packages/util/test/address.spec.ts +++ b/packages/util/test/address.spec.ts @@ -77,7 +77,10 @@ describe('Address', () => { it('should instantiate from private key', () => { // prettier-ignore - const privateKey = Uint8Array.from([234, 84, 189, 197, 45, 22, 63, 136, 201, 58, 176, 97, 87, 130, 207, 113, 138, 46, 251, 158, 81, 167, 152, 154, 171, 27, 8, 6, 126, 156, 28, 95]) + const privateKey = Uint8Array.from([ + 234, 84, 189, 197, 45, 22, 63, 136, 201, 58, 176, 97, 87, 130, 207, 113, 138, 46, 251, 158, + 81, 167, 152, 154, 171, 27, 8, 6, 126, 156, 28, 95, + ]) const str = '0x2f015c60e0be116b1f0cd534704db9c92118fb6a' const addr = createAddressFromPrivateKey(privateKey) assert.equal(addr.toString(), str) diff --git a/packages/util/tsconfig.lint.json b/packages/util/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/util/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/verkle/.eslintrc.cjs b/packages/verkle/.eslintrc.cjs deleted file mode 100644 index 887e31b0e6..0000000000 --- a/packages/verkle/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - ignorePatterns: ['src/rust-verkle-wasm/rust_verkle_wasm.js', '**/vendor/*.js'], - overrides: [ - { - files: ['benchmarks/*.ts', 'examples/*.ts'], - rules: { - 'no-console': 'off', - }, - }, - ], -} diff --git a/packages/verkle/.prettierignore b/packages/verkle/.prettierignore deleted file mode 100644 index 9fa0fb74e1..0000000000 --- a/packages/verkle/.prettierignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -.vscode -dist -.nyc_output -*.json -docs \ No newline at end of file diff --git a/packages/verkle/package.json b/packages/verkle/package.json index 0047ebc246..9248d9de6b 100644 --- a/packages/verkle/package.json +++ b/packages/verkle/package.json @@ -2,12 +2,7 @@ "name": "@ethereumjs/verkle", "version": "0.2.0-alpha.1", "description": "Implementation of verkle trees as used in Ethereum.", - "keywords": [ - "verkle", - "tree", - "trie", - "ethereum" - ], + "keywords": ["verkle", "tree", "trie", "ethereum"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/verkle#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+verkle%22" @@ -34,10 +29,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -45,9 +37,6 @@ "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- verkle", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node", "test:node": "npx vitest run", diff --git a/packages/verkle/tsconfig.lint.json b/packages/verkle/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/verkle/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/vm/.eslintignore b/packages/vm/.eslintignore deleted file mode 100644 index 3c018eed27..0000000000 --- a/packages/vm/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -vite.config.ts \ No newline at end of file diff --git a/packages/vm/.eslintrc.cjs b/packages/vm/.eslintrc.cjs deleted file mode 100644 index 811a41ecc2..0000000000 --- a/packages/vm/.eslintrc.cjs +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - rules: { - '@typescript-eslint/no-use-before-define': 'off', - 'no-invalid-this': 'off', - 'no-restricted-syntax': 'off', - }, - overrides: [ - { - files: ['test/util.ts', 'test/tester/**/*.ts', 'examples/**/*.ts'], - rules: { - 'no-console': 'off', - }, - }, - ], -} diff --git a/packages/vm/.prettierignore b/packages/vm/.prettierignore deleted file mode 100644 index 9fba258408..0000000000 --- a/packages/vm/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -*.json -.nyc_output -.vscode -coverage -dist -docs -node_modules diff --git a/packages/vm/package.json b/packages/vm/package.json index 93a81383fd..aaeda7d502 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -2,10 +2,7 @@ "name": "@ethereumjs/vm", "version": "9.0.0-alpha.1", "description": "An Ethereum VM implementation", - "keywords": [ - "ethereum", - "VM" - ], + "keywords": ["ethereum", "VM"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm#readme", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+vm%22" @@ -16,9 +13,7 @@ }, "license": "MPL-2.0", "author": "mjbecze ", - "contributors": [ - "Alex Beregszaszi " - ], + "contributors": ["Alex Beregszaszi "], "type": "module", "sideEffects": false, "main": "dist/cjs/index.js", @@ -29,10 +24,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "scripts": { "benchmarks": "node --max-old-space-size=4096 ./benchmarks/run.js benchmarks mainnetBlocks:10", "build": "../../config/cli/ts-build.sh", @@ -44,9 +36,6 @@ "examples": "tsx ../../scripts/examples-runner.ts -- vm", "examples:build": "npx embedme README.md", "formatTest": "node ./scripts/formatTest", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh && npm run test:buildIntegrity", "profiling": "0x ./benchmarks/run.js profiling", "test": "echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"", diff --git a/packages/vm/src/bloom/index.ts b/packages/vm/src/bloom/index.ts index b328e70b73..9992bdd07e 100644 --- a/packages/vm/src/bloom/index.ts +++ b/packages/vm/src/bloom/index.ts @@ -37,7 +37,7 @@ export class Bloom { const first2bytes = new DataView(e.buffer).getUint16(i * 2) const loc = mask & first2bytes const byteLoc = loc >> 3 - const bitLoc = 1 << loc % 8 + const bitLoc = 1 << (loc % 8) this.bitvector[BYTE_SIZE - byteLoc - 1] |= bitLoc } } @@ -55,7 +55,7 @@ export class Bloom { const first2bytes = new DataView(e.buffer).getUint16(i * 2) const loc = mask & first2bytes const byteLoc = loc >> 3 - const bitLoc = 1 << loc % 8 + const bitLoc = 1 << (loc % 8) match = (this.bitvector[BYTE_SIZE - byteLoc - 1] & bitLoc) !== 0 } diff --git a/packages/vm/test/retesteth/transition-child.cts b/packages/vm/test/retesteth/transition-child.cts index 9ddde4511a..6e5fdbb747 100644 --- a/packages/vm/test/retesteth/transition-child.cts +++ b/packages/vm/test/retesteth/transition-child.cts @@ -55,7 +55,9 @@ async function runTransition(argsIn: any) { nonce: '0x0000000000000000', extraData: '0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa', } - const genesis = createBlockFromBlockData({ header: BlockHeader.fromHeaderData(genesisBlockData) }) + const genesis = createBlockFromBlockData({ + header: BlockHeader.fromHeaderData(genesisBlockData), + }) blockchain = await createBlockchain({ common, genesisBlock: genesis }) } const vm = blockchain ? await VM.create({ common, blockchain }) : await VM.create({ common }) diff --git a/packages/vm/tsconfig.lint.json b/packages/vm/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/vm/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/packages/vm/vitest.config.browser.mts b/packages/vm/vitest.config.browser.mts index 73613ccbc2..feec1b532e 100644 --- a/packages/vm/vitest.config.browser.mts +++ b/packages/vm/vitest.config.browser.mts @@ -1,4 +1,3 @@ - import { configDefaults, defineConfig, mergeConfig } from 'vitest/config' import baseConfig from '../../config/vitest.config.browser.mts' @@ -13,8 +12,8 @@ export default mergeConfig( // Cannot read properties of undefined (reading 'pedersen_hash') 'test/api/EIPs/eip-6800-verkle.spec.ts', // Uses NodeJS builtins and we don't need to fill tests in browser anyway - 'test/api/t8ntool/t8ntool.spec.ts' + 'test/api/t8ntool/t8ntool.spec.ts', ], }, - } - )) \ No newline at end of file + }), +) diff --git a/packages/wallet/.eslintrc.cjs b/packages/wallet/.eslintrc.cjs deleted file mode 100644 index 38a6d05f92..0000000000 --- a/packages/wallet/.eslintrc.cjs +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - extends: '../../config/eslint.cjs', - parserOptions: { - project: ['./tsconfig.lint.json'], - }, - overrides: [ - { - files: ['test/index.spec.ts', "examples/**/*"], - rules: { - 'github/array-foreach': 'warn', - 'no-prototype-builtins': 'warn', - 'no-console': 'off', - }, - }, - ], -} diff --git a/packages/wallet/examples/hdKey.cjs b/packages/wallet/examples/hdKey.cjs index bd1d8496fb..7461d428f7 100644 --- a/packages/wallet/examples/hdKey.cjs +++ b/packages/wallet/examples/hdKey.cjs @@ -1,6 +1,6 @@ const { hdkey } = require('@ethereumjs/wallet') const wallet = hdkey.EthereumHDKey.fromMnemonic( - 'clown galaxy face oxygen birth round modify fame correct stumble kind excess' + 'clown galaxy face oxygen birth round modify fame correct stumble kind excess', ) console.log(wallet.getWallet().getAddressString()) // Should print an Ethereum address diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 688ec1c069..a33770b701 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -2,11 +2,7 @@ "name": "@ethereumjs/wallet", "version": "3.0.0-alpha.1", "description": "Utilities for handling Ethereum keys", - "keywords": [ - "ethereum", - "wallets", - "keys" - ], + "keywords": ["ethereum", "wallets", "keys"], "homepage": "https://github.com/ethereumjs/ethereumjs-monorepo/packages/wallet", "bugs": { "url": "https://github.com/ethereumjs/ethereumjs-monorepo/issues" @@ -27,10 +23,7 @@ "require": "./dist/cjs/index.js" } }, - "files": [ - "src", - "dist" - ], + "files": ["src", "dist"], "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", @@ -38,9 +31,6 @@ "docs:build": "npx typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- wallet", "examples:build": "npx embedme README.md", - "lint": "../../config/cli/lint.sh", - "lint:diff": "../../config/cli/lint-diff.sh", - "lint:fix": "../../config/cli/lint-fix.sh", "prepublishOnly": "../../config/cli/prepublish.sh", "test": "npm run test:node && npm run test:browser", "test:browser": "npx vitest run --config=../../config/vitest.config.browser.mts", diff --git a/packages/wallet/prettier.config.cjs b/packages/wallet/prettier.config.cjs deleted file mode 100644 index 1d6075423c..0000000000 --- a/packages/wallet/prettier.config.cjs +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - semi: false, - singleQuote: true, - printWidth: 100, -} diff --git a/packages/wallet/tsconfig.lint.json b/packages/wallet/tsconfig.lint.json deleted file mode 100644 index 3698f4f0be..0000000000 --- a/packages/wallet/tsconfig.lint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../config/tsconfig.lint.json" -} diff --git a/prettier.config.js b/prettier.config.js deleted file mode 100644 index a149966a75..0000000000 --- a/prettier.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./config/prettier.config')