@lodestar/api 1.44.0-dev.e47e0bb5bd → 1.44.0-dev.ec438788c3

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.
@@ -71,18 +71,6 @@ type PayloadAttestationMessageList = ValueOf<typeof PayloadAttestationMessageLis
71
71
  type SignedProposerPreferencesList = ValueOf<typeof SignedProposerPreferencesListType>;
72
72
 
73
73
  export type Endpoints = {
74
- /**
75
- * Get Attestations from operations pool
76
- * Retrieves attestations known by the node but not necessarily incorporated into any block
77
- */
78
- getPoolAttestations: Endpoint<
79
- "GET",
80
- {slot?: Slot; committeeIndex?: CommitteeIndex},
81
- {query: {slot?: number; committee_index?: number}},
82
- AttestationListPhase0,
83
- EmptyMeta
84
- >;
85
-
86
74
  /**
87
75
  * Get Attestations from operations pool
88
76
  * Retrieves attestations known by the node but not necessarily incorporated into any block
@@ -119,19 +107,6 @@ export type Endpoints = {
119
107
  VersionMeta
120
108
  >;
121
109
 
122
- /**
123
- * Get AttesterSlashings from operations pool
124
- * Retrieves attester slashings known by the node but not necessarily incorporated into any block
125
- */
126
- getPoolAttesterSlashings: Endpoint<
127
- // ⏎
128
- "GET",
129
- EmptyArgs,
130
- EmptyRequest,
131
- AttesterSlashingListPhase0,
132
- EmptyMeta
133
- >;
134
-
135
110
  /**
136
111
  * Get AttesterSlashings from operations pool
137
112
  * Retrieves attester slashings known by the node but not necessarily incorporated into any block
@@ -184,22 +159,6 @@ export type Endpoints = {
184
159
  EmptyMeta
185
160
  >;
186
161
 
187
- /**
188
- * Submit Attestation objects to node
189
- * Submits Attestation objects to the node. Each attestation in the request body is processed individually.
190
- *
191
- * If an attestation is validated successfully the node MUST publish that attestation on the appropriate subnet.
192
- *
193
- * If one or more attestations fail validation the node MUST return a 400 error with details of which attestations have failed, and why.
194
- */
195
- submitPoolAttestations: Endpoint<
196
- "POST",
197
- {signedAttestations: SingleAttestation<ForkPreElectra>[]},
198
- {body: unknown},
199
- EmptyResponseData,
200
- EmptyMeta
201
- >;
202
-
203
162
  /**
204
163
  * Submit Attestation objects to node
205
164
  * Submits Attestation objects to the node. Each attestation in the request body is processed individually.
@@ -216,18 +175,6 @@ export type Endpoints = {
216
175
  EmptyMeta
217
176
  >;
218
177
 
219
- /**
220
- * Submit AttesterSlashing object to node's pool
221
- * Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
222
- */
223
- submitPoolAttesterSlashings: Endpoint<
224
- "POST",
225
- {attesterSlashing: phase0.AttesterSlashing},
226
- {body: unknown},
227
- EmptyResponseData,
228
- EmptyMeta
229
- >;
230
-
231
178
  /**
232
179
  * Submit AttesterSlashing object to node's pool
233
180
  * Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
@@ -315,19 +262,6 @@ export type Endpoints = {
315
262
 
316
263
  export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoints> {
317
264
  return {
318
- getPoolAttestations: {
319
- url: "/eth/v1/beacon/pool/attestations",
320
- method: "GET",
321
- req: {
322
- writeReq: ({slot, committeeIndex}) => ({query: {slot, committee_index: committeeIndex}}),
323
- parseReq: ({query}) => ({slot: query.slot, committeeIndex: query.committee_index}),
324
- schema: {query: {slot: Schema.Uint, committee_index: Schema.Uint}},
325
- },
326
- resp: {
327
- data: AttestationListTypePhase0,
328
- meta: EmptyMetaCodec,
329
- },
330
- },
331
265
  getPoolAttestationsV2: {
332
266
  url: "/eth/v2/beacon/pool/attestations",
333
267
  method: "GET",
@@ -367,15 +301,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
367
301
  meta: VersionCodec,
368
302
  },
369
303
  },
370
- getPoolAttesterSlashings: {
371
- url: "/eth/v1/beacon/pool/attester_slashings",
372
- method: "GET",
373
- req: EmptyRequestCodec,
374
- resp: {
375
- data: AttesterSlashingListTypePhase0,
376
- meta: EmptyMetaCodec,
377
- },
378
- },
379
304
  getPoolAttesterSlashingsV2: {
380
305
  url: "/eth/v2/beacon/pool/attester_slashings",
381
306
  method: "GET",
@@ -414,20 +339,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
414
339
  meta: EmptyMetaCodec,
415
340
  },
416
341
  },
417
- submitPoolAttestations: {
418
- url: "/eth/v1/beacon/pool/attestations",
419
- method: "POST",
420
- req: {
421
- writeReqJson: ({signedAttestations}) => ({body: SingleAttestationListTypePhase0.toJson(signedAttestations)}),
422
- parseReqJson: ({body}) => ({signedAttestations: SingleAttestationListTypePhase0.fromJson(body)}),
423
- writeReqSsz: ({signedAttestations}) => ({body: SingleAttestationListTypePhase0.serialize(signedAttestations)}),
424
- parseReqSsz: ({body}) => ({signedAttestations: SingleAttestationListTypePhase0.deserialize(body)}),
425
- schema: {
426
- body: Schema.ObjectArray,
427
- },
428
- },
429
- resp: EmptyResponseCodec,
430
- },
431
342
  submitPoolAttestationsV2: {
432
343
  url: "/eth/v2/beacon/pool/attestations",
433
344
  method: "POST",
@@ -473,20 +384,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
473
384
  },
474
385
  resp: EmptyResponseCodec,
475
386
  },
476
- submitPoolAttesterSlashings: {
477
- url: "/eth/v1/beacon/pool/attester_slashings",
478
- method: "POST",
479
- req: {
480
- writeReqJson: ({attesterSlashing}) => ({body: ssz.phase0.AttesterSlashing.toJson(attesterSlashing)}),
481
- parseReqJson: ({body}) => ({attesterSlashing: ssz.phase0.AttesterSlashing.fromJson(body)}),
482
- writeReqSsz: ({attesterSlashing}) => ({body: ssz.phase0.AttesterSlashing.serialize(attesterSlashing)}),
483
- parseReqSsz: ({body}) => ({attesterSlashing: ssz.phase0.AttesterSlashing.deserialize(body)}),
484
- schema: {
485
- body: Schema.Object,
486
- },
487
- },
488
- resp: EmptyResponseCodec,
489
- },
490
387
  submitPoolAttesterSlashingsV2: {
491
388
  url: "/eth/v2/beacon/pool/attester_slashings",
492
389
  method: "POST",
@@ -1,4 +1,4 @@
1
- import {ContainerType, Type, ValueOf} from "@chainsafe/ssz";
1
+ import {ContainerType, OptionalType, Type, ValueOf} from "@chainsafe/ssz";
2
2
  import {ChainForkConfig} from "@lodestar/config";
3
3
  import {isForkPostFulu} from "@lodestar/params";
4
4
  import {ArrayOf, BeaconState, DataColumnSidecars, StringType, ssz, sszTypesFor} from "@lodestar/types";
@@ -78,12 +78,62 @@ const ForkChoiceResponseType = new ContainerType(
78
78
  {jsonCase: "eth2"}
79
79
  );
80
80
 
81
+ const ForkChoiceNodeV2ExtraDataType = new ContainerType(
82
+ {
83
+ executionOptimistic: ssz.Boolean,
84
+ timestamp: ssz.UintNum64,
85
+ target: stringType,
86
+ justifiedEpoch: ssz.Epoch,
87
+ finalizedEpoch: ssz.Epoch,
88
+ unrealizedJustifiedEpoch: ssz.Epoch,
89
+ unrealizedFinalizedEpoch: ssz.Epoch,
90
+ payloadAttesterCount: new OptionalType(ssz.UintNum64),
91
+ payloadAvailabilityYesCount: new OptionalType(ssz.UintNum64),
92
+ payloadDataAvailabilityYesCount: new OptionalType(ssz.UintNum64),
93
+ gasLimit: new OptionalType(ssz.UintNum64),
94
+ },
95
+ {jsonCase: "eth2"}
96
+ );
97
+ const ForkChoiceNodeV2Type = new ContainerType(
98
+ {
99
+ payloadStatus: new StringType<"pending" | "empty" | "full">(),
100
+ slot: ssz.Slot,
101
+ blockRoot: stringType,
102
+ parentRoot: stringType,
103
+ weight: ssz.UintNum64,
104
+ validity: new StringType<"valid" | "invalid" | "optimistic">(),
105
+ executionBlockHash: stringType,
106
+ extraData: ForkChoiceNodeV2ExtraDataType,
107
+ },
108
+ {jsonCase: "eth2"}
109
+ );
110
+ const ForkChoiceExtraDataType = new ContainerType(
111
+ {
112
+ unrealizedJustifiedCheckpoint: ssz.phase0.Checkpoint,
113
+ unrealizedFinalizedCheckpoint: ssz.phase0.Checkpoint,
114
+ proposerBoostRoot: stringType,
115
+ previousProposerBoostRoot: stringType,
116
+ headRoot: stringType,
117
+ },
118
+ {jsonCase: "eth2"}
119
+ );
120
+ const ForkChoiceResponseV2Type = new ContainerType(
121
+ {
122
+ justifiedCheckpoint: ssz.phase0.Checkpoint,
123
+ finalizedCheckpoint: ssz.phase0.Checkpoint,
124
+ forkChoiceNodes: ArrayOf(ForkChoiceNodeV2Type),
125
+ extraData: ForkChoiceExtraDataType,
126
+ },
127
+ {jsonCase: "eth2"}
128
+ );
129
+
81
130
  const ProtoNodeListType = ArrayOf(ProtoNodeType);
82
131
  const DebugChainHeadListType = ArrayOf(DebugChainHeadType);
83
132
 
84
133
  type ProtoNodeList = ValueOf<typeof ProtoNodeListType>;
85
134
  type DebugChainHeadList = ValueOf<typeof DebugChainHeadListType>;
86
135
  type ForkChoiceResponse = ValueOf<typeof ForkChoiceResponseType>;
136
+ type ForkChoiceResponseV2 = ValueOf<typeof ForkChoiceResponseV2Type>;
87
137
 
88
138
  export type Endpoints = {
89
139
  /**
@@ -110,6 +160,18 @@ export type Endpoints = {
110
160
  EmptyMeta
111
161
  >;
112
162
 
163
+ /**
164
+ * Retrieves all current fork choice context (v2: per (root, payload_status) with PTC vote tallies)
165
+ */
166
+ getDebugForkChoiceV2: Endpoint<
167
+ // ⏎
168
+ "GET",
169
+ EmptyArgs,
170
+ EmptyRequest,
171
+ ForkChoiceResponseV2,
172
+ EmptyMeta
173
+ >;
174
+
113
175
  /**
114
176
  * Dump all ProtoArray's nodes to debug
115
177
  */
@@ -185,6 +247,24 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
185
247
  },
