@lodestar/beacon-node 1.43.0-dev.bc569affb9 → 1.43.0-dev.c98da75ec7

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 (352) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +16 -5
  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 +86 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/debug/index.d.ts.map +1 -1
  8. package/lib/api/impl/debug/index.js +0 -1
  9. package/lib/api/impl/debug/index.js.map +1 -1
  10. package/lib/api/impl/lodestar/index.js +1 -1
  11. package/lib/api/impl/lodestar/index.js.map +1 -1
  12. package/lib/api/impl/validator/index.d.ts.map +1 -1
  13. package/lib/api/impl/validator/index.js +68 -2
  14. package/lib/api/impl/validator/index.js.map +1 -1
  15. package/lib/chain/blocks/blockInput/blockInput.d.ts +3 -0
  16. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  17. package/lib/chain/blocks/blockInput/blockInput.js +4 -1
  18. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  19. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  20. package/lib/chain/blocks/importBlock.js +16 -28
  21. package/lib/chain/blocks/importBlock.js.map +1 -1
  22. package/lib/chain/blocks/importExecutionPayload.d.ts +23 -6
  23. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  24. package/lib/chain/blocks/importExecutionPayload.js +57 -24
  25. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  26. package/lib/chain/blocks/index.d.ts +5 -3
  27. package/lib/chain/blocks/index.d.ts.map +1 -1
  28. package/lib/chain/blocks/index.js +58 -25
  29. package/lib/chain/blocks/index.js.map +1 -1
  30. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +12 -1
  31. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  32. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +28 -2
  33. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  34. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +17 -0
  35. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  36. package/lib/chain/blocks/payloadEnvelopeProcessor.js +2 -2
  37. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  38. package/lib/chain/blocks/types.d.ts +4 -3
  39. package/lib/chain/blocks/types.d.ts.map +1 -1
  40. package/lib/chain/blocks/utils/chainSegment.d.ts +21 -2
  41. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  42. package/lib/chain/blocks/utils/chainSegment.js +92 -12
  43. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  44. package/lib/chain/blocks/verifyBlock.d.ts +5 -3
  45. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  46. package/lib/chain/blocks/verifyBlock.js +50 -7
  47. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  48. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
  49. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  50. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -2
  51. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  52. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
  53. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  54. package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
  55. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  56. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
  57. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
  58. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +12 -8
  59. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  60. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  61. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +8 -3
  62. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  63. package/lib/chain/chain.d.ts +5 -3
  64. package/lib/chain/chain.d.ts.map +1 -1
  65. package/lib/chain/chain.js +38 -13
  66. package/lib/chain/chain.js.map +1 -1
  67. package/lib/chain/emitter.d.ts +0 -11
  68. package/lib/chain/emitter.d.ts.map +1 -1
  69. package/lib/chain/emitter.js +0 -4
  70. package/lib/chain/emitter.js.map +1 -1
  71. package/lib/chain/errors/blockError.d.ts +8 -1
  72. package/lib/chain/errors/blockError.d.ts.map +1 -1
  73. package/lib/chain/errors/blockError.js +2 -0
  74. package/lib/chain/errors/blockError.js.map +1 -1
  75. package/lib/chain/errors/executionPayloadBid.d.ts +19 -1
  76. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  77. package/lib/chain/errors/executionPayloadBid.js +3 -0
  78. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  79. package/lib/chain/errors/index.d.ts +1 -0
  80. package/lib/chain/errors/index.d.ts.map +1 -1
  81. package/lib/chain/errors/index.js +1 -0
  82. package/lib/chain/errors/index.js.map +1 -1
  83. package/lib/chain/errors/proposerPreferences.d.ts +40 -0
  84. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  85. package/lib/chain/errors/proposerPreferences.js +14 -0
  86. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  87. package/lib/chain/initState.d.ts.map +1 -1
  88. package/lib/chain/initState.js +6 -1
  89. package/lib/chain/initState.js.map +1 -1
  90. package/lib/chain/interface.d.ts +5 -3
  91. package/lib/chain/interface.d.ts.map +1 -1
  92. package/lib/chain/interface.js.map +1 -1
  93. package/lib/chain/lightClient/index.d.ts.map +1 -1
  94. package/lib/chain/lightClient/index.js +1 -1
  95. package/lib/chain/lightClient/index.js.map +1 -1
  96. package/lib/chain/opPools/index.d.ts +1 -0
  97. package/lib/chain/opPools/index.d.ts.map +1 -1
  98. package/lib/chain/opPools/index.js +1 -0
  99. package/lib/chain/opPools/index.js.map +1 -1
  100. package/lib/chain/opPools/payloadAttestationPool.d.ts +4 -3
  101. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  102. package/lib/chain/opPools/payloadAttestationPool.js +56 -14
  103. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  104. package/lib/chain/opPools/proposerPreferencesPool.d.ts +29 -0
  105. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -0
  106. package/lib/chain/opPools/proposerPreferencesPool.js +56 -0
  107. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -0
  108. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  109. package/lib/chain/prepareNextSlot.js +16 -18
  110. package/lib/chain/prepareNextSlot.js.map +1 -1
  111. package/lib/chain/produceBlock/produceBlockBody.d.ts +12 -3
  112. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  113. package/lib/chain/produceBlock/produceBlockBody.js +35 -17
  114. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  115. package/lib/chain/regen/interface.d.ts +1 -0
  116. package/lib/chain/regen/interface.d.ts.map +1 -1
  117. package/lib/chain/regen/interface.js +1 -0
  118. package/lib/chain/regen/interface.js.map +1 -1
  119. package/lib/chain/regen/queued.d.ts.map +1 -1
  120. package/lib/chain/regen/queued.js +1 -4
  121. package/lib/chain/regen/queued.js.map +1 -1
  122. package/lib/chain/regen/regen.d.ts.map +1 -1
  123. package/lib/chain/regen/regen.js +1 -4
  124. package/lib/chain/regen/regen.js.map +1 -1
  125. package/lib/chain/seenCache/index.d.ts +1 -0
  126. package/lib/chain/seenCache/index.d.ts.map +1 -1
  127. package/lib/chain/seenCache/index.js +1 -0
  128. package/lib/chain/seenCache/index.js.map +1 -1
  129. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +21 -11
  130. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  131. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +70 -20
  132. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  133. package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
  134. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  135. package/lib/chain/seenCache/seenProposerPreferences.js +26 -0
  136. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  137. package/lib/chain/validation/block.d.ts.map +1 -1
  138. package/lib/chain/validation/block.js +1 -0
  139. package/lib/chain/validation/block.js.map +1 -1
  140. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  141. package/lib/chain/validation/executionPayloadBid.js +68 -17
  142. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  143. package/lib/chain/validation/payloadAttestationMessage.d.ts +1 -1
  144. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  145. package/lib/chain/validation/payloadAttestationMessage.js +5 -3
  146. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  147. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  148. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  149. package/lib/chain/validation/proposerPreferences.js +91 -0
  150. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  151. package/lib/metrics/metrics/lodestar.d.ts +5 -0
  152. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  153. package/lib/metrics/metrics/lodestar.js +9 -0
  154. package/lib/metrics/metrics/lodestar.js.map +1 -1
  155. package/lib/network/gossip/interface.d.ts +7 -1
  156. package/lib/network/gossip/interface.d.ts.map +1 -1
  157. package/lib/network/gossip/interface.js +1 -0
  158. package/lib/network/gossip/interface.js.map +1 -1
  159. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  160. package/lib/network/gossip/scoringParameters.js +12 -1
  161. package/lib/network/gossip/scoringParameters.js.map +1 -1
  162. package/lib/network/gossip/topic.d.ts +29 -766
  163. package/lib/network/gossip/topic.d.ts.map +1 -1
  164. package/lib/network/gossip/topic.js +6 -0
  165. package/lib/network/gossip/topic.js.map +1 -1
  166. package/lib/network/interface.d.ts +3 -0
  167. package/lib/network/interface.d.ts.map +1 -1
  168. package/lib/network/network.d.ts +3 -0
  169. package/lib/network/network.d.ts.map +1 -1
  170. package/lib/network/network.js +13 -0
  171. package/lib/network/network.js.map +1 -1
  172. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  173. package/lib/network/processor/gossipHandlers.js +77 -20
  174. package/lib/network/processor/gossipHandlers.js.map +1 -1
  175. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  176. package/lib/network/processor/gossipQueues/index.js +5 -0
  177. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  178. package/lib/network/processor/index.d.ts.map +1 -1
  179. package/lib/network/processor/index.js +6 -5
  180. package/lib/network/processor/index.js.map +1 -1
  181. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  182. package/lib/network/reqresp/ReqRespBeaconNode.js +1 -1
  183. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  184. package/lib/network/reqresp/handlers/beaconBlocksByHead.d.ts +9 -0
  185. package/lib/network/reqresp/handlers/beaconBlocksByHead.d.ts.map +1 -0
  186. package/lib/network/reqresp/handlers/beaconBlocksByHead.js +61 -0
  187. package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -0
  188. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  189. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
  190. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  191. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
  192. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
  193. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  194. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  195. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
  196. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  197. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  198. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
  199. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  200. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  201. package/lib/network/reqresp/handlers/index.js +5 -0
  202. package/lib/network/reqresp/handlers/index.js.map +1 -1
  203. package/lib/network/reqresp/interface.d.ts +1 -1
  204. package/lib/network/reqresp/interface.js +1 -1
  205. package/lib/network/reqresp/protocols.d.ts +1 -0
  206. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  207. package/lib/network/reqresp/protocols.js +5 -0
  208. package/lib/network/reqresp/protocols.js.map +1 -1
  209. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  210. package/lib/network/reqresp/rateLimit.js +4 -0
  211. package/lib/network/reqresp/rateLimit.js.map +1 -1
  212. package/lib/network/reqresp/score.d.ts.map +1 -1
  213. package/lib/network/reqresp/score.js +1 -0
  214. package/lib/network/reqresp/score.js.map +1 -1
  215. package/lib/network/reqresp/types.d.ts +3 -0
  216. package/lib/network/reqresp/types.d.ts.map +1 -1
  217. package/lib/network/reqresp/types.js +3 -0
  218. package/lib/network/reqresp/types.js.map +1 -1
  219. package/lib/node/nodejs.js +2 -2
  220. package/lib/node/nodejs.js.map +1 -1
  221. package/lib/sync/constants.d.ts +7 -1
  222. package/lib/sync/constants.d.ts.map +1 -1
  223. package/lib/sync/constants.js +7 -4
  224. package/lib/sync/constants.js.map +1 -1
  225. package/lib/sync/range/batch.d.ts +55 -8
  226. package/lib/sync/range/batch.d.ts.map +1 -1
  227. package/lib/sync/range/batch.js +291 -66
  228. package/lib/sync/range/batch.js.map +1 -1
  229. package/lib/sync/range/chain.d.ts +22 -4
  230. package/lib/sync/range/chain.d.ts.map +1 -1
  231. package/lib/sync/range/chain.js +103 -11
  232. package/lib/sync/range/chain.js.map +1 -1
  233. package/lib/sync/range/range.d.ts.map +1 -1
  234. package/lib/sync/range/range.js +71 -11
  235. package/lib/sync/range/range.js.map +1 -1
  236. package/lib/sync/range/utils/peerBalancer.d.ts +2 -1
  237. package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
  238. package/lib/sync/range/utils/peerBalancer.js +8 -4
  239. package/lib/sync/range/utils/peerBalancer.js.map +1 -1
  240. package/lib/sync/sync.d.ts.map +1 -1
  241. package/lib/sync/sync.js +13 -0
  242. package/lib/sync/sync.js.map +1 -1
  243. package/lib/sync/types.d.ts +34 -0
  244. package/lib/sync/types.d.ts.map +1 -1
  245. package/lib/sync/types.js +34 -0
  246. package/lib/sync/types.js.map +1 -1
  247. package/lib/sync/unknownBlock.d.ts +29 -1
  248. package/lib/sync/unknownBlock.d.ts.map +1 -1
  249. package/lib/sync/unknownBlock.js +727 -61
  250. package/lib/sync/unknownBlock.js.map +1 -1
  251. package/lib/sync/utils/downloadByRange.d.ts +73 -10
  252. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  253. package/lib/sync/utils/downloadByRange.js +213 -26
  254. package/lib/sync/utils/downloadByRange.js.map +1 -1
  255. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  256. package/lib/sync/utils/downloadByRoot.js +16 -2
  257. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  258. package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
  259. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  260. package/lib/sync/utils/pendingBlocksTree.js +0 -9
  261. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  262. package/lib/sync/utils/rateLimit.d.ts +2 -0
  263. package/lib/sync/utils/rateLimit.d.ts.map +1 -0
  264. package/lib/sync/utils/rateLimit.js +15 -0
  265. package/lib/sync/utils/rateLimit.js.map +1 -0
  266. package/lib/util/dependentRoot.d.ts +6 -2
  267. package/lib/util/dependentRoot.d.ts.map +1 -1
  268. package/lib/util/dependentRoot.js +20 -16
  269. package/lib/util/dependentRoot.js.map +1 -1
  270. package/lib/util/sszBytes.d.ts.map +1 -1
  271. package/lib/util/sszBytes.js +8 -6
  272. package/lib/util/sszBytes.js.map +1 -1
  273. package/package.json +15 -16
  274. package/src/api/impl/beacon/blocks/index.ts +21 -5
  275. package/src/api/impl/beacon/pool/index.ts +136 -1
  276. package/src/api/impl/debug/index.ts +0 -1
  277. package/src/api/impl/lodestar/index.ts +1 -1
  278. package/src/api/impl/validator/index.ts +82 -1
  279. package/src/chain/blocks/blockInput/blockInput.ts +4 -1
  280. package/src/chain/blocks/importBlock.ts +16 -48
  281. package/src/chain/blocks/importExecutionPayload.ts +76 -30
  282. package/src/chain/blocks/index.ts +71 -22
  283. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +37 -3
  284. package/src/chain/blocks/payloadEnvelopeInput/types.ts +18 -0
  285. package/src/chain/blocks/payloadEnvelopeProcessor.ts +2 -2
  286. package/src/chain/blocks/types.ts +4 -3
  287. package/src/chain/blocks/utils/chainSegment.ts +117 -17
  288. package/src/chain/blocks/verifyBlock.ts +70 -9
  289. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
  290. package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
  291. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +16 -8
  292. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
  293. package/src/chain/chain.ts +46 -10
  294. package/src/chain/emitter.ts +0 -11
  295. package/src/chain/errors/blockError.ts +4 -1
  296. package/src/chain/errors/executionPayloadBid.ts +22 -1
  297. package/src/chain/errors/index.ts +1 -0
  298. package/src/chain/errors/proposerPreferences.ts +47 -0
  299. package/src/chain/initState.ts +9 -1
  300. package/src/chain/interface.ts +9 -1
  301. package/src/chain/lightClient/index.ts +6 -6
  302. package/src/chain/opPools/index.ts +1 -0
  303. package/src/chain/opPools/payloadAttestationPool.ts +63 -18
  304. package/src/chain/opPools/proposerPreferencesPool.ts +59 -0
  305. package/src/chain/prepareNextSlot.ts +21 -29
  306. package/src/chain/produceBlock/produceBlockBody.ts +46 -22
  307. package/src/chain/regen/interface.ts +1 -0
  308. package/src/chain/regen/queued.ts +2 -7
  309. package/src/chain/regen/regen.ts +2 -7
  310. package/src/chain/seenCache/index.ts +1 -0
  311. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +90 -24
  312. package/src/chain/seenCache/seenProposerPreferences.ts +32 -0
  313. package/src/chain/validation/block.ts +1 -0
  314. package/src/chain/validation/executionPayloadBid.ts +71 -18
  315. package/src/chain/validation/payloadAttestationMessage.ts +6 -4
  316. package/src/chain/validation/proposerPreferences.ts +110 -0
  317. package/src/metrics/metrics/lodestar.ts +10 -0
  318. package/src/network/gossip/interface.ts +6 -0
  319. package/src/network/gossip/scoringParameters.ts +14 -1
  320. package/src/network/gossip/topic.ts +6 -0
  321. package/src/network/interface.ts +3 -0
  322. package/src/network/network.ts +34 -0
  323. package/src/network/processor/gossipHandlers.ts +96 -20
  324. package/src/network/processor/gossipQueues/index.ts +5 -0
  325. package/src/network/processor/index.ts +6 -5
  326. package/src/network/reqresp/ReqRespBeaconNode.ts +1 -0
  327. package/src/network/reqresp/handlers/beaconBlocksByHead.ts +91 -0
  328. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
  329. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
  330. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
  331. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
  332. package/src/network/reqresp/handlers/index.ts +5 -0
  333. package/src/network/reqresp/interface.ts +1 -1
  334. package/src/network/reqresp/protocols.ts +6 -0
  335. package/src/network/reqresp/rateLimit.ts +4 -0
  336. package/src/network/reqresp/score.ts +1 -0
  337. package/src/network/reqresp/types.ts +5 -0
  338. package/src/node/nodejs.ts +2 -2
  339. package/src/sync/constants.ts +8 -4
  340. package/src/sync/range/batch.ts +388 -75
  341. package/src/sync/range/chain.ts +131 -14
  342. package/src/sync/range/range.ts +86 -11
  343. package/src/sync/range/utils/peerBalancer.ts +9 -3
  344. package/src/sync/sync.ts +13 -1
  345. package/src/sync/types.ts +72 -0
  346. package/src/sync/unknownBlock.ts +915 -65
  347. package/src/sync/utils/downloadByRange.ts +386 -39
  348. package/src/sync/utils/downloadByRoot.ts +24 -2
  349. package/src/sync/utils/pendingBlocksTree.ts +0 -15
  350. package/src/sync/utils/rateLimit.ts +16 -0
  351. package/src/util/dependentRoot.ts +22 -18
  352. package/src/util/sszBytes.ts +8 -6
