@lodestar/beacon-node 1.51.0-dev.32db66b396 → 1.51.0-dev.36022cc5cb

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 (502) hide show
  1. package/lib/api/impl/api.js +1 -1
  2. package/lib/api/impl/api.js.map +1 -1
  3. package/lib/api/impl/beacon/blocks/index.d.ts +2 -1
  4. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/blocks/index.js +29 -34
  6. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  7. package/lib/api/impl/beacon/index.d.ts +2 -1
  8. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/index.js +2 -2
  10. package/lib/api/impl/beacon/index.js.map +1 -1
  11. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  12. package/lib/api/impl/beacon/pool/index.js +5 -2
  13. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  15. package/lib/api/impl/beacon/state/index.js +8 -2
  16. package/lib/api/impl/beacon/state/index.js.map +1 -1
  17. package/lib/api/impl/beacon/state/utils.d.ts +3 -2
  18. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  19. package/lib/api/impl/beacon/state/utils.js +17 -9
  20. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  21. package/lib/api/impl/debug/index.d.ts.map +1 -1
  22. package/lib/api/impl/debug/index.js +3 -0
  23. package/lib/api/impl/debug/index.js.map +1 -1
  24. package/lib/api/impl/validator/index.d.ts +6 -0
  25. package/lib/api/impl/validator/index.d.ts.map +1 -1
  26. package/lib/api/impl/validator/index.js +143 -35
  27. package/lib/api/impl/validator/index.js.map +1 -1
  28. package/lib/api/options.d.ts +2 -0
  29. package/lib/api/options.d.ts.map +1 -1
  30. package/lib/api/options.js +1 -0
  31. package/lib/api/options.js.map +1 -1
  32. package/lib/chain/GetBlobsTracker.d.ts +13 -2
  33. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  34. package/lib/chain/GetBlobsTracker.js +85 -27
  35. package/lib/chain/GetBlobsTracker.js.map +1 -1
  36. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  37. package/lib/chain/archiveStore/archiveStore.js +1 -0
  38. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  39. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +4 -0
  40. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  41. package/lib/chain/archiveStore/utils/archiveBlocks.js +61 -97
  42. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  43. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  44. package/lib/chain/blocks/importBlock.js +23 -51
  45. package/lib/chain/blocks/importBlock.js.map +1 -1
  46. package/lib/chain/blocks/importExecutionPayload.d.ts +10 -11
  47. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  48. package/lib/chain/blocks/importExecutionPayload.js +82 -20
  49. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  50. package/lib/chain/blocks/index.d.ts.map +1 -1
  51. package/lib/chain/blocks/index.js +4 -4
  52. package/lib/chain/blocks/index.js.map +1 -1
  53. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +12 -9
  54. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  55. package/lib/chain/blocks/payloadEnvelopeProcessor.js +24 -19
  56. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  57. package/lib/chain/blocks/types.d.ts +8 -1
  58. package/lib/chain/blocks/types.d.ts.map +1 -1
  59. package/lib/chain/blocks/types.js +5 -0
  60. package/lib/chain/blocks/types.js.map +1 -1
  61. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  62. package/lib/chain/blocks/verifyBlock.js +18 -7
  63. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  64. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  65. package/lib/chain/blocks/verifyBlocksDataAvailability.js +8 -1
  66. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  67. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
  68. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  69. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  70. package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
  71. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  72. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  73. package/lib/chain/blocks/verifyBlocksSignatures.js +7 -5
  74. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  75. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +3 -3
  76. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  77. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +11 -6
  78. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  79. package/lib/chain/bls/interface.d.ts +2 -0
  80. package/lib/chain/bls/interface.d.ts.map +1 -1
  81. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  82. package/lib/chain/bls/multithread/index.js +13 -11
  83. package/lib/chain/bls/multithread/index.js.map +1 -1
  84. package/lib/chain/bls/multithread/types.d.ts +1 -1
  85. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  86. package/lib/chain/bls/multithread/worker.js +1 -1
  87. package/lib/chain/bls/multithread/worker.js.map +1 -1
  88. package/lib/chain/bls/singleThread.js +1 -1
  89. package/lib/chain/bls/singleThread.js.map +1 -1
  90. package/lib/chain/bls/utils.js +1 -1
  91. package/lib/chain/bls/utils.js.map +1 -1
  92. package/lib/chain/chain.d.ts +10 -3
  93. package/lib/chain/chain.d.ts.map +1 -1
  94. package/lib/chain/chain.js +61 -8
  95. package/lib/chain/chain.js.map +1 -1
  96. package/lib/chain/errors/blockError.d.ts +1 -1
  97. package/lib/chain/errors/blockError.d.ts.map +1 -1
  98. package/lib/chain/errors/blockError.js +1 -1
  99. package/lib/chain/errors/blockError.js.map +1 -1
  100. package/lib/chain/errors/executionPayloadBid.d.ts +11 -1
  101. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  102. package/lib/chain/errors/executionPayloadBid.js +2 -0
  103. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  104. package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
  105. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  106. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  107. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  108. package/lib/chain/errors/inclusionList.d.ts +60 -0
  109. package/lib/chain/errors/inclusionList.d.ts.map +1 -0
  110. package/lib/chain/errors/inclusionList.js +19 -0
  111. package/lib/chain/errors/inclusionList.js.map +1 -0
  112. package/lib/chain/errors/index.d.ts +1 -0
  113. package/lib/chain/errors/index.d.ts.map +1 -1
  114. package/lib/chain/errors/index.js +1 -0
  115. package/lib/chain/errors/index.js.map +1 -1
  116. package/lib/chain/forkChoice/index.d.ts +11 -1
  117. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  118. package/lib/chain/forkChoice/index.js +11 -0
  119. package/lib/chain/forkChoice/index.js.map +1 -1
  120. package/lib/chain/forkChoiceExecutionEngine.d.ts +53 -0
  121. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
  122. package/lib/chain/forkChoiceExecutionEngine.js +121 -0
  123. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
  124. package/lib/chain/interface.d.ts +7 -6
  125. package/lib/chain/interface.d.ts.map +1 -1
  126. package/lib/chain/interface.js.map +1 -1
  127. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  128. package/lib/chain/opPools/aggregatedAttestationPool.js +23 -10
  129. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  130. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  131. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  132. package/lib/chain/opPools/attestationPool.js +15 -4
  133. package/lib/chain/opPools/attestationPool.js.map +1 -1
  134. package/lib/chain/opPools/inclusionListStore.d.ts +63 -0
  135. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -0
  136. package/lib/chain/opPools/inclusionListStore.js +171 -0
  137. package/lib/chain/opPools/inclusionListStore.js.map +1 -0
  138. package/lib/chain/opPools/index.d.ts +1 -0
  139. package/lib/chain/opPools/index.d.ts.map +1 -1
  140. package/lib/chain/opPools/index.js +1 -0
  141. package/lib/chain/opPools/index.js.map +1 -1
  142. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  143. package/lib/chain/opPools/payloadAttestationPool.js +17 -7
  144. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  145. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
  146. package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
  147. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  148. package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
  149. package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
  150. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  151. package/lib/chain/opPools/utils.d.ts +1 -1
  152. package/lib/chain/opPools/utils.d.ts.map +1 -1
  153. package/lib/chain/opPools/utils.js +1 -1
  154. package/lib/chain/opPools/utils.js.map +1 -1
  155. package/lib/chain/options.d.ts +0 -1
  156. package/lib/chain/options.d.ts.map +1 -1
  157. package/lib/chain/options.js +0 -1
  158. package/lib/chain/options.js.map +1 -1
  159. package/lib/chain/produceBlock/produceBlockBody.d.ts +6 -3
  160. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  161. package/lib/chain/produceBlock/produceBlockBody.js +30 -10
  162. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  163. package/lib/chain/regen/interface.d.ts +2 -2
  164. package/lib/chain/regen/interface.d.ts.map +1 -1
  165. package/lib/chain/regen/interface.js +1 -1
  166. package/lib/chain/regen/interface.js.map +1 -1
  167. package/lib/chain/regen/queued.d.ts +1 -1
  168. package/lib/chain/regen/queued.d.ts.map +1 -1
  169. package/lib/chain/regen/queued.js +5 -3
  170. package/lib/chain/regen/queued.js.map +1 -1
  171. package/lib/chain/validation/executionPayloadBid.d.ts +0 -15
  172. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  173. package/lib/chain/validation/executionPayloadBid.js +37 -158
  174. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  175. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  176. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  177. package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
  178. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  179. package/lib/chain/validation/inclusionList.d.ts +14 -0
  180. package/lib/chain/validation/inclusionList.d.ts.map +1 -0
  181. package/lib/chain/validation/inclusionList.js +150 -0
  182. package/lib/chain/validation/inclusionList.js.map +1 -0
  183. package/lib/chain/validation/index.d.ts +1 -0
  184. package/lib/chain/validation/index.d.ts.map +1 -1
  185. package/lib/chain/validation/index.js +1 -0
  186. package/lib/chain/validation/index.js.map +1 -1
  187. package/lib/db/beacon.d.ts +7 -0
  188. package/lib/db/beacon.d.ts.map +1 -1
  189. package/lib/db/beacon.js +34 -0
  190. package/lib/db/beacon.js.map +1 -1
  191. package/lib/db/dataColumnStore.d.ts +1 -1
  192. package/lib/db/dataColumnStore.d.ts.map +1 -1
  193. package/lib/db/dataColumnStore.js +1 -4
  194. package/lib/db/dataColumnStore.js.map +1 -1
  195. package/lib/db/flatFileStore/flatFileStore.js +5 -5
  196. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  197. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  198. package/lib/db/flatFileStore/slotIndex.js +2 -2
  199. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  200. package/lib/db/interface.d.ts +1 -0
  201. package/lib/db/interface.d.ts.map +1 -1
  202. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +6 -0
  203. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  204. package/lib/db/repositories/dataColumnSidecarArchive.js +19 -0
  205. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  206. package/lib/execution/builder/apiClient.d.ts +14 -8
  207. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  208. package/lib/execution/builder/apiClient.js +12 -10
  209. package/lib/execution/builder/apiClient.js.map +1 -1
  210. package/lib/execution/builder/http.d.ts +2 -0
  211. package/lib/execution/builder/http.d.ts.map +1 -1
  212. package/lib/execution/builder/http.js +2 -0
  213. package/lib/execution/builder/http.js.map +1 -1
  214. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  215. package/lib/execution/builder/validateBid.js +14 -1
  216. package/lib/execution/builder/validateBid.js.map +1 -1
  217. package/lib/execution/engine/blobVersionedHashes.d.ts +1 -1
  218. package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -1
  219. package/lib/execution/engine/blobVersionedHashes.js.map +1 -1
  220. package/lib/execution/engine/disabled.d.ts +1 -0
  221. package/lib/execution/engine/disabled.d.ts.map +1 -1
  222. package/lib/execution/engine/disabled.js +3 -0
  223. package/lib/execution/engine/disabled.js.map +1 -1
  224. package/lib/execution/engine/http.d.ts +10 -4
  225. package/lib/execution/engine/http.d.ts.map +1 -1
  226. package/lib/execution/engine/http.js +32 -8
  227. package/lib/execution/engine/http.js.map +1 -1
  228. package/lib/execution/engine/index.d.ts +1 -1
  229. package/lib/execution/engine/index.d.ts.map +1 -1
  230. package/lib/execution/engine/index.js +1 -1
  231. package/lib/execution/engine/index.js.map +1 -1
  232. package/lib/execution/engine/interface.d.ts +28 -5
  233. package/lib/execution/engine/interface.d.ts.map +1 -1
  234. package/lib/execution/engine/interface.js.map +1 -1
  235. package/lib/execution/engine/jsonRpcTransport.d.ts +5 -4
  236. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  237. package/lib/execution/engine/jsonRpcTransport.js +34 -10
  238. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  239. package/lib/execution/engine/mock.d.ts +1 -0
  240. package/lib/execution/engine/mock.d.ts.map +1 -1
  241. package/lib/execution/engine/mock.js +31 -7
  242. package/lib/execution/engine/mock.js.map +1 -1
  243. package/lib/execution/engine/payloadIdCache.d.ts +5 -3
  244. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  245. package/lib/execution/engine/payloadIdCache.js +15 -4
  246. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  247. package/lib/execution/engine/restTransport.d.ts +4 -3
  248. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  249. package/lib/execution/engine/restTransport.js +3 -0
  250. package/lib/execution/engine/restTransport.js.map +1 -1
  251. package/lib/execution/engine/sszTypes.d.ts +38 -38
  252. package/lib/execution/engine/transport.d.ts +4 -12
  253. package/lib/execution/engine/transport.d.ts.map +1 -1
  254. package/lib/execution/engine/types.d.ts +25 -1
  255. package/lib/execution/engine/types.d.ts.map +1 -1
  256. package/lib/execution/engine/types.js +19 -6
  257. package/lib/execution/engine/types.js.map +1 -1
  258. package/lib/execution/engine/utils.d.ts.map +1 -1
  259. package/lib/execution/engine/utils.js +3 -2
  260. package/lib/execution/engine/utils.js.map +1 -1
  261. package/lib/index.d.ts +1 -0
  262. package/lib/index.d.ts.map +1 -1
  263. package/lib/index.js +2 -0
  264. package/lib/index.js.map +1 -1
  265. package/lib/metrics/metrics/beacon.d.ts +16 -0
  266. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  267. package/lib/metrics/metrics/beacon.js +35 -0
  268. package/lib/metrics/metrics/beacon.js.map +1 -1
  269. package/lib/metrics/metrics/lodestar.d.ts +16 -0
  270. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  271. package/lib/metrics/metrics/lodestar.js +35 -0
  272. package/lib/metrics/metrics/lodestar.js.map +1 -1
  273. package/lib/metrics/server/http.js +5 -5
  274. package/lib/metrics/server/http.js.map +1 -1
  275. package/lib/monitoring/service.js +1 -1
  276. package/lib/monitoring/service.js.map +1 -1
  277. package/lib/network/core/networkCore.d.ts +2 -0
  278. package/lib/network/core/networkCore.d.ts.map +1 -1
  279. package/lib/network/core/networkCore.js +3 -0
  280. package/lib/network/core/networkCore.js.map +1 -1
  281. package/lib/network/core/networkCoreWorker.js +1 -0
  282. package/lib/network/core/networkCoreWorker.js.map +1 -1
  283. package/lib/network/core/networkCoreWorkerHandler.d.ts +2 -0
  284. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  285. package/lib/network/core/networkCoreWorkerHandler.js +3 -0
  286. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  287. package/lib/network/core/types.d.ts +2 -0
  288. package/lib/network/core/types.d.ts.map +1 -1
  289. package/lib/network/gossip/gossipsub.d.ts +1 -0
  290. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  291. package/lib/network/gossip/gossipsub.js +10 -0
  292. package/lib/network/gossip/gossipsub.js.map +1 -1
  293. package/lib/network/gossip/interface.d.ts +8 -2
  294. package/lib/network/gossip/interface.d.ts.map +1 -1
  295. package/lib/network/gossip/interface.js +1 -0
  296. package/lib/network/gossip/interface.js.map +1 -1
  297. package/lib/network/gossip/topic.d.ts +13 -5
  298. package/lib/network/gossip/topic.d.ts.map +1 -1
  299. package/lib/network/gossip/topic.js +13 -1
  300. package/lib/network/gossip/topic.js.map +1 -1
  301. package/lib/network/interface.d.ts +4 -1
  302. package/lib/network/interface.d.ts.map +1 -1
  303. package/lib/network/libp2p/index.d.ts.map +1 -1
  304. package/lib/network/libp2p/index.js +5 -1
  305. package/lib/network/libp2p/index.js.map +1 -1
  306. package/lib/network/network.d.ts +6 -2
  307. package/lib/network/network.d.ts.map +1 -1
  308. package/lib/network/network.js +50 -15
  309. package/lib/network/network.js.map +1 -1
  310. package/lib/network/options.d.ts +2 -0
  311. package/lib/network/options.d.ts.map +1 -1
  312. package/lib/network/options.js.map +1 -1
  313. package/lib/network/peers/peerManager.d.ts +2 -1
  314. package/lib/network/peers/peerManager.d.ts.map +1 -1
  315. package/lib/network/peers/peerManager.js +28 -1
  316. package/lib/network/peers/peerManager.js.map +1 -1
  317. package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
  318. package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
  319. package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
  320. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  321. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  322. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  323. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  324. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  325. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  326. package/lib/network/processor/gossipHandlers.js +100 -38
  327. package/lib/network/processor/gossipHandlers.js.map +1 -1
  328. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  329. package/lib/network/processor/gossipQueues/index.js +6 -0
  330. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  331. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  332. package/lib/network/processor/gossipValidatorFn.js +5 -1
  333. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  334. package/lib/network/processor/index.d.ts +11 -0
  335. package/lib/network/processor/index.d.ts.map +1 -1
  336. package/lib/network/processor/index.js +66 -29
  337. package/lib/network/processor/index.js.map +1 -1
  338. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  339. package/lib/network/reqresp/ReqRespBeaconNode.js +6 -0
  340. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  341. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +10 -0
  342. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +1 -0
  343. package/lib/network/reqresp/handlers/inclusionListsByIndices.js +30 -0
  344. package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +1 -0
  345. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  346. package/lib/network/reqresp/handlers/index.js +5 -0
  347. package/lib/network/reqresp/handlers/index.js.map +1 -1
  348. package/lib/network/reqresp/protocols.d.ts +1 -0
  349. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  350. package/lib/network/reqresp/protocols.js +5 -0
  351. package/lib/network/reqresp/protocols.js.map +1 -1
  352. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  353. package/lib/network/reqresp/rateLimit.js +4 -0
  354. package/lib/network/reqresp/rateLimit.js.map +1 -1
  355. package/lib/network/reqresp/types.d.ts +5 -2
  356. package/lib/network/reqresp/types.d.ts.map +1 -1
  357. package/lib/network/reqresp/types.js +3 -0
  358. package/lib/network/reqresp/types.js.map +1 -1
  359. package/lib/node/nodejs.d.ts +3 -1
  360. package/lib/node/nodejs.d.ts.map +1 -1
  361. package/lib/node/nodejs.js +47 -21
  362. package/lib/node/nodejs.js.map +1 -1
  363. package/lib/node/options.d.ts +3 -1
  364. package/lib/node/options.d.ts.map +1 -1
  365. package/lib/node/options.js +4 -2
  366. package/lib/node/options.js.map +1 -1
  367. package/lib/sync/interface.d.ts.map +1 -1
  368. package/lib/sync/interface.js.map +1 -1
  369. package/lib/sync/sync.d.ts +7 -0
  370. package/lib/sync/sync.d.ts.map +1 -1
  371. package/lib/sync/sync.js +61 -3
  372. package/lib/sync/sync.js.map +1 -1
  373. package/lib/sync/unknownBlock.d.ts.map +1 -1
  374. package/lib/sync/unknownBlock.js +42 -18
  375. package/lib/sync/unknownBlock.js.map +1 -1
  376. package/lib/util/execution.d.ts +4 -4
  377. package/lib/util/execution.d.ts.map +1 -1
  378. package/lib/util/execution.js.map +1 -1
  379. package/lib/util/file.d.ts.map +1 -1
  380. package/lib/util/file.js +8 -9
  381. package/lib/util/file.js.map +1 -1
  382. package/lib/util/queue/itemQueue.js +1 -1
  383. package/lib/util/queue/itemQueue.js.map +1 -1
  384. package/lib/util/sszBytes.d.ts +5 -0
  385. package/lib/util/sszBytes.d.ts.map +1 -1
  386. package/lib/util/sszBytes.js +35 -2
  387. package/lib/util/sszBytes.js.map +1 -1
  388. package/package.json +31 -32
  389. package/src/api/impl/api.ts +1 -1
  390. package/src/api/impl/beacon/blocks/index.ts +57 -62
  391. package/src/api/impl/beacon/index.ts +3 -1
  392. package/src/api/impl/beacon/pool/index.ts +5 -1
  393. package/src/api/impl/beacon/state/index.ts +10 -1
  394. package/src/api/impl/beacon/state/utils.ts +20 -10
  395. package/src/api/impl/debug/index.ts +4 -0
  396. package/src/api/impl/validator/index.ts +178 -39
  397. package/src/api/options.ts +3 -0
  398. package/src/chain/GetBlobsTracker.ts +99 -40
  399. package/src/chain/archiveStore/archiveStore.ts +1 -0
  400. package/src/chain/archiveStore/utils/archiveBlocks.ts +76 -130
  401. package/src/chain/blocks/importBlock.ts +37 -72
  402. package/src/chain/blocks/importExecutionPayload.ts +123 -36
  403. package/src/chain/blocks/index.ts +11 -4
  404. package/src/chain/blocks/payloadEnvelopeProcessor.ts +35 -24
  405. package/src/chain/blocks/types.ts +9 -1
  406. package/src/chain/blocks/verifyBlock.ts +31 -16
  407. package/src/chain/blocks/verifyBlocksDataAvailability.ts +10 -1
  408. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +1 -1
  409. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  410. package/src/chain/blocks/verifyBlocksSignatures.ts +7 -5
  411. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +14 -6
  412. package/src/chain/bls/interface.ts +2 -0
  413. package/src/chain/bls/multithread/index.ts +14 -10
  414. package/src/chain/bls/multithread/types.ts +1 -1
  415. package/src/chain/bls/multithread/worker.ts +1 -5
  416. package/src/chain/bls/singleThread.ts +1 -1
  417. package/src/chain/bls/utils.ts +1 -1
  418. package/src/chain/chain.ts +71 -8
  419. package/src/chain/errors/blockError.ts +1 -1
  420. package/src/chain/errors/executionPayloadBid.ts +12 -0
  421. package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
  422. package/src/chain/errors/inclusionList.ts +38 -0
  423. package/src/chain/errors/index.ts +1 -0
  424. package/src/chain/forkChoice/index.ts +11 -0
  425. package/src/chain/forkChoiceExecutionEngine.ts +197 -0
  426. package/src/chain/interface.ts +7 -5
  427. package/src/chain/opPools/aggregatedAttestationPool.ts +25 -9
  428. package/src/chain/opPools/attestationPool.ts +16 -4
  429. package/src/chain/opPools/inclusionListStore.ts +208 -0
  430. package/src/chain/opPools/index.ts +1 -0
  431. package/src/chain/opPools/payloadAttestationPool.ts +18 -7
  432. package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
  433. package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
  434. package/src/chain/opPools/utils.ts +1 -1
  435. package/src/chain/options.ts +0 -2
  436. package/src/chain/produceBlock/produceBlockBody.ts +64 -21
  437. package/src/chain/regen/interface.ts +2 -2
  438. package/src/chain/regen/queued.ts +6 -4
  439. package/src/chain/validation/executionPayloadBid.ts +54 -183
  440. package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
  441. package/src/chain/validation/inclusionList.ts +192 -0
  442. package/src/chain/validation/index.ts +1 -0
  443. package/src/db/beacon.ts +44 -0
  444. package/src/db/dataColumnStore.ts +2 -4
  445. package/src/db/flatFileStore/flatFileStore.ts +7 -7
  446. package/src/db/flatFileStore/slotIndex.ts +4 -3
  447. package/src/db/interface.ts +2 -0
  448. package/src/db/repositories/dataColumnSidecarArchive.ts +20 -0
  449. package/src/execution/builder/apiClient.ts +16 -13
  450. package/src/execution/builder/http.ts +4 -0
  451. package/src/execution/builder/validateBid.ts +23 -2
  452. package/src/execution/engine/blobVersionedHashes.ts +1 -1
  453. package/src/execution/engine/disabled.ts +4 -0
  454. package/src/execution/engine/http.ts +52 -18
  455. package/src/execution/engine/index.ts +1 -1
  456. package/src/execution/engine/interface.ts +46 -6
  457. package/src/execution/engine/jsonRpcTransport.ts +56 -11
  458. package/src/execution/engine/mock.ts +32 -7
  459. package/src/execution/engine/payloadIdCache.ts +24 -6
  460. package/src/execution/engine/restTransport.ts +18 -2
  461. package/src/execution/engine/transport.ts +13 -14
  462. package/src/execution/engine/types.ts +44 -7
  463. package/src/execution/engine/utils.ts +4 -2
  464. package/src/index.ts +2 -0
  465. package/src/metrics/metrics/beacon.ts +37 -0
  466. package/src/metrics/metrics/lodestar.ts +36 -0
  467. package/src/metrics/server/http.ts +5 -5
  468. package/src/monitoring/service.ts +1 -1
  469. package/src/network/core/networkCore.ts +5 -0
  470. package/src/network/core/networkCoreWorker.ts +1 -0
  471. package/src/network/core/networkCoreWorkerHandler.ts +4 -0
  472. package/src/network/core/types.ts +2 -0
  473. package/src/network/gossip/gossipsub.ts +11 -0
  474. package/src/network/gossip/interface.ts +5 -0
  475. package/src/network/gossip/topic.ts +14 -0
  476. package/src/network/interface.ts +4 -0
  477. package/src/network/libp2p/index.ts +5 -1
  478. package/src/network/network.ts +56 -19
  479. package/src/network/options.ts +2 -0
  480. package/src/network/peers/peerManager.ts +28 -3
  481. package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
  482. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  483. package/src/network/processor/gossipHandlers.ts +124 -41
  484. package/src/network/processor/gossipQueues/index.ts +6 -0
  485. package/src/network/processor/gossipValidatorFn.ts +5 -0
  486. package/src/network/processor/index.ts +58 -27
  487. package/src/network/processor/types.ts +1 -1
  488. package/src/network/reqresp/ReqRespBeaconNode.ts +7 -0
  489. package/src/network/reqresp/handlers/inclusionListsByIndices.ts +44 -0
  490. package/src/network/reqresp/handlers/index.ts +5 -0
  491. package/src/network/reqresp/protocols.ts +6 -0
  492. package/src/network/reqresp/rateLimit.ts +4 -0
  493. package/src/network/reqresp/types.ts +6 -0
  494. package/src/node/nodejs.ts +58 -22
  495. package/src/node/options.ts +9 -6
  496. package/src/sync/interface.ts +1 -0
  497. package/src/sync/sync.ts +65 -4
  498. package/src/sync/unknownBlock.ts +47 -28
  499. package/src/util/execution.ts +6 -6
  500. package/src/util/file.ts +8 -9
  501. package/src/util/queue/itemQueue.ts +1 -1
  502. package/src/util/sszBytes.ts +42 -2
