@lodestar/beacon-node 1.43.0-dev.9c8becae00 → 1.43.0-dev.9f5db5b9c7

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 (331) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +17 -9
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +45 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +2 -2
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +0 -1
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/lodestar/index.js +1 -1
  14. package/lib/api/impl/lodestar/index.js.map +1 -1
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +68 -6
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  19. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  20. package/lib/chain/archiveStore/interface.d.ts +4 -4
  21. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  22. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
  23. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
  24. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
  25. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +2 -2
  26. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  27. package/lib/chain/archiveStore/utils/archiveBlocks.js +110 -58
  28. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  29. package/lib/chain/blocks/blockInput/blockInput.d.ts +3 -0
  30. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  31. package/lib/chain/blocks/blockInput/blockInput.js +4 -1
  32. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  33. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  34. package/lib/chain/blocks/importBlock.js +24 -20
  35. package/lib/chain/blocks/importBlock.js.map +1 -1
  36. package/lib/chain/blocks/importExecutionPayload.d.ts +28 -14
  37. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  38. package/lib/chain/blocks/importExecutionPayload.js +88 -90
  39. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  40. package/lib/chain/blocks/index.d.ts +5 -3
  41. package/lib/chain/blocks/index.d.ts.map +1 -1
  42. package/lib/chain/blocks/index.js +59 -26
  43. package/lib/chain/blocks/index.js.map +1 -1
  44. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +4 -0
  45. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  46. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +9 -2
  47. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  48. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
  49. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  50. package/lib/chain/blocks/payloadEnvelopeProcessor.js +2 -2
  51. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  52. package/lib/chain/blocks/types.d.ts +15 -20
  53. package/lib/chain/blocks/types.d.ts.map +1 -1
  54. package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
  55. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  56. package/lib/chain/blocks/utils/chainSegment.js +89 -12
  57. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  58. package/lib/chain/blocks/verifyBlock.d.ts +5 -3
  59. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  60. package/lib/chain/blocks/verifyBlock.js +50 -7
  61. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  62. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
  63. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  64. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -2
  65. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  66. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
  67. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  68. package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
  69. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  70. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +24 -0
  71. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -0
  72. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +79 -0
  73. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -0
  74. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  75. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +8 -3
  76. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  77. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +1 -1
  78. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
  79. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +2 -11
  80. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
  81. package/lib/chain/chain.d.ts +8 -6
  82. package/lib/chain/chain.d.ts.map +1 -1
  83. package/lib/chain/chain.js +21 -6
  84. package/lib/chain/chain.js.map +1 -1
  85. package/lib/chain/emitter.d.ts +3 -14
  86. package/lib/chain/emitter.d.ts.map +1 -1
  87. package/lib/chain/emitter.js +0 -4
  88. package/lib/chain/emitter.js.map +1 -1
  89. package/lib/chain/errors/blockError.d.ts +8 -1
  90. package/lib/chain/errors/blockError.d.ts.map +1 -1
  91. package/lib/chain/errors/blockError.js +2 -0
  92. package/lib/chain/errors/blockError.js.map +1 -1
  93. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  94. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  95. package/lib/chain/errors/executionPayloadBid.js +1 -0
  96. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  97. package/lib/chain/errors/executionPayloadEnvelope.d.ts +5 -0
  98. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  99. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  100. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  101. package/lib/chain/errors/index.d.ts +1 -0
  102. package/lib/chain/errors/index.d.ts.map +1 -1
  103. package/lib/chain/errors/index.js +1 -0
  104. package/lib/chain/errors/index.js.map +1 -1
  105. package/lib/chain/errors/proposerPreferences.d.ts +40 -0
  106. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  107. package/lib/chain/errors/proposerPreferences.js +14 -0
  108. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  109. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  110. package/lib/chain/forkChoice/index.js +5 -17
  111. package/lib/chain/forkChoice/index.js.map +1 -1
  112. package/lib/chain/interface.d.ts +7 -5
  113. package/lib/chain/interface.d.ts.map +1 -1
  114. package/lib/chain/interface.js.map +1 -1
  115. package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
  116. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  117. package/lib/chain/opPools/payloadAttestationPool.js +26 -4
  118. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  119. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  120. package/lib/chain/prepareNextSlot.js +31 -13
  121. package/lib/chain/prepareNextSlot.js.map +1 -1
  122. package/lib/chain/produceBlock/produceBlockBody.d.ts +11 -1
  123. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  124. package/lib/chain/produceBlock/produceBlockBody.js +52 -14
  125. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  126. package/lib/chain/regen/interface.d.ts +1 -0
  127. package/lib/chain/regen/interface.d.ts.map +1 -1
  128. package/lib/chain/regen/interface.js +1 -0
  129. package/lib/chain/regen/interface.js.map +1 -1
  130. package/lib/chain/regen/queued.d.ts.map +1 -1
  131. package/lib/chain/regen/queued.js +1 -4
  132. package/lib/chain/regen/queued.js.map +1 -1
  133. package/lib/chain/regen/regen.d.ts.map +1 -1
  134. package/lib/chain/regen/regen.js +1 -4
  135. package/lib/chain/regen/regen.js.map +1 -1
  136. package/lib/chain/seenCache/index.d.ts +1 -0
  137. package/lib/chain/seenCache/index.d.ts.map +1 -1
  138. package/lib/chain/seenCache/index.js +1 -0
  139. package/lib/chain/seenCache/index.js.map +1 -1
  140. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +19 -6
  141. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  142. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +40 -22
  143. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  144. package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
  145. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  146. package/lib/chain/seenCache/seenProposerPreferences.js +26 -0
  147. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  148. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  149. package/lib/chain/stateCache/persistentCheckpointsCache.js +4 -1
  150. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  151. package/lib/chain/validation/block.d.ts.map +1 -1
  152. package/lib/chain/validation/block.js +1 -0
  153. package/lib/chain/validation/block.js.map +1 -1
  154. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  155. package/lib/chain/validation/executionPayloadBid.js +24 -9
  156. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  157. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  158. package/lib/chain/validation/executionPayloadEnvelope.js +19 -9
  159. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  160. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  161. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  162. package/lib/chain/validation/proposerPreferences.js +91 -0
  163. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  164. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +1 -1
  165. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  166. package/lib/execution/engine/http.d.ts.map +1 -1
  167. package/lib/execution/engine/http.js +21 -14
  168. package/lib/execution/engine/http.js.map +1 -1
  169. package/lib/execution/engine/interface.d.ts +1 -0
  170. package/lib/execution/engine/interface.d.ts.map +1 -1
  171. package/lib/execution/engine/mock.d.ts.map +1 -1
  172. package/lib/execution/engine/mock.js +6 -0
  173. package/lib/execution/engine/mock.js.map +1 -1
  174. package/lib/execution/engine/types.d.ts +20 -0
  175. package/lib/execution/engine/types.d.ts.map +1 -1
  176. package/lib/execution/engine/types.js +18 -0
  177. package/lib/execution/engine/types.js.map +1 -1
  178. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  179. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  180. package/lib/metrics/metrics/lodestar.js +4 -0
  181. package/lib/metrics/metrics/lodestar.js.map +1 -1
  182. package/lib/network/gossip/interface.d.ts +7 -1
  183. package/lib/network/gossip/interface.d.ts.map +1 -1
  184. package/lib/network/gossip/interface.js +1 -0
  185. package/lib/network/gossip/interface.js.map +1 -1
  186. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  187. package/lib/network/gossip/scoringParameters.js +12 -1
  188. package/lib/network/gossip/scoringParameters.js.map +1 -1
  189. package/lib/network/gossip/topic.d.ts +13 -2
  190. package/lib/network/gossip/topic.d.ts.map +1 -1
  191. package/lib/network/gossip/topic.js +6 -0
  192. package/lib/network/gossip/topic.js.map +1 -1
  193. package/lib/network/interface.d.ts +1 -0
  194. package/lib/network/interface.d.ts.map +1 -1
  195. package/lib/network/network.d.ts +1 -0
  196. package/lib/network/network.d.ts.map +1 -1
  197. package/lib/network/network.js +6 -1
  198. package/lib/network/network.js.map +1 -1
  199. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  200. package/lib/network/processor/gossipHandlers.js +27 -19
  201. package/lib/network/processor/gossipHandlers.js.map +1 -1
  202. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  203. package/lib/network/processor/gossipQueues/index.js +5 -0
  204. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  205. package/lib/network/processor/index.d.ts.map +1 -1
  206. package/lib/network/processor/index.js +6 -5
  207. package/lib/network/processor/index.js.map +1 -1
  208. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  209. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
  210. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  211. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
  212. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
  213. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  214. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  215. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
  216. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  217. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  218. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
  219. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  220. package/lib/node/nodejs.js +2 -2
  221. package/lib/node/nodejs.js.map +1 -1
  222. package/lib/sync/range/batch.d.ts +23 -2
  223. package/lib/sync/range/batch.d.ts.map +1 -1
  224. package/lib/sync/range/batch.js +132 -44
  225. package/lib/sync/range/batch.js.map +1 -1
  226. package/lib/sync/range/chain.d.ts +6 -2
  227. package/lib/sync/range/chain.d.ts.map +1 -1
  228. package/lib/sync/range/chain.js +26 -7
  229. package/lib/sync/range/chain.js.map +1 -1
  230. package/lib/sync/range/range.d.ts.map +1 -1
  231. package/lib/sync/range/range.js +17 -6
  232. package/lib/sync/range/range.js.map +1 -1
  233. package/lib/sync/types.d.ts +34 -0
  234. package/lib/sync/types.d.ts.map +1 -1
  235. package/lib/sync/types.js +34 -0
  236. package/lib/sync/types.js.map +1 -1
  237. package/lib/sync/unknownBlock.d.ts +22 -1
  238. package/lib/sync/unknownBlock.d.ts.map +1 -1
  239. package/lib/sync/unknownBlock.js +602 -53
  240. package/lib/sync/unknownBlock.js.map +1 -1
  241. package/lib/sync/utils/downloadByRange.d.ts +46 -10
  242. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  243. package/lib/sync/utils/downloadByRange.js +162 -24
  244. package/lib/sync/utils/downloadByRange.js.map +1 -1
  245. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  246. package/lib/sync/utils/downloadByRoot.js +16 -2
  247. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  248. package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
  249. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  250. package/lib/sync/utils/pendingBlocksTree.js +0 -9
  251. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  252. package/lib/util/sszBytes.d.ts.map +1 -1
  253. package/lib/util/sszBytes.js +20 -5
  254. package/lib/util/sszBytes.js.map +1 -1
  255. package/package.json +16 -15
  256. package/src/api/impl/beacon/blocks/index.ts +22 -9
  257. package/src/api/impl/beacon/pool/index.ts +83 -1
  258. package/src/api/impl/beacon/state/utils.ts +2 -2
  259. package/src/api/impl/debug/index.ts +0 -1
  260. package/src/api/impl/lodestar/index.ts +1 -1
  261. package/src/api/impl/validator/index.ts +82 -5
  262. package/src/chain/archiveStore/archiveStore.ts +5 -5
  263. package/src/chain/archiveStore/interface.ts +4 -4
  264. package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +4 -4
  265. package/src/chain/archiveStore/utils/archiveBlocks.ts +153 -94
  266. package/src/chain/blocks/blockInput/blockInput.ts +4 -1
  267. package/src/chain/blocks/importBlock.ts +24 -38
  268. package/src/chain/blocks/importExecutionPayload.ts +109 -105
  269. package/src/chain/blocks/index.ts +73 -23
  270. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +10 -2
  271. package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
  272. package/src/chain/blocks/payloadEnvelopeProcessor.ts +2 -2
  273. package/src/chain/blocks/types.ts +15 -25
  274. package/src/chain/blocks/utils/chainSegment.ts +114 -17
  275. package/src/chain/blocks/verifyBlock.ts +70 -9
  276. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
  277. package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
  278. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +134 -0
  279. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
  280. package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
  281. package/src/chain/chain.ts +38 -19
  282. package/src/chain/emitter.ts +3 -14
  283. package/src/chain/errors/blockError.ts +4 -1
  284. package/src/chain/errors/executionPayloadBid.ts +6 -0
  285. package/src/chain/errors/executionPayloadEnvelope.ts +6 -0
  286. package/src/chain/errors/index.ts +1 -0
  287. package/src/chain/errors/proposerPreferences.ts +47 -0
  288. package/src/chain/forkChoice/index.ts +2 -22
  289. package/src/chain/interface.ts +11 -3
  290. package/src/chain/opPools/payloadAttestationPool.ts +29 -8
  291. package/src/chain/prepareNextSlot.ts +36 -14
  292. package/src/chain/produceBlock/produceBlockBody.ts +63 -13
  293. package/src/chain/regen/interface.ts +1 -0
  294. package/src/chain/regen/queued.ts +2 -7
  295. package/src/chain/regen/regen.ts +2 -7
  296. package/src/chain/seenCache/index.ts +1 -0
  297. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +47 -25
  298. package/src/chain/seenCache/seenProposerPreferences.ts +32 -0
  299. package/src/chain/stateCache/persistentCheckpointsCache.ts +4 -1
  300. package/src/chain/validation/block.ts +1 -0
  301. package/src/chain/validation/executionPayloadBid.ts +25 -8
  302. package/src/chain/validation/executionPayloadEnvelope.ts +20 -10
  303. package/src/chain/validation/proposerPreferences.ts +110 -0
  304. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +1 -1
  305. package/src/execution/engine/http.ts +21 -14
  306. package/src/execution/engine/interface.ts +1 -0
  307. package/src/execution/engine/mock.ts +8 -1
  308. package/src/execution/engine/types.ts +41 -0
  309. package/src/metrics/metrics/lodestar.ts +4 -0
  310. package/src/network/gossip/interface.ts +6 -0
  311. package/src/network/gossip/scoringParameters.ts +14 -1
  312. package/src/network/gossip/topic.ts +6 -0
  313. package/src/network/interface.ts +1 -0
  314. package/src/network/network.ts +12 -1
  315. package/src/network/processor/gossipHandlers.ts +38 -20
  316. package/src/network/processor/gossipQueues/index.ts +5 -0
  317. package/src/network/processor/index.ts +6 -5
  318. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
  319. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
  320. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
  321. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
  322. package/src/node/nodejs.ts +2 -2
  323. package/src/sync/range/batch.ts +188 -49
  324. package/src/sync/range/chain.ts +37 -9
  325. package/src/sync/range/range.ts +18 -6
  326. package/src/sync/types.ts +72 -0
  327. package/src/sync/unknownBlock.ts +760 -57
  328. package/src/sync/utils/downloadByRange.ts +272 -39
  329. package/src/sync/utils/downloadByRoot.ts +24 -2
  330. package/src/sync/utils/pendingBlocksTree.ts +0 -15
  331. package/src/util/sszBytes.ts +25 -5
