@lodestar/api 1.45.0-dev.fadf0fbb1f → 1.46.0-dev.8fc4e297d2

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.
@@ -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 received a `PayloadAttestationMessage` (from P2P or API) that passes validation rules of the `payload_attestation_message` topic */
114
+ payloadAttestationMessage = "payload_attestation_message",
113
115
  /** The node has executed the Fast Confirmation Rule and produced a confirmed beacon block */
114
116
  fastConfirmation = "fast_confirmation",
115
117
  }
@@ -137,6 +139,7 @@ export const eventTypes: {[K in EventType]: K} = {
137
139
  [EventType.executionPayloadAvailable]: EventType.executionPayloadAvailable,
138
140
  [EventType.executionPayloadBid]: EventType.executionPayloadBid,
139
141
  [EventType.proposerPreferences]: EventType.proposerPreferences,
142
+ [EventType.payloadAttestationMessage]: EventType.payloadAttestationMessage,
140
143
  [EventType.fastConfirmation]: EventType.fastConfirmation,
141
144
  };
142
145
 
@@ -206,6 +209,7 @@ export type EventData = {
206
209
  };
207
210
  [EventType.executionPayloadBid]: {version: ForkName; data: gloas.SignedExecutionPayloadBid};
208
211
  [EventType.proposerPreferences]: {version: ForkName; data: gloas.SignedProposerPreferences};
212
+ [EventType.payloadAttestationMessage]: {version: ForkName; data: gloas.PayloadAttestationMessage};
209
213
  [EventType.fastConfirmation]: {
210
214
  block: RootHex;
211
215
  slot: Slot;
@@ -408,6 +412,7 @@ export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: Type
408
412
  ),
409
413
  [EventType.executionPayloadBid]: WithVersion((fork) => getPostGloasForkTypes(fork).SignedExecutionPayloadBid),
410
414
  [EventType.proposerPreferences]: WithVersion((fork) => getPostGloasForkTypes(fork).SignedProposerPreferences),
