Skip to content

Commit 5f2cf3c

Browse files
authored
chore: v1.33.0 release (#8100)
2 parents 8f56b55 + 7afce97 commit 5f2cf3c

File tree

80 files changed

+1558
-880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1558
-880
lines changed

.github/workflows/test-bun.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Bun Tests
2+
# only one can run at a time
3+
concurrency:
4+
# If PR, cancel prev commits. head_ref = source branch name on pull_request, null if push
5+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
# We intentionally don't run push on feature branches. See PR for rational.
11+
branches: [unstable, stable]
12+
pull_request:
13+
workflow_dispatch:
14+
15+
jobs:
16+
unit-tests-bun:
17+
name: Unit Tests (Bun)
18+
runs-on: buildjet-4vcpu-ubuntu-2204
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
cache: yarn
26+
- uses: oven-sh/setup-bun@v2
27+
with:
28+
bun-version: latest
29+
- name: Install Yarn
30+
run: bun install -g npm:yarn
31+
- name: Install
32+
run: yarn install --frozen-lockfile
33+
- name: Build
34+
run: yarn build
35+
- name: Unit Tests
36+
# These packages are not testable yet in Bun because of `@chainsafe/blst` dependency.
37+
run: excluded=(beacon-node prover light-client cli); for pkg in packages/*/; do [[ ! " ${excluded[@]} " =~ " $(basename "$pkg") " ]] && echo "Testing $(basename "$pkg")" && (cd "$pkg" && bun run --bun test:unit); done
38+
shell: bash

configs/vitest.config.browser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import path from "node:path";
44
import {nodePolyfills} from "vite-plugin-node-polyfills";
5-
import topLevelAwait from "vite-plugin-top-level-await";
65
import {defineProject} from "vitest/config";
76
import {blsBrowserPlugin} from "../scripts/vite/plugins/blsBrowserPlugin.js";
87

8+
const isBun = "bun" in process.versions;
9+
910
export const browserTestProject = defineProject({
1011
test: {
1112
name: "browser",
@@ -47,7 +48,10 @@ export const browserTestProject = defineProject({
4748
},
4849
},
4950
plugins: [
50-
topLevelAwait(),
51+
// Bun does allow commonjs to be in pipeline and `vite-plugin-top-level-await` is using it
52+
// So we convert it to the dynamic import so bun unit tests does not load these
53+
// when the `import` called on top of the config file
54+
...(isBun ? [] : [import("vite-plugin-top-level-await").then((p) => p.default())]),
5155
blsBrowserPlugin(),
5256
nodePolyfills({
5357
include: ["buffer", "process", "util", "string_decoder", "url", "querystring", "events"],

configs/vitest.config.unit.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ const setupFiles = [
77
path.join(import.meta.dirname, "../scripts/vitest/setupFiles/lodestarPreset.ts"),
88
];
99

10+
const isBun = "bun" in process.versions;
11+
1012
export const unitTestMinimalProject = defineProject({
1113
test: {
1214
name: "unit-minimal",
1315
include: ["**/test/unit-minimal/**/*.test.ts"],
1416
setupFiles,
15-
pool: "forks",
17+
// Current vitest `forks` pool is not yet supported with Bun
18+
// so we conditionally switch to our custom pool which run tests in main process
19+
pool: isBun ? "vitest-in-process-pool" : "forks",
20+
poolOptions: {
21+
forks: isBun ? {singleFork: true} : {},
22+
},
1623
env: {
1724
LODESTAR_PRESET: "minimal",
1825
},
@@ -32,7 +39,12 @@ export const unitTestMainnetProject = defineProject({
3239
// for now I tried to identify such tests an increase the limit a bit higher
3340
testTimeout: 20_000,
3441
hookTimeout: 20_000,
35-
pool: "forks",
42+
// Current vitest `forks` pool is not yet supported with Bun
43+
// so we conditionally switch to our custom pool which run tests in main process
44+
pool: isBun ? "vitest-in-process-pool" : "forks",
45+
poolOptions: {
46+
forks: isBun ? {singleFork: true} : {},
47+
},
3648
env: {
3749
LODESTAR_PRESET: "mainnet",
3850
},

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
],
55
"npmClient": "yarn",
66
"useNx": true,
7-
"version": "1.32.0",
7+
"version": "1.33.0",
88
"stream": true,
99
"command": {
1010
"version": {

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
"@chainsafe/biomejs-config": "^0.1.2",
4747
"@biomejs/biome": "^1.9.4",
4848
"@types/node": "^20.12.8",
49-
"@vitest/browser": "^3.0.6",
50-
"@vitest/coverage-v8": "^3.0.6",
49+
"@vitest/browser": "3.0.9",
50+
"@vitest/coverage-v8": "3.0.9",
5151
"crypto-browserify": "^3.12.0",
5252
"dotenv": "^16.4.5",
5353
"electron": "^26.2.2",
5454
"https-browserify": "^1.0.0",
5555
"jsdom": "^23.0.1",
5656
"lerna": "^7.3.0",
57-
"libp2p": "2.8.2",
57+
"libp2p": "2.9.0",
5858
"node-gyp": "^9.4.0",
5959
"npm-run-all": "^4.1.5",
6060
"path-browserify": "^1.0.1",
@@ -71,14 +71,16 @@
7171
"vite-plugin-dts": "^4.5.0",
7272
"vite-plugin-node-polyfills": "^0.23.0",
7373
"vite-plugin-top-level-await": "^1.5.0",
74-
"vitest": "^3.0.6",
75-
"vitest-when": "^0.6.0",
74+
"vitest": "3.0.9",
75+
"vitest-in-process-pool": "2.0.1",
76+
"vitest-when": "^0.6.1",
7677
"wait-port": "^1.1.0",
7778
"webdriverio": "^9.7.2"
7879
},
7980
"resolutions": {
8081
"dns-over-http-resolver": "^2.1.1",
8182
"loupe": "^2.3.6",
82-
"testcontainers/**/nan": "^2.19.0"
83+
"testcontainers/**/nan": "^2.19.0",
84+
"vitest": "3.0.9"
8385
}
8486
}

packages/api/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bugs": {
1212
"url": "https://github.com/ChainSafe/lodestar/issues"
1313
},
14-
"version": "1.32.0",
14+
"version": "1.33.0",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -72,10 +72,10 @@
7272
"dependencies": {
7373
"@chainsafe/persistent-merkle-tree": "^1.2.0",
7474
"@chainsafe/ssz": "^1.2.1",
75-
"@lodestar/config": "^1.32.0",
76-
"@lodestar/params": "^1.32.0",
77-
"@lodestar/types": "^1.32.0",
78-
"@lodestar/utils": "^1.32.0",
75+
"@lodestar/config": "^1.33.0",
76+
"@lodestar/params": "^1.33.0",
77+
"@lodestar/types": "^1.33.0",
78+
"@lodestar/utils": "^1.33.0",
7979
"eventsource": "^2.0.2",
8080
"qs": "^6.11.1"
8181
},

packages/api/src/builder/routes.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ export type Endpoints = {
7575
ExecutionPayload | ExecutionPayloadAndBlobsBundle,
7676
VersionMeta
7777
>;
78+
79+
submitBlindedBlockV2: Endpoint<
80+
"POST",
81+
{signedBlindedBlock: WithOptionalBytes<SignedBlindedBeaconBlock>},
82+
{body: unknown; headers: {[MetaHeader.Version]: string}},
83+
EmptyResponseData,
84+
EmptyMeta
85+
>;
7886
};
7987

8088
export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoints> {
@@ -173,5 +181,48 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
173181
meta: VersionCodec,
174182
},
175183
},
184+
submitBlindedBlockV2: {
185+
url: "/eth/v2/builder/blinded_blocks",
186+
method: "POST",
187+
req: {
188+
writeReqJson: ({signedBlindedBlock}) => {
189+
const fork = config.getForkName(signedBlindedBlock.data.message.slot);
190+
return {
191+
body: getPostBellatrixForkTypes(fork).SignedBlindedBeaconBlock.toJson(signedBlindedBlock.data),
192+
headers: {
193+
[MetaHeader.Version]: fork,
194+
},
195+
};
196+
},
197+
parseReqJson: ({body, headers}) => {
198+
const fork = toForkName(fromHeaders(headers, MetaHeader.Version));
199+
return {
200+
signedBlindedBlock: {data: getPostBellatrixForkTypes(fork).SignedBlindedBeaconBlock.fromJson(body)},
201+
};
202+
},
203+
writeReqSsz: ({signedBlindedBlock}) => {
204+
const fork = config.getForkName(signedBlindedBlock.data.message.slot);
205+
return {
206+
body:
207+
signedBlindedBlock.bytes ??
208+
getPostBellatrixForkTypes(fork).SignedBlindedBeaconBlock.serialize(signedBlindedBlock.data),
209+
headers: {
210+
[MetaHeader.Version]: fork,
211+
},
212+
};
213+
},
214+
parseReqSsz: ({body, headers}) => {
215+
const fork = toForkName(fromHeaders(headers, MetaHeader.Version));
216+
return {
217+
signedBlindedBlock: {data: getPostBellatrixForkTypes(fork).SignedBlindedBeaconBlock.deserialize(body)},
218+
};
219+
},
220+
schema: {
221+
body: Schema.Object,
222+
headers: {[MetaHeader.Version]: Schema.String},
223+
},
224+
},
225+
resp: EmptyResponseCodec,
226+
},
176227
};
177228
}

