@lodestar/api 1.45.0-dev.67b1b61d1b → 1.45.0-dev.8d73a6a8cb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/beacon/routes/beacon/index.d.ts +1 -1
- package/lib/beacon/routes/beacon/index.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/pool.d.ts +34 -0
- package/lib/beacon/routes/beacon/pool.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/pool.js +44 -1
- package/lib/beacon/routes/beacon/pool.js.map +1 -1
- package/lib/beacon/routes/beacon/state.d.ts +2 -54
- package/lib/beacon/routes/beacon/state.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/state.js +1 -34
- package/lib/beacon/routes/beacon/state.js.map +1 -1
- package/lib/beacon/routes/events.d.ts +1 -0
- package/lib/beacon/routes/events.d.ts.map +1 -1
- package/lib/beacon/routes/node.d.ts +0 -2
- package/lib/beacon/routes/node.d.ts.map +1 -1
- package/lib/beacon/routes/node.js +0 -2
- package/lib/beacon/routes/node.js.map +1 -1
- package/lib/beacon/routes/validator.d.ts +1 -27
- package/lib/beacon/routes/validator.d.ts.map +1 -1
- package/lib/beacon/routes/validator.js +2 -30
- package/lib/beacon/routes/validator.js.map +1 -1
- package/lib/utils/serdes.d.ts +0 -2
- package/lib/utils/serdes.d.ts.map +1 -1
- package/lib/utils/serdes.js +0 -2
- package/lib/utils/serdes.js.map +1 -1
- package/lib/utils/server/handler.d.ts.map +1 -1
- package/lib/utils/server/handler.js +0 -4
- package/lib/utils/server/handler.js.map +1 -1
- package/package.json +6 -6
- package/src/beacon/routes/beacon/index.ts +0 -3
- package/src/beacon/routes/beacon/pool.ts +72 -0
- package/src/beacon/routes/beacon/state.ts +2 -63
- package/src/beacon/routes/node.ts +1 -3
- package/src/beacon/routes/validator.ts +2 -56
- package/src/utils/serdes.ts +0 -3
- package/src/utils/server/handler.ts +0 -5
|
@@ -3,7 +3,6 @@ import {ChainForkConfig} from "@lodestar/config";
|
|
|
3
3
|
import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
|
|
4
4
|
import {
|
|
5
5
|
ArrayOf,
|
|
6
|
-
BuilderStatus,
|
|
7
6
|
CommitteeIndex,
|
|
8
7
|
Epoch,
|
|
9
8
|
RootHex,
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
ExecutionOptimisticFinalizedAndVersionCodec,
|
|
24
23
|
ExecutionOptimisticFinalizedAndVersionMeta,
|
|
25
24
|
} from "../../../utils/metadata.js";
|
|
26
|
-
import {
|
|
25
|
+
import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js";
|
|
27
26
|
import {WireFormat} from "../../../utils/wireFormat.js";
|
|
28
27
|
import {RootResponse, RootResponseType} from "./block.js";
|
|
29
28
|
|
|
@@ -38,9 +37,8 @@ export type StateArgs = {
|
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
export type ValidatorId = string | number;
|
|
41
|
-
export type BuilderId = string | number;
|
|
42
40
|
|
|
43
|
-
export type {
|
|
41
|
+
export type {ValidatorStatus};
|
|
44
42
|
|
|
45
43
|
export const RandaoResponseType = new ContainerType({
|
|
46
44
|
randao: ssz.Root,
|
|
@@ -59,11 +57,6 @@ export const ValidatorResponseType = new ContainerType({
|
|
|
59
57
|
status: new StringType<ValidatorStatus>(),
|
|
60
58
|
validator: ssz.phase0.Validator,
|
|
61
59
|
});
|
|
62
|
-
export const BuilderResponseType = new ContainerType({
|
|
63
|
-
index: ssz.BuilderIndex,
|
|
64
|
-
status: new StringType<BuilderStatus>(),
|
|
65
|
-
builder: ssz.gloas.Builder,
|
|
66
|
-
});
|
|
67
60
|
export const ValidatorIdentityType = new ContainerType(
|
|
68
61
|
{
|
|
69
62
|
index: ssz.ValidatorIndex,
|
|
@@ -91,7 +84,6 @@ export const EpochSyncCommitteeResponseType = new ContainerType(
|
|
|
91
84
|
{jsonCase: "eth2"}
|
|
92
85
|
);
|
|
93
86
|
export const ValidatorResponseListType = ArrayOf(ValidatorResponseType);
|
|
94
|
-
export const BuilderResponseListType = ArrayOf(BuilderResponseType);
|
|
95
87
|
export const ValidatorIdentitiesType = ArrayOf(ValidatorIdentityType);
|
|
96
88
|
export const EpochCommitteeResponseListType = ArrayOf(EpochCommitteeResponseType);
|
|
97
89
|
export const ValidatorBalanceListType = ArrayOf(ValidatorBalanceType);
|
|
@@ -99,13 +91,11 @@ export const ValidatorBalanceListType = ArrayOf(ValidatorBalanceType);
|
|
|
99
91
|
export type RandaoResponse = ValueOf<typeof RandaoResponseType>;
|
|
100
92
|
export type FinalityCheckpoints = ValueOf<typeof FinalityCheckpointsType>;
|
|
101
93
|
export type ValidatorResponse = ValueOf<typeof ValidatorResponseType>;
|
|
102
|
-
export type BuilderResponse = ValueOf<typeof BuilderResponseType>;
|
|
103
94
|
export type EpochCommitteeResponse = ValueOf<typeof EpochCommitteeResponseType>;
|
|
104
95
|
export type ValidatorBalance = ValueOf<typeof ValidatorBalanceType>;
|
|
105
96
|
export type EpochSyncCommitteeResponse = ValueOf<typeof EpochSyncCommitteeResponseType>;
|
|
106
97
|
|
|
107
98
|
export type ValidatorResponseList = ValueOf<typeof ValidatorResponseListType>;
|
|
108
|
-
export type BuilderResponseList = ValueOf<typeof BuilderResponseListType>;
|
|
109
99
|
export type ValidatorIdentities = ValueOf<typeof ValidatorIdentitiesType>;
|
|
110
100
|
export type EpochCommitteeResponseList = ValueOf<typeof EpochCommitteeResponseListType>;
|
|
111
101
|
export type ValidatorBalanceList = ValueOf<typeof ValidatorBalanceListType>;
|
|
@@ -214,30 +204,6 @@ export type Endpoints = {
|
|
|
214
204
|
ExecutionOptimisticAndFinalizedMeta
|
|
215
205
|
>;
|
|
216
206
|
|
|
217
|
-
/**
|
|
218
|
-
* Get builders from state
|
|
219
|
-
*
|
|
220
|
-
* Returns filterable list of builders with their status and index.
|
|
221
|
-
*
|
|
222
|
-
* Information will be returned for all indices or public keys that match known builders. If an index or public key does not
|
|
223
|
-
* match any known builder, no information will be returned but this will not cause an error. There are no guarantees for the
|
|
224
|
-
* returned data in terms of ordering; both the index and public key are returned for each builder, and can be used to confirm
|
|
225
|
-
* for which inputs a response has been returned.
|
|
226
|
-
*
|
|
227
|
-
* Returns 400 if the requested state is prior to Gloas.
|
|
228
|
-
*/
|
|
229
|
-
getStateBuilders: Endpoint<
|
|
230
|
-
"POST",
|
|
231
|
-
StateArgs & {
|
|
232
|
-
/** Either hex encoded public key (any bytes48 with 0x prefix) or builder index */
|
|
233
|
-
builderIds?: BuilderId[];
|
|
234
|
-
statuses?: BuilderStatus[];
|
|
235
|
-
},
|
|
236
|
-
{params: {state_id: string}; body: {ids?: string[]; statuses?: BuilderStatus[]}},
|
|
237
|
-
BuilderResponseList,
|
|
238
|
-
ExecutionOptimisticAndFinalizedMeta
|
|
239
|
-
>;
|
|
240
|
-
|
|
241
207
|
/**
|
|
242
208
|
* Get validator identities from state
|
|
243
209
|
*
|
|
@@ -523,33 +489,6 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
|
|
|
523
489
|
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
524
490
|
},
|
|
525
491
|
},
|
|
526
|
-
getStateBuilders: {
|
|
527
|
-
url: "/eth/v1/beacon/states/{state_id}/builders",
|
|
528
|
-
method: "POST",
|
|
529
|
-
req: JsonOnlyReq({
|
|
530
|
-
writeReqJson: ({stateId, builderIds, statuses}) => ({
|
|
531
|
-
params: {state_id: stateId.toString()},
|
|
532
|
-
body: {
|
|
533
|
-
ids: toBuilderIdsStr(builderIds),
|
|
534
|
-
statuses,
|
|
535
|
-
},
|
|
536
|
-
}),
|
|
537
|
-
parseReqJson: ({params, body = {}}) => ({
|
|
538
|
-
stateId: params.state_id,
|
|
539
|
-
builderIds: fromBuilderIdsStr(body.ids),
|
|
540
|
-
statuses: body.statuses ?? undefined,
|
|
541
|
-
}),
|
|
542
|
-
schema: {
|
|
543
|
-
params: {state_id: Schema.StringRequired},
|
|
544
|
-
body: Schema.Object,
|
|
545
|
-
},
|
|
546
|
-
}),
|
|
547
|
-
resp: {
|
|
548
|
-
onlySupport: WireFormat.json,
|
|
549
|
-
data: BuilderResponseListType,
|
|
550
|
-
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
551
|
-
},
|
|
552
|
-
},
|
|
553
492
|
postStateValidatorIdentities: {
|
|
554
493
|
url: "/eth/v1/beacon/states/{state_id}/validator_identities",
|
|
555
494
|
method: "POST",
|
|
@@ -106,7 +106,6 @@ export enum NodeHealth {
|
|
|
106
106
|
*/
|
|
107
107
|
export enum ClientCode {
|
|
108
108
|
BU = "BU", // besu
|
|
109
|
-
CN = "CN", // caplin
|
|
110
109
|
EJ = "EJ", // ethereumJS
|
|
111
110
|
EG = "EG", // erigon
|
|
112
111
|
EX = "EX", // ethrex
|
|
@@ -115,8 +114,7 @@ export enum ClientCode {
|
|
|
115
114
|
LH = "LH", // lighthouse
|
|
116
115
|
LS = "LS", // lodestar
|
|
117
116
|
NM = "NM", // nethermind
|
|
118
|
-
NB = "NB", // nimbus
|
|
119
|
-
NE = "NE", // nimbus EL
|
|
117
|
+
NB = "NB", // nimbus
|
|
120
118
|
TE = "TE", // trin-execution
|
|
121
119
|
TK = "TK", // teku
|
|
122
120
|
PM = "PM", // prysm
|
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
ForkPostDeneb,
|
|
5
5
|
ForkPostGloas,
|
|
6
6
|
ForkPreDeneb,
|
|
7
|
-
MIN_SEED_LOOKAHEAD,
|
|
8
|
-
SLOTS_PER_EPOCH,
|
|
9
7
|
VALIDATOR_REGISTRY_LIMIT,
|
|
10
8
|
isForkPostDeneb,
|
|
11
9
|
isForkPostElectra,
|
|
@@ -248,10 +246,6 @@ export const SignedValidatorRegistrationV1ListType = ArrayOf(
|
|
|
248
246
|
ssz.bellatrix.SignedValidatorRegistrationV1,
|
|
249
247
|
VALIDATOR_REGISTRY_LIMIT
|
|
250
248
|
);
|
|
251
|
-
export const SignedProposerPreferencesListType = ArrayOf(
|
|
252
|
-
ssz.gloas.SignedProposerPreferences,
|
|
253
|
-
(MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH
|
|
254
|
-
);
|
|
255
249
|
|
|
256
250
|
export type ValidatorIndices = ValueOf<typeof ValidatorIndicesType>;
|
|
257
251
|
export type AttesterDuty = ValueOf<typeof AttesterDutyType>;
|
|
@@ -279,13 +273,6 @@ export type SyncCommitteeSelectionList = ValueOf<typeof SyncCommitteeSelectionLi
|
|
|
279
273
|
export type LivenessResponseData = ValueOf<typeof LivenessResponseDataType>;
|
|
280
274
|
export type LivenessResponseDataList = ValueOf<typeof LivenessResponseDataListType>;
|
|
281
275
|
export type SignedValidatorRegistrationV1List = ValueOf<typeof SignedValidatorRegistrationV1ListType>;
|
|
282
|
-
export type SignedProposerPreferencesList = ValueOf<typeof SignedProposerPreferencesListType>;
|
|
283
|
-
|
|
284
|
-
// The beacon node does not return any data if there is no canonical block at the requested slot (missed slot).
|
|
285
|
-
// In this case, we receive a success response (204) which is not handled as an error. The generic response
|
|
286
|
-
// handler already checks the status code and will not attempt to parse the body, but it will return no value.
|
|
287
|
-
// It is important that this type indicates that there might be no value to ensure it is properly handled downstream.
|
|
288
|
-
export type MaybePayloadAttestationData = gloas.PayloadAttestationData | undefined;
|
|
289
276
|
|
|
290
277
|
export type Endpoints = {
|
|
291
278
|
/**
|
|
@@ -496,7 +483,7 @@ export type Endpoints = {
|
|
|
496
483
|
slot: Slot;
|
|
497
484
|
},
|
|
498
485
|
{params: {slot: Slot}},
|
|
499
|
-
|
|
486
|
+
gloas.PayloadAttestationData,
|
|
500
487
|
VersionMeta
|
|
501
488
|
>;
|
|
502
489
|
|
|
@@ -659,20 +646,6 @@ export type Endpoints = {
|
|
|
659
646
|
EmptyResponseData,
|
|
660
647
|
EmptyMeta
|
|
661
648
|
>;
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* Submit signed proposer preferences
|
|
665
|
-
*
|
|
666
|
-
* Verifies given signed proposer preferences and publishes them on the `proposer_preferences`
|
|
667
|
-
* gossipsub topic. Supersedes `prepareBeaconProposer` and `registerValidator` from Gloas onwards.
|
|
668
|
-
*/
|
|
669
|
-
submitProposerPreferences: Endpoint<
|
|
670
|
-
"POST",
|
|
671
|
-
{signedProposerPreferences: SignedProposerPreferencesList},
|
|
672
|
-
{body: unknown; headers: {[MetaHeader.Version]: string}},
|
|
673
|
-
EmptyResponseData,
|
|
674
|
-
EmptyMeta
|
|
675
|
-
>;
|
|
676
649
|
};
|
|
677
650
|
|
|
678
651
|
export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoints> {
|
|
@@ -1009,7 +982,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
|
|
|
1009
982
|
},
|
|
1010
983
|
},
|
|
1011
984
|
resp: {
|
|
1012
|
-
data:
|
|
985
|
+
data: ssz.gloas.PayloadAttestationData,
|
|
1013
986
|
meta: VersionCodec,
|
|
1014
987
|
},
|
|
1015
988
|
},
|
|
@@ -1237,33 +1210,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
|
|
|
1237
1210
|
requestWireFormat: WireFormat.ssz,
|
|
1238
1211
|
},
|
|
1239
1212
|
},
|
|
1240
|
-
submitProposerPreferences: {
|
|
1241
|
-
url: "/eth/v1/validator/proposer_preferences",
|
|
1242
|
-
method: "POST",
|
|
1243
|
-
req: {
|
|
1244
|
-
writeReqJson: ({signedProposerPreferences}) => ({
|
|
1245
|
-
body: SignedProposerPreferencesListType.toJson(signedProposerPreferences),
|
|
1246
|
-
headers: {[MetaHeader.Version]: config.getForkName(signedProposerPreferences[0]?.message.proposalSlot ?? 0)},
|
|
1247
|
-
}),
|
|
1248
|
-
parseReqJson: ({body, headers}) => {
|
|
1249
|
-
toForkName(fromHeaders(headers, MetaHeader.Version));
|
|
1250
|
-
return {signedProposerPreferences: SignedProposerPreferencesListType.fromJson(body)};
|
|
1251
|
-
},
|
|
1252
|
-
writeReqSsz: ({signedProposerPreferences}) => ({
|
|
1253
|
-
body: SignedProposerPreferencesListType.serialize(signedProposerPreferences),
|
|
1254
|
-
headers: {[MetaHeader.Version]: config.getForkName(signedProposerPreferences[0]?.message.proposalSlot ?? 0)},
|
|
1255
|
-
}),
|
|
1256
|
-
parseReqSsz: ({body, headers}) => {
|
|
1257
|
-
toForkName(fromHeaders(headers, MetaHeader.Version));
|
|
1258
|
-
return {signedProposerPreferences: SignedProposerPreferencesListType.deserialize(body)};
|
|
1259
|
-
},
|
|
1260
|
-
schema: {
|
|
1261
|
-
body: Schema.ObjectArray,
|
|
1262
|
-
headers: {[MetaHeader.Version]: Schema.String},
|
|
1263
|
-
},
|
|
1264
|
-
},
|
|
1265
|
-
resp: EmptyResponseCodec,
|
|
1266
|
-
},
|
|
1267
1213
|
};
|
|
1268
1214
|
}
|
|
1269
1215
|
|
package/src/utils/serdes.ts
CHANGED
|
@@ -75,9 +75,6 @@ export function fromValidatorIdsStr(ids?: string[]): (string | number)[] | undef
|
|
|
75
75
|
return ids?.map((id) => (typeof id === "string" && id.startsWith("0x") ? id : fromU64Str(id)));
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export const toBuilderIdsStr = toValidatorIdsStr;
|
|
79
|
-
export const fromBuilderIdsStr = fromValidatorIdsStr;
|
|
80
|
-
|
|
81
78
|
const GRAFFITI_HEX_LENGTH = 66;
|
|
82
79
|
|
|
83
80
|
export function toGraffitiHex(utf8?: string): string | undefined {
|
|
@@ -111,11 +111,6 @@ export function createFastifyHandler<E extends Endpoint>(
|
|
|
111
111
|
resp.statusCode = response.status;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// A 204 No Content response has no body
|
|
115
|
-
if (resp.statusCode === 204) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
114
|
switch (responseWireFormat) {
|
|
120
115
|
case WireFormat.json: {
|
|
121
116
|
const metaHeaders = definition.resp.meta.toHeadersObject(response?.meta);
|