@@ -11,7 +11,7 @@ import {IBeaconChain} from "../index.js";
11
11
 
12
12
  export type PayloadAttestationValidationResult = {
13
13
  attDataRootHex: RootHex;
14
- validatorCommitteeIndex: number;
14
+ validatorCommitteeIndices: number[];
15
15
  };
16
16
 
17
17
  export async function validateApiPayloadAttestationMessage(
@@ -80,9 +80,11 @@ async function validatePayloadAttestationMessage(
80
80
  // [REJECT] The message's validator index is within the payload committee in
81
81
  // `get_ptc(state, data.slot)`. The `state` is the head state corresponding to
82
82
  // processing the block up to the current slot as determined by the fork choice.
83
- const validatorCommitteeIndex = state.getIndexInPayloadTimelinessCommittee(validatorIndex, data.slot);
83
+ // The validator may occupy multiple PTC positions because `compute_ptc` samples
84
+ // by effective balance — collect all of them so duplicate votes are counted.
85
+ const validatorCommitteeIndices = state.getIndicesInPayloadTimelinessCommittee(validatorIndex, data.slot);
84
86
 
85
- if (validatorCommitteeIndex === -1) {
87
+ if (validatorCommitteeIndices.length === 0) {
86
88
  throw new PayloadAttestationError(GossipAction.REJECT, {
87
89
  code: PayloadAttestationErrorCode.INVALID_ATTESTER,
88
90
  attesterIndex: validatorIndex,
@@ -115,6 +117,6 @@ async function validatePayloadAttestationMessage(
115
117
 
116
118
  return {
117
119
  attDataRootHex: toRootHex(ssz.gloas.PayloadAttestationData.hashTreeRoot(data)),
118
- validatorCommitteeIndex,
120
+ validatorCommitteeIndices,
119
121
  };
120
122
  }
@@ -0,0 +1,110 @@
1
+ import {SLOTS_PER_EPOCH} from "@lodestar/params";
2
+ import {
3
+ computeEpochAtSlot,
4
+ createSingleSignatureSetFromComponents,
5
+ getProposerPreferencesSigningRoot,
6
+ } from "@lodestar/state-transition";
7
+ import {ValidatorIndex, gloas} from "@lodestar/types";
8
+ import {toRootHex} from "@lodestar/utils";
9
+ import {GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode} from "../errors/index.js";
10
+ import {IBeaconChain} from "../index.js";
11
+
12
+ /**
13
+ * Validates a gossiped `SignedProposerPreferences` per
14
+ * https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#proposer_preferences
15
+ */
16
+ export async function validateGossipProposerPreferences(
17
+ chain: IBeaconChain,
18
+ signedProposerPreferences: gloas.SignedProposerPreferences
19
+ ): Promise<void> {
20
+ const preferences = signedProposerPreferences.message;
21
+ const {proposalSlot, validatorIndex, dependentRoot} = preferences;
22
+ const dependentRootHex = toRootHex(dependentRoot);
23
+ const proposalEpoch = computeEpochAtSlot(proposalSlot);
24
+
25
+ // [IGNORE] `preferences.proposal_slot` is in the current or next epoch.
26
+ const currentEpoch = chain.clock.currentEpoch;
27
+ if (proposalEpoch < currentEpoch || proposalEpoch > currentEpoch + 1) {
28
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
29
+ code: ProposerPreferencesErrorCode.INVALID_EPOCH,
30
+ proposalSlot,
31
+ currentEpoch,
32
+ });
33
+ }
34
+
35
+ // [IGNORE] `preferences.proposal_slot` has not already passed.
36
+ const currentSlot = chain.clock.currentSlot;
37
+ if (proposalSlot <= currentSlot) {
38
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
39
+ code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
40
+ proposalSlot,
41
+ currentSlot,
42
+ });
43
+ }
44
+
45
+ // [IGNORE] The block with root `dependent_root` has been seen by the node.
46
+ // Resolve the proposer lookahead for the message's branch via head state (fast path) or
47
+ // the previous-root checkpoint state (populated by `processSlotsToNearestCheckpoint` for
48
+ // any imported branch crossing into `proposalEpoch - 1`). The head-state path also handles
49
+ // narrow timing windows where the checkpoint state isn't yet populated.
50
+ const headState = chain.getHeadState();
51
+ let proposers: ValidatorIndex[] | null = null;
52
+ if (headState.epoch === proposalEpoch && headState.currentDecisionRoot === dependentRootHex) {
53
+ proposers = headState.currentProposers;
54
+ } else if (headState.epoch === proposalEpoch - 1 && headState.nextDecisionRoot === dependentRootHex) {
55
+ proposers = headState.nextProposers;
56
+ } else {
57
+ // Sync lookup only to not trigger disk reload from gossip input.
58
+ const checkpointState = chain.regen.getCheckpointStateSync({epoch: proposalEpoch - 1, rootHex: dependentRootHex});
59
+ if (checkpointState !== null) {
60
+ // State is at `proposalEpoch - 1`, so proposers for `proposalSlot` (next epoch from
61
+ // the state's perspective) live in `nextProposers`.
62
+ proposers = checkpointState.nextProposers;
63
+ }
64
+ }
65
+ if (proposers === null) {
66
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
67
+ code: ProposerPreferencesErrorCode.UNKNOWN_DEPENDENT_ROOT,
68
+ proposalSlot,
69
+ dependentRoot: dependentRootHex,
70
+ });
71
+ }
72
+
73
+ // [REJECT] `is_valid_proposal_slot(state, preferences)` returns True.
74
+ if (proposers[proposalSlot % SLOTS_PER_EPOCH] !== validatorIndex) {
75
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
76
+ code: ProposerPreferencesErrorCode.INVALID_PROPOSER,
77
+ proposalSlot,
78
+ validatorIndex,
79
+ dependentRoot: dependentRootHex,
80
+ });
81
+ }
82
+
83
+ // [IGNORE] First valid message for (dependent_root, proposal_slot, validator_index).
84
+ if (chain.seenProposerPreferences.isKnown(dependentRootHex, proposalSlot, validatorIndex)) {
85
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
86
+ code: ProposerPreferencesErrorCode.ALREADY_KNOWN,
87
+ proposalSlot,
88
+ validatorIndex,
89
+ dependentRoot: dependentRootHex,
90
+ });
91
+ }
92
+
93
+ // [REJECT] `signed_proposer_preferences.signature` is valid with respect to the validator's public key.
94
+ const signatureSet = createSingleSignatureSetFromComponents(
95
+ chain.pubkeyCache.getOrThrow(validatorIndex),
96
+ getProposerPreferencesSigningRoot(chain.config, preferences),
97
+ signedProposerPreferences.signature
98
+ );
99
+
100
+ if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true}))) {
101
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
102
+ code: ProposerPreferencesErrorCode.INVALID_SIGNATURE,
103
+ proposalSlot,
104
+ validatorIndex,
105
+ });
106
+ }
107
+
108
+ // Valid
109
+ chain.seenProposerPreferences.add(dependentRootHex, proposalSlot, validatorIndex);
110
+ }
@@ -3,6 +3,7 @@ import {NotReorgedReason} from "@lodestar/fork-choice";
3
3
  import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
