@lodestar/beacon-node 1.43.0-dev.0bc48d3b54 → 1.43.0-dev.1213f9c92d

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 (291) hide show
  1. package/lib/api/impl/beacon/blocks/index.js +7 -9
  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 +45 -2
  5. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  6. package/lib/api/impl/beacon/state/utils.d.ts +2 -2
  7. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  9. package/lib/api/impl/lodestar/index.js +1 -1
  10. package/lib/api/impl/lodestar/index.js.map +1 -1
  11. package/lib/api/impl/validator/index.d.ts.map +1 -1
  12. package/lib/api/impl/validator/index.js +66 -5
  13. package/lib/api/impl/validator/index.js.map +1 -1
  14. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  15. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  16. package/lib/chain/archiveStore/interface.d.ts +4 -4
  17. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  18. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
  19. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
  20. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
  21. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +2 -2
  22. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  23. package/lib/chain/archiveStore/utils/archiveBlocks.js +110 -58
  24. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  25. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  26. package/lib/chain/blocks/importBlock.js +3 -2
  27. package/lib/chain/blocks/importBlock.js.map +1 -1
  28. package/lib/chain/blocks/importExecutionPayload.d.ts +28 -14
  29. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  30. package/lib/chain/blocks/importExecutionPayload.js +86 -86
  31. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  32. package/lib/chain/blocks/index.d.ts +5 -3
  33. package/lib/chain/blocks/index.d.ts.map +1 -1
  34. package/lib/chain/blocks/index.js +31 -11
  35. package/lib/chain/blocks/index.js.map +1 -1
  36. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +1 -0
  37. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  38. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +4 -1
  39. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  40. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
  41. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  42. package/lib/chain/blocks/payloadEnvelopeProcessor.js +2 -2
  43. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  44. package/lib/chain/blocks/types.d.ts +14 -20
  45. package/lib/chain/blocks/types.d.ts.map +1 -1
  46. package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
  47. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  48. package/lib/chain/blocks/utils/chainSegment.js +81 -12
  49. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  50. package/lib/chain/blocks/verifyBlock.d.ts +5 -3
  51. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  52. package/lib/chain/blocks/verifyBlock.js +51 -7
  53. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  54. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  55. package/lib/chain/blocks/verifyBlocksSanityChecks.js +15 -4
  56. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  57. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +24 -0
  58. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -0
  59. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +76 -0
  60. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -0
  61. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  62. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +8 -3
  63. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  64. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +1 -1
  65. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
  66. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +2 -11
  67. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
  68. package/lib/chain/chain.d.ts +8 -6
  69. package/lib/chain/chain.d.ts.map +1 -1
  70. package/lib/chain/chain.js +21 -6
  71. package/lib/chain/chain.js.map +1 -1
  72. package/lib/chain/emitter.d.ts +3 -14
  73. package/lib/chain/emitter.d.ts.map +1 -1
  74. package/lib/chain/emitter.js +0 -4
  75. package/lib/chain/emitter.js.map +1 -1
  76. package/lib/chain/errors/blockError.d.ts +8 -1
  77. package/lib/chain/errors/blockError.d.ts.map +1 -1
  78. package/lib/chain/errors/blockError.js +2 -0
  79. package/lib/chain/errors/blockError.js.map +1 -1
  80. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  81. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  82. package/lib/chain/errors/executionPayloadBid.js +1 -0
  83. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  84. package/lib/chain/errors/executionPayloadEnvelope.d.ts +5 -0
  85. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  86. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  87. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  88. package/lib/chain/errors/index.d.ts +1 -0
  89. package/lib/chain/errors/index.d.ts.map +1 -1
  90. package/lib/chain/errors/index.js +1 -0
  91. package/lib/chain/errors/index.js.map +1 -1
  92. package/lib/chain/errors/proposerPreferences.d.ts +33 -0
  93. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  94. package/lib/chain/errors/proposerPreferences.js +13 -0
  95. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  96. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  97. package/lib/chain/forkChoice/index.js +5 -17
  98. package/lib/chain/forkChoice/index.js.map +1 -1
  99. package/lib/chain/interface.d.ts +7 -5
  100. package/lib/chain/interface.d.ts.map +1 -1
  101. package/lib/chain/interface.js.map +1 -1
  102. package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
  103. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  104. package/lib/chain/opPools/payloadAttestationPool.js +26 -4
  105. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  106. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  107. package/lib/chain/prepareNextSlot.js +31 -13
  108. package/lib/chain/prepareNextSlot.js.map +1 -1
  109. package/lib/chain/produceBlock/produceBlockBody.d.ts +10 -1
  110. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  111. package/lib/chain/produceBlock/produceBlockBody.js +55 -15
  112. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  113. package/lib/chain/regen/interface.d.ts +1 -0
  114. package/lib/chain/regen/interface.d.ts.map +1 -1
  115. package/lib/chain/regen/interface.js +1 -0
  116. package/lib/chain/regen/interface.js.map +1 -1
  117. package/lib/chain/seenCache/index.d.ts +1 -0
  118. package/lib/chain/seenCache/index.d.ts.map +1 -1
  119. package/lib/chain/seenCache/index.js +1 -0
  120. package/lib/chain/seenCache/index.js.map +1 -1
  121. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +19 -6
  122. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  123. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +28 -20
  124. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  125. package/lib/chain/seenCache/seenProposerPreferences.d.ts +15 -0
  126. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  127. package/lib/chain/seenCache/seenProposerPreferences.js +25 -0
  128. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  129. package/lib/chain/validation/block.d.ts.map +1 -1
  130. package/lib/chain/validation/block.js +1 -0
  131. package/lib/chain/validation/block.js.map +1 -1
  132. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  133. package/lib/chain/validation/executionPayloadBid.js +13 -1
  134. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  135. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  136. package/lib/chain/validation/executionPayloadEnvelope.js +19 -9
  137. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  138. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  139. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  140. package/lib/chain/validation/proposerPreferences.js +69 -0
  141. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  142. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +1 -1
  143. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  144. package/lib/execution/engine/mock.d.ts.map +1 -1
  145. package/lib/execution/engine/mock.js +3 -0
  146. package/lib/execution/engine/mock.js.map +1 -1
  147. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  148. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  149. package/lib/metrics/metrics/lodestar.js +4 -0
  150. package/lib/metrics/metrics/lodestar.js.map +1 -1
  151. package/lib/network/gossip/interface.d.ts +7 -1
  152. package/lib/network/gossip/interface.d.ts.map +1 -1
  153. package/lib/network/gossip/interface.js +1 -0
  154. package/lib/network/gossip/interface.js.map +1 -1
  155. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  156. package/lib/network/gossip/scoringParameters.js +12 -1
  157. package/lib/network/gossip/scoringParameters.js.map +1 -1
  158. package/lib/network/gossip/topic.d.ts +28 -748
  159. package/lib/network/gossip/topic.d.ts.map +1 -1
  160. package/lib/network/gossip/topic.js +6 -0
  161. package/lib/network/gossip/topic.js.map +1 -1
  162. package/lib/network/interface.d.ts +1 -0
  163. package/lib/network/interface.d.ts.map +1 -1
  164. package/lib/network/network.d.ts +1 -0
  165. package/lib/network/network.d.ts.map +1 -1
  166. package/lib/network/network.js +6 -1
  167. package/lib/network/network.js.map +1 -1
  168. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  169. package/lib/network/processor/gossipHandlers.js +17 -19
  170. package/lib/network/processor/gossipHandlers.js.map +1 -1
  171. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  172. package/lib/network/processor/gossipQueues/index.js +5 -0
  173. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  174. package/lib/network/processor/index.d.ts.map +1 -1
  175. package/lib/network/processor/index.js +6 -5
  176. package/lib/network/processor/index.js.map +1 -1
  177. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  178. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
  179. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  180. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
  181. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
  182. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  183. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  184. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
  185. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  186. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  187. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
  188. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  189. package/lib/node/notifier.js +7 -1
  190. package/lib/node/notifier.js.map +1 -1
  191. package/lib/sync/range/batch.d.ts +23 -2
  192. package/lib/sync/range/batch.d.ts.map +1 -1
  193. package/lib/sync/range/batch.js +84 -33
  194. package/lib/sync/range/batch.js.map +1 -1
  195. package/lib/sync/range/chain.d.ts +6 -2
  196. package/lib/sync/range/chain.d.ts.map +1 -1
  197. package/lib/sync/range/chain.js +26 -7
  198. package/lib/sync/range/chain.js.map +1 -1
  199. package/lib/sync/range/range.d.ts.map +1 -1
  200. package/lib/sync/range/range.js +17 -6
  201. package/lib/sync/range/range.js.map +1 -1
  202. package/lib/sync/types.d.ts +34 -0
  203. package/lib/sync/types.d.ts.map +1 -1
  204. package/lib/sync/types.js +34 -0
  205. package/lib/sync/types.js.map +1 -1
  206. package/lib/sync/unknownBlock.d.ts +22 -1
  207. package/lib/sync/unknownBlock.d.ts.map +1 -1
  208. package/lib/sync/unknownBlock.js +602 -53
  209. package/lib/sync/unknownBlock.js.map +1 -1
  210. package/lib/sync/utils/downloadByRange.d.ts +46 -10
  211. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  212. package/lib/sync/utils/downloadByRange.js +147 -24
  213. package/lib/sync/utils/downloadByRange.js.map +1 -1
  214. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  215. package/lib/sync/utils/downloadByRoot.js +6 -2
  216. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  217. package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
  218. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  219. package/lib/sync/utils/pendingBlocksTree.js +0 -9
  220. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  221. package/lib/util/sszBytes.d.ts.map +1 -1
  222. package/lib/util/sszBytes.js +16 -3
  223. package/lib/util/sszBytes.js.map +1 -1
  224. package/package.json +16 -15
  225. package/src/api/impl/beacon/blocks/index.ts +9 -9
  226. package/src/api/impl/beacon/pool/index.ts +83 -1
  227. package/src/api/impl/beacon/state/utils.ts +2 -2
  228. package/src/api/impl/lodestar/index.ts +1 -1
  229. package/src/api/impl/validator/index.ts +80 -4
  230. package/src/chain/archiveStore/archiveStore.ts +5 -5
  231. package/src/chain/archiveStore/interface.ts +4 -4
  232. package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +4 -4
  233. package/src/chain/archiveStore/utils/archiveBlocks.ts +153 -94
  234. package/src/chain/blocks/importBlock.ts +3 -2
  235. package/src/chain/blocks/importExecutionPayload.ts +107 -101
  236. package/src/chain/blocks/index.ts +54 -15
  237. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +5 -1
  238. package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
  239. package/src/chain/blocks/payloadEnvelopeProcessor.ts +2 -2
  240. package/src/chain/blocks/types.ts +14 -25
  241. package/src/chain/blocks/utils/chainSegment.ts +106 -17
  242. package/src/chain/blocks/verifyBlock.ts +68 -9
  243. package/src/chain/blocks/verifyBlocksSanityChecks.ts +16 -7
  244. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +129 -0
  245. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
  246. package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
  247. package/src/chain/chain.ts +38 -19
  248. package/src/chain/emitter.ts +3 -14
  249. package/src/chain/errors/blockError.ts +4 -1
  250. package/src/chain/errors/executionPayloadBid.ts +6 -0
  251. package/src/chain/errors/executionPayloadEnvelope.ts +6 -0
  252. package/src/chain/errors/index.ts +1 -0
  253. package/src/chain/errors/proposerPreferences.ts +39 -0
  254. package/src/chain/forkChoice/index.ts +2 -22
  255. package/src/chain/interface.ts +11 -3
  256. package/src/chain/opPools/payloadAttestationPool.ts +29 -8
  257. package/src/chain/prepareNextSlot.ts +36 -14
  258. package/src/chain/produceBlock/produceBlockBody.ts +64 -14
  259. package/src/chain/regen/interface.ts +1 -0
  260. package/src/chain/seenCache/index.ts +1 -0
  261. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +35 -23
  262. package/src/chain/seenCache/seenProposerPreferences.ts +29 -0
  263. package/src/chain/validation/block.ts +1 -0
  264. package/src/chain/validation/executionPayloadBid.ts +14 -0
  265. package/src/chain/validation/executionPayloadEnvelope.ts +20 -10
  266. package/src/chain/validation/proposerPreferences.ts +91 -0
  267. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +1 -1
  268. package/src/execution/engine/mock.ts +5 -1
  269. package/src/metrics/metrics/lodestar.ts +4 -0
  270. package/src/network/gossip/interface.ts +6 -0
  271. package/src/network/gossip/scoringParameters.ts +14 -1
  272. package/src/network/gossip/topic.ts +6 -0
  273. package/src/network/interface.ts +1 -0
  274. package/src/network/network.ts +12 -1
  275. package/src/network/processor/gossipHandlers.ts +26 -20
  276. package/src/network/processor/gossipQueues/index.ts +5 -0
  277. package/src/network/processor/index.ts +6 -5
  278. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
  279. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
  280. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
  281. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
  282. package/src/node/notifier.ts +8 -1
  283. package/src/sync/range/batch.ts +142 -38
  284. package/src/sync/range/chain.ts +37 -9
  285. package/src/sync/range/range.ts +18 -6
  286. package/src/sync/types.ts +72 -0
  287. package/src/sync/unknownBlock.ts +760 -57
  288. package/src/sync/utils/downloadByRange.ts +256 -39
  289. package/src/sync/utils/downloadByRoot.ts +12 -2
  290. package/src/sync/utils/pendingBlocksTree.ts +0 -15
  291. package/src/util/sszBytes.ts +21 -3
