Skip to content

Commit 3859741

Browse files
authored
chore: release v1.20.1 (#6955)
2 parents 27b9c03 + c1877bf commit 3859741

File tree

25 files changed

+143
-103
lines changed

25 files changed

+143
-103
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
],
55
"npmClient": "yarn",
66
"useNx": true,
7-
"version": "1.20.0",
7+
"version": "1.20.1",
88
"stream": true,
99
"command": {
1010
"version": {

packages/api/package.json

+5-5
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.20.0",
14+
"version": "1.20.1",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -72,10 +72,10 @@
7272
"dependencies": {
7373
"@chainsafe/persistent-merkle-tree": "^0.7.1",
7474
"@chainsafe/ssz": "^0.15.1",
75-
"@lodestar/config": "^1.20.0",
76-
"@lodestar/params": "^1.20.0",
77-
"@lodestar/types": "^1.20.0",
78-
"@lodestar/utils": "^1.20.0",
75+
"@lodestar/config": "^1.20.1",
76+
"@lodestar/params": "^1.20.1",
77+
"@lodestar/types": "^1.20.1",
78+
"@lodestar/utils": "^1.20.1",
7979
"eventsource": "^2.0.2",
8080
"qs": "^6.11.1"
8181
},

packages/api/src/utils/headers.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ export enum HttpHeader {
44
ContentType = "content-type",
55
Accept = "accept",
66
Authorization = "authorization",
7+
/**
8+
* Used to indicate which response headers should be made available to
9+
* scripts running in the browser, in response to a cross-origin request.
10+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
11+
*/
12+
ExposeHeaders = "access-control-expose-headers",
713
}
814

915
export enum MediaType {
@@ -44,7 +50,12 @@ export function parseAcceptHeader(accept?: string, supported = SUPPORTED_MEDIA_T
4450
// Normalize here, using 1 as the default qvalue
4551
const quality = current.includes(";") ? current.split(";") : [current, "q=1"];
4652

47-
const mediaType = quality[0].trim();
53+
let mediaType = quality[0].trim();
54+
55+
if (mediaType === "*/*") {
56+
// Default to json if all media types are accepted
57+
mediaType = MediaType.json;
58+
}
4859

4960
// If the mime type isn't acceptable, move on to the next entry
5061
if (!isSupportedMediaType(mediaType, supported)) {

packages/api/src/utils/metadata.ts

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {StringType, ssz, stringType} from "@lodestar/types";
55
import {ResponseMetadataCodec} from "./types.js";
66
import {toBoolean} from "./serdes.js";
77
import {toForkName} from "./fork.js";
8+
import {HttpHeader} from "./headers.js";
89

910
export const VersionType = new ContainerType({
1011
/**
@@ -90,6 +91,7 @@ export const ExecutionOptimisticCodec: ResponseMetadataCodec<ExecutionOptimistic
9091
fromJson: (val) => ExecutionOptimisticType.fromJson(val),
9192
toHeadersObject: (val) => ({
9293
[MetaHeader.ExecutionOptimistic]: val.executionOptimistic.toString(),
94+
[HttpHeader.ExposeHeaders]: MetaHeader.ExecutionOptimistic,
9395
}),
9496
fromHeaders: (headers) => ({
9597
executionOptimistic: toBoolean(headers.getOrDefault(MetaHeader.ExecutionOptimistic, "false")),
@@ -101,6 +103,7 @@ export const VersionCodec: ResponseMetadataCodec<VersionMeta> = {
101103
fromJson: (val) => VersionType.fromJson(val),
102104
toHeadersObject: (val) => ({
103105
[MetaHeader.Version]: val.version,
106+
[HttpHeader.ExposeHeaders]: MetaHeader.Version,
104107
}),
105108
fromHeaders: (headers) => ({
106109
version: toForkName(headers.getRequired(MetaHeader.Version)),
@@ -113,6 +116,7 @@ export const ExecutionOptimisticAndVersionCodec: ResponseMetadataCodec<Execution
113116
toHeadersObject: (val) => ({
114117
[MetaHeader.ExecutionOptimistic]: val.executionOptimistic.toString(),
115118
[MetaHeader.Version]: val.version,
119+
[HttpHeader.ExposeHeaders]: [MetaHeader.ExecutionOptimistic, MetaHeader.Version].toString(),
116120
}),
117121
fromHeaders: (headers) => ({
118122
executionOptimistic: toBoolean(headers.getOrDefault(MetaHeader.ExecutionOptimistic, "false")),
@@ -126,6 +130,7 @@ export const ExecutionOptimisticAndFinalizedCodec: ResponseMetadataCodec<Executi
126130
toHeadersObject: (val) => ({
127131
[MetaHeader.ExecutionOptimistic]: val.executionOptimistic.toString(),
128132
[MetaHeader.Finalized]: val.finalized.toString(),
133+
[HttpHeader.ExposeHeaders]: [MetaHeader.ExecutionOptimistic, MetaHeader.Finalized].toString(),
129134
}),
130135
fromHeaders: (headers) => ({
131136
executionOptimistic: toBoolean(headers.getOrDefault(MetaHeader.ExecutionOptimistic, "false")),
@@ -141,6 +146,7 @@ export const ExecutionOptimisticFinalizedAndVersionCodec: ResponseMetadataCodec<
141146
[MetaHeader.ExecutionOptimistic]: val.executionOptimistic.toString(),
142147
[MetaHeader.Finalized]: val.finalized.toString(),
143148
[MetaHeader.Version]: val.version,
149+
[HttpHeader.ExposeHeaders]: [MetaHeader.ExecutionOptimistic, MetaHeader.Finalized, MetaHeader.Version].toString(),
144150
}),
145151
fromHeaders: (headers) => ({
146152
executionOptimistic: toBoolean(headers.getOrDefault(MetaHeader.ExecutionOptimistic, "false")),
@@ -156,6 +162,7 @@ export const ExecutionOptimisticAndDependentRootCodec: ResponseMetadataCodec<Exe
156162
toHeadersObject: (val) => ({
157163
[MetaHeader.ExecutionOptimistic]: val.executionOptimistic.toString(),
158164
[MetaHeader.DependentRoot]: val.dependentRoot,
165+
[HttpHeader.ExposeHeaders]: [MetaHeader.ExecutionOptimistic, MetaHeader.DependentRoot].toString(),
159166
}),
160167
fromHeaders: (headers) => ({
161168
executionOptimistic: toBoolean(headers.getOrDefault(MetaHeader.ExecutionOptimistic, "false")),

packages/api/src/utils/server/handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function createFastifyHandler<E extends Endpoint>(
4444
if (definition.resp.isEmpty) {
4545
// Ignore Accept header, the response will be sent without body
4646
responseMediaType = null;
47-
} else if (acceptHeader === undefined || acceptHeader === "*/*") {
47+
} else if (acceptHeader === undefined) {
4848
// Default to json to not force user to set header, e.g. when using curl
4949
responseMediaType = MediaType.json;
5050
} else {

packages/api/test/unit/utils/headers.test.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ describe("utils / headers", () => {
55
describe("parseAcceptHeader", () => {
66
const testCases: {header: string | undefined; expected: MediaType | null}[] = [
77
{header: undefined, expected: null},
8-
{header: "*/*", expected: null},
8+
{header: "*/*", expected: MediaType.json},
99
{header: "application/json", expected: MediaType.json},
1010
{header: "application/octet-stream", expected: MediaType.ssz},
1111
{header: "application/invalid", expected: null},
1212
{header: "application/invalid;q=1,application/octet-stream;q=0.1", expected: MediaType.ssz},
1313
{header: "application/octet-stream;q=0.5,application/json;q=1", expected: MediaType.json},
1414
{header: "application/octet-stream;q=1,application/json;q=0.1", expected: MediaType.ssz},
15+
{header: "application/octet-stream;q=1,application/json;q=0.9", expected: MediaType.ssz},
16+
{header: "application/octet-stream;q=1,*/*;q=0.9", expected: MediaType.ssz},
1517
{header: "application/octet-stream,application/json;q=0.1", expected: MediaType.ssz},
1618
{header: "application/octet-stream;,application/json;q=0.1", expected: MediaType.json},
1719
{header: "application/octet-stream;q=2,application/json;q=0.1", expected: MediaType.json},
@@ -20,6 +22,12 @@ describe("utils / headers", () => {
2022
{header: "application/octet-stream ; q=0.5 , application/json ; q=1", expected: MediaType.json},
2123
{header: "application/octet-stream ; q=1 , application/json ; q=0.1", expected: MediaType.ssz},
2224
{header: "application/octet-stream;q=1,application/json;q=0.1", expected: MediaType.ssz},
25+
{
26+
// Default Accept header set by chrome browser
27+
header:
28+
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
29+
expected: MediaType.json,
30+
},
2331

2432
// The implementation is order dependent, however, RFC-9110 doesn't specify a preference.
2533
// The following tests serve to document the behavior at the time of implementation- not a

packages/beacon-node/package.json

+13-13
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.20.0",
14+
"version": "1.20.1",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -120,18 +120,18 @@
120120
"@libp2p/peer-id-factory": "^4.1.0",
121121
"@libp2p/prometheus-metrics": "^3.0.21",
122122
"@libp2p/tcp": "9.0.23",
123-
"@lodestar/api": "^1.20.0",
124-
"@lodestar/config": "^1.20.0",
125-
"@lodestar/db": "^1.20.0",
126-
"@lodestar/fork-choice": "^1.20.0",
127-
"@lodestar/light-client": "^1.20.0",
128-
"@lodestar/logger": "^1.20.0",
129-
"@lodestar/params": "^1.20.0",
130-
"@lodestar/reqresp": "^1.20.0",
131-
"@lodestar/state-transition": "^1.20.0",
132-
"@lodestar/types": "^1.20.0",
133-
"@lodestar/utils": "^1.20.0",
134-
"@lodestar/validator": "^1.20.0",
123+
"@lodestar/api": "^1.20.1",
124+
"@lodestar/config": "^1.20.1",
125+
"@lodestar/db": "^1.20.1",
126+
"@lodestar/fork-choice": "^1.20.1",
127+
"@lodestar/light-client": "^1.20.1",
128+
"@lodestar/logger": "^1.20.1",
129+
"@lodestar/params": "^1.20.1",
130+
"@lodestar/reqresp": "^1.20.1",
131+
"@lodestar/state-transition": "^1.20.1",
132+
"@lodestar/types": "^1.20.1",
133+
"@lodestar/utils": "^1.20.1",
134+
"@lodestar/validator": "^1.20.1",
135135
"@multiformats/multiaddr": "^12.1.3",
136136
"c-kzg": "^2.1.2",
137137
"datastore-core": "^9.1.1",

packages/beacon-node/src/api/rest/base.ts

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ export class RestApiServer {
9494
const operationId = getOperationId(req);
9595
this.logger.debug(`Req ${req.id} ${req.ip} ${operationId}`);
9696
metrics?.requests.inc({operationId});
97+
98+
// Workaround to fix compatibility with go-eth2-client
99+
// See https://github.com/attestantio/go-eth2-client/issues/144
100+
if (
101+
// go-eth2-client supports handling SSZ data in response for these endpoints
102+
!["produceBlindedBlock", "produceBlockV3", "getBlockV2", "getStateV2"].includes(operationId) &&
103+
// Only Vouch seems to override default header
104+
["go-eth2-client", "Go-http-client", "Vouch"].includes(req.headers["user-agent"]?.split("/")[0] ?? "")
105+
) {
106+
// Override Accept header to force server to return JSON
107+
req.headers.accept = "application/json";
108+
}
97109
});
98110

99111
server.addHook("preHandler", async (req, _res) => {

packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {describe, it, beforeEach, afterEach, expect} from "vitest";
22
import bls from "@chainsafe/bls";
33
import {createBeaconConfig, ChainConfig} from "@lodestar/config";
44
import {chainConfig as chainConfigDef} from "@lodestar/config/default";
5-
import {getClient, routes} from "@lodestar/api";
5+
import {getClient, HttpHeader, routes} from "@lodestar/api";
66
import {sleep} from "@lodestar/utils";
77
import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
88
import {Validator} from "@lodestar/validator";
@@ -102,6 +102,8 @@ describe("lightclient api", function () {
102102
expect(update.attestedHeader.beacon.slot).toBe(slot - 1);
103103
// version is set
104104
expect(res.meta().version).toBe(ForkName.altair);
105+
// Ensure version header is made available to scripts running in the browser
106+
expect(res.headers.get(HttpHeader.ExposeHeaders)?.includes("Eth-Consensus-Version")).toBe(true);
105107
});
106108

107109
it.skip("getLightClientFinalityUpdate()", async function () {

packages/cli/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/lodestar",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "Command line interface for lodestar",
55
"author": "ChainSafe Systems",
66
"license": "LGPL-3.0",
@@ -63,17 +63,17 @@
6363
"@libp2p/crypto": "^4.1.0",
6464
"@libp2p/peer-id": "^4.1.0",
6565
"@libp2p/peer-id-factory": "^4.1.0",
66-
"@lodestar/api": "^1.20.0",
67-
"@lodestar/beacon-node": "^1.20.0",
68-
"@lodestar/config": "^1.20.0",
69-
"@lodestar/db": "^1.20.0",
70-
"@lodestar/light-client": "^1.20.0",
71-
"@lodestar/logger": "^1.20.0",
72-
"@lodestar/params": "^1.20.0",
73-
"@lodestar/state-transition": "^1.20.0",
74-
"@lodestar/types": "^1.20.0",
75-
"@lodestar/utils": "^1.20.0",
76-
"@lodestar/validator": "^1.20.0",
66+
"@lodestar/api": "^1.20.1",
67+
"@lodestar/beacon-node": "^1.20.1",
68+
"@lodestar/config": "^1.20.1",
69+
"@lodestar/db": "^1.20.1",
70+
"@lodestar/light-client": "^1.20.1",
71+
"@lodestar/logger": "^1.20.1",
72+
"@lodestar/params": "^1.20.1",
73+
"@lodestar/state-transition": "^1.20.1",
74+
"@lodestar/types": "^1.20.1",
75+
"@lodestar/utils": "^1.20.1",
76+
"@lodestar/validator": "^1.20.1",
7777
"@multiformats/multiaddr": "^12.1.3",
7878
"deepmerge": "^4.3.1",
7979
"ethers": "^6.7.0",
@@ -89,7 +89,7 @@
8989
"yargs": "^17.7.1"
9090
},
9191
"devDependencies": {
92-
"@lodestar/test-utils": "^1.20.0",
92+
"@lodestar/test-utils": "^1.20.1",
9393
"@types/debug": "^4.1.7",
9494
"@types/got": "^9.6.12",
9595
"@types/inquirer": "^9.0.3",

packages/config/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/config",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "Chain configuration required for lodestar",
55
"author": "ChainSafe Systems",
66
"license": "Apache-2.0",
@@ -65,7 +65,7 @@
6565
],
6666
"dependencies": {
6767
"@chainsafe/ssz": "^0.15.1",
68-
"@lodestar/params": "^1.20.0",
69-
"@lodestar/types": "^1.20.0"
68+
"@lodestar/params": "^1.20.1",
69+
"@lodestar/types": "^1.20.1"
7070
}
7171
}

packages/db/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/db",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "DB modules of Lodestar",
55
"author": "ChainSafe Systems",
66
"homepage": "https://github.com/ChainSafe/lodestar#readme",
@@ -36,12 +36,12 @@
3636
},
3737
"dependencies": {
3838
"@chainsafe/ssz": "^0.15.1",
39-
"@lodestar/config": "^1.20.0",
40-
"@lodestar/utils": "^1.20.0",
39+
"@lodestar/config": "^1.20.1",
40+
"@lodestar/utils": "^1.20.1",
4141
"classic-level": "^1.4.1",
4242
"it-all": "^3.0.4"
4343
},
4444
"devDependencies": {
45-
"@lodestar/logger": "^1.20.0"
45+
"@lodestar/logger": "^1.20.1"
4646
}
4747
}

packages/flare/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/flare",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "Beacon chain debugging tool",
55
"author": "ChainSafe Systems",
66
"license": "Apache-2.0",
@@ -60,12 +60,12 @@
6060
"dependencies": {
6161
"@chainsafe/bls": "7.1.3",
6262
"@chainsafe/bls-keygen": "^0.4.0",
63-
"@lodestar/api": "^1.20.0",
64-
"@lodestar/config": "^1.20.0",
65-
"@lodestar/params": "^1.20.0",
66-
"@lodestar/state-transition": "^1.20.0",
67-
"@lodestar/types": "^1.20.0",
68-
"@lodestar/utils": "^1.20.0",
63+
"@lodestar/api": "^1.20.1",
64+
"@lodestar/config": "^1.20.1",
65+
"@lodestar/params": "^1.20.1",
66+
"@lodestar/state-transition": "^1.20.1",
67+
"@lodestar/types": "^1.20.1",
68+
"@lodestar/utils": "^1.20.1",
6969
"source-map-support": "^0.5.21",
7070
"yargs": "^17.7.1"
7171
},

packages/fork-choice/package.json

+6-6
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.20.0",
14+
"version": "1.20.1",
1515
"type": "module",
1616
"exports": "./lib/index.js",
1717
"types": "./lib/index.d.ts",
@@ -37,11 +37,11 @@
3737
},
3838
"dependencies": {
3939
"@chainsafe/ssz": "^0.15.1",
40-
"@lodestar/config": "^1.20.0",
41-
"@lodestar/params": "^1.20.0",
42-
"@lodestar/state-transition": "^1.20.0",
43-
"@lodestar/types": "^1.20.0",
44-
"@lodestar/utils": "^1.20.0"
40+
"@lodestar/config": "^1.20.1",
41+
"@lodestar/params": "^1.20.1",
42+
"@lodestar/state-transition": "^1.20.1",
43+
"@lodestar/types": "^1.20.1",
44+
"@lodestar/utils": "^1.20.1"
4545
},
4646
"keywords": [
4747
"ethereum",

packages/light-client/package.json

+6-6
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.20.0",
14+
"version": "1.20.1",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -76,11 +76,11 @@
7676
"@chainsafe/bls": "7.1.3",
7777
"@chainsafe/persistent-merkle-tree": "^0.7.1",
7878
"@chainsafe/ssz": "^0.15.1",
79-
"@lodestar/api": "^1.20.0",
80-
"@lodestar/config": "^1.20.0",
81-
"@lodestar/params": "^1.20.0",
82-
"@lodestar/types": "^1.20.0",
83-
"@lodestar/utils": "^1.20.0",
79+
"@lodestar/api": "^1.20.1",
80+
"@lodestar/config": "^1.20.1",
81+
"@lodestar/params": "^1.20.1",
82+
"@lodestar/types": "^1.20.1",
83+
"@lodestar/utils": "^1.20.1",
8484
"mitt": "^3.0.0"
8585
},
8686
"devDependencies": {

0 commit comments

Comments
 (0)