Skip to content

Commit

Permalink
Merge branch 'unstable' into devnet-5
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Dec 6, 2024
2 parents bec4c00 + dad9037 commit 1873e97
Show file tree
Hide file tree
Showing 47 changed files with 446 additions and 127 deletions.
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: 22.4
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 python3
- uses: "./.github/actions/setup-and-build"
with:
node: 22.4
node: 22
- run: |
mkdir -p dist
yarn global add caxa@3.0.1
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: 22.4
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: [22.4]
node: [22]
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: [22.4]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [22.4]
node: [22]
steps:
- uses: actions/checkout@v4

Expand All @@ -92,7 +92,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [22.4]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [22.4]
node: [22]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [22.4]
node: [22]
steps:
# <common-build> - Uses YAML anchors in the future
- uses: actions/checkout@v4
Expand All @@ -192,7 +192,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [22.4]
node: [22]
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ docs/pages/libraries/lightclient-prover/lightclient.md
docs/pages/libraries/lightclient-prover/prover.md
docs/pages/api/api-reference.md
docs/pages/contribution/getting-started.md
docs/static/install
## Docusaurus
docs/.docusaurus/
docs/build/
Expand Down
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"window.title": "${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}[${activeRepositoryBranchName}]",
"editor.defaultFormatter": "esbenp.prettier-vscode",
// For `sysoev.vscode-open-in-github` extension
"openInGitHub.defaultBranch": "unstable",
"editor.formatOnSave": true,
Expand All @@ -18,5 +17,11 @@
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
}
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
2 changes: 2 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Vitalik
Vitest
Wagyu
api
args
async
backfill
beaconcha
Expand Down Expand Up @@ -244,3 +245,4 @@ xRelayPubKey
xcode
yaml
yamux
yml
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:22.4-slim AS build_src
FROM --platform=${BUILDPLATFORM:-amd64} node:22-slim AS build_src
ARG COMMIT
WORKDIR /usr/app
RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/*
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:22.4-slim AS build_deps
FROM node:22-slim AS build_deps
WORKDIR /usr/app
RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/*

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:22.4-slim
FROM node:22-slim
WORKDIR /usr/app
COPY --from=build_deps /usr/app .

Expand Down
6 changes: 6 additions & 0 deletions docs/pages/run/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

Binaries can be downloaded from the Lodestar [release page](https://github.com/ChainSafe/lodestar/releases/latest) under the `Assets` section.

Run the following command to install the latest version

```bash
curl -fsSL https://chainsafe.github.io/lodestar/install | bash
```

## Docker Installation

The [`chainsafe/lodestar`](https://hub.docker.com/r/chainsafe/lodestar) Docker Hub repository is maintained actively. It contains the `lodestar` CLI preinstalled.
Expand Down
41 changes: 40 additions & 1 deletion packages/api/src/beacon/routes/lodestar.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import {ContainerType, ValueOf} from "@chainsafe/ssz";
import {ChainForkConfig} from "@lodestar/config";
import {Epoch, RootHex, Slot} from "@lodestar/types";
import {Epoch, RootHex, Slot, ssz} from "@lodestar/types";
import {
ArrayOf,
EmptyArgs,
EmptyMeta,
EmptyMetaCodec,
EmptyRequest,
EmptyRequestCodec,
EmptyResponseCodec,
EmptyResponseData,
JsonOnlyResponseCodec,
} from "../../utils/codecs.js";
import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js";
import {StateArgs} from "./beacon/state.js";
import {FilterGetPeers, NodePeer, PeerDirection, PeerState} from "./node.js";

// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes
Expand Down Expand Up @@ -75,6 +79,16 @@ export type LodestarNodePeer = NodePeer & {

export type LodestarThreadType = "main" | "network" | "discv5";

const HistoricalSummariesResponseType = new ContainerType(
{
historicalSummaries: ssz.capella.HistoricalSummaries,
proof: ArrayOf(ssz.Bytes8),
},
{jsonCase: "eth2"}
);

export type HistoricalSummariesResponse = ValueOf<typeof HistoricalSummariesResponseType>;

export type Endpoints = {
/** Trigger to write a heapdump to disk at `dirpath`. May take > 1min */
writeHeapdump: Endpoint<
Expand Down Expand Up @@ -214,6 +228,16 @@ export type Endpoints = {
{count: number}
>;

/** Returns historical summaries and proof for a given state ID */
getHistoricalSummaries: Endpoint<
// ⏎
"GET",
StateArgs,
{params: {state_id: string}},
HistoricalSummariesResponse,
EmptyMeta
>;

/** Dump Discv5 Kad values */
discv5GetKadValues: Endpoint<
// ⏎
Expand Down Expand Up @@ -365,6 +389,21 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
},
resp: JsonOnlyResponseCodec,
},
getHistoricalSummaries: {
url: "/eth/v1/lodestar/historical_summaries/{state_id}",
method: "GET",
req: {
writeReq: ({stateId}) => ({params: {state_id: stateId.toString()}}),
parseReq: ({params}) => ({stateId: params.state_id}),
schema: {
params: {state_id: Schema.StringRequired},
},
},
resp: {
data: HistoricalSummariesResponseType,
meta: EmptyMetaCodec,
},
},
discv5GetKadValues: {
url: "/eth/v1/debug/discv5_kad_values",
method: "GET",
Expand Down
Loading

0 comments on commit 1873e97

Please sign in to comment.