@lodestar/beacon-node 1.49.0-dev.a261342520 → 1.49.0-dev.a56f18f2ea

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.
Files changed (213) hide show
  1. package/lib/api/impl/beacon/blocks/index.js +2 -2
  2. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  3. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.js +4 -2
  5. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  6. package/lib/api/impl/validator/index.d.ts.map +1 -1
  7. package/lib/api/impl/validator/index.js +9 -7
  8. package/lib/api/impl/validator/index.js.map +1 -1
  9. package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
  10. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  11. package/lib/chain/archiveStore/archiveStore.js +0 -5
  12. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  13. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  14. package/lib/chain/archiveStore/historicalState/metrics.js +4 -6
  15. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  16. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  17. package/lib/chain/archiveStore/utils/pruneHistory.js +14 -3
  18. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  19. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  20. package/lib/chain/blocks/importExecutionPayload.js +13 -0
  21. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  22. package/lib/chain/blocks/index.js +2 -2
  23. package/lib/chain/blocks/index.js.map +1 -1
  24. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -1
  25. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  26. package/lib/chain/emitter.d.ts +10 -0
  27. package/lib/chain/emitter.d.ts.map +1 -1
  28. package/lib/chain/emitter.js +4 -0
  29. package/lib/chain/emitter.js.map +1 -1
  30. package/lib/chain/errors/attesterSlashingError.d.ts +4 -1
  31. package/lib/chain/errors/attesterSlashingError.d.ts.map +1 -1
  32. package/lib/chain/errors/attesterSlashingError.js +1 -0
  33. package/lib/chain/errors/attesterSlashingError.js.map +1 -1
  34. package/lib/chain/errors/payloadAttestation.d.ts +4 -0
  35. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -1
  36. package/lib/chain/errors/payloadAttestation.js +1 -0
  37. package/lib/chain/errors/payloadAttestation.js.map +1 -1
  38. package/lib/chain/errors/proposerSlashingError.d.ts +4 -1
  39. package/lib/chain/errors/proposerSlashingError.d.ts.map +1 -1
  40. package/lib/chain/errors/proposerSlashingError.js +1 -0
  41. package/lib/chain/errors/proposerSlashingError.js.map +1 -1
  42. package/lib/chain/options.d.ts +0 -4
  43. package/lib/chain/options.d.ts.map +1 -1
  44. package/lib/chain/options.js +0 -1
  45. package/lib/chain/options.js.map +1 -1
  46. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  47. package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
  48. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  49. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  50. package/lib/chain/produceBlock/produceBlockBody.js +6 -6
  51. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  52. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +2 -1
  53. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  54. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +3 -2
  55. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  56. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  57. package/lib/chain/validation/attesterSlashing.js +1 -2
  58. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  59. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  60. package/lib/chain/validation/payloadAttestationMessage.js +8 -1
  61. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  62. package/lib/chain/validation/proposerSlashing.js +1 -2
  63. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  64. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  65. package/lib/chain/validatorMonitor.js +2 -2
  66. package/lib/chain/validatorMonitor.js.map +1 -1
  67. package/lib/db/beacon.d.ts +1 -2
  68. package/lib/db/beacon.d.ts.map +1 -1
  69. package/lib/db/beacon.js +1 -3
  70. package/lib/db/beacon.js.map +1 -1
  71. package/lib/db/buckets.d.ts +0 -1
  72. package/lib/db/buckets.d.ts.map +1 -1
  73. package/lib/db/buckets.js +1 -1
  74. package/lib/db/buckets.js.map +1 -1
  75. package/lib/db/interface.d.ts +1 -2
  76. package/lib/db/interface.d.ts.map +1 -1
  77. package/lib/db/repositories/blockArchive.d.ts +5 -0
  78. package/lib/db/repositories/blockArchive.d.ts.map +1 -1
  79. package/lib/db/repositories/blockArchive.js +36 -1
  80. package/lib/db/repositories/blockArchive.js.map +1 -1
  81. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  82. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  83. package/lib/db/repositories/index.d.ts +0 -1
  84. package/lib/db/repositories/index.d.ts.map +1 -1
  85. package/lib/db/repositories/index.js +0 -1
  86. package/lib/db/repositories/index.js.map +1 -1
  87. package/lib/metrics/metrics/lodestar.d.ts +12 -11
  88. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  89. package/lib/metrics/metrics/lodestar.js +25 -23
  90. package/lib/metrics/metrics/lodestar.js.map +1 -1
  91. package/lib/network/gossip/encoding.d.ts +1 -2
  92. package/lib/network/gossip/encoding.d.ts.map +1 -1
  93. package/lib/network/gossip/encoding.js +5 -10
  94. package/lib/network/gossip/encoding.js.map +1 -1
  95. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  96. package/lib/network/gossip/gossipsub.js +16 -1
  97. package/lib/network/gossip/gossipsub.js.map +1 -1
  98. package/lib/network/gossip/topic.d.ts +9 -6
  99. package/lib/network/gossip/topic.d.ts.map +1 -1
  100. package/lib/network/gossip/topic.js +23 -8
  101. package/lib/network/gossip/topic.js.map +1 -1
  102. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  103. package/lib/network/processor/gossipHandlers.js +16 -5
  104. package/lib/network/processor/gossipHandlers.js.map +1 -1
  105. package/lib/network/processor/gossipValidatorFn.d.ts +2 -0
  106. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  107. package/lib/network/processor/gossipValidatorFn.js +88 -7
  108. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  109. package/lib/network/processor/index.d.ts +6 -2
  110. package/lib/network/processor/index.d.ts.map +1 -1
  111. package/lib/network/processor/index.js +62 -24
  112. package/lib/network/processor/index.js.map +1 -1
  113. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  114. package/lib/network/reqresp/protocols.js +19 -5
  115. package/lib/network/reqresp/protocols.js.map +1 -1
  116. package/lib/node/nodejs.d.ts +2 -7
  117. package/lib/node/nodejs.d.ts.map +1 -1
  118. package/lib/node/nodejs.js +2 -22
  119. package/lib/node/nodejs.js.map +1 -1
  120. package/lib/sync/interface.d.ts +1 -2
  121. package/lib/sync/interface.d.ts.map +1 -1
  122. package/lib/sync/options.d.ts +0 -6
  123. package/lib/sync/options.d.ts.map +1 -1
  124. package/lib/sync/options.js +0 -2
  125. package/lib/sync/options.js.map +1 -1
  126. package/lib/sync/types.d.ts +21 -0
  127. package/lib/sync/types.d.ts.map +1 -1
  128. package/lib/sync/types.js +22 -0
  129. package/lib/sync/types.js.map +1 -1
  130. package/lib/sync/unknownBlock.d.ts +20 -0
  131. package/lib/sync/unknownBlock.d.ts.map +1 -1
  132. package/lib/sync/unknownBlock.js +158 -2
  133. package/lib/sync/unknownBlock.js.map +1 -1
  134. package/lib/util/shuffle.d.ts +0 -4
  135. package/lib/util/shuffle.d.ts.map +1 -1
  136. package/lib/util/shuffle.js +0 -8
  137. package/lib/util/shuffle.js.map +1 -1
  138. package/lib/util/sszBytes.d.ts +5 -0
  139. package/lib/util/sszBytes.d.ts.map +1 -1
  140. package/lib/util/sszBytes.js +13 -1
  141. package/lib/util/sszBytes.js.map +1 -1
  142. package/package.json +15 -15
  143. package/src/api/impl/beacon/blocks/index.ts +2 -2
  144. package/src/api/impl/beacon/pool/index.ts +6 -2
  145. package/src/api/impl/validator/index.ts +9 -7
  146. package/src/chain/archiveStore/archiveStore.ts +0 -6
  147. package/src/chain/archiveStore/historicalState/metrics.ts +4 -7
  148. package/src/chain/archiveStore/utils/pruneHistory.ts +14 -4
  149. package/src/chain/blocks/importExecutionPayload.ts +14 -0
  150. package/src/chain/blocks/index.ts +2 -2
  151. package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -1
  152. package/src/chain/emitter.ts +7 -2
  153. package/src/chain/errors/attesterSlashingError.ts +3 -1
  154. package/src/chain/errors/payloadAttestation.ts +2 -0
  155. package/src/chain/errors/proposerSlashingError.ts +3 -1
  156. package/src/chain/options.ts +0 -5
  157. package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
  158. package/src/chain/produceBlock/produceBlockBody.ts +17 -6
  159. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +3 -2
  160. package/src/chain/validation/attesterSlashing.ts +1 -2
  161. package/src/chain/validation/payloadAttestationMessage.ts +9 -0
  162. package/src/chain/validation/proposerSlashing.ts +1 -2
  163. package/src/chain/validatorMonitor.ts +12 -2
  164. package/src/db/beacon.ts +0 -5
  165. package/src/db/buckets.ts +1 -1
  166. package/src/db/interface.ts +0 -3
  167. package/src/db/repositories/blockArchive.ts +38 -1
  168. package/src/db/repositories/index.ts +0 -1
  169. package/src/metrics/metrics/lodestar.ts +34 -26
  170. package/src/network/gossip/encoding.ts +5 -8
  171. package/src/network/gossip/gossipsub.ts +19 -2
  172. package/src/network/gossip/topic.ts +25 -7
  173. package/src/network/processor/gossipHandlers.ts +18 -5
  174. package/src/network/processor/gossipValidatorFn.ts +111 -7
  175. package/src/network/processor/index.ts +81 -24
  176. package/src/network/reqresp/protocols.ts +31 -6
  177. package/src/node/nodejs.ts +0 -27
  178. package/src/sync/interface.ts +1 -2
  179. package/src/sync/options.ts +0 -8
  180. package/src/sync/types.ts +24 -3
  181. package/src/sync/unknownBlock.ts +166 -1
  182. package/src/util/shuffle.ts +0 -9
  183. package/src/util/sszBytes.ts +18 -0
  184. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
  185. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
  186. package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
  187. package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
  188. package/lib/db/repositories/backfilledRanges.d.ts +0 -18
  189. package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
  190. package/lib/db/repositories/backfilledRanges.js +0 -26
  191. package/lib/db/repositories/backfilledRanges.js.map +0 -1
  192. package/lib/sync/backfill/backfill.d.ts +0 -169
  193. package/lib/sync/backfill/backfill.d.ts.map +0 -1
  194. package/lib/sync/backfill/backfill.js +0 -686
  195. package/lib/sync/backfill/backfill.js.map +0 -1
  196. package/lib/sync/backfill/errors.d.ts +0 -30
  197. package/lib/sync/backfill/errors.d.ts.map +0 -1
  198. package/lib/sync/backfill/errors.js +0 -15
  199. package/lib/sync/backfill/errors.js.map +0 -1
  200. package/lib/sync/backfill/index.d.ts +0 -2
  201. package/lib/sync/backfill/index.d.ts.map +0 -1
  202. package/lib/sync/backfill/index.js +0 -2
  203. package/lib/sync/backfill/index.js.map +0 -1
  204. package/lib/sync/backfill/verify.d.ts +0 -18
  205. package/lib/sync/backfill/verify.d.ts.map +0 -1
  206. package/lib/sync/backfill/verify.js +0 -36
  207. package/lib/sync/backfill/verify.js.map +0 -1
  208. package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
  209. package/src/db/repositories/backfilledRanges.ts +0 -29
  210. package/src/sync/backfill/backfill.ts +0 -916
  211. package/src/sync/backfill/errors.ts +0 -23
  212. package/src/sync/backfill/index.ts +0 -1
  213. package/src/sync/backfill/verify.ts +0 -58