415
+ [EventType.payloadAttestationMessage]: WithVersion((fork) => getPostGloasForkTypes(fork).PayloadAttestationMessage),
411
416
  [EventType.fastConfirmation]: new ContainerType(
412
417
  {
413
418
  block: stringType,
@@ -106,6 +106,7 @@ export enum NodeHealth {
106
106
  */
107
107
  export enum ClientCode {
108
108
  BU = "BU", // besu
109
+ CN = "CN", // caplin
109
110
  EJ = "EJ", // ethereumJS
110
111
  EG = "EG", // erigon
111
112
  EX = "EX", // ethrex
@@ -114,7 +115,8 @@ export enum ClientCode {
114
115
  LH = "LH", // lighthouse
115
116
  LS = "LS", // lodestar
116
117
  NM = "NM", // nethermind
117
- NB = "NB", // nimbus
118
+ NB = "NB", // nimbus CL
119
+ NE = "NE", // nimbus EL
118
120
  TE = "TE", // trin-execution
119
121
  TK = "TK", // teku
120
122
  PM = "PM", // prysm
@@ -38,6 +38,7 @@ import {
38
38
  EmptyResponseCodec,
39
39
  EmptyResponseData,
40
40
  JsonOnlyReq,
41
+ WithMeta,
41
42
  WithVersion,
42
43
  } from "../../utils/codecs.js";
43
44
  import {getPostBellatrixForkTypes, getPostGloasForkTypes, toForkName} from "../../utils/fork.js";
@@ -98,6 +99,10 @@ export const ProduceBlockV4MetaType = new ContainerType(
98
99
  ...VersionType.fields,
99
100
  /** Consensus rewards paid to the proposer for this block, in Wei */
100
101
  consensusBlockValue: ssz.UintBn64,
102
+ /** Local execution payload value when self-building, or builder bid value when committing to a bid, in Wei */
103
+ executionPayloadValue: ssz.UintBn64,
104
+ /** Specifies whether the response contains full block contents or only the beacon block */
105
+ executionPayloadIncluded: ssz.Boolean,
101
106
  },
102
107
  {jsonCase: "eth2"}
103
108
  );
@@ -421,6 +426,12 @@ export type Endpoints = {
421
426
  * Post-Gloas, proposers submit execution payload bids rather than full execution payloads,
422
427
  * so there is no longer a concept of blinded or unblinded blocks. Builders release the payload later.
423
428
  * This endpoint is specific to the post-Gloas forks and is not backwards compatible with previous forks.
429
+ *
430
+ * When self-building and `includePayload` is true, the response contains the full `BlockContents`
431
+ * (block, execution payload envelope, KZG proofs and blobs) which enables stateless envelope
432
+ * publishing via any beacon node. When `includePayload` is false, only the `BeaconBlock` is
433
+ * returned and the beacon node caches the envelope and blobs internally.
434
+ * When committing to a builder bid, only the `BeaconBlock` is returned in either case.
424
435
  */
425
436
  produceBlockV4: Endpoint<
426
437
  "GET",
@@ -433,6 +444,8 @@ export type Endpoints = {
433
444
  graffiti?: string;
434
445
  skipRandaoVerification?: boolean;
435
446
  builderBoostFactor?: UintBn64;
447
+ /** Include execution payload envelope and blobs in the response when self-building */
448
+ includePayload: boolean;
436
449
  } & Omit<ExtraProduceBlockOpts, "blindedLocal">,
437
450
  {
438
451
  params: {slot: number};
@@ -444,16 +457,18 @@ export type Endpoints = {
444
457
  builder_selection?: string;
445
458
  builder_boost_factor?: string;
446
459
  strict_fee_recipient_check?: boolean;
460
+ include_payload: boolean;
447
461
  };
448
462
  },
449
- BeaconBlock<ForkPostGloas>,
463
+ BeaconBlock<ForkPostGloas> | BlockContents<ForkPostGloas>,
450
464
  ProduceBlockV4Meta
451
465
  >;
452
466
 
453
467
  /**
454
468
  * Get execution payload envelope.
455
- * Retrieves execution payload envelope for a given slot and beacon block root.
456
- * The envelope contains the full execution payload along with associated metadata.
469
+ * Retrieves the cached execution payload envelope for a given slot and beacon block root,
470
+ * to be signed and published via `publishExecutionPayloadEnvelope`.
471
+ * Used in the stateful (`includePayload=false`) local build flow.
457
472
  */
458
473
  getExecutionPayloadEnvelope: Endpoint<
459
474
  "GET",
@@ -495,7 +510,7 @@ export type Endpoints = {
495
510
  /** The slot for which payload attestation data should be created */
496
511
  slot: Slot;
497
512
  },
498
- {params: {slot: Slot}},
513
+ {query: {slot: Slot}},
499
514
  MaybePayloadAttestationData,
500
515
  VersionMeta
501
516
  >;
@@ -906,6 +921,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
906
921
  builderSelection,
907
922
  builderBoostFactor,
908
923
  strictFeeRecipientCheck,
924
+ includePayload,
909
925
  }) => ({
910
926
  params: {slot},
911
927
  query: {
@@ -916,6 +932,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
916
932
  builder_selection: builderSelection,
917
933
  builder_boost_factor: builderBoostFactor?.toString(),
918
934
  strict_fee_recipient_check: strictFeeRecipientCheck,
935
+ include_payload: includePayload,
919
936
  },
920
937
  }),
921
938
  parseReq: ({params, query}) => ({
@@ -927,6 +944,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
927
944
  builderSelection: query.builder_selection as BuilderSelection,
928
945
  builderBoostFactor: parseBuilderBoostFactor(query.builder_boost_factor),
929
946
  strictFeeRecipientCheck: query.strict_fee_recipient_check,
947
+ includePayload: query.include_payload,
930
948
  }),
931
949
  schema: {
932
950
  params: {slot: Schema.UintRequired},
@@ -938,21 +956,33 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
938
956
  builder_selection: Schema.String,
939
957
  builder_boost_factor: Schema.String,
940
958
  strict_fee_recipient_check: Schema.Boolean,
959
+ include_payload: Schema.BooleanRequired,
941
960
  },
942
961
  },
943
962
  },
944
963
  resp: {
945
- data: WithVersion((fork) => getPostGloasForkTypes(fork).BeaconBlock),
964
+ data: WithMeta(
965
+ ({version, executionPayloadIncluded}) =>
966
+ (executionPayloadIncluded
967
+ ? getPostGloasForkTypes(version).BlockContents
968
+ : getPostGloasForkTypes(version).BeaconBlock) as Type<
969
+ BeaconBlock<ForkPostGloas> | BlockContents<ForkPostGloas>
970
+ >
971
+ ),
946
972
  meta: {
947
973
  toJson: (meta) => ProduceBlockV4MetaType.toJson(meta),
948
974
  fromJson: (val) => ProduceBlockV4MetaType.fromJson(val),
949
975
  toHeadersObject: (meta) => ({
950
976
  [MetaHeader.Version]: meta.version,
951
977
  [MetaHeader.ConsensusBlockValue]: meta.consensusBlockValue.toString(),
978
+ [MetaHeader.ExecutionPayloadValue]: meta.executionPayloadValue.toString(),
979
+ [MetaHeader.ExecutionPayloadIncluded]: meta.executionPayloadIncluded.toString(),
952
980
  }),
953
981
  fromHeaders: (headers) => ({
954
982
  version: toForkName(headers.getRequired(MetaHeader.Version)),
955
983
  consensusBlockValue: BigInt(headers.getRequired(MetaHeader.ConsensusBlockValue)),
984
+ executionPayloadValue: BigInt(headers.getRequired(MetaHeader.ExecutionPayloadValue)),
985
+ executionPayloadIncluded: toBoolean(headers.getRequired(MetaHeader.ExecutionPayloadIncluded)),
956
986
  }),
957
987
  },
958
988
  },
@@ -999,13 +1029,13 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
999
1029
  },