4
4
  import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
5
5
  import {BlockInputSource} from "../../chain/blocks/blockInput/index.js";
6
+ import {PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
6
7
  import {PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
7
8
  import {JobQueueItemType} from "../../chain/bls/index.js";
8
9
  import {AttestationErrorCode, BlockErrorCode} from "../../chain/errors/index.js";
@@ -613,6 +614,10 @@ export function createLodestarMetrics(
613
614
  name: "lodestar_sync_unknown_block_pending_blocks_size",
614
615
  help: "Current size of UnknownBlockSync pending blocks cache",
615
616
  }),
617
+ pendingPayloads: register.gauge({
618
+ name: "lodestar_sync_unknown_block_pending_payloads_size",
619
+ help: "Current size of UnknownBlockSync pending payloads cache",
620
+ }),
616
621
  knownBadBlocks: register.gauge({
617
622
  name: "lodestar_sync_unknown_block_known_bad_blocks_size",
618
623
  help: "Current size of UnknownBlockSync known bad blocks cache",
@@ -886,6 +891,11 @@ export function createLodestarMetrics(
886
891
  labelNames: ["source"],
887
892
  buckets: [0.5, 1, 2, 4, 6, 12],
888
893
  }),
894
+ processPayloadErrors: register.gauge<{error: PayloadErrorCode | "NOT_PAYLOAD_ERROR"}>({
895
+ name: "lodestar_gossip_execution_payload_envelope_process_payload_errors",
896
+ help: "Count of errors, by error type, while processing execution payload envelopes",
897
+ labelNames: ["error"],
898
+ }),
889
899
  },
890
900
  // recovery in the case of specific blob rows required
891
901
  recoverBlobSidecars: {
@@ -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
  };
@@ -78,6 +78,7 @@ export interface INetwork extends INetworkCorePublic {
78
78
  // ReqResp
79
79
  sendBeaconBlocksByRange(peerId: PeerIdStr, request: phase0.BeaconBlocksByRangeRequest): Promise<SignedBeaconBlock[]>;
80
80
  sendBeaconBlocksByRoot(peerId: PeerIdStr, request: BeaconBlocksByRootRequest): Promise<SignedBeaconBlock[]>;
81
+ sendBeaconBlocksByHead(peerId: PeerIdStr, request: fulu.BeaconBlocksByHeadRequest): Promise<SignedBeaconBlock[]>;
81
82
  sendBlobSidecarsByRange(peerId: PeerIdStr, request: deneb.BlobSidecarsByRangeRequest): Promise<deneb.BlobSidecar[]>;
82
83
  sendBlobSidecarsByRoot(peerId: PeerIdStr, request: BlobSidecarsByRootRequest): Promise<deneb.BlobSidecar[]>;
83
84
  sendDataColumnSidecarsByRange(
@@ -112,6 +113,8 @@ export interface INetwork extends INetworkCorePublic {
112
113
  publishLightClientFinalityUpdate(update: LightClientFinalityUpdate): Promise<number>;
113
114
  publishLightClientOptimisticUpdate(update: LightClientOptimisticUpdate): Promise<number>;
114
115
  publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number>;
116
+ publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number>;
117
+ publishProposerPreferences(signedProposerPreferences: gloas.SignedProposerPreferences): Promise<number>;
115
118
 
116
119
  // Debug
117
120
  dumpGossipQueue(gossipType: GossipType): Promise<PendingGossipsubMessage[]>;
@@ -515,6 +515,28 @@ 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
+
529
+ async publishProposerPreferences(signedProposerPreferences: gloas.SignedProposerPreferences): Promise<number> {
530
+ const epoch = computeEpochAtSlot(signedProposerPreferences.message.proposalSlot);
531
+ const boundary = this.config.getForkBoundaryAtEpoch(epoch);
532
+
533
+ return this.publishGossip<GossipType.proposer_preferences>(
534
+ {type: GossipType.proposer_preferences, boundary},
535
+ signedProposerPreferences,
536
+ {ignoreDuplicatePublishError: true}
537
+ );
538
+ }
539
+
518
540
  private async publishGossip<K extends GossipType>(
519
541
  topic: GossipTopicMap[K],
520
542
  object: GossipTypeMap[K],
@@ -567,6 +589,18 @@ export class Network implements INetwork {
567
589
  );
568
590
  }
569
591
 
592
+ async sendBeaconBlocksByHead(
593
+ peerId: PeerIdStr,
594
+ request: fulu.BeaconBlocksByHeadRequest
595
+ ): Promise<SignedBeaconBlock[]> {
596
+ return collectMaxResponseTypedWithBytes(
597
+ this.sendReqRespRequest(peerId, ReqRespMethod.BeaconBlocksByHead, [Version.V1], request),
598
+ Math.min(request.count, this.config.MAX_REQUEST_BLOCKS_DENEB),
599
+ responseSszTypeByMethod[ReqRespMethod.BeaconBlocksByHead],
600
+ this.chain.serializedCache
601
+ );
602
+ }
603
+
570
604
  async sendLightClientBootstrap(peerId: PeerIdStr, request: Root): Promise<LightClientBootstrap> {
571
605
  return collectExactOneTyped(
572
606
  this.sendReqRespRequest(peerId, ReqRespMethod.LightClientBootstrap, [Version.V1], request),
@@ -35,6 +35,7 @@ import {
35
35
  IBlockInput,
36
36
  isBlockInputColumns,
37
37
  } from "../../chain/blocks/blockInput/index.js";
38
+ import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
38
39
  import {PayloadEnvelopeInput, PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
39
40
  import {BlobSidecarValidation} from "../../chain/blocks/types.js";
40
41
  import {ChainEvent} from "../../chain/emitter.js";
@@ -52,6 +53,8 @@ import {
52
53
  ExecutionPayloadEnvelopeErrorCode,
53
54
  GossipAction,
54
55
  GossipActionError,
56
+ PayloadAttestationError,
57
+ PayloadAttestationErrorCode,
55
58
  SyncCommitteeError,
56
59
  } from "../../chain/errors/index.js";
57
60
  import {IBeaconChain} from "../../chain/interface.js";
@@ -79,6 +82,7 @@ import {
79
82
  import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js";
80
83
  import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js";
81
84
  import {validateGossipPayloadAttestationMessage} from "../../chain/validation/payloadAttestationMessage.js";
85
+ import {validateGossipProposerPreferences} from "../../chain/validation/proposerPreferences.js";
82
86
  import {OpSource} from "../../chain/validatorMonitor.js";
83
87
  import {Metrics} from "../../metrics/index.js";
84
88
  import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
@@ -182,6 +186,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
182
186
  });
183
187
  try {
184
188
  await validateGossipBlock(config, chain, signedBlock, fork);
189
+
190
+ if (isForkPostGloas(fork)) {
191
+ chain.seenPayloadEnvelopeInputCache.add({
192
+ blockRootHex,
193
+ block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
194
+ forkName: fork,
195
+ sampledColumns: chain.custodyConfig.sampledColumns,
196
+ custodyColumns: chain.custodyConfig.custodyColumns,
197
+ timeCreatedSec: seenTimestampSec,
198
+ });
199
+ }
200
+
185
201
  const blockInputMeta = blockInput.getLogMeta();
186
202
 
187
203
  const recvToValidation = Date.now() / 1000 - seenTimestampSec;
@@ -198,7 +214,10 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
198
214
  } catch (e) {
199
215
  if (e instanceof BlockGossipError) {
200
216
  logger.debug("Gossip block has error", {slot, root: blockShortHex, code: e.type.code});
201
- if (e.type.code === BlockErrorCode.PARENT_UNKNOWN && blockInput) {
217
+ if (
218
+ (e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
219
+ blockInput
220
+ ) {
202
221
  chain.emitter.emit(ChainEvent.blockUnknownParent, {
203
222
  blockInput,
204
223
  peer: peerIdStr,
@@ -589,6 +608,24 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
589
608
  // Returns the delay between the start of `block.slot` and `current time`
590
609
  const delaySec = chain.clock.secFromSlot(slot);
591
610
  metrics?.gossipBlock.elapsedTimeTillProcessed.observe(delaySec);
611
+
612
+ if (isForkPostGloas(blockInput.forkName)) {
613
+ const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockInput.blockRootHex);
614
+ // This payloadInput should have been created just after gossip validation
615
+ if (!payloadInput) {
616
+ throw Error(
617
+ `PayloadEnvelopeInput not seeded for block ${blockInput.blockRootHex} during gossip processing`
618
+ );
619
+ }
620
+
621
+ // Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
622
+ // which is all the information we need so there is no reason to delay until execution payload arrives
623
+ // TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
624
+ // (for example later in the slot). Do not couple retries to incoming gossip columns.
625
+ // Columns fetched here feed payloadInput.addColumn, which resolves waitForAllData for any
626
+ // in-flight importExecutionPayload. No processExecutionPayload trigger needed from this path.
627
+ chain.getBlobsTracker.triggerGetBlobs(payloadInput);
628
+ }
592
629
  })
593
630
  .catch((e) => {
594
631
  // Adjust verbosity based on error type
@@ -1057,10 +1094,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1057
1094
  const signedEnvelope = sszDeserialize(topic, serializedData);
1058
1095
  const envelope = signedEnvelope.message;
1059
1096
 
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
1097
+ // unlike BlockInput, we send the envelope into UnknownBlockInput sync
1098
+ // inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
1064
1099
  try {
1065
1100
  await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
1066
1101
  } catch (e) {
@@ -1068,14 +1103,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1068
1103
  const {beaconBlockRoot} = signedEnvelope.message;
1069
1104
  const slot = signedEnvelope.message.payload.slotNumber;
1070
1105
  logger.debug("Gossip envelope has error", {slot, root: toRootHex(beaconBlockRoot), code: e.type.code});
1071
- if (e.type.code === ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN) {
1072
- // TODO GLOAS: UnknownBlockSync to handle this
1073
- chain.emitter.emit(ChainEvent.envelopeUnknownBlock, {
1074
- envelope: signedEnvelope,
1075
- peer: peerIdStr,
1076
- source: BlockInputSource.gossip,
1077
- });
1078
- }
1079
1106
 
1080
1107
  if (e.action === GossipAction.REJECT) {
1081
1108
  chain.persistInvalidSszValue(
@@ -1122,7 +1149,40 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1122
1149
  });
1123
1150
 
1124
1151
  chain.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
1125
- chain.logger.debug("Error processing execution payload from gossip", {slot, root: blockRootHex}, e as Error);
1152
+ // Adjust verbosity based on error type
1153
+ let logLevel: LogLevel;
1154
+
1155
+ if (e instanceof PayloadError) {
1156
+ switch (e.type.code) {
1157
+ // BLOCK_NOT_IN_FORK_CHOICE should not happen, validateGossipExecutionPayloadEnvelope above
1158
+ // already verified the block is in fork choice
1159
+ case PayloadErrorCode.BLOCK_NOT_IN_FORK_CHOICE:
1160
+ case PayloadErrorCode.MISS_BLOCK_STATE:
1161
+ case PayloadErrorCode.EXECUTION_ENGINE_ERROR:
1162
+ // Errors might indicate an issue with our node or the connected EL client
1163
+ logLevel = LogLevel.error;
1164
+ break;
1165
+ // INVALID_SIGNATURE should not happen, signature is verified during gossip validation
1166
+ case PayloadErrorCode.INVALID_SIGNATURE:
1167
+ case PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR:
1168
+ case PayloadErrorCode.EXECUTION_ENGINE_INVALID:
1169
+ core.reportPeer(peerIdStr, PeerAction.LowToleranceError, "BadGossipPayload");
1170
+ // Misbehaving peer, but could highlight an issue in another client
1171
+ logLevel = LogLevel.warn;
1172
+ break;
1173
+ }
1174
+ } else {
1175
+ // Any unexpected error
1176
+ logLevel = LogLevel.error;
1177
+ }
1178
+ metrics?.gossipExecutionPayloadEnvelope.processPayloadErrors.inc({
1179
+ error: e instanceof PayloadError ? e.type.code : "NOT_PAYLOAD_ERROR",
1180
+ });
1181
+ chain.logger[logLevel](
1182
+ "Error processing execution payload from gossip",
1183
+ {slot, peer: peerIdStr, root: blockRootHex},
1184
+ e as Error
1185
+ );
1126
1186
  });
1127
1187
  },
1128
1188
  [GossipType.payload_attestation_message]: async ({
@@ -1137,7 +1197,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1137
1197
  const insertOutcome = chain.payloadAttestationPool.add(
1138
1198
  payloadAttestationMessage,
1139
1199
  validationResult.attDataRootHex,
1140
- validationResult.validatorCommitteeIndex
1200
+ validationResult.validatorCommitteeIndices
1141
1201
  );
1142
1202
  metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
1143
1203
  } catch (e) {
@@ -1145,7 +1205,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1145
1205
  }
1146
1206
  chain.forkChoice.notifyPtcMessages(
1147
1207
  toRootHex(payloadAttestationMessage.data.beaconBlockRoot),
1148
- [validationResult.validatorCommitteeIndex],
1208
+ validationResult.validatorCommitteeIndices,
1149
1209
  payloadAttestationMessage.data.payloadPresent
1150
1210
  );
1151
1211
  },
@@ -1170,6 +1230,20 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1170
1230
  data: executionPayloadBid,
1171
1231
  });
1172
1232
  },
1233
+ [GossipType.proposer_preferences]: async ({
1234
+ gossipData,
1235
+ topic,
1236
+ }: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
1237
+ const {serializedData} = gossipData;
1238
+ const signedProposerPreferences = sszDeserialize(topic, serializedData);
1239
+ await validateGossipProposerPreferences(chain, signedProposerPreferences);
1240
+
1241
+ chain.proposerPreferencesPool.add(signedProposerPreferences);
1242
+ chain.emitter.emit(routes.events.EventType.proposerPreferences, {
1243
+ version: ForkName.gloas,
1244
+ data: signedProposerPreferences,
1245
+ });
1246
+ },
1173
1247
  };
1174
1248
  }
1175
1249
 
@@ -1292,10 +1366,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
1292
1366
  try {
1293
1367
  return await fn();
1294
1368
  } catch (e) {
1295
- if (
1296
- e instanceof AttestationError &&
1297
- e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT
1298
- ) {
1369
+ const isUnknownAttestationRoot =
1370
+ e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
1371
+ const isUnknownPayloadAttestationRoot =
1372
+ e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
1373
+
1374
+ if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
1299
1375
  if (unknownBlockRootRetries === 0) {
1300
1376
  // Trigger unknown block root search here
1301
1377
  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: {
@@ -286,6 +286,7 @@ export class ReqRespBeaconNode extends ReqResp {
286
286
  // instead of protocol version. This is not easily fixable with our current architecture.
287
287
  // See https://github.com/ChainSafe/lodestar/pull/8168 for more details.
288
288
  [protocols.StatusV2(fork, this.config), this.onStatus.bind(this)],
289
+ [protocols.BeaconBlocksByHead(fork, this.config), this.getHandler(ReqRespMethod.BeaconBlocksByHead)],
289
290
  [
290
291
  protocols.DataColumnSidecarsByRoot(fork, this.config),
291
292
  this.getHandler(ReqRespMethod.DataColumnSidecarsByRoot),