@@ -1,24 +1,122 @@
1
1
  import {TopicValidatorResult} from "@libp2p/gossipsub";
2
2
  import {ChainForkConfig} from "@lodestar/config";
3
3
  import {Logger} from "@lodestar/utils";
4
- import {AttestationError, GossipAction, GossipActionError} from "../../chain/errors/index.js";
4
+ import {
5
+ AttestationError,
6
+ AttestationErrorCode,
7
+ AttesterSlashingErrorCode,
8
+ BlobSidecarErrorCode,
9
+ BlockErrorCode,
10
+ BlsToExecutionChangeErrorCode,
11
+ DataColumnSidecarErrorCode,
12
+ ExecutionPayloadBidErrorCode,
13
+ ExecutionPayloadEnvelopeErrorCode,
14
+ GossipAction,
15
+ GossipActionError,
16
+ PayloadAttestationErrorCode,
17
+ ProposerPreferencesErrorCode,
18
+ ProposerSlashingErrorCode,
19
+ SyncCommitteeErrorCode,
20
+ VoluntaryExitErrorCode,
21
+ } from "../../chain/errors/index.js";
5
22
  import {Metrics} from "../../metrics/index.js";
23
+ import {INetworkCore} from "../core/index.js";
6
24
  import {
7
25
  BatchGossipHandlerFn,
8
26
  GossipHandlerFn,
9
27
  GossipHandlers,
10
28
  GossipMessageInfo,
29
+ GossipType,
11
30
  GossipValidatorBatchFn,
12
31
  GossipValidatorFn,
13
32
  } from "../gossip/interface.js";
