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: update nodejs to latest 22 #6729

Merged
merged 13 commits into from
May 24, 2024
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// Upgrade the container to Node 22
// https://github.com/ChainSafe/lodestar/issues/6742
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
"features": {
"ghcr.io/devcontainers/features/python:1": {}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn
- name: Node.js version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
sudo apt-get install -y build-essential
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- run: |
mkdir -p dist
yarn global add [email protected]
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@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: yarn
- name: Node.js version
id: node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn

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@v4
with:
node-version: 20
node-version: 22
registry-url: "https://registry.npmjs.org"
check-latest: true
cache: yarn
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 @@ -61,7 +61,7 @@ jobs:

- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

- name: Generate changelog
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md
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 @@ -67,7 +67,7 @@ jobs:

- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

- name: Generate changelog
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md
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 @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn
- name: Node.js version
Expand Down
12 changes: 6 additions & 6 deletions .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@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

sim-test-multifork:
name: Multifork sim test
Expand All @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down
14 changes: 7 additions & 7 deletions .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: [20]
node: [22]
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we wanna run unit tests against both versions, might be too expensive though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had been running tests for latest version only. If we had earlier [18, 20] then would make more sense to replace one version.

steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
Expand All @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
- uses: actions/checkout@v4

Expand All @@ -95,7 +95,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
Expand All @@ -195,7 +195,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down
2 changes: 2 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Lerna
MEV
MacOS
Metamask
ModuleNotFoundError
Monorepo
NPM
NVM
Expand Down Expand Up @@ -125,6 +126,7 @@ devcontainer
devnet
devnets
devtools
distutils
eg
enodes
enum
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:20-alpine as build_src
FROM --platform=${BUILDPLATFORM:-amd64} node:22-alpine as build_src
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:20-alpine as build_deps
FROM node:22-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:20-alpine
FROM node:22-alpine
WORKDIR /usr/app
COPY --from=build_deps /usr/app .

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/chainsafe/lodestar?color=blue&label=Docker&sort=semver)](https://hub.docker.com/r/chainsafe/lodestar)
[![Eth Consensus Spec v1.4.0](https://img.shields.io/badge/ETH%20consensus--spec-1.4.0-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0)
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.x-green)
[![codecov](https://codecov.io/gh/ChainSafe/lodestar/graph/badge.svg)](https://codecov.io/gh/ChainSafe/lodestar)
[![gitpoap badge](https://public-api.gitpoap.io/v1/repo/ChainSafe/lodestar/badge)](https://www.gitpoap.io/gh/ChainSafe/lodestar)

Expand Down
12 changes: 11 additions & 1 deletion docs/pages/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Docker is the recommended setup for Lodestar. Use our [Lodestar Quickstart scrip

### 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 v20) 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 v22) of [NodeJS](https://nodejs.org/en/).

:::info
NodeJS versions older than the current LTS are not supported by Lodestar. We recommend running the latest Node LTS.
Expand Down Expand Up @@ -83,6 +83,16 @@ Lodestar should now be ready for use.

See [Command Line Reference](./../reference/cli.md) for further information.

### Known Issues

**ModuleNotFoundError: No module named 'distutils'**

If you stump upon this issue while running Yarn, it's because Python 3.12 had removed `distutils` package. That package is required for node build tool. You can install it with following command.

```bash
pip3 install setuptools --force-reinstall --user
```

## Install from NPM [not recommended]

:::danger
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/tools/core-dumps.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ which llvm-config
/opt/homebrew/opt/llvm/bin/llvm-config # if this is not what comes up restart the shell
$ npm install -g llnode
$ llnode
(lldb) plugin load '/Users/ninja_user/.nvm/versions/node/v20.5.1/lib/node_modules/llnode/llnode.dylib'
(lldb) plugin load '/Users/ninja_user/.nvm/versions/node/v22.1.0/lib/node_modules/llnode/llnode.dylib'
(lldb) settings set prompt '(llnode) '
(llnode)
```
Expand Down Expand Up @@ -58,7 +58,7 @@ Once you collect the core dump you can load it into `llnode` for debugging.
$ llnode -f /path/to/node_debug -c /Users/ninja_user/coredumps/node.coredump
(lldb) target create "node_debug" --core "node.coredump"
Core file '/Users/ninja_user/coredumps/node.coredump' (x86_64) was loaded.
(lldb) plugin load '/Users/ninja_user/.nvm/versions/node/v20.5.1/lib/node_modules/llnode/llnode.dylib'
(lldb) plugin load '/Users/ninja_user/.nvm/versions/node/v22.1.0/lib/node_modules/llnode/llnode.dylib'
(lldb) settings set prompt '(llnode) '
(llnode)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/tools/heap-dumps.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ $ git clone https://github.com/nodejs/node.git
$ cd node

# Use whichever version of node you prefer
$ git checkout v20.10.0
$ git checkout v22.1.0
$ ./configure --debug

# This command only builds the debug version of node and assumes
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "root",
"private": true,
"engines": {
"node": ">=20.1.0 <21"
"node": ">=20.1.0 <21 || >=22 <23"
},
"workspaces": [
"packages/*"
Expand Down Expand Up @@ -48,7 +48,7 @@
"@chainsafe/eslint-plugin-node": "^11.2.3",
"@dapplion/benchmark": "^0.2.4",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.28",
"@types/node": "^20.12.8",
wemeetagain marked this conversation as resolved.
Show resolved Hide resolved
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitest/browser": "^1.6.0",
Expand Down Expand Up @@ -91,6 +91,7 @@
"@puppeteer/browsers": "^2.1.0",
"dns-over-http-resolver": "^2.1.1",
"loupe": "^2.3.6",
"vite": "^5.2.11"
"vite": "^5.2.11",
"testcontainers/**/nan": "^2.19.0"
}
}
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-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.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.4.0](https://img.shields.io/badge/ETH%20consensus--spec-1.4.0-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0)
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.x-green)

> This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project
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.4.0](https://img.shields.io/badge/ETH%20consensus--spec-1.4.0-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0)
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.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/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-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.x-green)

> This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project
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-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.x-green)

> This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project
Expand Down
2 changes: 1 addition & 1 deletion packages/types/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.4.0](https://img.shields.io/badge/ETH%20consensus--spec-1.4.0-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0)
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.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.4.0](https://img.shields.io/badge/ETH%20consensus--spec-1.4.0-blue)](https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0)
![ES Version](https://img.shields.io/badge/ES-2021-yellow)
![Node Version](https://img.shields.io/badge/node-20.x-green)
![Node Version](https://img.shields.io/badge/node-22.x-green)

> This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project
Expand Down
Loading
Loading