diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 64937957191..72af86de75b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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": {} diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index efb9e0231e2..e515bef7f92 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -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 diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 83bd63caf54..9d4e9de6264 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -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 caxa@3.0.1 diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 9ad566c417e..021e5019760 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 61a9f0eba3d..b8f4e7b95eb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 check-latest: true cache: yarn diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index e38abd9e68d..da045764dd4 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@v4 with: - node-version: 20 + node-version: 22 registry-url: "https://registry.npmjs.org" check-latest: true cache: yarn diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 7132ce19404..35831822bcd 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -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 diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index dc5018cd2cb..741c060e4d2 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -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 diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index bd957c596a4..ad79bc2c003 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -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 diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index 0a00777bfec..ff28149537d 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 046cbe1f3cc..f55eb661629 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -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" @@ -74,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [22] steps: - uses: actions/checkout@v4 @@ -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" @@ -134,7 +134,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -171,7 +171,7 @@ jobs: strategy: fail-fast: false matrix: - node: [20] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -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" diff --git a/.wordlist.txt b/.wordlist.txt index 3af9d860c6d..5f0f7136456 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -62,6 +62,7 @@ Lerna MEV MacOS Metamask +ModuleNotFoundError Monorepo NPM NVM @@ -125,6 +126,7 @@ devcontainer devnet devnets devtools +distutils eg enodes enum diff --git a/Dockerfile b/Dockerfile index f7d654bfb70..2a1a2d1a2c8 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:22-alpine as build_src ARG COMMIT WORKDIR /usr/app RUN apk update && apk add --no-cache g++ make python3 py3-setuptools && 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: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/* @@ -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 . diff --git a/README.md b/README.md index be74ef7d950..8546a467f40 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/pages/getting-started/installation.md b/docs/pages/getting-started/installation.md index 7630f031dda..cf53916e054 100644 --- a/docs/pages/getting-started/installation.md +++ b/docs/pages/getting-started/installation.md @@ -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. @@ -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 diff --git a/docs/pages/tools/core-dumps.md b/docs/pages/tools/core-dumps.md index 21f2e6a08f5..519e018e7ca 100644 --- a/docs/pages/tools/core-dumps.md +++ b/docs/pages/tools/core-dumps.md @@ -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) ``` @@ -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) ``` diff --git a/docs/pages/tools/heap-dumps.md b/docs/pages/tools/heap-dumps.md index 7e6bcfeda66..97f2be51dfa 100644 --- a/docs/pages/tools/heap-dumps.md +++ b/docs/pages/tools/heap-dumps.md @@ -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 diff --git a/package.json b/package.json index 8179d65a925..4bd777f5c0c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "root", "private": true, "engines": { - "node": ">=20.1.0 <21" + "node": ">=20.1.0 <21 || >=22 <23" }, "workspaces": [ "packages/*" @@ -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", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", "@vitest/browser": "^1.6.0", @@ -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" } } diff --git a/packages/api/README.md b/packages/api/README.md index 16596e91b31..39d7098d60c 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-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 diff --git a/packages/beacon-node/README.md b/packages/beacon-node/README.md index 4406973f3c1..92e3f38787b 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.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 diff --git a/packages/params/README.md b/packages/params/README.md index 5be334f7bc1..730b27276f0 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.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 diff --git a/packages/prover/README.md b/packages/prover/README.md index 4a0e5f96f76..b377448a172 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-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 diff --git a/packages/reqresp/README.md b/packages/reqresp/README.md index 8298a15187a..dbfbf304c54 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-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 diff --git a/packages/types/README.md b/packages/types/README.md index 500b75225b8..749f93321d3 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.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 diff --git a/packages/validator/README.md b/packages/validator/README.md index a7232549f76..b29972acf8a 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.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 diff --git a/yarn.lock b/yarn.lock index d2699f1afbc..db687875f6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3010,10 +3010,10 @@ dependencies: undici-types "~5.26.4" -"@types/node@^20.11.28": - version "20.11.28" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.28.tgz#4fd5b2daff2e580c12316e457473d68f15ee6f66" - integrity sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA== +"@types/node@^20.12.8": + version "20.12.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.8.tgz#35897bf2bfe3469847ab04634636de09552e8256" + integrity sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w== dependencies: undici-types "~5.26.4" @@ -9450,10 +9450,10 @@ n12@0.4.0: resolved "https://registry.yarnpkg.com/n12/-/n12-0.4.0.tgz#363058560b435e6857b5e039ed5eab08c5122e5e" integrity sha512-p/hj4zQ8d3pbbFLQuN1K9honUxiDDhueOWyFLw/XgBv+wZCE44bcLH4CIcsolOceJQduh4Jf7m/LfaTxyGmGtQ== -nan@^2.16.0, nan@^2.17.0: - version "2.17.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" - integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== +nan@^2.16.0, nan@^2.17.0, nan@^2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0" + integrity sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw== nanoid@3.3.3: version "3.3.3"