1000
1030
  },
1001
1031
  producePayloadAttestationData: {
1002
- url: "/eth/v1/validator/payload_attestation_data/{slot}",
1032
+ url: "/eth/v1/validator/payload_attestation_data",
1003
1033
  method: "GET",
1004
1034
  req: {
1005
- writeReq: ({slot}) => ({params: {slot}}),
1006
- parseReq: ({params}) => ({slot: params.slot}),
1035
+ writeReq: ({slot}) => ({query: {slot}}),
1036
+ parseReq: ({query}) => ({slot: query.slot}),
1007
1037
  schema: {
1008
- params: {slot: Schema.UintRequired},
1038
+ query: {slot: Schema.UintRequired},
1009
1039
  },
1010
1040
  },
1011
1041
  resp: {
@@ -74,8 +74,10 @@ export type ExecutionOptimisticAndDependentRootMeta = ValueOf<typeof ExecutionOp
74
74
 
75
75
  export enum MetaHeader {
76
76
  Version = "Eth-Consensus-Version",
77
+ BlobDataIncluded = "Eth-Blob-Data-Included",
77
78
  ConsensusBlockValue = "Eth-Consensus-Block-Value",
78
79
  ExecutionPayloadBlinded = "Eth-Execution-Payload-Blinded",
80
+ ExecutionPayloadIncluded = "Eth-Execution-Payload-Included",
79
81
  ExecutionPayloadValue = "Eth-Execution-Payload-Value",
80
82
 
81
83
  /* Lodestar-specific (non-standardized) headers */
@@ -34,6 +34,7 @@ export enum Schema {
34
34
  ObjectArray,
35
35
  AnyArray,
36
36
  Boolean,
37
+ BooleanRequired,
37
38
  }
38
39
 
39
40
  /**
@@ -71,6 +72,7 @@ function getJsonSchemaItem(schema: Schema): JsonSchema {
71
72
  return {type: "array"};
72
73
 
73
74
  case Schema.Boolean:
75
+ case Schema.BooleanRequired:
74
76
  return {type: "boolean"};
75
77
  }
76
78
  }
@@ -81,6 +83,7 @@ function isRequired(schema: Schema): boolean {
81
83
  case Schema.StringRequired:
82
84
  case Schema.UintOrStringRequired:
83
85
  case Schema.StringArrayRequired:
86
+ case Schema.BooleanRequired:
84
87
  return true;
85
88
 
86
89
  default: