Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: use node v20 throughout monorepo #5730

Merged
merged 27 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4c1616b
chore!: use node 20 throughout monorepo
wemeetagain Jul 5, 2023
a899503
Add yarn.lock
wemeetagain Jul 6, 2023
6ce7718
Revert @types/node change
wemeetagain Jul 6, 2023
9ff2e2a
Fix ts-node usage
wemeetagain Jul 6, 2023
1d5c3c1
Add missed files
wemeetagain Jul 7, 2023
c153a27
Merge branch 'unstable' into cayman/node-20
wemeetagain Jul 7, 2023
7b70892
Remove more ts-node-esm
wemeetagain Jul 7, 2023
84e44b8
Update cross-fetch dependency
wemeetagain Jul 11, 2023
9494c71
Merge branch 'unstable' into cayman/update-libp2p
wemeetagain Jul 11, 2023
0c47758
Update @types/node to 20.4.2
nflaig Jul 14, 2023
8354bd4
Use node version 20.4 in CI
nflaig Jul 14, 2023
b38bee6
Revert "Use node version 20.4 in CI"
nflaig Jul 14, 2023
d296b2f
skip tests that break in CI
wemeetagain Jul 14, 2023
e1f07be
Update Dockerfile
wemeetagain Jul 14, 2023
d954b96
Check code ECONNRESET in Lighthouse health response
nflaig Jul 14, 2023
409d8ad
Revert "Check code ECONNRESET in Lighthouse health response"
nflaig Jul 14, 2023
cfcc70e
Revert "Update Dockerfile"
wemeetagain Jul 14, 2023
cf9f1da
Revert CI from using node 20
wemeetagain Jul 14, 2023
3f6dd77
Revert "skip tests that break in CI"
wemeetagain Jul 14, 2023
f716f64
Fix the loader for few sim tests
nazarhussain Jul 15, 2023
2e115d0
Update CI node version to 20
nazarhussain Jul 15, 2023
49df2c2
Fix e2e test
nazarhussain Jul 15, 2023
2925e87
Remove try/catch from e2e test
nflaig Jul 16, 2023
0190311
Consistently use node 20 in CI
nflaig Jul 16, 2023
7744f8f
Fix missed 18.x reference in types readme
nflaig Jul 16, 2023
3ae47c4
Set node 20.x in readme
nflaig Jul 16, 2023
1887287
Use node 18 in sim tests
nflaig Jul 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18]
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18]
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sim-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18]
node: [20]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
nflaig marked this conversation as resolved.
Show resolved Hide resolved
ARG COMMIT
WORKDIR /usr/app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
Expand All @@ -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/*

Expand All @@ -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 .

Expand Down
2 changes: 1 addition & 1 deletion docs/install/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: v20 is not yet LTS version until 2023-10-24, see nodejs-release-working-group for schedule


<!-- prettier-ignore-start -->
!!! info
Expand Down
2 changes: 1 addition & 1 deletion packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
13 changes: 6 additions & 7 deletions packages/cli/test/utils/childprocRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -133,8 +132,8 @@ export function bufferStderr(proc: child_process.ChildProcessWithoutNullStreams)

export function execCli(lodestarArgs: string[], opts?: ShellOpts): Promise<string> {
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});
Expand Down
2 changes: 1 addition & 1 deletion packages/params/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions packages/params/test/e2e/overridePreset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`);

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).
});

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(

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).
"Lodestar preset is already frozen"
);
});
Expand Down
5 changes: 2 additions & 3 deletions packages/params/test/e2e/setPreset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`);

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).
});

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(

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).
"Lodestar preset is already frozen"
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/prover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/reqresp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_e2e_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3670,9 +3670,9 @@
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==
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"
Expand Down