@@ -505,7 +505,7 @@ export class Network implements INetwork {
505
505
  }
506
506
 
507
507
  async publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number> {
508
- const epoch = computeEpochAtSlot(signedEnvelope.message.slot);
508
+ const epoch = computeEpochAtSlot(signedEnvelope.message.payload.slotNumber);
509
509
  const boundary = this.config.getForkBoundaryAtEpoch(epoch);
510
510
 
511
511
  return this.publishGossip<GossipType.execution_payload>(
@@ -515,6 +515,17 @@ export class Network implements INetwork {
515
515
  );
516
516
  }
517
517
 
518
+ async publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number> {
519
+ const epoch = computeEpochAtSlot(payloadAttestationMessage.data.slot);
520
+ const boundary = this.config.getForkBoundaryAtEpoch(epoch);
521
+
522
+ return this.publishGossip<GossipType.payload_attestation_message>(
523
+ {type: GossipType.payload_attestation_message, boundary},
524
+ payloadAttestationMessage,
525
+ {ignoreDuplicatePublishError: true}
526
+ );
527
+ }
528
+
518
529
  private async publishGossip<K extends GossipType>(
519
530
  topic: GossipTopicMap[K],
520
531
  object: GossipTypeMap[K],
@@ -52,6 +52,8 @@ import {
52
52
  ExecutionPayloadEnvelopeErrorCode,
53
53
  GossipAction,
54
54
  GossipActionError,
55
+ PayloadAttestationError,
56
+ PayloadAttestationErrorCode,
55
57
  SyncCommitteeError,
56
58
  } from "../../chain/errors/index.js";
57
59
  import {IBeaconChain} from "../../chain/interface.js";
@@ -79,6 +81,7 @@ import {
79
81
  import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js";
80
82
  import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js";
81
83
  import {validateGossipPayloadAttestationMessage} from "../../chain/validation/payloadAttestationMessage.js";
84
+ import {validateGossipProposerPreferences} from "../../chain/validation/proposerPreferences.js";
82
85
  import {OpSource} from "../../chain/validatorMonitor.js";
83
86
  import {Metrics} from "../../metrics/index.js";
84
87
  import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
@@ -198,7 +201,10 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
198
201
  } catch (e) {
199
202
  if (e instanceof BlockGossipError) {
200
203
  logger.debug("Gossip block has error", {slot, root: blockShortHex, code: e.type.code});
201
- if (e.type.code === BlockErrorCode.PARENT_UNKNOWN && blockInput) {
204
+ if (
205
+ (e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
206
+ blockInput
207
+ ) {
202
208
  chain.emitter.emit(ChainEvent.blockUnknownParent, {
203
209
  blockInput,
204
210
  peer: peerIdStr,
@@ -1057,24 +1063,15 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1057
1063
  const signedEnvelope = sszDeserialize(topic, serializedData);
1058
1064
  const envelope = signedEnvelope.message;
1059
1065
 
1060
- // TODO GLOAS: consider optimistically create PayloadEnvelopeInput here similar to how we do that for beacon_block
1061
- // so that UnknownBlockSync can handle backward sync
1062
- // the problem now is we cannot create a PayloadEnvelopeInput without the beacon block being known, we need at least the proposer index
1063
- // we can achieve that by looking into the EpochCache
1066
+ // unlike BlockInput, we send the envelope into UnknownBlockInput sync
1067
+ // inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
1064
1068
  try {
1065
1069
  await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
1066
1070
  } catch (e) {
1067
1071
  if (e instanceof ExecutionPayloadEnvelopeError) {
1068
- const {slot, beaconBlockRoot} = signedEnvelope.message;
1072
+ const {beaconBlockRoot} = signedEnvelope.message;
1073
+ const slot = signedEnvelope.message.payload.slotNumber;
1069
1074
  logger.debug("Gossip envelope has error", {slot, root: toRootHex(beaconBlockRoot), code: e.type.code});
1070
- if (e.type.code === ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN) {
1071
- // TODO GLOAS: UnknownBlockSync to handle this
1072
- chain.emitter.emit(ChainEvent.envelopeUnknownBlock, {
1073
- envelope: signedEnvelope,
1074
- peer: peerIdStr,
1075
- source: BlockInputSource.gossip,
1076
- });
1077
- }
1078
1075
 
1079
1076
  if (e.action === GossipAction.REJECT) {
1080
1077
  chain.persistInvalidSszValue(
@@ -1088,7 +1085,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1088
1085
  throw e;
1089
1086
  }
1090
1087
 
1091
- const slot = envelope.slot;
1088
+ const slot = envelope.payload.slotNumber;
1092
1089
  const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
1093
1090
  metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
1094
1091
  chain.validatorMonitor?.registerExecutionPayloadEnvelope(OpSource.gossip, delaySec, signedEnvelope);
@@ -1118,7 +1115,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1118
1115
  builderIndex: envelope.builderIndex,
1119
1116
  blockHash: toRootHex(envelope.payload.blockHash),
1120
1117
  blockRoot: blockRootHex,
1121
- stateRoot: toRootHex(envelope.stateRoot),
1122
1118
  });
1123
1119
 
1124
1120
  chain.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
@@ -1170,6 +1166,14 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1170
1166
  data: executionPayloadBid,
1171
1167
  });
1172
1168
  },
1169
+ [GossipType.proposer_preferences]: async ({
1170
+ gossipData,
1171
+ topic,
1172
+ }: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
1173
+ const {serializedData} = gossipData;
1174
+ const signedProposerPreferences = sszDeserialize(topic, serializedData);
1175
+ await validateGossipProposerPreferences(chain, signedProposerPreferences);
1176
+ },
1173
1177
  };
1174
1178
  }
1175
1179
 
@@ -1292,10 +1296,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
1292
1296
  try {
1293
1297
  return await fn();
1294
1298
  } catch (e) {
1295
- if (
1296
- e instanceof AttestationError &&
1297
- e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT
1298
- ) {
1299
+ const isUnknownAttestationRoot =
1300
+ e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
1301
+ const isUnknownPayloadAttestationRoot =
1302
+ e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
1303
+
1304
+ if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
1299
1305
  if (unknownBlockRootRetries === 0) {
1300
1306
  // Trigger unknown block root search here
1301
1307
  const rootHex = toRootHex(blockRoot);
@@ -83,6 +83,11 @@ const linearGossipQueueOpts: {
83
83
  type: QueueType.FIFO,
84
84
  dropOpts: {type: DropType.count, count: 1},
85
85
  },
86
+ [GossipType.proposer_preferences]: {
87
+ maxLength: 1024,
88
+ type: QueueType.FIFO,
89
+ dropOpts: {type: DropType.count, count: 1},
90
+ },
86
91
  };
87
92
 
88
93
  const indexedGossipQueueOpts: {
@@ -76,6 +76,7 @@ type WorkOpts = {
76
76
  */
77
77
  const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
78
78
  [GossipType.beacon_block]: {bypassQueue: true},
79
+ [GossipType.execution_payload]: {bypassQueue: true},
79
80
  [GossipType.blob_sidecar]: {bypassQueue: true},
80
81
  [GossipType.data_column_sidecar]: {bypassQueue: true},
81
82
  [GossipType.beacon_aggregate_and_proof]: {},
@@ -88,9 +89,9 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
88
89
  [GossipType.sync_committee]: {},
89
90
  [GossipType.light_client_finality_update]: {},
90
91
  [GossipType.light_client_optimistic_update]: {},
91
- [GossipType.execution_payload]: {bypassQueue: true},
92
92
  [GossipType.payload_attestation_message]: {},
93
93
  [GossipType.execution_payload_bid]: {},
94
+ [GossipType.proposer_preferences]: {},
94
95
  };
95
96
  const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
96
97
 
@@ -443,8 +444,7 @@ export class NetworkProcessor {
443
444
  }
444
445
  case GossipType.execution_payload: {
445
446
  // extractBlockSlotRootFn does not return a root for this topic.
446
- // Extract beacon_block_root directly and proactively trigger block sync if missing.
447
- // Do NOT await the block — the handler runs immediately; BlockInputSync handles recovery.
447
+ // Extract beacon_block_root directly
448
448
  const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
449
449
  if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
450
450
  this.searchUnknownBlock(
@@ -452,9 +452,10 @@ export class NetworkProcessor {
452
452
  BlockInputSource.network_processor,
453
453
  message.propagationSource.toString()
454
454
  );
455
+ // We always want to await the block
456
+ // This allows us to properly forward the payload envelope
457
+ preprocessResult = {action: PreprocessAction.AwaitBlock, root: blockRoot};
455
458
  }
456
- // do not await the block, we want UnknownBlockSync to handle it.
457
- preprocessResult = {action: PreprocessAction.PushToQueue};
458
459
  break;
459
460
  }
460
461
  case GossipType.execution_payload_bid: {
@@ -24,6 +24,10 @@ export async function* onBeaconBlocksByRange(
24
24
  // in the case of initializing from a non-finalized state, we don't have the finalized block so this api does not work
25
25
  // chain.forkChoice.getFinalizeBlock().slot
26
26
  const finalizedSlot = chain.forkChoice.getFinalizedCheckpointSlot();
27
+ // Blocks are migrated to blockArchive at finalization (including the finalized block itself),
28
+ // so the archive loop serves up to AND INCLUDING finalizedSlot and the headChain loop
29
+ // starts above it to avoid duplicate yields. See archiveBlocks.ts for the migration logic.
30
+ const archiveMaxSlot = finalizedSlot;
27
31
 
28
32
  const forkName = chain.config.getForkName(startSlot);
29
33
  if (isForkPostFulu(forkName) && startSlot < chain.earliestAvailableSlot) {
@@ -35,9 +39,12 @@ export async function* onBeaconBlocksByRange(
35
39
  }
36
40
 
37
41
  // Finalized range of blocks
38
- if (startSlot <= finalizedSlot) {
42
+ if (startSlot <= archiveMaxSlot) {
39
43
  // Chain of blobs won't change
40
- for await (const {key, value} of finalized.binaryEntriesStream({gte: startSlot, lt: endSlot})) {
44
+ for await (const {key, value} of finalized.binaryEntriesStream({
45
+ gte: startSlot,
46
+ lt: Math.min(endSlot, archiveMaxSlot + 1),
47
+ })) {
41
48
  yield {
42
49
  data: value,
43
50
  boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(finalized.decodeKey(key))),
@@ -46,19 +53,20 @@ export async function* onBeaconBlocksByRange(
46
53
  }
47
54
 
48
55
  // Non-finalized range of blocks
49
- if (endSlot > finalizedSlot) {
56
+ if (endSlot > archiveMaxSlot) {
50
57
  const headBlock = chain.forkChoice.getHead();
51
58
  const headRoot = headBlock.blockRoot;
52
59
  // TODO DENEB: forkChoice should mantain an array of canonical blocks, and change only on reorg
53
60
  const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot, headBlock.payloadStatus);
54
- // getAllAncestorBlocks response includes the head node, so it's the full chain.
61
+ // `getAllAncestorBlocks` includes both the head and the previous-finalized boundary.
55
62
 
56
63
  // Iterate head chain with ascending block numbers
57
64
  for (let i = headChain.length - 1; i >= 0; i--) {
58
65
  const block = headChain[i];
59
66
 
60
- // Must include only blocks in the range requested
61
- if (block.slot >= startSlot && block.slot < endSlot) {
67
+ // Must include only blocks in the range requested, and skip anything the archive loop
68
+ // above already served via the block.slot > archiveMaxSlot filter.
69
+ if (block.slot > archiveMaxSlot && block.slot >= startSlot && block.slot < endSlot) {
62
70
  // Note: Here the forkChoice head may change due to a re-org, so the headChain reflects the canonical chain
63
71
  // at the time of the start of the request. Spec is clear the chain of blobs must be consistent, but on
64
72
  // re-org there's no need to abort the request
@@ -20,31 +20,37 @@ export async function* onBlobSidecarsByRange(
20
20
  const finalized = db.blobSidecarsArchive;
21
21
  const unfinalized = db.blobSidecars;
22
22
  const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
23
+ // Blobs are migrated to blobSidecarsArchive at finalization (including the finalized block
24
+ // itself), so the archive loop serves up to AND INCLUDING finalizedSlot and the headChain
25
+ // loop starts above it to avoid duplicate yields. See archiveBlocks.ts for the migration logic.
26
+ const archiveMaxSlot = finalizedSlot;
23
27
 
24
28
  // Finalized range of blobs
25
- if (startSlot <= finalizedSlot) {
29
+ if (startSlot <= archiveMaxSlot) {
26
30
  // Chain of blobs won't change
27
31
  for await (const {key, value: blobSideCarsBytesWrapped} of finalized.binaryEntriesStream({
28
32
  gte: startSlot,
29
- lt: endSlot,
33
+ lt: Math.min(endSlot, archiveMaxSlot + 1),
30
34
  })) {
31
35
  yield* iterateBlobBytesFromWrapper(chain, blobSideCarsBytesWrapped, finalized.decodeKey(key));
32
36
  }
33
37
  }
34
38
 
35
39
  // Non-finalized range of blobs
36
- if (endSlot > finalizedSlot) {
40
+ if (endSlot > archiveMaxSlot) {
37
41
  const headBlock = chain.forkChoice.getHead();
38
42
  const headRoot = headBlock.blockRoot;
39
43
  // TODO DENEB: forkChoice should mantain an array of canonical blocks, and change only on reorg
40
44
  const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot, headBlock.payloadStatus);
45
+ // `getAllAncestorBlocks` includes both the head and the previous-finalized boundary.
41
46
 
42
47
  // Iterate head chain with ascending block numbers
43
48
  for (let i = headChain.length - 1; i >= 0; i--) {
44
49
  const block = headChain[i];
45
50
 
46
- // Must include only blobs in the range requested
47
- if (block.slot >= startSlot && block.slot < endSlot) {
51
+ // Must include only blobs in the range requested, and skip anything the archive loop
52
+ // above already served via the block.slot > archiveMaxSlot filter.
53
+ if (block.slot > archiveMaxSlot && block.slot >= startSlot && block.slot < endSlot) {
48
54
  // Note: Here the forkChoice head may change due to a re-org, so the headChain reflects the canonical chain
49
55
  // at the time of the start of the request. Spec is clear the chain of blobs must be consistent, but on
50
56
  // re-org there's no need to abort the request
@@ -1,6 +1,6 @@
1
1
  import {PeerId} from "@libp2p/interface";
2
2
  import {ChainConfig} from "@lodestar/config";
3
- import {GENESIS_SLOT} from "@lodestar/params";
3
+ import {ForkSeq, GENESIS_SLOT} from "@lodestar/params";
4
4
  import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
5
5
  import {computeEpochAtSlot} from "@lodestar/state-transition";
6
6
  import {ColumnIndex, Epoch, fulu} from "@lodestar/types";
@@ -43,10 +43,19 @@ export async function* onDataColumnSidecarsByRange(
43
43
 
44
44
  const finalized = db.dataColumnSidecarArchive;
45
45
  const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
46
+ // Columns of the last finalized block live in different DBs depending on fork:
47
+ // - Pre-gloas (fulu): migrated to dataColumnSidecarArchive in the same finalization run.
48
+ // - Post-gloas: stay in the hot db (db.dataColumnSidecar) until the next finalization run,
49
+ // because the migration filter requires payloadStatus === FULL for gloas blocks.
50
+ // archiveMaxSlot is the last slot whose columns are served by the archive loop below;
51
+ // anything above it is served by the headChain loop.
52
+ const isPostGloasFinalized = chain.config.getForkSeq(finalizedSlot) >= ForkSeq.gloas;
53
+ const archiveMaxSlot = isPostGloasFinalized ? finalizedSlot - 1 : finalizedSlot;
46
54
 
47
55
  // Finalized range of columns
48
- if (startSlot <= finalizedSlot) {
49
- for (let slot = startSlot; slot < endSlot; slot++) {
56
+ if (startSlot <= archiveMaxSlot) {
57
+ const archiveEnd = Math.min(endSlot, archiveMaxSlot + 1);
58
+ for (let slot = startSlot; slot < archiveEnd; slot++) {
50
59
  const dataColumnSidecars = await finalized.getManyBinary(slot, availableColumns);
51
60
 
52
61
  const unavailableColumnIndices: ColumnIndex[] = [];
@@ -81,9 +90,12 @@ export async function* onDataColumnSidecarsByRange(
81
90
  }
82
91
 
83
92
  // Non-finalized range of columns
84
- if (endSlot > finalizedSlot) {
93
+ if (endSlot > archiveMaxSlot) {
85
94
  const headBlock = chain.forkChoice.getHead();
86
95
  const headRoot = headBlock.blockRoot;
96
+ // getAllAncestorBlocks includes the last finalized block as its final element.
97
+ // Skip anything the archive loop above already served via the block.slot > archiveMaxSlot
98
+ // filter below (pre-gloas this skips finalizedSlot, post-gloas it keeps it).
87
99
  const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot, headBlock.payloadStatus);
88
100
 
89
101
  // Iterate head chain with ascending block numbers
@@ -91,7 +103,7 @@ export async function* onDataColumnSidecarsByRange(
91
103
  const block = headChain[i];
92
104
 
93
105
  // Must include only columns in the range requested
94
- if (block.slot >= startSlot && block.slot < endSlot) {
106
+ if (block.slot > archiveMaxSlot && block.slot >= startSlot && block.slot < endSlot) {
95
107
  // Note: Here the forkChoice head may change due to a re-org, so the headChain reflects the canonical chain
96
108
  // at the time of the start of the request. Spec is clear the chain of columns must be consistent, but on
97
109
  // re-org there's no need to abort the request
@@ -21,12 +21,15 @@ export async function* onExecutionPayloadEnvelopesByRange(
21
21
 
22
22
  const finalized = db.executionPayloadEnvelopeArchive;
23
23
  const finalizedSlot = chain.forkChoice.getFinalizedCheckpointSlot();
24
+ // The current finalized block's envelope is still in the hot db; archive migration happens
25
+ // in the next finalization run (see migrateExecutionPayloadEnvelopesFromHotToColdDb).
26
+ const archiveMaxSlot = finalizedSlot - 1;
24
27
 
25
28
  // Finalized range of envelopes
26
- if (startSlot <= finalizedSlot) {
29
+ if (startSlot <= archiveMaxSlot) {
27
30
  for await (const {key, value: envelopeBytes} of finalized.binaryEntriesStream({
28
31
  gte: startSlot,
29
- lt: endSlot,
32
+ lt: Math.min(endSlot, archiveMaxSlot + 1),
30
33
  })) {
31
34
  const slot = finalized.decodeKey(key);
32
35
  yield {
@@ -37,7 +40,7 @@ export async function* onExecutionPayloadEnvelopesByRange(
37
40
  }
38
41
 
39
42
  // Non-finalized range of envelopes
40
- if (endSlot > finalizedSlot) {
43
+ if (endSlot > archiveMaxSlot) {
41
44
  const headBlock = chain.forkChoice.getHead();
42
45
  const headRoot = headBlock.blockRoot;
43
46
  const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot, headBlock.payloadStatus);
@@ -46,7 +49,7 @@ export async function* onExecutionPayloadEnvelopesByRange(
46
49
  for (let i = headChain.length - 1; i >= 0; i--) {
47
50
  const block = headChain[i];
48
51
 
49
- if (block.slot >= startSlot && block.slot < endSlot) {
52
+ if (block.slot > archiveMaxSlot && block.slot >= startSlot && block.slot < endSlot) {
50
53
  // Skip EMPTY blocks
51
54
  if (block.payloadStatus !== PayloadStatus.FULL) {
52
55
  continue;
@@ -167,7 +167,14 @@ function getHeadExecutionInfo(
167
167
  return [];
168
168
  }
169
169
 
170
- const executionStatusStr = headInfo.executionStatus.toLowerCase();
170
+ // A PayloadSeparated head is a gloas beacon block imported before its payload envelope
171
+ // arrives, in that case the exec-block row surfaces the inherited parent anchor (from the
172
+ // bid), which is already validated. Normalize to "valid" to avoid leaking internal
173
+ // fork-choice bookkeeping into the log. Once the payload envelope arrives and the FULL
174
+ // variant becomes head, executionStatus is Valid/Syncing naturally.
175
+ // TODO GLOAS: revisit once optimistic sync is implemented
176
+ const executionStatusStr =
177
+ headInfo.executionStatus === ExecutionStatus.PayloadSeparated ? "valid" : headInfo.executionStatus.toLowerCase();
171
178
 
172
179
  // Add execution status to notifier only if head is on/post bellatrix
173
180
  if (isStatePostBellatrix(headState) && headState.isExecutionStateType) {