33
+ import {PeerAction} from "../peers/index.js";
14
34
  import {prettyPrintPeerIdStr} from "../util.js";
15
35
 
16
36
  export type ValidatorFnModules = {
17
37
  config: ChainForkConfig;
18
38
  logger: Logger;
19
39
  metrics: Metrics | null;
40
+ core: INetworkCore;
41
+ };
42
+
43
+ type RejectPeerActionRule = {default: PeerAction; byCode?: Record<string, PeerAction>};
44
+
45
+ /**
46
+ * PeerAction mapping based on the topic and specific codes.
47
+ * Invalid signatures are Fatal on every topic.
48
+ */
49
+ const gossipRejectPeerAction: Record<GossipType, RejectPeerActionRule> = {
50
+ [GossipType.beacon_block]: {
51
+ default: PeerAction.LowToleranceError,
52
+ byCode: {[BlockErrorCode.PROPOSAL_SIGNATURE_INVALID]: PeerAction.Fatal},
53
+ },
54
+ [GossipType.blob_sidecar]: {
55
+ default: PeerAction.LowToleranceError,
56
+ byCode: {[BlobSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID]: PeerAction.Fatal},
57
+ },
58
+ [GossipType.data_column_sidecar]: {
59
+ default: PeerAction.LowToleranceError,
60
+ byCode: {[DataColumnSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID]: PeerAction.Fatal},
61
+ },
62
+ [GossipType.execution_payload]: {
63
+ default: PeerAction.LowToleranceError,
64
+ byCode: {[ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
65
+ },
66
+ [GossipType.beacon_aggregate_and_proof]: {
67
+ default: PeerAction.MidToleranceError,
68
+ byCode: {[AttestationErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
69
+ },
70
+ [GossipType.beacon_attestation]: {
71
+ default: PeerAction.MidToleranceError,
72
+ byCode: {[AttestationErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
73
+ },
74
+ [GossipType.sync_committee_contribution_and_proof]: {
75
+ default: PeerAction.MidToleranceError,
76
+ byCode: {[SyncCommitteeErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
77
+ },
78
+ [GossipType.sync_committee]: {
79
+ default: PeerAction.MidToleranceError,
80
+ byCode: {[SyncCommitteeErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
81
+ },
82
+ [GossipType.payload_attestation_message]: {
83
+ default: PeerAction.MidToleranceError,
84
+ byCode: {[PayloadAttestationErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
85
+ },
86
+ [GossipType.execution_payload_bid]: {
87
+ default: PeerAction.HighToleranceError,
88
+ byCode: {[ExecutionPayloadBidErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
89
+ },
90
+ [GossipType.proposer_preferences]: {
91
+ default: PeerAction.HighToleranceError,
92
+ byCode: {[ProposerPreferencesErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
93
+ },
94
+ [GossipType.voluntary_exit]: {
95
+ default: PeerAction.HighToleranceError,
96
+ byCode: {[VoluntaryExitErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
97
+ },
98
+ [GossipType.bls_to_execution_change]: {
99
+ default: PeerAction.HighToleranceError,
100
+ byCode: {[BlsToExecutionChangeErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
101
+ },
102
+ [GossipType.proposer_slashing]: {
103
+ default: PeerAction.HighToleranceError,
104
+ byCode: {[ProposerSlashingErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
105
+ },
106
+ [GossipType.attester_slashing]: {
107
+ default: PeerAction.HighToleranceError,
108
+ byCode: {[AttesterSlashingErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
109
+ },
110
+ // light client validators only throw IGNORE
111
+ [GossipType.light_client_finality_update]: {default: PeerAction.HighToleranceError},
112
+ [GossipType.light_client_optimistic_update]: {default: PeerAction.HighToleranceError},
20
113
  };
21
114
 
115
+ function rejectPeerAction(type: GossipType, code: string): PeerAction {
116
+ const rule = gossipRejectPeerAction[type];
117
+ return rule.byCode?.[code] ?? rule.default;
118
+ }
119
+
22
120
  /**
23
121
  * Similar to getGossipValidatorFn but return a function to accept a batch of beacon_attestation messages
24
122
  * with the same attestation data
@@ -27,7 +125,7 @@ export function getGossipValidatorBatchFn(
27
125
  gossipHandlers: GossipHandlers,
28
126
  modules: ValidatorFnModules
29
127
  ): GossipValidatorBatchFn {
30
- const {logger, metrics} = modules;
128
+ const {logger, metrics, core} = modules;
31
129
 
32
130
  return async function gossipValidatorBatchFn(messageInfos: GossipMessageInfo[]) {
33
131
  // all messageInfos have same topic type
@@ -69,16 +167,19 @@ export function getGossipValidatorBatchFn(
69
167
  // only beacon_attestation topic is validated in batch
70
168
  metrics?.networkProcessor.gossipAttestationIgnoreByReason.inc({reason: e.type.code});
71
169
  return TopicValidatorResult.Ignore;
72
- case GossipAction.REJECT:
170
+ case GossipAction.REJECT: {
73
171
  metrics?.networkProcessor.gossipValidationReject.inc({topic: type});
74
172
  // only beacon_attestation topic is validated in batch
75
173
  metrics?.networkProcessor.gossipAttestationRejectByReason.inc({reason: e.type.code});
174
+ const peerAction = rejectPeerAction(type, e.type.code);
175
+ core.reportPeer(propagationSource, peerAction, e.type.code);
76
176
  logger.debug(
77
177
  `Gossip validation ${type} rejected`,
78
- {peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
178
+ {peer: propagationSource, clientAgent, clientVersion, peerAction},
79
179
  e
80
180
  );
81
181
  return TopicValidatorResult.Reject;
182
+ }
82
183
  }
83
184
  });
84
185
  } catch (e) {
@@ -108,7 +209,7 @@ export function getGossipValidatorBatchFn(
108
209
  * @see getGossipHandlers for reasoning on why GossipHandlerFn are used for gossip validation.
109
210
  */
110
211
  export function getGossipValidatorFn(gossipHandlers: GossipHandlers, modules: ValidatorFnModules): GossipValidatorFn {
111
- const {logger, metrics} = modules;
212
+ const {logger, metrics, core} = modules;
112
213
 
113
214
  return async function gossipValidatorFn({
114
215
  topic,
@@ -155,14 +256,17 @@ export function getGossipValidatorFn(gossipHandlers: GossipHandlers, modules: Va
155
256
  metrics?.networkProcessor.gossipValidationIgnore.inc({topic: type});
156
257
  return TopicValidatorResult.Ignore;
157
258
 
158
- case GossipAction.REJECT:
259
+ case GossipAction.REJECT: {
159
260
  metrics?.networkProcessor.gossipValidationReject.inc({topic: type});
261
+ const peerAction = rejectPeerAction(type, e.type.code);
262
+ core.reportPeer(propagationSource, peerAction, e.type.code);
160
263
  logger.debug(
161
264
  `Gossip validation ${type} rejected`,
162
- {peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
265
+ {peer: propagationSource, clientAgent, clientVersion, peerAction},
163
266
  e
164
267
  );
165
268
  return TopicValidatorResult.Reject;
269
+ }
166
270
  }
167
271
  }
168
272
  };
@@ -86,8 +86,13 @@ export const MAX_AWAITING_MESSAGES_PER_ROOT: Partial<Record<GossipType, number>>
86
86
 
87
87
  /**
88
88
  * Track the forwarded peers we already emit to UnknownBlockInput sync.
89
+ * envelopeSlotEmitted: whether the unknownEnvelopeBlockRootSlot event was already emitted for this root.
89
90
  */
90
- type SearchedRootEntry = {blockPeerIds?: Set<PeerIdStr>; envelopePeerIds?: Set<PeerIdStr>};
91
+ type SearchedRootEntry = {
92
+ blockPeerIds?: Set<PeerIdStr>;
93
+ envelopePeerIds?: Set<PeerIdStr>;
94
+ envelopeSlotEmitted?: boolean;
95
+ };
91
96
 
92
97
  /**
93
98
  * This is respective to gossipsub seenTTL (which is 550 * 0.7 = 385s), also it's respective
@@ -192,6 +197,19 @@ type PreprocessResult =
192
197
  | {action: PreprocessAction.AwaitBlock; root: RootHex}
193
198
  | {action: PreprocessAction.AwaitEnvelope; root: RootHex};
194
199
 
200
+ enum SearchTarget {
201
+ Block,
202
+ PayloadEnvelope,
203
+ }
204
+
205
+ type SearchUnknownRootTarget =
206
+ | {target: SearchTarget.Block}
207
+ | {
208
+ target: SearchTarget.PayloadEnvelope;
209
+ /** The message slot is the payload's slot, so it can be used for UnknownBlockInput search */
210
+ slotIsPayloadSlot: boolean;
211
+ };
212
+
195
213
  /**
196
214
  * Network processor handles the gossip queues and throtles processing to not overload the main thread
197
215
  * - Decides when to process work and what to process
@@ -347,12 +365,17 @@ export class NetworkProcessor {
347
365
  }
348
366
 
349
367
  /**
350
- * Search envelope via `ChainEvent.unknownEnvelopeBlockRoot` event
368
+ * Search envelope via `ChainEvent.unknownEnvelopeBlockRoot` / `ChainEvent.unknownEnvelopeBlockRootSlot` event
351
369
  * Slot is the message slot, which is not necessarily the same as the envelope's slot, but it can be used for a good prune strategy.
352
370
  * In the rare case, if 2 messages on 2 slots search for the same root (for example beacon_attestation) we may emit the same root twice but BlockInputSync should handle it well.
353
371
  * Same peer-forwarding + dedup behavior as searchUnknownBlock.
354
372
  */
355
- searchUnknownEnvelope({slot, root}: SlotRootHex, source: BlockInputSource, peer?: PeerIdStr): void {
373
+ searchUnknownEnvelope(
374
+ {slot, root}: SlotRootHex,
375
+ source: BlockInputSource,
376
+ peer?: PeerIdStr,
377
+ slotIsPayloadSlot = false
378
+ ): void {
356
379
  if (this.chain.seenPayloadEnvelope(root)) {
357
380
  return;
358
381
  }
@@ -369,8 +392,17 @@ export class NetworkProcessor {
369
392
  forwardedPeers.add(peer);
370
393
  shouldEmit = true;
371
394
  }
395
+ // the payload-slot seed must reach the sync once, even if a slot-less trigger started the search first
396
+ if (slotIsPayloadSlot && !entry.envelopeSlotEmitted) {
397
+ shouldEmit = true;
398
+ }
372
399
  if (shouldEmit) {
373
- this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, {rootHex: root, slot, peer, source});
400
+ if (slotIsPayloadSlot) {
401
+ entry.envelopeSlotEmitted = true;
402
+ this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRootSlot, {rootHex: root, slot, peer, source});
403
+ } else {
404
+ this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, {rootHex: root, peer, source});
405
+ }
374
406
  }
375
407
  }
376
408
 
@@ -431,7 +463,7 @@ export class NetworkProcessor {
431
463
  // no need to check if root is a descendant of the current finalized block, it will be checked once we validate the message if needed
432
464
  if (root && !this.chain.forkChoice.hasBlockHexUnsafe(root)) {
433
465
  // starting from GLOAS, unknown root from data_column_sidecar also falls into this case
434
- this.searchUnknownRoot({slot, root}, true, false, peerId);
466
+ this.searchUnknownRoot({slot, root}, peerId, {target: SearchTarget.Block});
435
467
  // for beacon_attestation and beacon_aggregate_and_proof messages, this is only temporary.
436
468
  // if "index = 1" we need to await for the Envelope instead
437
469
  preprocessResult = {action: PreprocessAction.AwaitBlock, root};
@@ -446,27 +478,28 @@ export class NetworkProcessor {
446
478
  if (topicType === GossipType.beacon_block) {
447
479
  const parentRoot = getParentRootFromSignedBeaconBlockSerialized(message.msg.data);
448
480
  if (parentRoot) {
449
- let searchParentBlock = false;
450
- let searchParentEnvelope = false;
481
+ let search: SearchUnknownRootTarget | null = null;
451
482
  if (ForkSeq[fork] >= ForkSeq.gloas) {
452
483
  // GLOAS: also check parent envelope, same logic as execution_payload_bid
453
484
  const parentBlockHash = getParentBlockHashFromGloasSignedBeaconBlockSerialized(message.msg.data);
454
485
  if (parentBlockHash && !this.chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHash)) {
455
486
  const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
456
487
  if (protoBlock === null) {
457
- searchParentBlock = true;
488
+ search = {target: SearchTarget.Block};
458
489
  } else if (
459
490
  protoBlock.executionPayloadBlockHash &&
460
491
  protoBlock.executionPayloadBlockHash !== parentBlockHash
461
492
  ) {
462
493
  // only search for the envelope by block root if we're sure there is one. Otherwise UnknownBlockSync will penalize the peer.
463
- searchParentEnvelope = true;
494
+ search = {target: SearchTarget.PayloadEnvelope, slotIsPayloadSlot: false};
464
495
  }
465
496
  }
466
497
  } else if (!this.chain.forkChoice.hasBlockHexUnsafe(parentRoot)) {
467
- searchParentBlock = true;
498
+ search = {target: SearchTarget.Block};
499
+ }
500
+ if (search !== null) {
501
+ this.searchUnknownRoot({slot, root: parentRoot}, peerId, search);
468
502
  }
469
- this.searchUnknownRoot({slot, root: parentRoot}, searchParentBlock, searchParentEnvelope, peerId);
470
503
  }
471
504
  preprocessResult = {action: PreprocessAction.PushToQueue};
472
505
  }
@@ -485,7 +518,10 @@ export class NetworkProcessor {
485
518
  : getDataIndexFromSignedAggregateAndProofSerialized(message.msg.data);
486
519
  if (attIndex === 1 && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
487
520
  // attestation votes that the payload is available but it is not yet known
488
- this.searchUnknownRoot({slot, root}, false, true, peerId);
521
+ this.searchUnknownRoot({slot, root}, peerId, {
522
+ target: SearchTarget.PayloadEnvelope,
523
+ slotIsPayloadSlot: false,
524
+ });
489
525
  preprocessResult = {action: PreprocessAction.AwaitEnvelope, root};
490
526
  }
491
527
  break;
@@ -494,8 +530,13 @@ export class NetworkProcessor {
494
530
  if (root == null) break;
495
531
  const payloadPresent = getPayloadPresentFromPayloadAttestationMessageSerialized(message.msg.data);
496
532
  if (payloadPresent && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
497
- // payload attestation votes that the payload is available but it is not yet known
498
- this.searchUnknownRoot({slot, root}, false, true, peerId);
533
+ // payload attestation votes that the payload is available but it is not yet known.
534
+ // this is optimistic search, the peer may not have the payload (only the ptc committee had).
535
+ // the PTC vote's slot is the payload's slot
536
+ this.searchUnknownRoot({slot, root}, undefined, {
537
+ target: SearchTarget.PayloadEnvelope,
538
+ slotIsPayloadSlot: true,
539
+ });
499
540
  // do not await the envelope, payload attestation processing only requires that the block is known
500
541
  // also do not reset preprocessResult, we may already await for the block
501
542
  }
@@ -504,7 +545,12 @@ export class NetworkProcessor {
504
545
  case GossipType.data_column_sidecar: {
505
546
  if (root == null) break;
506
547
  if (!this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
507
- this.searchUnknownRoot({slot, root}, false, true, peerId);
548
+ // this is optimistic search, the peer may not have the payload.
549
+ // the sidecar's slot is the block's (and so the payload's) slot
550
+ this.searchUnknownRoot({slot, root}, undefined, {
551
+ target: SearchTarget.PayloadEnvelope,
552
+ slotIsPayloadSlot: true,
553
+ });
508
554
  // do not await the envelope, we can do gossip validation
509
555
  // also do not reset preprocessResult, we may already await for the block
510
556
  }
@@ -515,7 +561,7 @@ export class NetworkProcessor {
515
561
  // Extract beacon_block_root directly
516
562
  const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
517
563
  if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
518
- this.searchUnknownRoot({slot, root: blockRoot}, true, false, peerId);
564
+ this.searchUnknownRoot({slot, root: blockRoot}, peerId, {target: SearchTarget.Block});
519
565
  // We always want to await the block
520
566
  // This allows us to properly forward the payload envelope
521
567
  preprocessResult = {action: PreprocessAction.AwaitBlock, root: blockRoot};
@@ -534,13 +580,16 @@ export class NetworkProcessor {
534
580
  ) {
535
581
  const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentBlockRoot);
536
582
  if (protoBlock === null) {
537
- this.searchUnknownRoot({slot, root: parentBlockRoot}, true, false, peerId);
583
+ this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {target: SearchTarget.Block});
538
584
  preprocessResult = {action: PreprocessAction.AwaitBlock, root: parentBlockRoot};
539
585
  } else if (
540
586
  protoBlock.executionPayloadBlockHash &&
541
587
  protoBlock.executionPayloadBlockHash !== parentBlockHash
542
588
  ) {
543
- this.searchUnknownRoot({slot, root: parentBlockRoot}, false, true, peerId);
589
+ this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {
590
+ target: SearchTarget.PayloadEnvelope,
591
+ slotIsPayloadSlot: false,
592
+ });
544
593
  preprocessResult = {action: PreprocessAction.AwaitEnvelope, root: parentBlockRoot};
545
594
  }
546
595
  }
@@ -641,16 +690,24 @@ export class NetworkProcessor {
641
690
  return true;
642
691
  }
643
692
 
693
+ /**
694
+ * Search block/envelope given a SlotRootHex
695
+ * undefined peer id means optimistic search
696
+ */
644
697
  private searchUnknownRoot(
645
698
  slotRoot: SlotRootHex,
646
- searchBlock: boolean,
647
- searchEnvelope: boolean,
648
- peerId: PeerIdStr
699
+ peerId: PeerIdStr | undefined,
700
+ search: SearchUnknownRootTarget
649
701
  ): void {
650
- if (!searchBlock && !searchEnvelope) return;
651
702
  if (this.tooManySearchedRoots(slotRoot.slot, slotRoot.root)) return;
652
- if (searchBlock) this.searchUnknownBlock(slotRoot, BlockInputSource.network_processor, peerId);
653
- if (searchEnvelope) this.searchUnknownEnvelope(slotRoot, BlockInputSource.network_processor, peerId);
703
+ switch (search.target) {
704
+ case SearchTarget.Block:
705
+ this.searchUnknownBlock(slotRoot, BlockInputSource.network_processor, peerId);
706
+ break;
707
+ case SearchTarget.PayloadEnvelope:
708
+ this.searchUnknownEnvelope(slotRoot, BlockInputSource.network_processor, peerId, search.slotIsPayloadSlot);
709
+ break;
710
+ }
654
711
  }
655
712
 
656
713
  private pushPendingGossipsubMessageToQueue(message: PendingGossipsubMessage): void {
@@ -1,6 +1,7 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
- import {ForkName} from "@lodestar/params";
2
+ import {ForkName, isForkPostGloas} from "@lodestar/params";
3
3
  import {ContextBytesFactory, ContextBytesType, Encoding, TypeSizes} from "@lodestar/reqresp";
4
+ import {computeMaxGloasDataColumnSidecarSize} from "../../util/sszBytes.js";
4
5
  import {rateLimitQuotas} from "./rateLimit.js";
5
6
  import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js";
6
7
 
@@ -151,18 +152,42 @@ function toProtocol(protocol: ProtocolSummary) {
151
152
  encoding: Encoding.SSZ_SNAPPY,
152
153
  contextBytes: toContextBytes(protocol.contextBytesType, config),
153
154
  inboundRateLimits: rateLimitQuotas(fork, config)[protocol.method],
154
- requestSizes: requestType === null ? null : clampTypeSizes(requestType, config),
155
- responseSizes: (fork) => clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version), config),
155
+ requestSizes: requestType === null ? null : clampTypeSizes(requestType, config.MAX_PAYLOAD_SIZE),
156
+ responseSizes: (fork) =>
157
+ clampResponseTypeSizes(
158
+ responseSszTypeByMethod[protocol.method](fork, protocol.version),
159
+ protocol.method,
160
+ fork,
161
+ config
162
+ ),
156
163
  };
157
164
  };
158
165
  }
159
166
 
167
+ function clampResponseTypeSizes(
168
+ type: TypeSizes,
169
+ method: ReqRespMethod,
170
+ fork: ForkName,
171
+ config: BeaconConfig
172
+ ): TypeSizes {
173
+ let maxPayloadSize = config.MAX_PAYLOAD_SIZE;
174
+ if (isForkPostGloas(fork)) {
175
+ switch (method) {
176
+ case ReqRespMethod.DataColumnSidecarsByRange:
177
+ case ReqRespMethod.DataColumnSidecarsByRoot:
178
+ maxPayloadSize = Math.min(maxPayloadSize, computeMaxGloasDataColumnSidecarSize(config));
179
+ break;
180
+ }
181
+ }
182
+ return clampTypeSizes(type, maxPayloadSize);
183
+ }
184
+
160
185
  /**
161
- * Length-prefix must be within the SSZ type bounds or MAX_PAYLOAD_SIZE, whichever is smaller
186
+ * Length-prefix must be within the SSZ type bounds or the configured payload limit, whichever is smaller.
162
187
  * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies
163
188
  */
164
- function clampTypeSizes(type: TypeSizes, config: BeaconConfig): TypeSizes {
165
- return {minSize: type.minSize, maxSize: Math.min(type.maxSize, config.MAX_PAYLOAD_SIZE)};
189
+ function clampTypeSizes(type: TypeSizes, maxPayloadSize: number): TypeSizes {
190
+ return {minSize: type.minSize, maxSize: Math.min(type.maxSize, maxPayloadSize)};
166
191
  }
167
192
 
168
193
  function toContextBytes(type: ContextBytesType, config: BeaconConfig): ContextBytesFactory {
@@ -8,7 +8,6 @@ import {BeaconConfig} from "@lodestar/config";
8
8
  import type {LoggerNode} from "@lodestar/logger/node";
9
9
  import {ZERO_HASH_HEX} from "@lodestar/params";
10
10
  import {IBeaconStateView, isStatePostBellatrix, isStatePostGloas} from "@lodestar/state-transition";
11
- import {phase0} from "@lodestar/types";
12
11
  import {sleep, toRootHex} from "@lodestar/utils";
13
12
  import {ProcessShutdownCallback} from "@lodestar/validator";
14
13
  import {BeaconRestApiServer, getApi} from "../api/index.js";
@@ -19,7 +18,6 @@ import {initializeExecutionBuilder, initializeExecutionEngine} from "../executio
19
18
  import {HttpMetricsServer, Metrics, createMetrics, getHttpMetricsServer} from "../metrics/index.js";
20
19
  import {MonitoringService} from "../monitoring/index.js";
21
20
  import {Network, getReqRespHandlers} from "../network/index.js";
22
- import {BackfillSync} from "../sync/backfill/index.js";
23
21
  import {BeaconSync, IBeaconSync} from "../sync/index.js";
24
22
  import {Clock} from "../util/clock.js";
25
23
  import {startDeferredVoluntaryExitPublisher} from "./deferredVoluntaryExitPublisher.js";
@@ -38,7 +36,6 @@ export type BeaconNodeModules = {
38
36
  chain: IBeaconChain;
39
37
  api: BeaconApiMethods;
40
38
  sync: IBeaconSync;
41
- backfillSync: BackfillSync | null;
42
39
  metricsServer: HttpMetricsServer | null;
43
40
  monitoring: MonitoringService | null;
44
41
  restApi?: BeaconRestApiServer;
@@ -58,7 +55,6 @@ export type BeaconNodeInitModules = {
58
55
  peerStoreDir?: string;
59
56
  anchorState: IBeaconStateView;
60
57
  isAnchorStateFinalized: boolean;
61
- wsCheckpoint?: phase0.Checkpoint;
62
58
  metricsRegistries?: Registry[];
63
59
  };
64
60
 
@@ -70,7 +66,6 @@ export enum BeaconNodeStatus {
70
66
 
71
67
  enum LoggerModule {
72
68
  api = "api",
73
- backfill = "backfill",
74
69
  chain = "chain",
75
70
  execution = "execution",
76
71
  metrics = "metrics",
@@ -105,7 +100,6 @@ export class BeaconNode {
105
100
  api: BeaconApiMethods;
106
101
  restApi?: BeaconRestApiServer;
107
102
  sync: IBeaconSync;
108
- backfillSync: BackfillSync | null;
109
103
 
110
104
  status: BeaconNodeStatus;
111
105
  private controller?: AbortController;
@@ -123,7 +117,6 @@ export class BeaconNode {
123
117
  api,
124
118
  restApi,
125
119
  sync,
126
- backfillSync,
127
120
  controller,
128
121
  }: BeaconNodeModules) {
129
122
  this.opts = opts;
@@ -138,7 +131,6 @@ export class BeaconNode {
138
131
  this.restApi = restApi;
139
132
  this.network = network;
140
133
  this.sync = sync;
141
- this.backfillSync = backfillSync;
142
134
  this.controller = controller;
143
135
 
144
136
  this.status = BeaconNodeStatus.started;
@@ -161,7 +153,6 @@ export class BeaconNode {
161
153
  peerStoreDir,
162
154
  anchorState,
163
155
  isAnchorStateFinalized,
164
- wsCheckpoint,
165
156
  metricsRegistries = [],
166
157
  }: BeaconNodeInitModules): Promise<T> {
167
158
  if (hasher.name !== "hashtree") {
@@ -295,25 +286,9 @@ export class BeaconNode {
295
286
  chain,
296
287
  metrics,
297
288
  network,
298
- wsCheckpoint,
299
289
  logger: logger.child({module: LoggerModule.sync}),
300
290
  });
301
291
 
302
- const backfillSync =
303
- opts.sync.backfillBatchSize > 0
304
- ? await BackfillSync.init(opts.sync, {
305
- config,
306
- db,
307
- chain,
308
- metrics,
309
- network,
310
- wsCheckpoint,
311
- anchorState,
312
- logger: logger.child({module: LoggerModule.backfill}),
313
- signal,
314
- })
315
- : null;
316
-
317
292
  const api = getApi(opts.api, {
318
293
  config,
319
294
  logger: logger.child({module: LoggerModule.api}),
@@ -361,7 +336,6 @@ export class BeaconNode {
361
336
  api,
362
337
  restApi,
363
338
  sync,
364
- backfillSync,
365
339
  controller,
366
340
  }) as T;
367
341
  }
@@ -373,7 +347,6 @@ export class BeaconNode {
373
347
  if (this.status === BeaconNodeStatus.started) {
374
348
  this.status = BeaconNodeStatus.closing;
375
349
  this.sync.close();
376
- this.backfillSync?.close();
377
350
  if (this.restApi) await this.restApi.close();
378
351
  await this.network.close();
379
352
  if (this.metricsServer) await this.metricsServer.close();
@@ -1,6 +1,6 @@
1
1
  import {routes} from "@lodestar/api";
2
2
  import {BeaconConfig} from "@lodestar/config";
3
- import {Slot, phase0} from "@lodestar/types";
3
+ import {Slot} from "@lodestar/types";
4
4
  import {Logger} from "@lodestar/utils";
5
5
  import {IBeaconChain} from "../chain/index.js";
6
6
  import {IBeaconDb} from "../db/index.js";
@@ -51,5 +51,4 @@ export interface SyncModules {
51
51
  metrics: Metrics | null;
52
52
  logger: Logger;
53
53
  chain: IBeaconChain;
54
- wsCheckpoint?: phase0.Checkpoint;
55
54
  }
@@ -16,12 +16,6 @@ export type SyncOptions = {
16
16
  disableRangeSync?: boolean;
17
17
  /** USE FOR TESTING ONLY. Disable unknown block sync completely */
18
18
  disableBlockInputSync?: boolean;
19
- /**
20
- * The batch size of slots for backfill sync can attempt to sync/process before yielding
21
- * to sync loop. This number can be increased or decreased to make a suitable resource
22
- * allocation to backfill sync. The default of 0 would mean backfill sync will be skipped
23
- */
24
- backfillBatchSize: number;
25
19
  /** For testing only, MAX_PENDING_BLOCKS by default */
26
20
  maxPendingBlocks?: number;
27
21
 
@@ -39,7 +33,5 @@ export type SyncOptions = {
39
33
  export const defaultSyncOptions: SyncOptions = {
40
34
  isSingleNode: false,
41
35
  disableProcessAsChainSegment: false,
42
- /** By default skip the backfill sync */
43
- backfillBatchSize: 0,
44
36
  slotImportTolerance: SLOTS_PER_EPOCH,
45
37
  };
package/src/sync/types.ts CHANGED
@@ -23,6 +23,14 @@ export enum PendingBlockType {
23
23
  * Payload analog of UNKNOWN_BLOCK_ROOT: we have a beacon block root but not its execution payload envelope.
24
24
  */
25
25
  UNKNOWN_PAYLOAD_BLOCK_ROOT = "unknown_payload_block_root",
26
+ /**
27
+ * Same as UNKNOWN_PAYLOAD_BLOCK_ROOT, but the trigger also carries the payload's slot
28
+ */
29
+ UNKNOWN_PAYLOAD_BLOCK_ROOT_SLOT = "unknown_payload_block_root_slot",
30
+ /**
31
+ * Same as UNKNOWN_PAYLOAD_BLOCK_ROOT_SLOT for the current slot
32
+ */
33
+ DEFERRED_PAYLOAD_BLOCK_ROOT = "deferred_payload_block_root",
26
34
  /**
27
35
  * Payload analog of INCOMPLETE_BLOCK_INPUT: we have a partial payload input that did not complete in time.
28
36
  */
@@ -49,6 +57,20 @@ export enum FetchResult {
49
57
  FailureMaxAttempts = "failure_max_attempts",
50
58
  }
51
59
 
60
+ /**
61
+ * Outcome of a slot's deferred optimistic payload searches, recorded once when its poll loop ends.
62
+ */
63
+ export enum DeferredPayloadResult {
64
+ /** gossip delivered every watched payload before PAYLOAD_DUE, no search was needed */
65
+ ImportedBeforeSearch = "imported_before_search",
66
+ /** at least one was missing at PAYLOAD_DUE, we searched, and all were imported afterwards */
67
+ ImportedAfterSearch = "imported_after_search",
68
+ /** something was still not in fork choice when the slot ended */
69
+ Unresolved = "unresolved",
70
+ /** the slot had no optimistic search and no payload import at all, eg a skipped slot */
71
+ ResolvedNoRoot = "resolved_no_root",
72
+ }
73
+
52
74
  export enum PendingBlockInputStatus {
53
75
  pending = "pending",
54
76
  fetching = "fetching",
@@ -130,9 +152,8 @@ export type PendingPayloadInput = {
130
152
  export type PendingPayloadRootHex = {
131
153
  status: PendingPayloadInputStatus.pending | PendingPayloadInputStatus.fetching;
132
154
  rootHex: RootHex;
133
- // Trusted slot only (fork choice / validated data), may be missing until resolved. NOT the gossip
134
- // message slot from ChainEvent.unknownEnvelopeBlockRoot, which is untrusted and not necessarily the
135
- // payload/block slot. See BlockInputSync.resolvePayloadSlot.
155
+ // slot could be via fork choice or ChainEvent.unknownEnvelopeBlockRootSlot
156
+ // while ChainEvent.unknownEnvelopeBlockRoot does not provide one
136
157
  slot?: Slot;
137
158
  timeAddedSec: number;
138
159
  timeSyncedSec?: number;