From 4c1616b6897f3046d4bdff4dec7f46c2c39fbfa7 Mon Sep 17 00:00:00 2001 From: Cayman Date: Wed, 5 Jul 2023 10:20:30 -0400 Subject: [PATCH 01/25] chore!: use node 20 throughout monorepo --- .github/workflows/benchmark.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-browser.yml | 2 +- .github/workflows/test-e2e.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 2 +- .github/workflows/test-spec.yml | 2 +- .github/workflows/test.yml | 2 +- Dockerfile | 6 +++--- docs/install/source.md | 2 +- package.json | 2 +- packages/api/README.md | 2 +- packages/beacon-node/README.md | 2 +- packages/params/README.md | 2 +- packages/prover/README.md | 2 +- packages/reqresp/README.md | 2 +- packages/validator/README.md | 2 +- 21 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d1de888472cf..98842a38b026 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index bad86bd201b9..1556cd191b55 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - name: Node.js version id: node run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 98b4ba2b56ee..cdceb49d808a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 673b2ec6af92..a656f8562bf3 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 registry-url: "https://registry.npmjs.org" check-latest: true - name: Node.js version diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 07106e1945f7..005d2738b1c6 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index 40f0cba82f78..01e222d48e72 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -60,7 +60,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index c8854c1896aa..c4c478b53a07 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index d76910185489..25d49c64ad01 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index 60cf84560766..a47a2a07a5a1 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 1da1959a8072..74f19be3af99 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 58a80543303f..eb17c2e2babf 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b95fb6a44794..22bef8d6c10a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index 346fffd117dc..5a9541e06f1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # --platform=$BUILDPLATFORM is used build javascript source with host arch # Otherwise TS builds on emulated archs and can be extremely slow (+1h) -FROM --platform=${BUILDPLATFORM:-amd64} node:18-alpine as build_src +FROM --platform=${BUILDPLATFORM:-amd64} node:20-alpine as build_src ARG COMMIT WORKDIR /usr/app RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/* @@ -21,7 +21,7 @@ RUN cd packages/cli && GIT_COMMIT=${COMMIT} yarn write-git-data # Copy built src + node_modules to build native packages for archs different than host. # Note: This step is redundant for the host arch -FROM node:18-alpine as build_deps +FROM node:20-alpine as build_deps WORKDIR /usr/app RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/* @@ -35,7 +35,7 @@ RUN cd node_modules/classic-level && yarn rebuild # Copy built src + node_modules to a new layer to prune unnecessary fs # Previous layer weights 7.25GB, while this final 488MB (as of Oct 2020) -FROM node:18-alpine +FROM node:20-alpine WORKDIR /usr/app COPY --from=build_deps /usr/app . diff --git a/docs/install/source.md b/docs/install/source.md index 6068c5189093..4fba0a625111 100644 --- a/docs/install/source.md +++ b/docs/install/source.md @@ -2,7 +2,7 @@ ## Prerequisites -Make sure to have [Yarn installed](https://classic.yarnpkg.com/en/docs/install). It is also recommended to [install NVM (Node Version Manager)](https://github.com/nvm-sh/nvm) and use the LTS version (currently v18) of [NodeJS](https://nodejs.org/en/). +Make sure to have [Yarn installed](https://classic.yarnpkg.com/en/docs/install). It is also recommended to [install NVM (Node Version Manager)](https://github.com/nvm-sh/nvm) and use the LTS version (currently v20) of [NodeJS](https://nodejs.org/en/). !!! info diff --git a/package.json b/package.json index 10a8c70bb391..09de50501a78 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", - "@types/node": "^18.15.11", + "@types/node": "^20.3.3", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", "@typescript-eslint/eslint-plugin": "5.60.1", diff --git a/packages/api/README.md b/packages/api/README.md index c8a1ebf3a31a..877e04384ee4 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -3,7 +3,7 @@ [![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)](https://discord.gg/aMxzVcr) [![ETH Beacon APIs Spec v2.1.0](https://img.shields.io/badge/ETH%20beacon--APIs-2.1.0-blue)](https://github.com/ethereum/beacon-APIs/releases/tag/v2.1.0) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project diff --git a/packages/beacon-node/README.md b/packages/beacon-node/README.md index 67e26c73a9ff..955cfdb0e9b6 100644 --- a/packages/beacon-node/README.md +++ b/packages/beacon-node/README.md @@ -3,7 +3,7 @@ [![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)](https://discord.gg/aMxzVcr) [![Eth Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project diff --git a/packages/params/README.md b/packages/params/README.md index ebce8bda5b1b..bf4457146fbd 100644 --- a/packages/params/README.md +++ b/packages/params/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Eth Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project diff --git a/packages/prover/README.md b/packages/prover/README.md index c4df66751e51..46c733c9715d 100644 --- a/packages/prover/README.md +++ b/packages/prover/README.md @@ -3,7 +3,7 @@ [![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)](https://discord.gg/aMxzVcr) [![ETH Beacon APIs Spec v2.1.0](https://img.shields.io/badge/ETH%20beacon--APIs-2.1.0-blue)](https://github.com/ethereum/beacon-APIs/releases/tag/v2.1.0) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project diff --git a/packages/reqresp/README.md b/packages/reqresp/README.md index ecb29a7ff2ad..a363dfc65388 100644 --- a/packages/reqresp/README.md +++ b/packages/reqresp/README.md @@ -3,7 +3,7 @@ [![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)](https://discord.gg/aMxzVcr) [![ETH Beacon APIs Spec v2.1.0](https://img.shields.io/badge/ETH%20beacon--APIs-2.1.0-blue)](https://github.com/ethereum/beacon-APIs/releases/tag/v2.1.0) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project diff --git a/packages/validator/README.md b/packages/validator/README.md index 84301ca7efa5..d9ae22a01f04 100644 --- a/packages/validator/README.md +++ b/packages/validator/README.md @@ -3,7 +3,7 @@ [![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)](https://discord.gg/aMxzVcr) [![Eth Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project From a8995032edd83ade0c13b19373189e03fb2d3f53 Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 6 Jul 2023 09:41:54 -0400 Subject: [PATCH 02/25] Add yarn.lock --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6f8d87567688..b1fbf1e5b47e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3669,10 +3669,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.45.tgz#155b13a33c665ef2b136f7f245fa525da419e810" integrity sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ== -"@types/node@^18.15.11": - version "18.15.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" - integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== +"@types/node@^20.3.3": + version "20.4.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.0.tgz#01d637d1891e419bc85763b46f42809cd2d5addb" + integrity sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g== "@types/normalize-package-data@^2.4.0": version "2.4.1" From 6ce771895ec3f6f3a594c2b986a59d0d11d356f8 Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 6 Jul 2023 09:50:27 -0400 Subject: [PATCH 03/25] Revert @types/node change --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 09de50501a78..10a8c70bb391 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", - "@types/node": "^20.3.3", + "@types/node": "^18.15.11", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", "@typescript-eslint/eslint-plugin": "5.60.1", diff --git a/yarn.lock b/yarn.lock index b1fbf1e5b47e..78a6e51f9b68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3669,10 +3669,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.45.tgz#155b13a33c665ef2b136f7f245fa525da419e810" integrity sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ== -"@types/node@^20.3.3": - version "20.4.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.0.tgz#01d637d1891e419bc85763b46f42809cd2d5addb" - integrity sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g== +"@types/node@^18.15.11": + version "18.16.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" + integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== "@types/normalize-package-data@^2.4.0": version "2.4.1" From 9ff2e2a349946ae28745adf591867f46c264d897 Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 6 Jul 2023 10:19:38 -0400 Subject: [PATCH 04/25] Fix ts-node usage --- packages/cli/package.json | 10 +++++----- packages/cli/test/utils/childprocRunner.ts | 13 ++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 5a3873a58316..c63ceb0bb270 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -24,7 +24,7 @@ "build": "tsc -p tsconfig.build.json && yarn write-git-data", "build:release": "yarn clean && yarn run build", "build:watch": "tsc -p tsconfig.build.json --watch", - "build:refdocs": "ts-node --esm ./docsgen/index.ts docs/cli.md", + "build:refdocs": "node --loader ts-node/esm ./docsgen/index.ts docs/cli.md", "write-git-data": "node lib/util/gitData/writeGitData.js", "check-build": "node -e \"(async function() { await import('./lib/index.js') })()\" lodestar --help", "check-types": "tsc", @@ -33,10 +33,10 @@ "pretest": "yarn run check-types", "test:unit": "nyc --cache-dir .nyc_output/.cache -e .ts mocha 'test/unit/**/*.test.ts'", "test:e2e": "mocha --timeout 30000 'test/e2e/**/*.test.ts'", - "test:sim:multifork": "LODESTAR_PRESET=minimal ts-node --esm test/sim/multi_fork.test.ts", - "test:sim:endpoints": "LODESTAR_PRESET=minimal ts-node --esm test/sim/endpoints.test.ts", - "test:sim:deneb": "LODESTAR_PRESET=minimal ts-node --esm test/sim/deneb.test.ts", - "test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal ts-node --esm test/sim/backup_eth_provider.test.ts", + "test:sim:multifork": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/multi_fork.test.ts", + "test:sim:endpoints": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/endpoints.test.ts", + "test:sim:deneb": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/deneb.test.ts", + "test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/backup_eth_provider.test.ts", "test": "yarn test:unit && yarn test:e2e", "coverage": "codecov -F lodestar", "check-readme": "typescript-docs-verifier" diff --git a/packages/cli/test/utils/childprocRunner.ts b/packages/cli/test/utils/childprocRunner.ts index 5e3a79e5e7a4..cd2ab6b713ea 100644 --- a/packages/cli/test/utils/childprocRunner.ts +++ b/packages/cli/test/utils/childprocRunner.ts @@ -4,7 +4,6 @@ import {shell, ShellOpts} from "./shell.js"; const {RUN_FROM_SRC} = process.env; const nodeJsBinaryPath = process.execPath; -const tsNodeBinaryPath = esmRelativePathJoin("../../../../node_modules/.bin/ts-node"); const cliSrcScriptPath = esmRelativePathJoin("../../src/index.ts"); const cliLibScriptPath = esmRelativePathJoin("../../lib/index.js"); @@ -78,13 +77,13 @@ export function spawnCli(opts: SpawnCliOpts, lodestarArgs: string[]): child_proc const logPrefix = opts?.logPrefix ?? ""; const command = RUN_FROM_SRC - ? // ts-node --esm cli.ts - tsNodeBinaryPath + ? // node --loader ts-node/esm cli.ts + nodeJsBinaryPath : // node cli.js nodeJsBinaryPath; const prefixArgs = RUN_FROM_SRC - ? // ts-node --esm cli.ts - ["--esm", cliSrcScriptPath, ...lodestarArgs] + ? // node --loader ts-node/esm cli.ts + ["--loader", "ts-node/esm", cliSrcScriptPath, ...lodestarArgs] : // node cli.js [cliLibScriptPath, ...lodestarArgs]; @@ -133,8 +132,8 @@ export function bufferStderr(proc: child_process.ChildProcessWithoutNullStreams) export function execCli(lodestarArgs: string[], opts?: ShellOpts): Promise { const prefixArgs = RUN_FROM_SRC - ? // ts-node --esm cli.ts - [tsNodeBinaryPath, "--esm", cliSrcScriptPath] + ? // node --loader ts-node/esm cli.ts + [nodeJsBinaryPath, "--loader", "ts-node/esm", cliSrcScriptPath] : // node cli.js [nodeJsBinaryPath, cliLibScriptPath]; return shell([...prefixArgs, ...lodestarArgs], {pipeToProcess: true, ...opts}); From 1d5c3c19f64ef4d584e0d64de323cabc4513af21 Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 7 Jul 2023 08:54:28 -0400 Subject: [PATCH 05/25] Add missed files --- packages/prover/package.json | 2 +- scripts/run_e2e_env.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/prover/package.json b/packages/prover/package.json index e060e3abb28d..1206473963ce 100644 --- a/packages/prover/package.json +++ b/packages/prover/package.json @@ -56,7 +56,7 @@ "test:browsers": "yarn karma start karma.config.cjs", "test:e2e": "LODESTAR_PRESET=minimal mocha 'test/e2e/**/*.test.ts'", "check-readme": "typescript-docs-verifier", - "generate-fixtures": "npx ts-node --esm scripts/generate_fixtures.ts" + "generate-fixtures": "node --loader ts-node/esm scripts/generate_fixtures.ts" }, "dependencies": { "@ethereumjs/block": "^4.2.2", diff --git a/scripts/run_e2e_env.sh b/scripts/run_e2e_env.sh index 180cda203d94..08f1680b30c6 100755 --- a/scripts/run_e2e_env.sh +++ b/scripts/run_e2e_env.sh @@ -3,7 +3,7 @@ function start_app() { mkdir -p test-logs/e2e-test-env export LODESTAR_PRESET=minimal - nohup npx ts-node --esm packages/cli/test/scripts/e2e_test_env.ts > test-logs/e2e-test-env/simulation.out 2>&1 & + nohup node --loader ts-node/esm packages/cli/test/scripts/e2e_test_env.ts > test-logs/e2e-test-env/simulation.out 2>&1 & echo $! > test-logs/e2e-test-env/simulation.pid echo "Wait for the node to be ready" npx wait-port -t 60000 0.0.0.0:5001 From 7b7089204f07698ea853cee94c036f851556f071 Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 7 Jul 2023 09:32:08 -0400 Subject: [PATCH 06/25] Remove more ts-node-esm --- packages/params/test/e2e/overridePreset.test.ts | 5 ++--- packages/params/test/e2e/setPreset.test.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/params/test/e2e/overridePreset.test.ts b/packages/params/test/e2e/overridePreset.test.ts index 61483e2cee91..e16dd97a08ef 100644 --- a/packages/params/test/e2e/overridePreset.test.ts +++ b/packages/params/test/e2e/overridePreset.test.ts @@ -18,18 +18,17 @@ const exec = util.promisify(child.exec); // Solutions: https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules // eslint-disable-next-line @typescript-eslint/naming-convention const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const tsNodeBinary = path.join(__dirname, "../../../../node_modules/.bin/ts-node-esm"); describe("Override preset", function () { // Allow time for ts-node to compile Typescript source this.timeout(30_000); it("Should correctly override preset", async () => { - await exec(`${tsNodeBinary} ${path.join(__dirname, scriptNames.ok)}`); + await exec(`node --loader ts-node/esm ${path.join(__dirname, scriptNames.ok)}`); }); it("Should throw trying to override preset in the wrong order", async () => { - await expect(exec(`${tsNodeBinary} ${path.join(__dirname, scriptNames.error)}`)).to.be.rejectedWith( + await expect(exec(`node --loader ts-node/esm ${path.join(__dirname, scriptNames.error)}`)).to.be.rejectedWith( "Lodestar preset is already frozen" ); }); diff --git a/packages/params/test/e2e/setPreset.test.ts b/packages/params/test/e2e/setPreset.test.ts index d2268d32fe51..2b7ff271cd94 100644 --- a/packages/params/test/e2e/setPreset.test.ts +++ b/packages/params/test/e2e/setPreset.test.ts @@ -18,18 +18,17 @@ const exec = util.promisify(child.exec); // Solutions: https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules // eslint-disable-next-line @typescript-eslint/naming-convention const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const tsNodeBinary = path.join(__dirname, "../../../../node_modules/.bin/ts-node-esm"); describe("setPreset", function () { // Allow time for ts-node to compile Typescript source this.timeout(30_000); it("Should correctly set preset", async () => { - await exec(`${tsNodeBinary} ${path.join(__dirname, scriptNames.ok)}`); + await exec(`node --loader ts-node/esm ${path.join(__dirname, scriptNames.ok)}`); }); it("Should throw trying to set preset in the wrong order", async () => { - await expect(exec(`${tsNodeBinary} ${path.join(__dirname, scriptNames.error)}`)).to.be.rejectedWith( + await expect(exec(`node --loader ts-node/esm ${path.join(__dirname, scriptNames.error)}`)).to.be.rejectedWith( "Lodestar preset is already frozen" ); }); From 84e44b81b625b3d15bd78f7c9a3f9e3722d66ce0 Mon Sep 17 00:00:00 2001 From: Cayman Date: Tue, 11 Jul 2023 11:43:35 -0400 Subject: [PATCH 07/25] Update cross-fetch dependency --- packages/api/package.json | 2 +- packages/beacon-node/package.json | 2 +- packages/light-client/package.json | 2 +- packages/validator/package.json | 2 +- yarn.lock | 14 ++++++++++++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 28cb5dc1f6c9..b925953770f1 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -75,7 +75,7 @@ "@lodestar/params": "^1.9.1", "@lodestar/types": "^1.9.1", "@lodestar/utils": "^1.9.1", - "cross-fetch": "^3.1.4", + "cross-fetch": "^4.0.0", "eventsource": "^2.0.2", "qs": "^6.11.1" }, diff --git a/packages/beacon-node/package.json b/packages/beacon-node/package.json index fbdb5aa9609b..8768690d7084 100644 --- a/packages/beacon-node/package.json +++ b/packages/beacon-node/package.json @@ -135,7 +135,7 @@ "@types/datastore-level": "^3.0.0", "buffer-xor": "^2.0.2", "c-kzg": "^2.1.0", - "cross-fetch": "^3.1.4", + "cross-fetch": "^4.0.0", "datastore-core": "^9.1.1", "datastore-level": "^10.1.1", "deepmerge": "^4.3.1", diff --git a/packages/light-client/package.json b/packages/light-client/package.json index 61c685517e6c..2b3779df81f4 100644 --- a/packages/light-client/package.json +++ b/packages/light-client/package.json @@ -73,7 +73,7 @@ "@lodestar/state-transition": "^1.9.1", "@lodestar/types": "^1.9.1", "@lodestar/utils": "^1.9.1", - "cross-fetch": "^3.1.4", + "cross-fetch": "^4.0.0", "mitt": "^3.0.0", "strict-event-emitter-types": "^2.0.0" }, diff --git a/packages/validator/package.json b/packages/validator/package.json index 1b20eb5db607..4a749792a2f0 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -58,7 +58,7 @@ "@lodestar/types": "^1.9.1", "@lodestar/utils": "^1.9.1", "bigint-buffer": "^1.1.5", - "cross-fetch": "^3.1.4", + "cross-fetch": "^4.0.0", "strict-event-emitter-types": "^2.0.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 78a6e51f9b68..8a7d108022c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6078,6 +6078,13 @@ cross-fetch@^3.1.4: dependencies: node-fetch "2.6.7" +cross-fetch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983" + integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g== + dependencies: + node-fetch "^2.6.12" + cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz" @@ -11190,6 +11197,13 @@ node-fetch@2.6.7, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: resolved "https://registry.npmjs.org/@achingbrain/node-fetch/-/node-fetch-2.6.7.tgz" integrity sha512-iTASGs+HTFK5E4ZqcMsHmeJ4zodyq8L38lZV33jwqcBJYoUt3HjN4+ot+O9/0b+ke8ddE7UgOtVuZN/OkV19/g== +node-fetch@^2.6.12: + version "2.6.12" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba" + integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== + dependencies: + whatwg-url "^5.0.0" + node-fetch@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" From 0c4775836eba729bdb7ffc6651e52d24c3c4fb1c Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 14 Jul 2023 15:15:28 +0200 Subject: [PATCH 08/25] Update @types/node to 20.4.2 --- package.json | 2 +- yarn.lock | 35 ++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 10a8c70bb391..d9bb0333b789 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", - "@types/node": "^18.15.11", + "@types/node": "^20.4.2", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", "@typescript-eslint/eslint-plugin": "5.60.1", diff --git a/yarn.lock b/yarn.lock index 8a7d108022c0..09625908176c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3669,10 +3669,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.45.tgz#155b13a33c665ef2b136f7f245fa525da419e810" integrity sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ== -"@types/node@^18.15.11": - version "18.16.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" - integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== +"@types/node@^20.4.2": + version "20.4.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.2.tgz#129cc9ae69f93824f92fac653eebfb4812ab4af9" + integrity sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -10406,11 +10406,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lru-cache@^7.14.1: - version "7.18.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" - integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== - lru-cache@^7.4.4, lru-cache@^7.5.1: version "7.14.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.0.tgz#21be64954a4680e303a09e9468f880b98a0b3c7f" @@ -10421,6 +10416,11 @@ lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.10.1.tgz#db577f42a94c168f676b638d15da8fb073448cab" integrity sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A== +"lru-cache@^9.1.1 || ^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.0.tgz#b9e2a6a72a129d81ab317202d93c7691df727e61" + integrity sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw== + make-dir@3.1.0, make-dir@^3.0.0, make-dir@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -10863,11 +10863,16 @@ minipass@^3.1.6: dependencies: yallist "^4.0.0" -minipass@^4.0.0, minipass@^4.0.2, minipass@^4.2.4: +minipass@^4.0.0, minipass@^4.2.4: version "4.2.5" resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.5.tgz#9e0e5256f1e3513f8c34691dd68549e85b2c8ceb" integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": + version "7.0.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.2.tgz#58a82b7d81c7010da5bd4b2c0c85ac4b4ec5131e" + integrity sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA== + minizlib@^1.3.3: version "1.3.3" resolved "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz" @@ -12260,12 +12265,12 @@ path-parse@^1.0.5, path-parse@^1.0.6, path-parse@^1.0.7: integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-scurry@^1.6.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.6.3.tgz#4eba7183d64ef88b63c7d330bddc3ba279dc6c40" - integrity sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g== + version "1.10.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" + integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== dependencies: - lru-cache "^7.14.1" - minipass "^4.0.2" + lru-cache "^9.1.1 || ^10.0.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" path-to-regexp@0.1.7: version "0.1.7" From 8354bd4125f2f8f897b7bf536dd2aeb2eefcaee4 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 14 Jul 2023 16:06:37 +0200 Subject: [PATCH 09/25] Use node version 20.4 in CI --- .github/workflows/benchmark.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-browser.yml | 2 +- .github/workflows/test-e2e.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 2 +- .github/workflows/test-spec.yml | 2 +- .github/workflows/test.yml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 98842a38b026..d496e88ddc8b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 1556cd191b55..2e6d85997c40 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 - name: Node.js version id: node run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cdceb49d808a..86b64b61ae59 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index a656f8562bf3..17fbefa653df 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 registry-url: "https://registry.npmjs.org" check-latest: true - name: Node.js version diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 005d2738b1c6..4466de8c7627 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index 01e222d48e72..cb4b339d5dc8 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -60,7 +60,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index c4c478b53a07..511c28d2f655 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [20.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 25d49c64ad01..02857d88e1b3 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [20.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index a47a2a07a5a1..cac5b30805b8 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 74f19be3af99..b8970baeb4da 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index eb17c2e2babf..134547890e19 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.4 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22bef8d6c10a..d7c1bbe5f738 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [20.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 From b38bee698d1a7e05b363a395bc26c899ed231f69 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 14 Jul 2023 16:38:54 +0200 Subject: [PATCH 10/25] Revert "Use node version 20.4 in CI" --- .github/workflows/benchmark.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-browser.yml | 2 +- .github/workflows/test-e2e.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 2 +- .github/workflows/test-spec.yml | 2 +- .github/workflows/test.yml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d496e88ddc8b..98842a38b026 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 2e6d85997c40..1556cd191b55 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 - name: Node.js version id: node run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 86b64b61ae59..cdceb49d808a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 17fbefa653df..a656f8562bf3 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 registry-url: "https://registry.npmjs.org" check-latest: true - name: Node.js version diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 4466de8c7627..005d2738b1c6 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index cb4b339d5dc8..01e222d48e72 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -60,7 +60,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index 511c28d2f655..c4c478b53a07 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20.4] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 02857d88e1b3..25d49c64ad01 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20.4] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index cac5b30805b8..a47a2a07a5a1 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index b8970baeb4da..74f19be3af99 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 134547890e19..eb17c2e2babf 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20.4 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7c1bbe5f738..22bef8d6c10a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20.4] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 From d296b2f1a280189761bb6175343a43362010f881 Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 14 Jul 2023 11:28:21 -0400 Subject: [PATCH 11/25] skip tests that break in CI --- packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts index 9ab0068c06a0..cd15ebd97006 100644 --- a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts +++ b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts @@ -35,12 +35,14 @@ describe("eth1 / jsonRpcHttpClient", function () { url: `https://${randomHex}.infura.io`, error: "getaddrinfo ENOTFOUND", }, + /* { id: "Bad port", url: `http://localhost:${port + 1}`, requestListener: (req, res) => res.end(), error: "connect ECONNREFUSED", }, + */ { id: "Not a JSON RPC endpoint", requestListener: (req, res) => { @@ -192,7 +194,7 @@ describe("eth1 / jsonRpcHttpClient - with retries", function () { expect(retryCount).to.be.equal(retryAttempts, "ENOTFOUND should be retried before failing"); }); - it("should retry ECONNREFUSED", async function () { + it.skip("should retry ECONNREFUSED", async function () { let retryCount = 0; const url = `http://localhost:${port + 1}`; From e1f07be309449069312c46b696c17c8f8b9e18cb Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 14 Jul 2023 12:02:28 -0400 Subject: [PATCH 12/25] Update Dockerfile Co-authored-by: Nico Flaig --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5a9541e06f1a..cdc1de8e5298 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # --platform=$BUILDPLATFORM is used build javascript source with host arch # Otherwise TS builds on emulated archs and can be extremely slow (+1h) -FROM --platform=${BUILDPLATFORM:-amd64} node:20-alpine as build_src +FROM --platform=${BUILDPLATFORM:-amd64} node:20.4-alpine as build_src ARG COMMIT WORKDIR /usr/app RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/* From d954b96396fbdb524b8ac8896665d0eee3ba6f02 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 14 Jul 2023 18:05:54 +0200 Subject: [PATCH 13/25] Check code ECONNRESET in Lighthouse health response --- packages/cli/test/utils/simulation/cl_clients/lighthouse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts b/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts index 9b29ed856c2d..3df86eb3bbf7 100644 --- a/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts +++ b/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts @@ -107,7 +107,7 @@ export const generateLighthouseBeaconNode: CLClientGenerator Date: Fri, 14 Jul 2023 18:14:53 +0200 Subject: [PATCH 14/25] Revert "Check code ECONNRESET in Lighthouse health response" --- packages/cli/test/utils/simulation/cl_clients/lighthouse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts b/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts index 3df86eb3bbf7..9b29ed856c2d 100644 --- a/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts +++ b/packages/cli/test/utils/simulation/cl_clients/lighthouse.ts @@ -107,7 +107,7 @@ export const generateLighthouseBeaconNode: CLClientGenerator Date: Fri, 14 Jul 2023 12:18:08 -0400 Subject: [PATCH 15/25] Revert "Update Dockerfile" This reverts commit e1f07be309449069312c46b696c17c8f8b9e18cb. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cdc1de8e5298..5a9541e06f1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # --platform=$BUILDPLATFORM is used build javascript source with host arch # Otherwise TS builds on emulated archs and can be extremely slow (+1h) -FROM --platform=${BUILDPLATFORM:-amd64} node:20.4-alpine as build_src +FROM --platform=${BUILDPLATFORM:-amd64} node:20-alpine as build_src ARG COMMIT WORKDIR /usr/app RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/* From cf9f1dabcb1990355b5ceaf1a16993cab3d54bdc Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 14 Jul 2023 15:59:37 -0400 Subject: [PATCH 16/25] Revert CI from using node 20 --- .github/workflows/benchmark.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-browser.yml | 2 +- .github/workflows/test-e2e.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 2 +- .github/workflows/test-spec.yml | 2 +- .github/workflows/test.yml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 98842a38b026..d1de888472cf 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 1556cd191b55..bad86bd201b9 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 - name: Node.js version id: node run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cdceb49d808a..98b4ba2b56ee 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index a656f8562bf3..673b2ec6af92 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 registry-url: "https://registry.npmjs.org" check-latest: true - name: Node.js version diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 005d2738b1c6..07106e1945f7 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index 01e222d48e72..40f0cba82f78 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -60,7 +60,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index c4c478b53a07..c8854c1896aa 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [18] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 25d49c64ad01..d76910185489 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [18] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index a47a2a07a5a1..60cf84560766 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 74f19be3af99..1da1959a8072 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index eb17c2e2babf..58a80543303f 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22bef8d6c10a..b95fb6a44794 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [18] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 From 3f6dd7703cbbb2fee50ecc202eda46edf4936a67 Mon Sep 17 00:00:00 2001 From: Cayman Date: Fri, 14 Jul 2023 16:00:31 -0400 Subject: [PATCH 17/25] Revert "skip tests that break in CI" This reverts commit d296b2f1a280189761bb6175343a43362010f881. --- packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts index cd15ebd97006..9ab0068c06a0 100644 --- a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts +++ b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts @@ -35,14 +35,12 @@ describe("eth1 / jsonRpcHttpClient", function () { url: `https://${randomHex}.infura.io`, error: "getaddrinfo ENOTFOUND", }, - /* { id: "Bad port", url: `http://localhost:${port + 1}`, requestListener: (req, res) => res.end(), error: "connect ECONNREFUSED", }, - */ { id: "Not a JSON RPC endpoint", requestListener: (req, res) => { @@ -194,7 +192,7 @@ describe("eth1 / jsonRpcHttpClient - with retries", function () { expect(retryCount).to.be.equal(retryAttempts, "ENOTFOUND should be retried before failing"); }); - it.skip("should retry ECONNREFUSED", async function () { + it("should retry ECONNREFUSED", async function () { let retryCount = 0; const url = `http://localhost:${port + 1}`; From f716f640dd1717c5b883d396bc3eebbc91a95bc5 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Sat, 15 Jul 2023 23:03:23 +0200 Subject: [PATCH 18/25] Fix the loader for few sim tests --- packages/cli/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 793bec1a57e9..c966fbfffd94 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -34,9 +34,9 @@ "test:unit": "nyc --cache-dir .nyc_output/.cache -e .ts mocha 'test/unit/**/*.test.ts'", "test:e2e": "mocha --timeout 30000 'test/e2e/**/*.test.ts'", "test:sim:multifork": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/multi_fork.test.ts", - "test:sim:endpoints": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/endpoints.test.ts", - "test:sim:deneb": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/deneb.test.ts", - "test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal node ts-node/esm test/sim/backup_eth_provider.test.ts", + "test:sim:endpoints": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/endpoints.test.ts", + "test:sim:deneb": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/deneb.test.ts", + "test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/backup_eth_provider.test.ts", "test": "yarn test:unit && yarn test:e2e", "coverage": "codecov -F lodestar", "check-readme": "typescript-docs-verifier" From 2e115d092ba0fe13eca2f5a22ac98c651824cadf Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Sat, 15 Jul 2023 23:25:22 +0200 Subject: [PATCH 19/25] Update CI node version to 20 --- .github/workflows/test-browser.yml | 2 +- .github/workflows/test-e2e.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index c8854c1896aa..c4c478b53a07 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index d76910185489..25d49c64ad01 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b95fb6a44794..22bef8d6c10a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [18] + node: [20] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v3 From 49df2c23399cad2f64a7d04866ea75341c6b2632 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Sun, 16 Jul 2023 00:23:18 +0200 Subject: [PATCH 20/25] Fix e2e test --- .../test/e2e/eth1/jsonRpcHttpClient.test.ts | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts index 9ab0068c06a0..fdaeda8081cf 100644 --- a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts +++ b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts @@ -6,6 +6,10 @@ import {JsonRpcHttpClient} from "../../../src/eth1/provider/jsonRpcHttpClient.js import {getGoerliRpcUrl} from "../../testParams.js"; import {RpcPayload} from "../../../src/eth1/interface.js"; +type FetchError = { + code: string; +}; + describe("eth1 / jsonRpcHttpClient", function () { this.timeout("10 seconds"); @@ -22,6 +26,7 @@ describe("eth1 / jsonRpcHttpClient", function () { abort?: true; timeout?: number; error: any; + errorCode?: string; }[] = [ // // NOTE: This DNS query is very expensive, all cache miss. So it can timeout the tests and cause false positives // { @@ -39,7 +44,8 @@ describe("eth1 / jsonRpcHttpClient", function () { id: "Bad port", url: `http://localhost:${port + 1}`, requestListener: (req, res) => res.end(), - error: "connect ECONNREFUSED", + error: "", + errorCode: "ECONNREFUSED", }, { id: "Not a JSON RPC endpoint", @@ -122,7 +128,6 @@ describe("eth1 / jsonRpcHttpClient", function () { for (const testCase of testCases) { const {id, requestListener, abort, timeout} = testCase; - const error = testCase.error as Error; let {url, payload} = testCase; it(id, async function () { @@ -148,7 +153,16 @@ describe("eth1 / jsonRpcHttpClient", function () { const controller = new AbortController(); if (abort) setTimeout(() => controller.abort(), 50); const eth1JsonRpcClient = new JsonRpcHttpClient([url], {signal: controller.signal}); - await expect(eth1JsonRpcClient.fetch(payload, {timeout})).to.be.rejectedWith(error); + + try { + await eth1JsonRpcClient.fetch(payload, {timeout}); + } catch (error) { + if (testCase.errorCode) { + expect((error as FetchError).code).to.eql(testCase.errorCode); + } else { + expect((error as Error).message).includes(testCase.error); + } + } }); } }); @@ -201,16 +215,18 @@ describe("eth1 / jsonRpcHttpClient - with retries", function () { const controller = new AbortController(); const eth1JsonRpcClient = new JsonRpcHttpClient([url], {signal: controller.signal}); - await expect( - eth1JsonRpcClient.fetchWithRetries(payload, { + try { + await eth1JsonRpcClient.fetchWithRetries(payload, { retryAttempts, shouldRetry: () => { // using the shouldRetry function to keep tab of the retried requests retryCount++; return true; }, - }) - ).to.be.rejectedWith("connect ECONNREFUSED"); + }); + } catch (error) { + expect((error as FetchError).code).eql("ECONNREFUSED"); + } expect(retryCount).to.be.equal(retryAttempts, "connect ECONNREFUSED should be retried before failing"); }); From 2925e87583c50c0896f42b402cd2555d45dfbdde Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 16 Jul 2023 12:59:20 +0200 Subject: [PATCH 21/25] Remove try/catch from e2e test --- .../test/e2e/eth1/jsonRpcHttpClient.test.ts | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts index fdaeda8081cf..6de1cebf6fc8 100644 --- a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts +++ b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts @@ -153,16 +153,13 @@ describe("eth1 / jsonRpcHttpClient", function () { const controller = new AbortController(); if (abort) setTimeout(() => controller.abort(), 50); const eth1JsonRpcClient = new JsonRpcHttpClient([url], {signal: controller.signal}); - - try { - await eth1JsonRpcClient.fetch(payload, {timeout}); - } catch (error) { + await expect(eth1JsonRpcClient.fetch(payload, {timeout})).to.be.rejected.then((error) => { if (testCase.errorCode) { - expect((error as FetchError).code).to.eql(testCase.errorCode); + expect((error as FetchError).code).to.be.equal(testCase.errorCode); } else { - expect((error as Error).message).includes(testCase.error); + expect((error as Error).message).to.include(testCase.error); } - } + }); }); } }); @@ -215,19 +212,19 @@ describe("eth1 / jsonRpcHttpClient - with retries", function () { const controller = new AbortController(); const eth1JsonRpcClient = new JsonRpcHttpClient([url], {signal: controller.signal}); - try { - await eth1JsonRpcClient.fetchWithRetries(payload, { + await expect( + eth1JsonRpcClient.fetchWithRetries(payload, { retryAttempts, shouldRetry: () => { // using the shouldRetry function to keep tab of the retried requests retryCount++; return true; }, - }); - } catch (error) { - expect((error as FetchError).code).eql("ECONNREFUSED"); - } - expect(retryCount).to.be.equal(retryAttempts, "connect ECONNREFUSED should be retried before failing"); + }) + ).to.be.rejected.then((error) => { + expect((error as FetchError).code).to.be.equal("ECONNREFUSED"); + }); + expect(retryCount).to.be.equal(retryAttempts, "code ECONNREFUSED should be retried before failing"); }); it("should retry 404", async function () { From 0190311719c800fed516477255958f70a00f2733 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 16 Jul 2023 13:03:20 +0200 Subject: [PATCH 22/25] Consistently use node 20 in CI --- .github/workflows/benchmark.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 2 +- .github/workflows/test-spec.yml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d1de888472cf..98842a38b026 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index bad86bd201b9..1556cd191b55 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - name: Node.js version id: node run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 98b4ba2b56ee..cdceb49d808a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 673b2ec6af92..a656f8562bf3 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 registry-url: "https://registry.npmjs.org" check-latest: true - name: Node.js version diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 07106e1945f7..005d2738b1c6 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index 40f0cba82f78..01e222d48e72 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -60,7 +60,7 @@ jobs: fetch-depth: 0 # Needs full depth for changelog generation - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index 60cf84560766..a47a2a07a5a1 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 1da1959a8072..74f19be3af99 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 58a80543303f..eb17c2e2babf 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 check-latest: true - name: Node.js version id: node From 7744f8f33466469a58e7638bbc7ba10038e92771 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 16 Jul 2023 13:04:06 +0200 Subject: [PATCH 23/25] Fix missed 18.x reference in types readme --- packages/types/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/types/README.md b/packages/types/README.md index 0c668490bb18..9cd1f020a44d 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Eth Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) > This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project From 3ae47c468936c444463509f5da198ce25a8a1ced Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 16 Jul 2023 13:07:08 +0200 Subject: [PATCH 24/25] Set node 20.x in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index abfcb754e26d..9eeeb12ef43e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Ethereum Consensus Spec v1.1.10](https://img.shields.io/badge/ETH%20consensus--spec-1.1.10-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.10) [![codecov](https://codecov.io/gh/ChainSafe/lodestar/branch/unstable/graph/badge.svg)](https://codecov.io/gh/ChainSafe/lodestar) ![ES Version](https://img.shields.io/badge/ES-2020-yellow) -![Node Version](https://img.shields.io/badge/node-18.15.x-green) +![Node Version](https://img.shields.io/badge/node-20.x-green) [![gitpoap badge](https://public-api.gitpoap.io/v1/repo/ChainSafe/lodestar/badge)](https://www.gitpoap.io/gh/ChainSafe/lodestar) [Lodestar](https://lodestar.chainsafe.io) is a TypeScript implementation of the [Ethereum Consensus specification](https://github.com/ethereum/consensus-specs) developed by [ChainSafe Systems](https://chainsafe.io). From 18872876dd61793700710a9b47a2a80dfee920ab Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 16 Jul 2023 13:34:21 +0200 Subject: [PATCH 25/25] Use node 18 in sim tests --- .github/workflows/test-sim.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 74f19be3af99..1da1959a8072 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 check-latest: true - name: Node.js version id: node