186
248
  },
187
249
  },
250
+ getDebugForkChoiceV2: {
251
+ url: "/eth/v2/debug/fork_choice",
252
+ method: "GET",
253
+ req: EmptyRequestCodec,
254
+ resp: {
255
+ data: ForkChoiceResponseV2Type,
256
+ meta: EmptyMetaCodec,
257
+ onlySupport: WireFormat.json,
258
+ transform: {
259
+ toResponse: (data) => ({
260
+ ...(data as ForkChoiceResponseV2),
261
+ }),
262
+ fromResponse: (resp) => ({
263
+ data: resp as ForkChoiceResponseV2,
264
+ }),
265
+ },
266
+ },
267
+ },
188
268
  getProtoArrayNodes: {
189
269
  url: "/eth/v0/debug/forkchoice",
190
270
  method: "GET",
@@ -110,6 +110,8 @@ export enum EventType {
110
110
  executionPayloadBid = "execution_payload_bid",
111
111
  /** The node has received a `SignedProposerPreferences` (from P2P or API) that passes gossip validation on the `proposer_preferences` topic */
112
112
  proposerPreferences = "proposer_preferences",
113
+ /** The node has executed the Fast Confirmation Rule and produced a confirmed beacon block */
114
+ fastConfirmation = "fast_confirmation",
113
115
  }
114
116
 
115
117
  export const eventTypes: {[K in EventType]: K} = {
@@ -135,6 +137,7 @@ export const eventTypes: {[K in EventType]: K} = {
135
137
  [EventType.executionPayloadAvailable]: EventType.executionPayloadAvailable,
136
138
  [EventType.executionPayloadBid]: EventType.executionPayloadBid,
137
139
  [EventType.proposerPreferences]: EventType.proposerPreferences,
140
+ [EventType.fastConfirmation]: EventType.fastConfirmation,
138
141
  };
139
142
 
140
143
  export type EventData = {
@@ -203,6 +206,11 @@ export type EventData = {
203
206
  };
204
207
  [EventType.executionPayloadBid]: {version: ForkName; data: gloas.SignedExecutionPayloadBid};
205
208
  [EventType.proposerPreferences]: {version: ForkName; data: gloas.SignedProposerPreferences};
209
+ [EventType.fastConfirmation]: {
210
+ block: RootHex;
211
+ slot: Slot;
212
+ currentSlot: Slot;
213
+ };
206
214
  };
207
215
 
208
216
  export type BeaconEvent = {[K in EventType]: {type: K; message: EventData[K]}}[EventType];
@@ -400,6 +408,14 @@ export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: Type
400
408
  ),
401
409
  [EventType.executionPayloadBid]: WithVersion((fork) => getPostGloasForkTypes(fork).SignedExecutionPayloadBid),
402
410
  [EventType.proposerPreferences]: WithVersion((fork) => getPostGloasForkTypes(fork).SignedProposerPreferences),
411
+ [EventType.fastConfirmation]: new ContainerType(
412
+ {
413
+ block: stringType,
414
+ slot: ssz.Slot,
415
+ currentSlot: ssz.Slot,
416
+ },
417
+ {jsonCase: "eth2"}
418
+ ),
403
419
 
404
420
  [EventType.lightClientOptimisticUpdate]: WithVersion(
405
421
  (fork) => getPostAltairForkTypes(fork).LightClientOptimisticUpdate
@@ -136,6 +136,25 @@ export type CustodyInfo = {
136
136
  custodyColumns: number[];
137
137
  };
138
138
 
139
+ export type FastConfirmationInfo = {
140
+ confirmed: {
141
+ rootHex: RootHex | null;
142
+ slot: Slot | null;
143
+ };
144
+ head: {
145
+ rootHex: RootHex;
146
+ slot: Slot;
147
+ };
148
+ justifiedCheckpoint: {
149
+ rootHex: RootHex;
150
+ epoch: Epoch;
151
+ };
152
+ finalizedCheckpoint: {
153
+ rootHex: RootHex;
154
+ epoch: Epoch;
155
+ };
156
+ };
157
+
139
158
  export type Endpoints = {
140
159
  /** Trigger to write a heapdump to disk at `dirpath`. May take > 1min */
141
160
  writeHeapdump: Endpoint<
@@ -397,6 +416,8 @@ export type Endpoints = {
397
416
  EmptyMeta
398
417
  >;
399
418
 
419
+ getFastConfirmationInfo: Endpoint<"GET", EmptyArgs, EmptyRequest, FastConfirmationInfo, EmptyMeta>;
420
+
400
421
  /** Craft attester slashings from the attestations in the provided blocks */
401
422
  getAttesterSlashingsFromBlocks: Endpoint<
402
423
  "POST",
@@ -579,8 +600,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
579
600
  meta: ExecutionOptimisticFinalizedAndVersionCodec,
580
601
  },
581
602
  },
582
- // TODO GLOAS: this endpoint needs to be updated because post-gloas there could be two variants of the persisted checkpoint state (empty or full).
583
- // Either add a an additional parameter `payloadPresent`, or return one or both variants of state.
584
603
  getPersistedCheckpointState: {
585
604
  url: "/eth/v1/lodestar/persisted_checkpoint_state",
586
605
  method: "GET",
@@ -634,6 +653,12 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
634
653
  req: EmptyRequestCodec,
635
654
  resp: JsonOnlyResponseCodec,
636
655
  },
656
+ getFastConfirmationInfo: {
657
+ url: "/eth/v1/lodestar/fast_confirmation",
658
+ method: "GET",
659
+ req: EmptyRequestCodec,
660
+ resp: JsonOnlyResponseCodec,
661
+ },
637
662
  getAttesterSlashingsFromBlocks: {
638
663
  url: "/eth/v1/lodestar/blocks/attester_slashings",
639
664
  method: "POST",
@@ -499,23 +499,6 @@ export type Endpoints = {
499
499
  EmptyMeta
500
500
  >;
501
501
 
502
- /**
503
- * Get aggregated attestation
504
- * Aggregates all attestations matching given attestation data root and slot
505
- * Returns an aggregated `Attestation` object with same `AttestationData` root.
506
- */
507
- getAggregatedAttestation: Endpoint<
508
- "GET",
509
- {
510
- /** HashTreeRoot of AttestationData that validator want's aggregated */
511
- attestationDataRoot: Root;
512
- slot: Slot;
513
- },
514
- {query: {attestation_data_root: string; slot: number}},
515
- phase0.Attestation,
516
- EmptyMeta
517
- >;
518
-
519
502
  /**
520
503
  * Get aggregated attestation
521
504
  * Aggregates all attestations matching given attestation data root, slot and committee index
@@ -534,18 +517,6 @@ export type Endpoints = {
534
517
  VersionMeta
535
518
  >;
536
519
 
537
- /**
538
- * Publish multiple aggregate and proofs
539
- * Verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
540
- */
541
- publishAggregateAndProofs: Endpoint<
542
- "POST",
543
- {signedAggregateAndProofs: SignedAggregateAndProofListPhase0},
544
- {body: unknown},
545
- EmptyResponseData,
546
- EmptyMeta
547
- >;
548
-
549
520
  /**
550
521
  * Publish multiple aggregate and proofs
551
522
  * Verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
@@ -960,7 +931,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
960
931
  },
961
932
  },
962
933
  getExecutionPayloadEnvelope: {
963
- url: "/eth/v1/validator/execution_payload_envelope/{slot}/{beacon_block_root}",
934
+ url: "/eth/v1/validator/execution_payload_envelopes/{slot}/{beacon_block_root}",
964
935
  method: "GET",
965
936
  req: {
966
937
  writeReq: ({slot, beaconBlockRoot}) => ({
@@ -1040,29 +1011,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
1040
1011
  meta: EmptyMetaCodec,
1041
1012
  },
1042
1013
  },
1043
- getAggregatedAttestation: {
1044
- url: "/eth/v1/validator/aggregate_attestation",
1045
- method: "GET",
1046
- req: {
1047
- writeReq: ({attestationDataRoot, slot}) => ({
1048
- query: {attestation_data_root: toRootHex(attestationDataRoot), slot},
1049
- }),
1050
- parseReq: ({query}) => ({
1051
- attestationDataRoot: fromHex(query.attestation_data_root),
1052
- slot: query.slot,
1053
- }),
1054
- schema: {
1055
- query: {
1056
- attestation_data_root: Schema.StringRequired,
1057
- slot: Schema.UintRequired,
1058
- },
1059
- },
1060
- },
1061
- resp: {
1062
- data: ssz.phase0.Attestation,
1063
- meta: EmptyMetaCodec,
1064
- },
1065
- },
1066
1014
  getAggregatedAttestationV2: {
1067
1015
  url: "/eth/v2/validator/aggregate_attestation",
1068
1016
  method: "GET",
@@ -1088,28 +1036,6 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
1088
1036
  meta: VersionCodec,
1089
1037
  },
1090
1038
  },
1091
- publishAggregateAndProofs: {
1092
- url: "/eth/v1/validator/aggregate_and_proofs",
1093
- method: "POST",
1094
- req: {
1095
- writeReqJson: ({signedAggregateAndProofs}) => ({
1096
- body: SignedAggregateAndProofListPhase0Type.toJson(signedAggregateAndProofs),
1097
- }),
1098
- parseReqJson: ({body}) => ({
1099
- signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.fromJson(body),
1100
- }),
1101
- writeReqSsz: ({signedAggregateAndProofs}) => ({
1102
- body: SignedAggregateAndProofListPhase0Type.serialize(signedAggregateAndProofs),
1103
- }),
1104
- parseReqSsz: ({body}) => ({
1105
- signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.deserialize(body),
1106
- }),
1107
- schema: {
1108
- body: Schema.ObjectArray,
1109
- },
1110
- },
1111
- resp: EmptyResponseCodec,
1112
- },
1113
1039
  publishAggregateAndProofsV2: {
1114
1040
  url: "/eth/v2/validator/aggregate_and_proofs",
1115
1041
  method: "POST",