@@ -216,13 +216,15 @@ export class ExecutionEngineHttp implements IExecutionEngine {
216
216
  executionRequests?: ExecutionRequests
217
217
  ): Promise<ExecutePayloadResponse> {
218
218
  const method =
219
- ForkSeq[fork] >= ForkSeq.electra
220
- ? "engine_newPayloadV4"
221
- : ForkSeq[fork] >= ForkSeq.deneb
222
- ? "engine_newPayloadV3"
223
- : ForkSeq[fork] >= ForkSeq.capella
224
- ? "engine_newPayloadV2"
225
- : "engine_newPayloadV1";
219
+ ForkSeq[fork] >= ForkSeq.gloas
220
+ ? "engine_newPayloadV5"
221
+ : ForkSeq[fork] >= ForkSeq.electra
222
+ ? "engine_newPayloadV4"
223
+ : ForkSeq[fork] >= ForkSeq.deneb
224
+ ? "engine_newPayloadV3"
225
+ : ForkSeq[fork] >= ForkSeq.capella
226
+ ? "engine_newPayloadV2"
227
+ : "engine_newPayloadV1";
226
228
 
227
229
  const serializedExecutionPayload = serializeExecutionPayload(fork, executionPayload);
228
230
 
@@ -244,7 +246,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
244
246
  }