packages/api/test/unit/builder/testData.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ export const testData: GenericServerTestCases<Endpoints> = {
2626
args: {signedBlindedBlock: {data: ssz.electra.SignedBlindedBeaconBlock.defaultValue()}},
2727
res: {data: ssz.deneb.ExecutionPayloadAndBlobsBundle.defaultValue(), meta: {version: ForkName.electra}},
2828
},
29+
submitBlindedBlockV2: {
30+
args: {signedBlindedBlock: {data: ssz.fulu.SignedBlindedBeaconBlock.defaultValue()}},
31+
res: undefined,
32+
},
2933
};

packages/beacon-node/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bugs": {
1212
"url": "https://github.com/ChainSafe/lodestar/issues"
1313
},
14-
"version": "1.32.0",
14+
"version": "1.33.0",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -103,33 +103,33 @@
103103
"@chainsafe/pubkey-index-map": "^3.0.0",
104104
"@chainsafe/ssz": "^1.2.1",
105105
"@chainsafe/threads": "^1.11.2",
106-
"@crate-crypto/node-eth-kzg": "^0.7.1",
106+
"@crate-crypto/node-eth-kzg": "0.8.0",
107107
"@ethersproject/abi": "^5.7.0",
108108
"@fastify/bearer-auth": "^10.0.1",
109109
"@fastify/cors": "^10.0.1",
110110
"@fastify/swagger": "^9.0.0",
111111
"@fastify/swagger-ui": "^5.0.1",
112112
"@libp2p/bootstrap": "^11.0.32",
113113
"@libp2p/crypto": "^5.0.15",
114-
"@libp2p/identify": "3.0.27",
114+
"@libp2p/identify": "^3.0.27",
115115
"@libp2p/interface": "^2.7.0",
116116
"@libp2p/mdns": "^11.0.32",
117117
"@libp2p/mplex": "^11.0.32",
118118
"@libp2p/peer-id": "^5.1.0",
119119
"@libp2p/prometheus-metrics": "^4.3.15",
120120
"@libp2p/tcp": "^10.1.8",
121-
"@lodestar/api": "^1.32.0",
122-
"@lodestar/config": "^1.32.0",
123-
"@lodestar/db": "^1.32.0",
124-
"@lodestar/fork-choice": "^1.32.0",
125-
"@lodestar/light-client": "^1.32.0",
126-
"@lodestar/logger": "^1.32.0",
127-
"@lodestar/params": "^1.32.0",
128-
"@lodestar/reqresp": "^1.32.0",
129-
"@lodestar/state-transition": "^1.32.0",
130-
"@lodestar/types": "^1.32.0",
131-
"@lodestar/utils": "^1.32.0",
132-
"@lodestar/validator": "^1.32.0",
121+
"@lodestar/api": "^1.33.0",
122+
"@lodestar/config": "^1.33.0",
123+
"@lodestar/db": "^1.33.0",
124+
"@lodestar/fork-choice": "^1.33.0",
125+
"@lodestar/light-client": "^1.33.0",
126+
"@lodestar/logger": "^1.33.0",
127+
"@lodestar/params": "^1.33.0",
128+
"@lodestar/reqresp": "^1.33.0",
129+
"@lodestar/state-transition": "^1.33.0",
130+
"@lodestar/types": "^1.33.0",
131+
"@lodestar/utils": "^1.33.0",
132+
"@lodestar/validator": "^1.33.0",
133133
"@multiformats/multiaddr": "^12.1.3",
134134
"datastore-core": "^10.0.2",
135135
"datastore-level": "^11.0.1",
@@ -139,7 +139,7 @@
139139
"it-all": "^3.0.4",
140140
"it-pipe": "^3.0.1",
141141
"jwt-simple": "0.5.6",
142-
"libp2p": "2.8.2",
142+
"libp2p": "2.9.0",
143143
"multiformats": "^11.0.1",
144144
"prom-client": "^15.1.0",
145145
"qs": "^6.11.1",