@@ -62,7 +62,7 @@ import {
62
62
  } from "../../../../chain/produceBlock/index.js";
63
63
  import {RegenCaller} from "../../../../chain/regen/index.js";
64
64
  import {validateGossipBlock, verifyBlockProposerSignature} from "../../../../chain/validation/block.js";
65
- import {validateApiExecutionPayloadBid} from "../../../../chain/validation/executionPayloadBid.js";
65
+ import {validateGossipExecutionPayloadBid} from "../../../../chain/validation/executionPayloadBid.js";
66
66
  import {validateApiExecutionPayloadEnvelope} from "../../../../chain/validation/executionPayloadEnvelope.js";
67
67
  import {OpSource} from "../../../../chain/validatorMonitor.js";
68
68
  import {
@@ -79,6 +79,7 @@ import {
79
79
  import {isOptimisticBlock} from "../../../../util/forkChoice.js";
80
80
  import {kzg} from "../../../../util/kzg.js";
81
81
  import {promiseAllMaybeAsync} from "../../../../util/promises.js";
82
+ import {ApiOptions} from "../../../options.js";
82
83
  import {ApiModules} from "../../types.js";
83
84
  import {assertUniqueItems} from "../../utils.js";
84
85
  import {getBlockResponse, toBeaconHeaderResponse} from "./utils.js";
@@ -96,16 +97,10 @@ const MAX_API_CLOCK_DISPARITY_MS = 1000;
96
97
  */
97
98
  const IDENTITY_PEER_ID = ""; // TODO: Compute identity keypair
98
99
 
99
- export function getBeaconBlockApi({
100
- chain,
101
- config,
102
- metrics,
103
- network,
104
- db,
105
- }: Pick<
106
- ApiModules,
107
- "chain" | "config" | "metrics" | "network" | "db"
108
- >): ApplicationMethods<routes.beacon.block.Endpoints> {
100
+ export function getBeaconBlockApi(
101
+ opts: ApiOptions,
102
+ {chain, config, metrics, network, db}: Pick<ApiModules, "chain" | "config" | "metrics" | "network" | "db">
103
+ ): ApplicationMethods<routes.beacon.block.Endpoints> {
109
104
  const publishBlockV2: ApplicationMethods<routes.beacon.block.Endpoints>["publishBlockV2"] = async (
110
105
  {signedBlockContents, broadcastValidation, builderUrl},
111
106
  context,
@@ -321,18 +316,8 @@ export function getBeaconBlockApi({
321
316
  break;
322
317
  }
323
318
 
324
- case routes.beacon.BroadcastValidation.none: {
325
- chain.logger.debug("Skipping broadcast validation", valLogMeta);
326
- break;
327
- }
328
-
329
319
  default: {
330
- // error or log warning we do not support this validation
331
- const message = `Broadcast validation of ${broadcastValidation} type not implemented yet`;
332
- if (chain.opts.broadcastValidationStrictness === "error") {
333
- throw Error(message);
334
- }
335
- chain.logger.warn(message, valLogMeta);
320
+ throw new ApiError(400, `Invalid broadcast validation level ${broadcastValidation}`);
336
321
  }
337
322
  }
338
323
 
@@ -402,26 +387,24 @@ export function getBeaconBlockApi({
402
387
  ...blobSidecars.map((blobSidecar) => () => network.publishBlobSidecar(blobSidecar)),
403
388
  () =>
404
389
  // there is no rush to persist block since we published it to gossip anyway
405
- chain
406
- .processBlock(blockForImport, opts)
407
- .catch((e) => {
408
- if (e instanceof BlockError) {
409
- switch (e.type.code) {
410
- case BlockErrorCode.ALREADY_KNOWN:
411
- // Block was imported while publishing, e.g. received via gossip
412
- chain.logger.debug("Ignoring already-known block during publishing", valLogMeta);
413
- return;
414
- case BlockErrorCode.PARENT_BLOCK_UNKNOWN:
415
- case BlockErrorCode.PARENT_PAYLOAD_UNKNOWN:
416
- chain.emitter.emit(ChainEvent.blockUnknownParent, {
417
- blockInput: blockForImport,
418
- peer: IDENTITY_PEER_ID,
419
- source: BlockInputSource.api,
420
- });
421
- }
390
+ chain.processBlock(blockForImport, opts).catch((e) => {
391
+ if (e instanceof BlockError) {
392
+ switch (e.type.code) {
393
+ case BlockErrorCode.ALREADY_KNOWN:
394
+ // Block was imported while publishing, e.g. received via gossip
395
+ chain.logger.debug("Ignoring already-known block during publishing", valLogMeta);
396
+ return;
397
+ case BlockErrorCode.PARENT_BLOCK_UNKNOWN:
398
+ case BlockErrorCode.PARENT_PAYLOAD_UNKNOWN:
399
+ chain.emitter.emit(ChainEvent.blockUnknownParent, {
400
+ blockInput: blockForImport,
401
+ peer: IDENTITY_PEER_ID,
402
+ source: BlockInputSource.api,
403
+ });
422
404
  }
423
- throw e;
424
- }),
405
+ }
406
+ throw e;
407
+ }),
425
408
  ];
426
409
  const sentPeersArr = await promiseAllMaybeAsync<{sentPeers: number; alreadyPublished: boolean} | number | void>(
427
410
  publishPromises
@@ -809,11 +792,6 @@ export function getBeaconBlockApi({
809
792
  };
810
793
  try {
811
794
  switch (broadcastValidation) {
812
- case routes.beacon.BroadcastValidation.none: {
813
- chain.logger.debug("Skipping broadcast validation of execution payload envelope", valLogMeta);
814
- break;
815
- }
816
-
817
795
  case routes.beacon.BroadcastValidation.gossip: {
818
796
  await validateApiExecutionPayloadEnvelope(chain, signedExecutionPayloadEnvelope);
819
797
  break;
@@ -852,11 +830,7 @@ export function getBeaconBlockApi({
852
830
  }
853
831
 
854
832
  default: {
855
- const message = `Broadcast validation of ${broadcastValidation} type not implemented yet`;
856
- if (chain.opts.broadcastValidationStrictness === "error") {
857
- throw Error(message);
858
- }
859
- chain.logger.warn(message, valLogMeta);
833
+ throw new ApiError(400, `Invalid broadcast validation level ${broadcastValidation}`);
860
834
  }
861
835
  }
862
836
  } catch (error) {
@@ -1008,9 +982,13 @@ export function getBeaconBlockApi({
1008
982
  () => network.publishSignedExecutionPayloadEnvelope(signedExecutionPayloadEnvelope),
1009
983
  // Publish all data column sidecars
1010
984
  ...dataColumnSidecars.map((dataColumnSidecar) => () => network.publishDataColumnSidecar(dataColumnSidecar)),
1011
- // Import execution payload. Signature is verified during broadcast validation, an already
1012
- // known envelope was verified by its original source and `none` deliberately skips validation
1013
- () => chain.processExecutionPayload(payloadInput, {validSignature: true}),
985
+ // Import execution payload
986
+ () =>
987
+ chain.processExecutionPayload(payloadInput, {
988
+ // Signature is verified during broadcast validation only for the submitted envelope,
989
+ // an envelope cached by another source is verified at import
990
+ validSignature: payloadInput.getPayloadEnvelope() === signedExecutionPayloadEnvelope,
991
+ }),
1014
992
  ];
1015
993
 
1016
994
  const publishPromise = promiseAllMaybeAsync<{sentPeers: number; alreadyPublished: boolean} | number | void>(
@@ -1077,15 +1055,25 @@ export function getBeaconBlockApi({
1077
1055
  throw new ApiError(400, `publishExecutionPayloadBid not supported for pre-gloas fork=${fork}`);
1078
1056
  }
1079
1057
 
1080
- const validationTimer = metrics?.opPool.executionPayloadBidPool.apiValidationTime.startTimer();
1081
- // TODO: once the builder is tested and can be trusted, skip this local validation
1082
- // to publish faster, accepting peer-score risk if it ever emits an invalid bid.
1083
- await validateApiExecutionPayloadBid(chain, signedExecutionPayloadBid);
1084
- validationTimer?.();
1085
-
1086
1058
  const elapsedSec = chain.clock.secFromSlot(slot, seenTimestampSec);
1087
1059
  metrics?.gossipExecutionPayloadBid.elapsedTimeTillReceived.observe({source: OpSource.api}, elapsedSec);
1088
1060
 
1061
+ if (!opts.disableBidValidation) {
1062
+ const validationTimer = metrics?.opPool.executionPayloadBidPool.apiValidationTime.startTimer();
1063
+ const {proposerIndex} = await validateGossipExecutionPayloadBid(chain, signedExecutionPayloadBid);
1064
+ validationTimer?.();
1065
+
1066
+ // Gossip does not deliver our own messages back to us, so a validated bid is added to the
1067
+ // pool here to allow a proposer on this node to select it
1068
+ const insertOutcome = chain.executionPayloadBidPool.add(
1069
+ signedExecutionPayloadBid,
1070
+ Math.floor(elapsedSec * 1000)
1071
+ );
1072
+ metrics?.opPool.executionPayloadBidPool.apiInsertOutcome.inc({insertOutcome});
1073
+
1074
+ chain.validatorMonitor?.registerExecutionPayloadBid(OpSource.api, proposerIndex, bid);
1075
+ }
1076
+
1089
1077
  const sentPeers = await network.publishSignedExecutionPayloadBid(signedExecutionPayloadBid);
1090
1078
 
1091
1079
  chain.emitter.emit(routes.events.EventType.executionPayloadBid, {
@@ -1104,7 +1092,7 @@ export function getBeaconBlockApi({
1104
1092
  },
1105
1093
 
1106
1094
  async getSignedExecutionPayloadEnvelope({blockId}, context) {
1107
- const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
1095
+ const {block, finalized} = await getBlockResponse(chain, blockId);
1108
1096
  const slot = block.message.slot;
1109
1097
  const fork = config.getForkName(slot);
1110
1098
 
@@ -1118,6 +1106,13 @@ export function getBeaconBlockApi({
1118
1106
  const blockRoot = config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block.message);
1119
1107
  const blockRootHex = toRootHex(blockRoot);
1120
1108
 
1109
+ // The block's own flag is the status of the payload it builds on, the envelope's is that of its
1110
+ // FULL variant. An unfinalized block without one has not imported its envelope yet.
1111
+ const payload = finalized ? null : chain.forkChoice.getBlockHex(blockRootHex, PayloadStatus.FULL);
1112
+ if (!finalized && payload === null) {
1113
+ throw new ApiError(404, `Execution payload envelope not found for slot=${slot}, blockRoot=${blockRootHex}`);
1114
+ }
1115
+
1121
1116
  let data: Uint8Array | gloas.SignedExecutionPayloadEnvelope | null;
1122
1117
  try {
1123
1118
  data = context?.returnBytes
@@ -1142,7 +1137,7 @@ export function getBeaconBlockApi({
1142
1137
 
1143
1138
  return {
1144
1139
  data,
1145
- meta: {executionOptimistic, finalized, version: fork},
1140
+ meta: {executionOptimistic: payload !== null && isOptimisticBlock(payload), finalized, version: fork},
1146
1141
  };
1147
1142
  },
1148
1143
 
@@ -3,6 +3,7 @@ import {ApplicationMethods} from "@lodestar/api/server";
3
3
  import {isForkPostGloas} from "@lodestar/params";
4
4
  import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
5
5
  import {toRootHex} from "@lodestar/utils";
6
+ import {ApiOptions} from "../../options.js";
6
7
  import {ApiError} from "../errors.js";
7
8
  import {ApiModules} from "../types.js";
8
9
  import {getBeaconBlockApi} from "./blocks/index.js";
@@ -11,9 +12,10 @@ import {getBeaconRewardsApi} from "./rewards/index.js";
11
12
  import {getBeaconStateApi} from "./state/index.js";
12
13
 
13
14
  export function getBeaconApi(
15
+ opts: ApiOptions,
14
16
  modules: Pick<ApiModules, "chain" | "config" | "logger" | "metrics" | "network" | "db" | "sync">
15
17
  ): ApplicationMethods<routes.beacon.Endpoints> {
16
- const block = getBeaconBlockApi(modules);
18
+ const block = getBeaconBlockApi(opts, modules);
17
19
  const pool = getBeaconPoolApi(modules);
18
20
  const state = getBeaconStateApi(modules);
19
21
  const rewards = getBeaconRewardsApi(modules);
@@ -17,6 +17,7 @@ import {
17
17
  PayloadAttestationError,
18
18
  PayloadAttestationErrorCode,
19
19
  SyncCommitteeError,
20
+ SyncCommitteeErrorCode,
20
21
  } from "../../../../chain/errors/index.js";
21
22
  import {validateApiAttesterSlashing} from "../../../../chain/validation/attesterSlashing.js";
22
23
  import {validateApiBlsToExecutionChange} from "../../../../chain/validation/blsToExecutionChange.js";
@@ -340,7 +341,10 @@ export function getBeaconPoolApi({
340
341
  const synCommittee = state.getIndexedSyncCommittee(signature.slot);
341
342
  const indexesInCommittee = synCommittee.validatorIndexMap.get(signature.validatorIndex);
342
343
  if (indexesInCommittee === undefined || indexesInCommittee.length === 0) {
343
- return; // Not a sync committee member
344
+ throw new SyncCommitteeError(GossipAction.REJECT, {
345
+ code: SyncCommitteeErrorCode.VALIDATOR_NOT_IN_SYNC_COMMITTEE,
346
+ validatorIndex: signature.validatorIndex,
347
+ });
344
348
  }
345
349
 
346
350
  // Verify signature only, all other data is very likely to be correct, since the `signature` object is created by this node.
@@ -17,6 +17,7 @@ import {
17
17
  isStatePostGloas,
18
18
  } from "@lodestar/state-transition";
19
19
  import {
20
+ BuilderIndex,
20
21
  ValidatorIndex,
21
22
  getBuilderStatus,
22
23
  getValidatorStatus,
@@ -29,6 +30,7 @@ import {ApiModules} from "../../types.js";
29
30
  import {assertUniqueItems} from "../../utils.js";
30
31
  import {
31
32
  filterStateValidatorsByStatus,
33
+ getBuilderIndexByPubkey,
32
34
  getStateBuilderIndex,
33
35
  getStateResponseWithRegen,
34
36
  getStateValidatorIndex,
@@ -170,8 +172,15 @@ export function getBeaconStateApi({
170
172
  if (builderIds.length) {
171
173
  assertUniqueItems(builderIds, "Duplicate builder IDs provided");
172
174
 
175
+ // There is no builder pubkey cache, scan the registry at most once per request
176
+ let builderIndexByPubkey: Map<string, BuilderIndex> | null = null;
177
+ const getBuilderIndexByPubkeyMap = () => {
178
+ builderIndexByPubkey ??= getBuilderIndexByPubkey(state);
179
+ return builderIndexByPubkey;
180
+ };
181
+
173
182
  for (const id of builderIds) {
174
- const resp = getStateBuilderIndex(id, state);
183
+ const resp = getStateBuilderIndex(id, state, getBuilderIndexByPubkeyMap);
175
184
  if (resp.valid) {
176
185
  const builderIndex = resp.builderIndex;
177
186
  const builder = state.getBuilder(builderIndex);
@@ -1,6 +1,6 @@
1
- import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
2
1
  import {routes} from "@lodestar/api";
3
2
  import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
3
+ import {type PubkeyCache} from "@lodestar/native/pubkeys";
4
4
  import {GENESIS_SLOT} from "@lodestar/params";
5
5
  import {IBeaconStateView, IBeaconStateViewGloas} from "@lodestar/state-transition";
6
6
  import {
@@ -13,7 +13,7 @@ import {
13
13
  getValidatorStatus,
14
14
  phase0,
15
15
  } from "@lodestar/types";
16
- import {byteArrayEquals, fromHex} from "@lodestar/utils";
16
+ import {fromHex, toHex} from "@lodestar/utils";
17
17
  import {IBeaconChain} from "../../../../chain/index.js";
18
18
  import {GENESIS_EPOCH} from "../../../../constants/index.js";
19
19
  import {IBeaconSync} from "../../../../sync/index.js";
@@ -118,9 +118,22 @@ type StateBuilderIndexResponse =
118
118
  | {valid: true; builderIndex: BuilderIndex}
119
119
  | {valid: false; code: number; reason: string};
120
120
 
121
+ export function getBuilderIndexByPubkey(state: IBeaconStateViewGloas): Map<string, BuilderIndex> {
122
+ const builderIndexByPubkey = new Map<string, BuilderIndex>();
123
+ const buildersLength = state.getBuildersLength();
124
+ for (let builderIndex = 0; builderIndex < buildersLength; builderIndex++) {
125
+ const pubkeyHex = toHex(state.getBuilder(builderIndex).pubkey);
126
+ if (!builderIndexByPubkey.has(pubkeyHex)) {
127
+ builderIndexByPubkey.set(pubkeyHex, builderIndex);
128
+ }
129
+ }
130
+ return builderIndexByPubkey;
131
+ }
132
+
121
133
  export function getStateBuilderIndex(
122
134
  id: routes.beacon.BuilderId | BLSPubkey,
123
- state: IBeaconStateViewGloas
135
+ state: IBeaconStateViewGloas,
136
+ getBuilderIndexByPubkeyMap: () => Map<string, BuilderIndex>
124
137
  ): StateBuilderIndexResponse {
125
138
  if (typeof id === "string") {
126
139
  // mutate `id` and fallthrough to below
@@ -148,14 +161,11 @@ export function getStateBuilderIndex(
148
161
  }
149
162
 
150
163
  // typeof id === Uint8Array
151
- // There is no builder pubkey cache, linear scan over the registry
152
- const buildersLength = state.getBuildersLength();
153
- for (let builderIndex = 0; builderIndex < buildersLength; builderIndex++) {
154
- if (byteArrayEquals(state.getBuilder(builderIndex).pubkey, id)) {
155
- return {valid: true, builderIndex};
156
- }
164
+ const builderIndex = getBuilderIndexByPubkeyMap().get(toHex(id));
165
+ if (builderIndex === undefined) {
166
+ return {valid: false, code: 404, reason: "Builder pubkey not found in state"};
157
167
  }
158
- return {valid: false, code: 404, reason: "Builder pubkey not found in state"};
168
+ return {valid: true, builderIndex};
159
169
  }
160
170
 
161
171
  export function filterStateValidatorsByStatus(
@@ -114,6 +114,10 @@ export function getDebugApi({
114
114
  unrealizedJustifiedRoot: node.unrealizedJustifiedRoot,
115
115
  unrealizedFinalizedEpoch: node.unrealizedFinalizedEpoch,
116
116
  unrealizedFinalizedRoot: node.unrealizedFinalizedRoot,
117
+ inclusionListSatisfied:
118
+ node.payloadStatus === PayloadStatus.FULL
119
+ ? forkChoice.getPayloadInclusionListSatisfaction(node.blockRoot)
120
+ : null,
117
121
  },
118
122
  };
119
123
  }),
@@ -18,6 +18,7 @@ import {
18
18
  isForkPostElectra,
19
19
  isForkPostFulu,
20
20
  isForkPostGloas,
21
+ isForkPostHeze,
21
22
  } from "@lodestar/params";
22
23
  import {
23
24
  DataAvailabilityStatus,
@@ -28,6 +29,7 @@ import {
28
29
  computeStartSlotAtEpoch,
29
30
  computeTimeAtSlot,
30
31
  getCurrentSlot,
32
+ getInclusionListCommittee,
31
33
  isStatePostAltair,
32
34
  isStatePostGloas,
33
35
  proposerShufflingDecisionRoot,
@@ -68,6 +70,7 @@ import {
68
70
  } from "@lodestar/utils";
69
71
  import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator";
70
72
  import {BlockInputSource} from "../../../chain/blocks/blockInput/types.js";
73
+ import {InclusionListSource} from "../../../chain/blocks/types.js";
71
74
  import {
72
75
  AttestationError,
73
76
  AttestationErrorCode,
@@ -83,11 +86,15 @@ import {PREPARE_NEXT_SLOT_BPS} from "../../../chain/prepareNextSlot.js";
83
86
  import {BlockType, ProduceFullDeneb, ProduceFullGloas} from "../../../chain/produceBlock/index.js";
84
87
  import {RegenCaller} from "../../../chain/regen/index.js";
85
88
  import {CheckpointHex} from "../../../chain/stateCache/types.js";
86
- import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
89
+ import {
90
+ InclusionListValidationResult,
91
+ validateApiAggregateAndProof,
92
+ validateGossipInclusionList,
93
+ } from "../../../chain/validation/index.js";
87
94
  import {validateGossipProposerPreferences} from "../../../chain/validation/proposerPreferences.js";
88
95
  import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js";
89
96
  import {ZERO_HASH} from "../../../constants/index.js";
90
- import {BUILDER_BID_DEADLINE_MS, BuilderApiBid, decodeBuilderUrl} from "../../../execution/builder/apiClient.js";
97
+ import {BuilderApiBid, decodeBuilderUrl} from "../../../execution/builder/apiClient.js";
91
98
  import {BuilderStatus, NoBidReceived} from "../../../execution/builder/http.js";
92
99
  import {getBuilderBidTotalGwei, validateBuilderApiExecutionPayloadBid} from "../../../execution/builder/validateBid.js";
93
100
  import {validateGossipFnRetryUnknownRoot} from "../../../network/processor/gossipHandlers.js";
@@ -116,10 +123,14 @@ import {
116
123
  * A cutoff of 1667 BPS (2 seconds for 12s slots) gives enough time and if there are unexpected delays
117
124
  * it ensures we publish in time as proposals after the attestation deadline will likely be orphaned
118
125
  * due to proposer boost reorg.
119
- *
120
- * TODO GLOAS: re-evaluate cutoff timing due to attestation deadline changes in gloas
121
126
  */
122
127
  const BLOCK_PRODUCTION_RACE_CUTOFF_BPS = 1667;
128
+ /**
129
+ * Post-gloas cutoff, kept at 1667 BPS (2 seconds for 12s slots) for now.
130
+ *
131
+ * TODO GLOAS: revisit, the block propagates faster as it only commits to a bid and the attestation deadline changed
132
+ */
133
+ export const BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS = 1667;
123
134
  /** Rejection message of the bid block branch when there is no viable bid to commit to */
124
135
  const NO_BID_AVAILABLE = "No builder bid available";
125
136
 
@@ -247,13 +258,13 @@ export function getValidatorApi(
247
258
  genesisBlockRoot = state.computeAnchorCheckpoint().checkpoint.root;
248
259
  } else if (state.slot < SLOTS_PER_HISTORICAL_ROOT) {
249
260
  genesisBlockRoot = state.getBlockRootAtSlot(GENESIS_SLOT);
250
- }
251
-
252
- const blockRes = await chain.getCanonicalBlockAtSlot(GENESIS_SLOT);
253
- if (blockRes) {
254
- genesisBlockRoot = config
255
- .getForkTypes(blockRes.block.message.slot)
256
- .SignedBeaconBlock.hashTreeRoot(blockRes.block);
261
+ } else {
262
+ const blockRes = await chain.getCanonicalBlockAtSlot(GENESIS_SLOT);
263
+ if (blockRes) {
264
+ genesisBlockRoot = config
265
+ .getForkTypes(blockRes.block.message.slot)
266
+ .BeaconBlock.hashTreeRoot(blockRes.block.message);
267
+ }
257
268
  }
258
269
  }
259
270
 
@@ -998,33 +1009,50 @@ export function getValidatorApi(
998
1009
  (!circuitBreakerActive &&
999
1010
  chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex) !== null);
1000
1011
 
1001
- // Select the p2p bid once builders had time to bid up, matching the deadline advertised
1002
- // on builder API bid requests, unless the circuit breaker is active
1003
- const p2pBidPromise: Promise<PooledExecutionPayloadBid | null> = circuitBreakerActive
1004
- ? Promise.resolve(null)
1005
- : sleep(Math.max(0, BUILDER_BID_DEADLINE_MS - chain.clock.msFromSlot(slot))).then(() => {
1006
- const p2pBid = chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex);
1007
- // Discard p2p bids below the proposer's configured floor on the total payment.
1008
- // A p2p bid's total is just its value since gossip validation enforces executionPayment=0.
1009
- if (p2pBid !== null && BigInt(p2pBid.signedBid.message.value) < builderConfig.minBid) {
1010
- logger.info("Best p2p bid below configured minimum", {
1011
- slot,
1012
- bidValue: prettyGweiToEth(p2pBid.signedBid.message.value),
1013
- minBid: prettyGweiToEth(builderConfig.minBid),
1014
- });
1015
- return null;
1016
- }
1017
- return p2pBid;
1018
- });
1012
+ // Calculate cutoff time based on start of the slot, ensures a slow local payload build does
1013
+ // not delay the proposal when a builder bid block is available (and vice versa)
1014
+ const cutoffMs = Math.max(
1015
+ 0,
1016
+ config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS) - chain.clock.msFromSlot(slot)
1017
+ );
1018
+
1019
+ // Give p2p bids the same time to bid up as granted to builder API bid requests via the advertised
1020
+ // deadline, the pool is read once the deadline passed and the bid requests settled. A late request
1021
+ // does not wait past the race cutoff, a pooled bid is still the fastest fallback if the local block fails
1022
+ const bidDeadlinePromise = circuitBreakerActive
1023
+ ? Promise.resolve()
1024
+ : sleep(Math.min(chain.builderApiClient.bidDeadline, cutoffMs));
1019
1025
 
1020
1026
  // Candidates are ranked by their boosted counted total payment, the p2p bid is governed
1021
1027
  // by the top-level factors and each builder API bid by its own entry. Ties prefer the
1022
1028
  // earliest received builder API bid, so the signed block can be routed back to its
1023
1029
  // builder directly.
1024
1030
  const bestBidPromise: Promise<BidCandidate | null> = (async () => {
1025
- const [builderApiBids, p2pBid] = await Promise.all([builderApiBidsPromise, p2pBidPromise]);
1031
+ // Past the race cutoff a pooled p2p bid is used right away rather than waiting for pending
1032
+ // builder API requests, the local block is selected at the cutoff anyway if it is ready
1033
+ let [builderApiBids] = await Promise.all([
1034
+ Promise.race([builderApiBidsPromise, sleep(cutoffMs).then(() => null)]),
1035
+ bidDeadlinePromise,
1036
+ ]);
1026
1037
  let parentExecutionRequestsPromise: Promise<gloas.ExecutionRequests> | null = null;
1027
1038
 
1039
+ let p2pBid: PooledExecutionPayloadBid | null = circuitBreakerActive
1040
+ ? null
1041
+ : chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex);
1042
+ // Discard p2p bids below the proposer's configured floor on the total payment.
1043
+ // A p2p bid's total is just its value since gossip validation enforces executionPayment=0.
1044
+ if (p2pBid !== null && BigInt(p2pBid.signedBid.message.value) < builderConfig.minBid) {
1045
+ logger.info("Best p2p bid below configured minimum", {
1046
+ slot,
1047
+ bidValue: prettyGweiToEth(p2pBid.signedBid.message.value),
1048
+ minBid: prettyGweiToEth(builderConfig.minBid),
1049
+ });
1050
+ p2pBid = null;
1051
+ }
1052
+ if (builderApiBids === null) {
1053
+ builderApiBids = p2pBid !== null ? [] : await builderApiBidsPromise;
1054
+ }
1055
+
1028
1056
  const candidates = (
1029
1057
  await Promise.all(
1030
1058
  builderApiBids.map(async ({url, entry, signedBid, receivedMs}): Promise<BidCandidate | null> => {
@@ -1111,13 +1139,6 @@ export function getValidatorApi(
1111
1139
  return fn().finally(() => t?.({source}));
1112
1140
  };
1113
1141
 
1114
- // Calculate cutoff time based on start of the slot, ensures a slow local payload build does
1115
- // not delay the proposal when a builder bid block is available (and vice versa)
1116
- const cutoffMs = Math.max(
1117
- 0,
1118
- config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_BPS) - chain.clock.msFromSlot(slot)
1119
- );
1120
-
1121
1142
  // use abort controller to stop waiting for the bid block if the engine block will be selected
1122
1143
  const controller = new AbortController();
1123
1144
 
@@ -1700,7 +1721,7 @@ export function getValidatorApi(
1700
1721
  }
1701
1722
  }
1702
1723
 
1703
- const dependentRoot = fromHex(state.getShufflingDecisionRoot(epoch)) || (await getGenesisBlockRoot(state));
1724
+ const dependentRoot = fromHex(state.getShufflingDecisionRoot(epoch));
1704
1725
 
1705
1726
  return {
1706
1727
  data: duties,
@@ -1749,7 +1770,10 @@ export function getValidatorApi(
1749
1770
  }
1750
1771
  }
1751
1772
 
1752
- const dependentRoot = fromHex(state.getShufflingDecisionRoot(epoch)) || (await getGenesisBlockRoot(state));
1773
+ // The fork epoch PTC is computed at the fork from effective balances updated at the end of the
1774
+ // last pre-fork epoch, so its dependent root is one epoch later than for other epochs
1775
+ const dependentRootEpoch = epoch === config.GLOAS_FORK_EPOCH ? epoch + 1 : epoch;
1776
+ const dependentRoot = fromHex(state.getShufflingDecisionRoot(dependentRootEpoch));
1753
1777
 
1754
1778
  return {
1755
1779
  data: duties,
@@ -2198,6 +2222,121 @@ export function getValidatorApi(
2198
2222
  }
2199
2223
  },
2200
2224
 
2225
+ async produceInclusionList({slot}) {
2226
+ notWhileSyncing(chain, sync.state);
2227
+
2228
+ if (!isForkPostHeze(chain.config.getForkName(slot))) {
2229
+ throw new ApiError(400, `Producing inclusion list for pre-heze slot: ${slot}`);
2230
+ }
2231
+
2232
+ await waitForSlot(slot); // Must never request for a future slot > currentSlot
2233
+
2234
+ const timer = metrics?.getInclusionListV1RequestsDuration.startTimer();
2235
+ const transactions = await chain.executionEngine.getInclusionList();
2236
+ timer?.();
2237
+ metrics?.getInclusionListV1Requests.inc();
2238
+
2239
+ return {data: transactions, meta: {version: chain.config.getForkName(slot)}};
2240
+ },
2241
+
2242
+ async getInclusionListCommitteeDuties({epoch, indices}) {
2243
+ notWhileSyncing(chain, sync.state);
2244
+
2245
+ if (indices.length === 0) {
2246
+ throw new ApiError(400, "No validator to get inclusion list committee duties");
2247
+ }
2248
+
2249
+ if (!isForkPostHeze(chain.config.getForkName(computeStartSlotAtEpoch(epoch)))) {
2250
+ throw new ApiError(400, `Requesting pre-heze inclusion list committee duties epoch: ${epoch}`);
2251
+ }
2252
+
2253
+ // May request for an epoch that's in the future
2254
+ await waitForNextClosestEpoch();
2255
+
2256
+ if (epoch > chain.clock.currentEpoch + 1) {
2257
+ throw new ApiError(400, "Cannot get duties for epoch more than one ahead");
2258
+ }
2259
+
2260
+ const head = chain.forkChoice.getHead();
2261
+ const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.getDuties);
2262
+
2263
+ const pubkeys = getPubkeysForIndices(state, indices);
2264
+ const requestedIndices = new Set(indices);
2265
+ const epochStartSlot = computeStartSlotAtEpoch(epoch);
2266
+ const shuffling = state.getShufflingAtEpoch(epoch);
2267
+
2268
+ // Validators set this as `dependent_root` on their inclusion lists
2269
+ const dependentRoot = fromHex(state.getShufflingDecisionRoot(epoch));
2270
+
2271
+ // A validator can be on several slots' committees in an epoch; report the earliest, as for attester duties
2272
+ const dutySlotByValidator = new Map<ValidatorIndex, Slot>();
2273
+ for (let i = 0; i < SLOTS_PER_EPOCH; i++) {
2274
+ const slot = epochStartSlot + i;
2275
+ for (const validatorIndex of getInclusionListCommittee(shuffling, slot).validatorIndices) {
2276
+ if (requestedIndices.has(validatorIndex) && !dutySlotByValidator.has(validatorIndex)) {
2277
+ dutySlotByValidator.set(validatorIndex, slot);
2278
+ }
2279
+ }
2280
+ }
2281
+
2282
+ const duties: routes.validator.InclusionListDuty[] = [];
2283
+ for (let i = 0; i < indices.length; i++) {
2284
+ const validatorIndex = indices[i];
2285
+ const slot = dutySlotByValidator.get(validatorIndex);
2286
+ if (slot !== undefined) {
2287
+ duties.push({pubkey: pubkeys[i], validatorIndex, slot, dependentRoot});
2288
+ }
2289
+ }
2290
+
2291
+ return {
2292
+ data: duties,
2293
+ meta: {
2294
+ dependentRoot: toRootHex(dependentRoot),
2295
+ executionOptimistic: isOptimisticBlock(head),
2296
+ },
2297
+ };
2298
+ },
2299
+
2300
+ async publishInclusionList({signedInclusionList}) {
2301
+ notWhileSyncing(chain, sync.state);
2302
+
2303
+ const {slot} = signedInclusionList.message;
2304
+ if (!isForkPostHeze(chain.config.getForkName(slot))) {
2305
+ throw new ApiError(400, `Publishing pre-heze inclusion list slot: ${slot}`);
2306
+ }
2307
+
2308
+ // Timeliness is judged on receipt, as for gossip, so a list submitted in time stays timely if validation is slow
2309
+ const secFromSlot = chain.clock.secFromSlot(slot, Date.now() / 1000);
2310
+ metrics?.inclusionListsReceived.inc({source: InclusionListSource.api});
2311
+ metrics?.inclusionListTransactionsReceived.inc(
2312
+ {source: InclusionListSource.api},
2313
+ signedInclusionList.message.transactions.length
2314
+ );
2315
+
2316
+ const timer = metrics?.inclusionListsValidationTime.startTimer();
2317
+ let validationResult: InclusionListValidationResult;
2318
+ try {
2319
+ validationResult = await validateGossipInclusionList(chain, signedInclusionList);
2320
+ } finally {
2321
+ timer?.({source: InclusionListSource.api});
2322
+ }
2323
+ const {committeeIndices, totalBytes} = validationResult;
2324
+ metrics?.inclusionListsValid.inc({source: InclusionListSource.api});
2325
+ metrics?.inclusionListsValidSize.inc(totalBytes);
2326
+
2327
+ const isTimely =
2328
+ secFromSlot >= 0 && secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
2329
+ chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
2330
+
2331
+ chain.emitter.emit(routes.events.EventType.inclusionList, {
2332
+ version: chain.config.getForkName(slot),
2333
+ data: signedInclusionList,
2334
+ });
2335
+
2336
+ await network.publishInclusionList(signedInclusionList);
2337
+ metrics?.inclusionListsPublished.inc();
2338
+ },
2339
+
2201
2340
  async getExecutionPayloadEnvelope({slot, beaconBlockRoot}) {
2202
2341
  const fork = config.getForkName(slot);
2203
2342