245
247
  const serializedExecutionRequests = serializeExecutionRequests(executionRequests);
246
248
  engineRequest = {
247
- method: "engine_newPayloadV4",
249
+ method: ForkSeq[fork] >= ForkSeq.gloas ? "engine_newPayloadV5" : "engine_newPayloadV4",
248
250
  params: [
249
251
  serializedExecutionPayload,
250
252
  serializedVersionedHashes,
@@ -348,11 +350,13 @@ export class ExecutionEngineHttp implements IExecutionEngine {
348
350
  // Once on capella, should this need to be permanently switched to v2 when payload attrs
349
351
  // not provided
350
352
  const method =
351
- ForkSeq[fork] >= ForkSeq.deneb
352
- ? "engine_forkchoiceUpdatedV3"
353
- : ForkSeq[fork] >= ForkSeq.capella
354
- ? "engine_forkchoiceUpdatedV2"
355
- : "engine_forkchoiceUpdatedV1";
353
+ ForkSeq[fork] >= ForkSeq.gloas
354
+ ? "engine_forkchoiceUpdatedV4"
355
+ : ForkSeq[fork] >= ForkSeq.deneb
356
+ ? "engine_forkchoiceUpdatedV3"
357
+ : ForkSeq[fork] >= ForkSeq.capella
358
+ ? "engine_forkchoiceUpdatedV2"
359
+ : "engine_forkchoiceUpdatedV1";
356
360
  const payloadAttributesRpc = payloadAttributes ? serializePayloadAttributes(payloadAttributes) : undefined;
357
361
  // If we are just fcUing and not asking execution for payload, retry is not required
358
362
  // and we can move on, as the next fcU will be issued soon on the new slot
@@ -438,9 +442,12 @@ export class ExecutionEngineHttp implements IExecutionEngine {
438
442
  case ForkName.electra:
439
443
  method = "engine_getPayloadV4";
440
444
  break;
441
- default:
445
+ case ForkName.fulu:
442
446
  method = "engine_getPayloadV5";
443
447
  break;
448
+ default:
449
+ method = "engine_getPayloadV6";
450
+ break;
444
451
  }
445
452
  const payloadResponse = await this.rpc.fetchWithRetries<
446
453
  EngineApiRpcReturnTypes[typeof method],
@@ -87,6 +87,7 @@ export type PayloadAttributes = {
87
87
  suggestedFeeRecipient: string;
88
88
  withdrawals?: capella.Withdrawal[];
89
89
  parentBeaconBlockRoot?: Uint8Array;
90
+ slotNumber?: number; // EIP-7843
90
91
  };
91
92
 
92
93
  export type VersionedHashes = Uint8Array[];
@@ -11,7 +11,7 @@ import {
11
11
  SLOTS_PER_EPOCH,
12
12
  } from "@lodestar/params";
13
13
  import {computeTimeAtSlot} from "@lodestar/state-transition";
14
- import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
14
+ import {ExecutionPayload, RootHex, bellatrix, deneb, gloas, ssz} from "@lodestar/types";
15
15
  import {fromHex, toRootHex} from "@lodestar/utils";
16
16
  import {ZERO_HASH_HEX} from "../../constants/index.js";
17
17
  import {INTEROP_BLOCK_HASH} from "../../node/utils/interop/state.js";
@@ -132,14 +132,17 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
132
132
  engine_newPayloadV2: this.notifyNewPayload.bind(this),
133
133
  engine_newPayloadV3: this.notifyNewPayload.bind(this),
134
134
  engine_newPayloadV4: this.notifyNewPayload.bind(this),
135
+ engine_newPayloadV5: this.notifyNewPayload.bind(this),
135
136
  engine_forkchoiceUpdatedV1: this.notifyForkchoiceUpdate.bind(this),
136
137
  engine_forkchoiceUpdatedV2: this.notifyForkchoiceUpdate.bind(this),
137
138
  engine_forkchoiceUpdatedV3: this.notifyForkchoiceUpdate.bind(this),
139
+ engine_forkchoiceUpdatedV4: this.notifyForkchoiceUpdate.bind(this),
138
140
  engine_getPayloadV1: this.getPayloadV1.bind(this),
139
141
  engine_getPayloadV2: this.getPayloadV5.bind(this),
140
142
  engine_getPayloadV3: this.getPayloadV5.bind(this),
141
143
  engine_getPayloadV4: this.getPayloadV5.bind(this),
142
144
  engine_getPayloadV5: this.getPayloadV5.bind(this),
145
+ engine_getPayloadV6: this.getPayloadV5.bind(this),
143
146
  engine_getPayloadBodiesByHashV1: this.getPayloadBodiesByHash.bind(this),
144
147
  engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this),
145
148
  engine_getClientVersionV1: this.getClientVersionV1.bind(this),
@@ -379,6 +382,10 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
379
382
  (executionPayload as ExecutionPayload<ForkPostCapella>).withdrawals = ssz.capella.Withdrawals.defaultValue();
380
383
  }
381
384
 
385
+ if (ForkSeq[fork] >= ForkSeq.gloas && payloadAttributes.slotNumber != null) {
386
+ (executionPayload as gloas.ExecutionPayload).slotNumber = payloadAttributes.slotNumber;
387
+ }
388
+
382
389
  this.preparingPayloads.set(payloadId, {
383
390
  executionPayload: serializeExecutionPayload(fork, executionPayload),
384
391
  blobsBundle: serializeBlobsBundle({
@@ -19,6 +19,7 @@ import {
19
19
  capella,
20
20
  deneb,
21
21
  electra,
22
+ gloas,
22
23
  ssz,
23
24
  } from "@lodestar/types";
24
25
  import {BlobAndProof} from "@lodestar/types/deneb";
@@ -50,6 +51,7 @@ export type EngineApiRpcParamTypes = {
50
51
  engine_newPayloadV2: [ExecutionPayloadRpc];
51
52
  engine_newPayloadV3: [ExecutionPayloadRpc, VersionedHashesRpc, DATA];
52
53
  engine_newPayloadV4: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
54
+ engine_newPayloadV5: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
53
55
  /**
54
56
  * 1. Object - Payload validity status with respect to the consensus rules:
55
57
  * - blockHash: DATA, 32 Bytes - block hash value of the payload
@@ -67,6 +69,10 @@ export type EngineApiRpcParamTypes = {
67
69
  forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
68
70
  payloadAttributes?: PayloadAttributesRpc,
69
71
  ];
72
+ engine_forkchoiceUpdatedV4: [
73
+ forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
74
+ payloadAttributes?: PayloadAttributesRpc,
75
+ ];
70
76
  /**
71
77
  * 1. payloadId: QUANTITY, 64 Bits - Identifier of the payload building process
72
78
  */
@@ -75,6 +81,7 @@ export type EngineApiRpcParamTypes = {
75
81
  engine_getPayloadV3: [QUANTITY];
76
82
  engine_getPayloadV4: [QUANTITY];
77
83
  engine_getPayloadV5: [QUANTITY];
84
+ engine_getPayloadV6: [QUANTITY];
78
85
 
79
86
  /**
80
87
  * 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
@@ -111,6 +118,7 @@ export type EngineApiRpcReturnTypes = {
111
118
  engine_newPayloadV2: PayloadStatus;
112
119
  engine_newPayloadV3: PayloadStatus;
113
120
  engine_newPayloadV4: PayloadStatus;
121
+ engine_newPayloadV5: PayloadStatus;
114
122
  engine_forkchoiceUpdatedV1: {
115
123
  payloadStatus: PayloadStatus;
116
124
  payloadId: QUANTITY | null;
@@ -123,6 +131,10 @@ export type EngineApiRpcReturnTypes = {
123
131
  payloadStatus: PayloadStatus;
124
132
  payloadId: QUANTITY | null;
125
133
  };
134
+ engine_forkchoiceUpdatedV4: {
135
+ payloadStatus: PayloadStatus;
136
+ payloadId: QUANTITY | null;
137
+ };
126
138
  /**
127
139
  * payloadId | Error: QUANTITY, 64 Bits - Identifier of the payload building process
128
140
  */
@@ -131,6 +143,7 @@ export type EngineApiRpcReturnTypes = {
131
143
  engine_getPayloadV3: ExecutionPayloadResponse;
132
144
  engine_getPayloadV4: ExecutionPayloadResponse;
133
145
  engine_getPayloadV5: ExecutionPayloadResponse;
146
+ engine_getPayloadV6: ExecutionPayloadResponse;
134
147
 
135
148
  engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
136
149
 
@@ -180,6 +193,8 @@ export type ExecutionPayloadRpc = {
180
193
  withdrawals?: WithdrawalRpc[]; // Capella hardfork
181
194
  blobGasUsed?: QUANTITY; // DENEB
182
195
  excessBlobGas?: QUANTITY; // DENEB
196
+ blockAccessList?: DATA; // GLOAS:EIP-7928
197
+ slotNumber?: QUANTITY; // GLOAS:EIP-7843
183
198
  };
184
199
 
185
200
  export type WithdrawalRpc = {
@@ -228,6 +243,8 @@ export type PayloadAttributesRpc = {
228
243
  withdrawals?: WithdrawalRpc[];
229
244
  /** DATA, 32 Bytes - value for the parentBeaconBlockRoot to be used for building block */
230
245
  parentBeaconBlockRoot?: DATA;
246
+ /** QUANTITY, 64 Bits - value for the slot number field of the new payload (EIP-7843) */
247
+ slotNumber?: QUANTITY;
231
248
  };
232
249
 
233
250
  export type ClientVersionRpc = {
@@ -280,6 +297,12 @@ export function serializeExecutionPayload(fork: ForkName, data: ExecutionPayload
280
297
 
281
298
  // No changes in Electra
282
299
 
300
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
301
+ const {blockAccessList, slotNumber} = data as gloas.ExecutionPayload;
302
+ payload.blockAccessList = bytesToData(blockAccessList);
303
+ payload.slotNumber = numToQuantity(slotNumber);
304
+ }
305
+
283
306
  return payload;
284
307
  }
285
308
 
@@ -375,6 +398,22 @@ export function parseExecutionPayload(
375
398
 
376
399
  // No changes in Electra
377
400
 
401
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
402
+ const {blockAccessList, slotNumber} = data;
403
+ if (blockAccessList == null) {
404
+ throw Error(
405
+ `blockAccessList missing for ${fork} >= gloas executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
406
+ );
407
+ }
408
+ if (slotNumber == null) {
409
+ throw Error(
410
+ `slotNumber missing for ${fork} >= gloas executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
411
+ );
412
+ }
413
+ (executionPayload as gloas.ExecutionPayload).blockAccessList = dataToBytes(blockAccessList, null);
414
+ (executionPayload as gloas.ExecutionPayload).slotNumber = quantityToNum(slotNumber);
415
+ }
416
+
378
417
  return {executionPayload, executionPayloadValue, blobsBundle, executionRequests, shouldOverrideBuilder};
379
418
  }
380
419
 
@@ -385,6 +424,7 @@ export function serializePayloadAttributes(data: PayloadAttributes): PayloadAttr
385
424
  suggestedFeeRecipient: data.suggestedFeeRecipient,
386
425
  withdrawals: data.withdrawals?.map(serializeWithdrawal),
387
426
  parentBeaconBlockRoot: data.parentBeaconBlockRoot ? bytesToData(data.parentBeaconBlockRoot) : undefined,
427
+ slotNumber: data.slotNumber !== undefined ? numToQuantity(data.slotNumber) : undefined,
388
428
  };
389
429
  }
390
430
 
@@ -401,6 +441,7 @@ export function deserializePayloadAttributes(data: PayloadAttributesRpc): Payloa
401
441
  suggestedFeeRecipient: data.suggestedFeeRecipient,
402
442
  withdrawals: data.withdrawals?.map((withdrawal) => deserializeWithdrawal(withdrawal)),
403
443
  parentBeaconBlockRoot: data.parentBeaconBlockRoot ? dataToBytes(data.parentBeaconBlockRoot, 32) : undefined,
444
+ slotNumber: data.slotNumber !== undefined ? quantityToNum(data.slotNumber) : undefined,
404
445
  };
405
446
  }
406
447
 
@@ -613,6 +613,10 @@ export function createLodestarMetrics(
613
613
  name: "lodestar_sync_unknown_block_pending_blocks_size",
614
614
  help: "Current size of UnknownBlockSync pending blocks cache",
615
615
  }),
616
+ pendingPayloads: register.gauge({
617
+ name: "lodestar_sync_unknown_block_pending_payloads_size",
618
+ help: "Current size of UnknownBlockSync pending payloads cache",
619
+ }),
616
620
  knownBadBlocks: register.gauge({
617
621
  name: "lodestar_sync_unknown_block_known_bad_blocks_size",
618
622
  help: "Current size of UnknownBlockSync known bad blocks cache",
@@ -41,6 +41,7 @@ export enum GossipType {
41
41
  execution_payload = "execution_payload",
42
42
  payload_attestation_message = "payload_attestation_message",
43
43
  execution_payload_bid = "execution_payload_bid",
44
+ proposer_preferences = "proposer_preferences",
44
45
  }
45
46
 
46
47
  export type SequentialGossipType = Exclude<GossipType, GossipType.beacon_attestation>;
@@ -78,6 +79,7 @@ export type GossipTopicTypeMap = {
78
79
  [GossipType.execution_payload]: {type: GossipType.execution_payload};
79
80
  [GossipType.payload_attestation_message]: {type: GossipType.payload_attestation_message};
80
81
  [GossipType.execution_payload_bid]: {type: GossipType.execution_payload_bid};
82
+ [GossipType.proposer_preferences]: {type: GossipType.proposer_preferences};
81
83
  };
82
84
 
83
85
  export type GossipTopicMap = {
@@ -110,6 +112,7 @@ export type GossipTypeMap = {
110
112
  [GossipType.execution_payload]: gloas.SignedExecutionPayloadEnvelope;
111
113
  [GossipType.payload_attestation_message]: gloas.PayloadAttestationMessage;
112
114
  [GossipType.execution_payload_bid]: gloas.SignedExecutionPayloadBid;
115
+ [GossipType.proposer_preferences]: gloas.SignedProposerPreferences;
113
116
  };
114
117
 
115
118
  export type GossipFnByType = {
@@ -141,6 +144,9 @@ export type GossipFnByType = {
141
144
  payloadAttestationMessage: gloas.PayloadAttestationMessage
142
145
  ) => Promise<void> | void;
143
146
  [GossipType.execution_payload_bid]: (executionPayloadBid: gloas.SignedExecutionPayloadBid) => Promise<void> | void;
147
+ [GossipType.proposer_preferences]: (
148
+ signedProposerPreferences: gloas.SignedProposerPreferences
149
+ ) => Promise<void> | void;
144
150
  };
145
151
 
146
152
  export type GossipFn = GossipFnByType[keyof GossipFnByType];
@@ -27,6 +27,7 @@ const BLS_TO_EXECUTION_CHANGE_WEIGHT = 0.05;
27
27
  const EXECUTION_PAYLOAD_WEIGHT = 0.5;
28
28
  const PAYLOAD_ATTESTATION_WEIGHT = 0.05;
29
29
  const EXECUTION_PAYLOAD_BID_WEIGHT = 0.05;
30
+ const PROPOSER_PREFERENCES_WEIGHT = 0.05;
30
31
 
31
32
  const beaconAttestationSubnetWeight = 1 / ATTESTATION_SUBNET_COUNT;
32
33
  const maxPositiveScore =
@@ -40,7 +41,8 @@ const maxPositiveScore =
40
41
  BLS_TO_EXECUTION_CHANGE_WEIGHT +
41
42
  EXECUTION_PAYLOAD_WEIGHT +
42
43
  PAYLOAD_ATTESTATION_WEIGHT +
43
- EXECUTION_PAYLOAD_BID_WEIGHT);
44
+ EXECUTION_PAYLOAD_BID_WEIGHT +
45
+ PROPOSER_PREFERENCES_WEIGHT);
44
46
 
45
47
  /**
46
48
  * The following params is implemented by Lighthouse at
@@ -198,6 +200,17 @@ function getAllTopicsScoreParams(
198
200
  expectedMessageRate: 1024, // TODO GLOAS: Need an estimate for this
199
201
  firstMessageDecayTime: epochDurationMs * 100,
200
202
  });
203
+ topicsParams[
204
+ stringifyGossipTopic(config, {
205
+ type: GossipType.proposer_preferences,
206
+ boundary,
207
+ })
208
+ ] = getTopicScoreParams(config, precomputedParams, {
209
+ topicWeight: PROPOSER_PREFERENCES_WEIGHT,
210
+ // Upper bound ~64 messages per epoch: one per proposer across the current + next epoch.
211
+ expectedMessageRate: 64 / SLOTS_PER_EPOCH,
212
+ firstMessageDecayTime: epochDurationMs * 100,
213
+ });
201
214
 
202
215
  // other topics
203
216
  topicsParams[
@@ -73,6 +73,7 @@ function stringifyGossipTopicType(topic: GossipTopic): string {
73
73
  case GossipType.execution_payload:
74
74
  case GossipType.payload_attestation_message:
75
75
  case GossipType.execution_payload_bid:
76
+ case GossipType.proposer_preferences:
76
77
  return topic.type;
77
78
  case GossipType.beacon_attestation:
78
79
  case GossipType.sync_committee:
@@ -124,6 +125,8 @@ export function getGossipSSZType(topic: GossipTopic) {
124
125
  return ssz.gloas.PayloadAttestationMessage;
125
126
  case GossipType.execution_payload_bid:
126
127
  return ssz.gloas.SignedExecutionPayloadBid;
128
+ case GossipType.proposer_preferences:
129
+ return ssz.gloas.SignedProposerPreferences;
127
130
  }
128
131
  }
129
132
 
@@ -203,6 +206,7 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr:
203
206
  case GossipType.execution_payload:
204
207
  case GossipType.payload_attestation_message:
205
208
  case GossipType.execution_payload_bid:
209
+ case GossipType.proposer_preferences:
206
210
  return {type: gossipTypeStr, boundary, encoding};
207
211
  }
208
212
 
@@ -257,6 +261,7 @@ export function getCoreTopicsAtFork(
257
261
  topics.push({type: GossipType.execution_payload});
258
262
  topics.push({type: GossipType.payload_attestation_message});
259
263
  topics.push({type: GossipType.execution_payload_bid});
264
+ topics.push({type: GossipType.proposer_preferences});
260
265
  }
261
266
 
262
267
  // After fulu also track data_column_sidecar_{index}
@@ -351,4 +356,5 @@ export const gossipTopicIgnoreDuplicatePublishError: Record<GossipType, boolean>
351
356
  [GossipType.execution_payload]: true,
352
357
  [GossipType.payload_attestation_message]: true,
353
358
  [GossipType.execution_payload_bid]: true,
359
+ [GossipType.proposer_preferences]: true,
354
360
  };
@@ -112,6 +112,7 @@ export interface INetwork extends INetworkCorePublic {
112
112
  publishLightClientFinalityUpdate(update: LightClientFinalityUpdate): Promise<number>;
113
113
  publishLightClientOptimisticUpdate(update: LightClientOptimisticUpdate): Promise<number>;
114
114
  publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number>;
115
+ publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number>;
115
116
 
116
117
  // Debug
117
118
  dumpGossipQueue(gossipType: GossipType): Promise<PendingGossipsubMessage[]>;
@@ -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";
@@ -182,6 +185,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
182
185
  });
183
186
  try {
184
187
  await validateGossipBlock(config, chain, signedBlock, fork);
188
+
189
+ if (isForkPostGloas(fork)) {
190
+ chain.seenPayloadEnvelopeInputCache.add({
191
+ blockRootHex,
192
+ block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
193
+ forkName: fork,
194
+ sampledColumns: chain.custodyConfig.sampledColumns,
195
+ custodyColumns: chain.custodyConfig.custodyColumns,
196
+ timeCreatedSec: seenTimestampSec,
197
+ });
198
+ }
199
+
185
200
  const blockInputMeta = blockInput.getLogMeta();
186
201
 
187
202
  const recvToValidation = Date.now() / 1000 - seenTimestampSec;
@@ -198,7 +213,10 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
198
213
  } catch (e) {
199
214
  if (e instanceof BlockGossipError) {
200
215
  logger.debug("Gossip block has error", {slot, root: blockShortHex, code: e.type.code});
201
- if (e.type.code === BlockErrorCode.PARENT_UNKNOWN && blockInput) {
216
+ if (
217
+ (e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
218
+ blockInput
219
+ ) {
202
220
  chain.emitter.emit(ChainEvent.blockUnknownParent, {
203
221
  blockInput,
204
222
  peer: peerIdStr,
@@ -1057,24 +1075,15 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1057
1075
  const signedEnvelope = sszDeserialize(topic, serializedData);
1058
1076
  const envelope = signedEnvelope.message;
1059
1077
 
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
1078
+ // unlike BlockInput, we send the envelope into UnknownBlockInput sync
1079
+ // inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
1064
1080
  try {
1065
1081
  await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
1066
1082
  } catch (e) {
1067
1083
  if (e instanceof ExecutionPayloadEnvelopeError) {
1068
- const {slot, beaconBlockRoot} = signedEnvelope.message;
1084
+ const {beaconBlockRoot} = signedEnvelope.message;
1085
+ const slot = signedEnvelope.message.payload.slotNumber;
1069
1086
  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
1087
 
1079
1088
  if (e.action === GossipAction.REJECT) {
1080
1089
  chain.persistInvalidSszValue(
@@ -1088,7 +1097,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1088
1097
  throw e;
1089
1098
  }
1090
1099
 
1091
- const slot = envelope.slot;
1100
+ const slot = envelope.payload.slotNumber;
1092
1101
  const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
1093
1102
  metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
1094
1103
  chain.validatorMonitor?.registerExecutionPayloadEnvelope(OpSource.gossip, delaySec, signedEnvelope);
@@ -1118,7 +1127,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1118
1127
  builderIndex: envelope.builderIndex,
1119
1128
  blockHash: toRootHex(envelope.payload.blockHash),
1120
1129
  blockRoot: blockRootHex,
1121
- stateRoot: toRootHex(envelope.stateRoot),
1122
1130
  });
1123
1131
 
1124
1132
  chain.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
@@ -1170,6 +1178,14 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1170
1178
  data: executionPayloadBid,
1171
1179
  });
1172
1180
  },
1181
+ [GossipType.proposer_preferences]: async ({
1182
+ gossipData,
1183
+ topic,
1184
+ }: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
1185
+ const {serializedData} = gossipData;
1186
+ const signedProposerPreferences = sszDeserialize(topic, serializedData);
1187
+ await validateGossipProposerPreferences(chain, signedProposerPreferences);
1188
+ },
1173
1189
  };
1174
1190
  }
1175
1191
 
@@ -1292,10 +1308,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
1292
1308
  try {
1293
1309
  return await fn();
1294
1310
  } catch (e) {
1295
- if (
1296
- e instanceof AttestationError &&
1297
- e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT
1298
- ) {
1311
+ const isUnknownAttestationRoot =
1312
+ e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
1313
+ const isUnknownPayloadAttestationRoot =
1314
+ e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
1315
+
1316
+ if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
1299
1317
  if (unknownBlockRootRetries === 0) {
1300
1318
  // Trigger unknown block root search here
1301
1319
  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