packages/beacon-node/src/api/impl/beacon/blocks/index.ts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SLOTS_PER_HISTORICAL_ROOT,
77
isForkPostBellatrix,
88
isForkPostElectra,
9+
isForkPostFulu,
910
} from "@lodestar/params";
1011
import {
1112
computeEpochAtSlot,
@@ -276,6 +277,7 @@ export function getBeaconBlockApi({
276277
.getPostBellatrixForkTypes(signedBlindedBlock.message.slot)
277278
.BlindedBeaconBlock.hashTreeRoot(signedBlindedBlock.message)
278279
);
280+
const fork = config.getForkName(slot);
279281

280282
// Either the payload/blobs are cached from i) engine locally or ii) they are from the builder
281283
//
@@ -295,19 +297,30 @@ export function getBeaconBlockApi({
295297
}
296298

297299
const source = ProducedBlockSource.builder;
298-
chain.logger.debug("Reconstructing signedBlockOrContents", {slot, blockRoot, source});
299300

300-
const signedBlockOrContents = await reconstructBuilderBlockOrContents(chain, {
301-
data: signedBlindedBlock,
302-
bytes: context?.sszBytes,
303-
});
301+
if (isForkPostFulu(fork)) {
302+
await submitBlindedBlockToBuilder(chain, {
303+
data: signedBlindedBlock,
304+
bytes: context?.sszBytes,
305+
});
306+
chain.logger.info("Submitted blinded block to builder for publishing", {slot, blockRoot});
307+
} else {
308+
// TODO: After fulu is live and all builders support submitBlindedBlockV2, we can safely remove
309+
// this code block and related functions
310+
chain.logger.debug("Reconstructing signedBlockOrContents", {slot, blockRoot, source});
304311

305-
// the full block is published by relay and it's possible that the block is already known to us
306-
// by gossip
307-
//
308-
// see: https://github.com/ChainSafe/lodestar/issues/5404
309-
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
310-
return publishBlock({signedBlockOrContents}, {...context, sszBytes: null}, {...opts, ignoreIfKnown: true});
312+
const signedBlockOrContents = await reconstructBuilderBlockOrContents(chain, {
313+
data: signedBlindedBlock,
314+
bytes: context?.sszBytes,
315+
});
316+
317+
// the full block is published by relay and it's possible that the block is already known to us
318+
// by gossip
319+
//
320+
// see: https://github.com/ChainSafe/lodestar/issues/5404
321+
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
322+
return publishBlock({signedBlockOrContents}, {...context, sszBytes: null}, {...opts, ignoreIfKnown: true});
323+
}
311324
};
312325

313326
return {
@@ -550,3 +563,14 @@ async function reconstructBuilderBlockOrContents(
550563
const signedBlockOrContents = await executionBuilder.submitBlindedBlock(signedBlindedBlock);
551564
return signedBlockOrContents;
552565
}
566+
567+
async function submitBlindedBlockToBuilder(
568+
chain: ApiModules["chain"],
569+
signedBlindedBlock: WithOptionalBytes<SignedBlindedBeaconBlock>
570+
): Promise<void> {
571+
const executionBuilder = chain.executionBuilder;
572+
if (!executionBuilder) {
573+
throw Error("executionBuilder required to submit SignedBlindedBeaconBlock to builder");
574+
}
575+
await executionBuilder.submitBlindedBlockNoResponse(signedBlindedBlock);
576+
}

0 commit comments

Comments
 (0)