@lodestar/beacon-node 1.40.0-dev.0ae7a89ead → 1.40.0-dev.13ab628623

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 (405) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +23 -27
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/config/constants.d.ts +3 -0
  5. package/lib/api/impl/config/constants.d.ts.map +1 -1
  6. package/lib/api/impl/config/constants.js +5 -1
  7. package/lib/api/impl/config/constants.js.map +1 -1
  8. package/lib/api/impl/debug/index.d.ts +1 -1
  9. package/lib/api/impl/debug/index.d.ts.map +1 -1
  10. package/lib/api/impl/debug/index.js +3 -6
  11. package/lib/api/impl/debug/index.js.map +1 -1
  12. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  13. package/lib/api/impl/lodestar/index.js +29 -2
  14. package/lib/api/impl/lodestar/index.js.map +1 -1
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +9 -8
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.d.ts +2 -0
  19. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  20. package/lib/chain/ColumnReconstructionTracker.js +7 -3
  21. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  22. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  23. package/lib/chain/archiveStore/utils/archiveBlocks.js +4 -0
  24. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  25. package/lib/chain/blocks/blockInput/blockInput.d.ts +30 -0
  26. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  27. package/lib/chain/blocks/blockInput/blockInput.js +42 -1
  28. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  29. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  30. package/lib/chain/blocks/importBlock.js +3 -7
  31. package/lib/chain/blocks/importBlock.js.map +1 -1
  32. package/lib/chain/blocks/index.d.ts.map +1 -1
  33. package/lib/chain/blocks/index.js +0 -14
  34. package/lib/chain/blocks/index.js.map +1 -1
  35. package/lib/chain/blocks/types.d.ts +0 -2
  36. package/lib/chain/blocks/types.d.ts.map +1 -1
  37. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  38. package/lib/chain/blocks/verifyBlock.js +1 -8
  39. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  40. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  41. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  42. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  43. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  44. package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
  45. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  46. package/lib/chain/blocks/writeBlockInputToDb.js +28 -28
  47. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  48. package/lib/chain/bls/multithread/index.d.ts +3 -1
  49. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  50. package/lib/chain/bls/multithread/index.js +5 -3
  51. package/lib/chain/bls/multithread/index.js.map +1 -1
  52. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  53. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  54. package/lib/chain/bls/multithread/jobItem.js +2 -2
  55. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  56. package/lib/chain/bls/singleThread.d.ts +4 -2
  57. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  58. package/lib/chain/bls/singleThread.js +4 -2
  59. package/lib/chain/bls/singleThread.js.map +1 -1
  60. package/lib/chain/bls/utils.d.ts +2 -2
  61. package/lib/chain/bls/utils.d.ts.map +1 -1
  62. package/lib/chain/bls/utils.js +9 -6
  63. package/lib/chain/bls/utils.js.map +1 -1
  64. package/lib/chain/chain.d.ts +22 -5
  65. package/lib/chain/chain.d.ts.map +1 -1
  66. package/lib/chain/chain.js +197 -44
  67. package/lib/chain/chain.js.map +1 -1
  68. package/lib/chain/errors/attestationError.d.ts +14 -1
  69. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  70. package/lib/chain/errors/attestationError.js +8 -0
  71. package/lib/chain/errors/attestationError.js.map +1 -1
  72. package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
  73. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
  74. package/lib/chain/errors/executionPayloadBid.js +15 -0
  75. package/lib/chain/errors/executionPayloadBid.js.map +1 -0
  76. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  77. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
  78. package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
  79. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
  80. package/lib/chain/errors/index.d.ts +3 -0
  81. package/lib/chain/errors/index.d.ts.map +1 -1
  82. package/lib/chain/errors/index.js +3 -0
  83. package/lib/chain/errors/index.js.map +1 -1
  84. package/lib/chain/errors/payloadAttestation.d.ts +34 -0
  85. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
  86. package/lib/chain/errors/payloadAttestation.js +13 -0
  87. package/lib/chain/errors/payloadAttestation.js.map +1 -0
  88. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  89. package/lib/chain/forkChoice/index.js +18 -0
  90. package/lib/chain/forkChoice/index.js.map +1 -1
  91. package/lib/chain/interface.d.ts +21 -3
  92. package/lib/chain/interface.d.ts.map +1 -1
  93. package/lib/chain/interface.js.map +1 -1
  94. package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
  95. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
  96. package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
  97. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
  98. package/lib/chain/opPools/index.d.ts +2 -0
  99. package/lib/chain/opPools/index.d.ts.map +1 -1
  100. package/lib/chain/opPools/index.js +2 -0
  101. package/lib/chain/opPools/index.js.map +1 -1
  102. package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
  103. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
  104. package/lib/chain/opPools/payloadAttestationPool.js +109 -0
  105. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
  106. package/lib/chain/options.d.ts +0 -1
  107. package/lib/chain/options.d.ts.map +1 -1
  108. package/lib/chain/options.js +0 -1
  109. package/lib/chain/options.js.map +1 -1
  110. package/lib/chain/prepareNextSlot.js +6 -4
  111. package/lib/chain/prepareNextSlot.js.map +1 -1
  112. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  113. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  114. package/lib/chain/produceBlock/produceBlockBody.js +5 -3
  115. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  116. package/lib/chain/regen/interface.d.ts +4 -9
  117. package/lib/chain/regen/interface.d.ts.map +1 -1
  118. package/lib/chain/regen/interface.js +1 -1
  119. package/lib/chain/regen/interface.js.map +1 -1
  120. package/lib/chain/regen/queued.d.ts +2 -3
  121. package/lib/chain/regen/queued.d.ts.map +1 -1
  122. package/lib/chain/regen/queued.js +2 -16
  123. package/lib/chain/regen/queued.js.map +1 -1
  124. package/lib/chain/regen/regen.d.ts +5 -7
  125. package/lib/chain/regen/regen.d.ts.map +1 -1
  126. package/lib/chain/regen/regen.js +7 -17
  127. package/lib/chain/regen/regen.js.map +1 -1
  128. package/lib/chain/seenCache/index.d.ts +3 -1
  129. package/lib/chain/seenCache/index.d.ts.map +1 -1
  130. package/lib/chain/seenCache/index.js +3 -1
  131. package/lib/chain/seenCache/index.js.map +1 -1
  132. package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
  133. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  134. package/lib/chain/seenCache/seenAttesters.js +5 -0
  135. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  136. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
  137. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
  138. package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
  139. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
  140. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
  141. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
  142. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
  143. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
  144. package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
  145. package/lib/chain/stateCache/index.d.ts +0 -2
  146. package/lib/chain/stateCache/index.d.ts.map +1 -1
  147. package/lib/chain/stateCache/index.js +0 -2
  148. package/lib/chain/stateCache/index.js.map +1 -1
  149. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +2 -1
  150. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  151. package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -0
  152. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  153. package/lib/chain/validation/aggregateAndProof.js +35 -14
  154. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  155. package/lib/chain/validation/attestation.d.ts +2 -2
  156. package/lib/chain/validation/attestation.d.ts.map +1 -1
  157. package/lib/chain/validation/attestation.js +27 -8
  158. package/lib/chain/validation/attestation.js.map +1 -1
  159. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  160. package/lib/chain/validation/attesterSlashing.js +1 -1
  161. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  162. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  163. package/lib/chain/validation/blobSidecar.js +3 -3
  164. package/lib/chain/validation/blobSidecar.js.map +1 -1
  165. package/lib/chain/validation/block.d.ts.map +1 -1
  166. package/lib/chain/validation/block.js +6 -6
  167. package/lib/chain/validation/block.js.map +1 -1
  168. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  169. package/lib/chain/validation/dataColumnSidecar.js +3 -3
  170. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  171. package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
  172. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
  173. package/lib/chain/validation/executionPayloadBid.js +104 -0
  174. package/lib/chain/validation/executionPayloadBid.js.map +1 -0
  175. package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
  176. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
  177. package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
  178. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
  179. package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
  180. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
  181. package/lib/chain/validation/payloadAttestationMessage.js +72 -0
  182. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
  183. package/lib/chain/validation/proposerSlashing.js +1 -1
  184. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  185. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
  186. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  187. package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
  188. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  189. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  190. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  191. package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
  192. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  193. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
  194. package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
  195. package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
  196. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  197. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  198. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  199. package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
  200. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  201. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
  202. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  203. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  204. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  205. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  206. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  207. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  208. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  209. package/lib/chain/validation/syncCommittee.js +1 -1
  210. package/lib/chain/validation/syncCommittee.js.map +1 -1
  211. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  212. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
  213. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  214. package/lib/chain/validation/voluntaryExit.js +1 -1
  215. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  216. package/lib/chain/validatorMonitor.d.ts +2 -0
  217. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  218. package/lib/chain/validatorMonitor.js +49 -7
  219. package/lib/chain/validatorMonitor.js.map +1 -1
  220. package/lib/db/repositories/checkpointState.js +0 -1
  221. package/lib/db/repositories/checkpointState.js.map +1 -1
  222. package/lib/metrics/metrics/lodestar.d.ts +27 -0
  223. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  224. package/lib/metrics/metrics/lodestar.js +64 -0
  225. package/lib/metrics/metrics/lodestar.js.map +1 -1
  226. package/lib/network/core/networkCore.d.ts +3 -0
  227. package/lib/network/core/networkCore.d.ts.map +1 -1
  228. package/lib/network/core/networkCore.js +9 -0
  229. package/lib/network/core/networkCore.js.map +1 -1
  230. package/lib/network/core/networkCoreWorker.js +3 -0
  231. package/lib/network/core/networkCoreWorker.js.map +1 -1
  232. package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -0
  233. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  234. package/lib/network/core/networkCoreWorkerHandler.js +9 -0
  235. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  236. package/lib/network/core/types.d.ts +3 -0
  237. package/lib/network/core/types.d.ts.map +1 -1
  238. package/lib/network/gossip/gossipsub.d.ts +34 -0
  239. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  240. package/lib/network/gossip/gossipsub.js +123 -0
  241. package/lib/network/gossip/gossipsub.js.map +1 -1
  242. package/lib/network/gossip/interface.d.ts +20 -2
  243. package/lib/network/gossip/interface.d.ts.map +1 -1
  244. package/lib/network/gossip/interface.js +3 -0
  245. package/lib/network/gossip/interface.js.map +1 -1
  246. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  247. package/lib/network/gossip/scoringParameters.js +38 -2
  248. package/lib/network/gossip/scoringParameters.js.map +1 -1
  249. package/lib/network/gossip/topic.d.ts +77 -1
  250. package/lib/network/gossip/topic.d.ts.map +1 -1
  251. package/lib/network/gossip/topic.js +20 -0
  252. package/lib/network/gossip/topic.js.map +1 -1
  253. package/lib/network/network.d.ts +3 -0
  254. package/lib/network/network.d.ts.map +1 -1
  255. package/lib/network/network.js +9 -0
  256. package/lib/network/network.js.map +1 -1
  257. package/lib/network/options.d.ts +6 -0
  258. package/lib/network/options.d.ts.map +1 -1
  259. package/lib/network/options.js.map +1 -1
  260. package/lib/network/peers/peerManager.d.ts.map +1 -1
  261. package/lib/network/peers/peerManager.js +9 -0
  262. package/lib/network/peers/peerManager.js.map +1 -1
  263. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  264. package/lib/network/processor/gossipHandlers.js +35 -4
  265. package/lib/network/processor/gossipHandlers.js.map +1 -1
  266. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  267. package/lib/network/processor/gossipQueues/index.js +16 -0
  268. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  269. package/lib/network/processor/index.d.ts.map +1 -1
  270. package/lib/network/processor/index.js +3 -0
  271. package/lib/network/processor/index.js.map +1 -1
  272. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  273. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
  274. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  275. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
  276. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  277. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
  278. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  279. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
  280. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  281. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
  282. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  283. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  284. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
  285. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  286. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
  287. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
  288. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  289. package/lib/network/reqresp/handlers/index.js +2 -2
  290. package/lib/network/reqresp/handlers/index.js.map +1 -1
  291. package/lib/sync/backfill/backfill.js +2 -2
  292. package/lib/sync/backfill/backfill.js.map +1 -1
  293. package/lib/sync/backfill/verify.d.ts +1 -2
  294. package/lib/sync/backfill/verify.d.ts.map +1 -1
  295. package/lib/sync/backfill/verify.js +2 -2
  296. package/lib/sync/backfill/verify.js.map +1 -1
  297. package/lib/sync/range/chain.d.ts.map +1 -1
  298. package/lib/sync/range/chain.js +0 -1
  299. package/lib/sync/range/chain.js.map +1 -1
  300. package/lib/sync/range/range.d.ts.map +1 -1
  301. package/lib/sync/range/range.js +0 -3
  302. package/lib/sync/range/range.js.map +1 -1
  303. package/lib/sync/unknownBlock.d.ts.map +1 -1
  304. package/lib/sync/unknownBlock.js +0 -3
  305. package/lib/sync/unknownBlock.js.map +1 -1
  306. package/package.json +15 -15
  307. package/src/api/impl/beacon/blocks/index.ts +39 -37
  308. package/src/api/impl/config/constants.ts +8 -0
  309. package/src/api/impl/debug/index.ts +2 -6
  310. package/src/api/impl/lodestar/index.ts +35 -3
  311. package/src/api/impl/validator/index.ts +14 -12
  312. package/src/chain/ColumnReconstructionTracker.ts +8 -4
  313. package/src/chain/archiveStore/utils/archiveBlocks.ts +4 -0
  314. package/src/chain/blocks/blockInput/blockInput.ts +53 -2
  315. package/src/chain/blocks/importBlock.ts +3 -7
  316. package/src/chain/blocks/index.ts +0 -19
  317. package/src/chain/blocks/types.ts +0 -2
  318. package/src/chain/blocks/verifyBlock.ts +0 -9
  319. package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
  320. package/src/chain/blocks/writeBlockInputToDb.ts +33 -30
  321. package/src/chain/bls/multithread/index.ts +7 -4
  322. package/src/chain/bls/multithread/jobItem.ts +7 -3
  323. package/src/chain/bls/singleThread.ts +5 -3
  324. package/src/chain/bls/utils.ts +15 -7
  325. package/src/chain/chain.ts +227 -56
  326. package/src/chain/errors/attestationError.ts +11 -1
  327. package/src/chain/errors/executionPayloadBid.ts +35 -0
  328. package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
  329. package/src/chain/errors/index.ts +3 -0
  330. package/src/chain/errors/payloadAttestation.ts +25 -0
  331. package/src/chain/forkChoice/index.ts +19 -0
  332. package/src/chain/interface.ts +32 -1
  333. package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
  334. package/src/chain/opPools/index.ts +2 -0
  335. package/src/chain/opPools/payloadAttestationPool.ts +157 -0
  336. package/src/chain/options.ts +0 -2
  337. package/src/chain/prepareNextSlot.ts +6 -6
  338. package/src/chain/produceBlock/produceBlockBody.ts +7 -5
  339. package/src/chain/regen/interface.ts +3 -13
  340. package/src/chain/regen/queued.ts +3 -24
  341. package/src/chain/regen/regen.ts +10 -25
  342. package/src/chain/seenCache/index.ts +3 -1
  343. package/src/chain/seenCache/seenAttesters.ts +5 -0
  344. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
  345. package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
  346. package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
  347. package/src/chain/stateCache/index.ts +0 -2
  348. package/src/chain/stateCache/persistentCheckpointsCache.ts +6 -2
  349. package/src/chain/validation/aggregateAndProof.ts +36 -14
  350. package/src/chain/validation/attestation.ts +33 -16
  351. package/src/chain/validation/attesterSlashing.ts +1 -6
  352. package/src/chain/validation/blobSidecar.ts +2 -7
  353. package/src/chain/validation/block.ts +6 -6
  354. package/src/chain/validation/dataColumnSidecar.ts +2 -7
  355. package/src/chain/validation/executionPayloadBid.ts +141 -0
  356. package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
  357. package/src/chain/validation/payloadAttestationMessage.ts +109 -0
  358. package/src/chain/validation/proposerSlashing.ts +1 -6
  359. package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
  360. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
  361. package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
  362. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
  363. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  364. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
  365. package/src/chain/validation/syncCommittee.ts +1 -1
  366. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
  367. package/src/chain/validation/voluntaryExit.ts +1 -1
  368. package/src/chain/validatorMonitor.ts +62 -8
  369. package/src/db/repositories/checkpointState.ts +1 -1
  370. package/src/metrics/metrics/lodestar.ts +65 -0
  371. package/src/network/core/networkCore.ts +12 -0
  372. package/src/network/core/networkCoreWorker.ts +3 -0
  373. package/src/network/core/networkCoreWorkerHandler.ts +9 -0
  374. package/src/network/core/types.ts +6 -0
  375. package/src/network/gossip/gossipsub.ts +147 -1
  376. package/src/network/gossip/interface.ts +17 -0
  377. package/src/network/gossip/scoringParameters.ts +44 -2
  378. package/src/network/gossip/topic.ts +21 -0
  379. package/src/network/network.ts +12 -0
  380. package/src/network/options.ts +6 -0
  381. package/src/network/peers/peerManager.ts +11 -0
  382. package/src/network/processor/gossipHandlers.ts +49 -4
  383. package/src/network/processor/gossipQueues/index.ts +16 -0
  384. package/src/network/processor/index.ts +3 -0
  385. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
  386. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
  387. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
  388. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
  389. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
  390. package/src/network/reqresp/handlers/index.ts +2 -2
  391. package/src/sync/backfill/backfill.ts +2 -2
  392. package/src/sync/backfill/verify.ts +2 -3
  393. package/src/sync/range/chain.ts +0 -1
  394. package/src/sync/range/range.ts +0 -3
  395. package/src/sync/unknownBlock.ts +0 -3
  396. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +0 -54
  397. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +0 -1
  398. package/lib/chain/stateCache/blockStateCacheImpl.js +0 -130
  399. package/lib/chain/stateCache/blockStateCacheImpl.js.map +0 -1
  400. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +0 -60
  401. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +0 -1
  402. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +0 -156
  403. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +0 -1
  404. package/src/chain/stateCache/blockStateCacheImpl.ts +0 -149
  405. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +0 -192
@@ -30,7 +30,7 @@ import {
30
30
  isDenebBlockContents,
31
31
  sszTypesFor,
32
32
  } from "@lodestar/types";
33
- import {fromAsync, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils";
33
+ import {fromHex, sleep, toHex, toRootHex} from "@lodestar/utils";
34
34
  import {BlockInputSource, isBlockInputBlobs, isBlockInputColumns} from "../../../../chain/blocks/blockInput/index.js";
35
35
  import {ImportBlockOpts} from "../../../../chain/blocks/types.js";
36
36
  import {verifyBlocksInEpoch} from "../../../../chain/blocks/verifyBlock.js";
@@ -133,21 +133,31 @@ export function getBeaconBlockApi({
133
133
 
134
134
  if (isBlockInputColumns(blockForImport)) {
135
135
  for (const dataColumnSidecar of dataColumnSidecars) {
136
- blockForImport.addColumn({
137
- blockRootHex: blockRoot,
138
- columnSidecar: dataColumnSidecar,
139
- source: BlockInputSource.api,
140
- seenTimestampSec,
141
- });
136
+ blockForImport.addColumn(
137
+ {
138
+ blockRootHex: blockRoot,
139
+ columnSidecar: dataColumnSidecar,
140
+ source: BlockInputSource.api,
141
+ seenTimestampSec,
142
+ },
143
+ // In multi-BN setups (DVT, fallback), the same block may be published to multiple nodes.
144
+ // Data columns may arrive via gossip from another node before the API publish completes,
145
+ // so we allow duplicates here instead of throwing an error.
146
+ {throwOnDuplicateAdd: false}
147
+ );
142
148
  }
143
149
  } else if (isBlockInputBlobs(blockForImport)) {
144
150
  for (const blobSidecar of blobSidecars) {
145
- blockForImport.addBlob({
146
- blockRootHex: blockRoot,
147
- blobSidecar,
148
- source: BlockInputSource.api,
149
- seenTimestampSec,
150
- });
151
+ blockForImport.addBlob(
152
+ {
153
+ blockRootHex: blockRoot,
154
+ blobSidecar,
155
+ source: BlockInputSource.api,
156
+ seenTimestampSec,
157
+ },
158
+ // Same as above for columns
159
+ {throwOnDuplicateAdd: false}
160
+ );
151
161
  }
152
162
  }
153
163
 
@@ -285,7 +295,7 @@ export function getBeaconBlockApi({
285
295
  () =>
286
296
  // there is no rush to persist block since we published it to gossip anyway
287
297
  chain
288
- .processBlock(blockForImport, {...opts, eagerPersistBlock: false})
298
+ .processBlock(blockForImport, opts)
289
299
  .catch((e) => {
290
300
  if (e instanceof BlockError && e.type.code === BlockErrorCode.PARENT_UNKNOWN) {
291
301
  chain.emitter.emit(ChainEvent.unknownParent, {
@@ -434,11 +444,13 @@ export function getBeaconBlockApi({
434
444
  const nonFinalizedBlocks = chain.forkChoice.getBlockSummariesByParentRoot(parentRoot);
435
445
  await Promise.all(
436
446
  nonFinalizedBlocks.map(async (summary) => {
437
- const block = await db.block.get(fromHex(summary.blockRoot));
438
- if (block) {
439
- const canonical = chain.forkChoice.getCanonicalBlockAtSlot(block.message.slot);
447
+ const blockResult = await chain.getBlockByRoot(summary.blockRoot);
448
+ if (blockResult) {
449
+ const canonical = chain.forkChoice.getCanonicalBlockAtSlot(blockResult.block.message.slot);
440
450
  if (canonical) {
441
- result.push(toBeaconHeaderResponse(config, block, canonical.blockRoot === summary.blockRoot));
451
+ result.push(
452
+ toBeaconHeaderResponse(config, blockResult.block, canonical.blockRoot === summary.blockRoot)
453
+ );
442
454
  if (isOptimisticBlock(canonical)) {
443
455
  executionOptimistic = true;
444
456
  }
@@ -492,9 +504,9 @@ export function getBeaconBlockApi({
492
504
  finalized = false;
493
505
 
494
506
  if (summary.blockRoot !== toRootHex(canonicalRoot)) {
495
- const block = await db.block.get(fromHex(summary.blockRoot));
496
- if (block) {
497
- result.push(toBeaconHeaderResponse(config, block));
507
+ const blockResult = await chain.getBlockByRoot(summary.blockRoot);
508
+ if (blockResult) {
509
+ result.push(toBeaconHeaderResponse(config, blockResult.block));
498
510
  }
499
511
  }
500
512
  })
@@ -626,6 +638,7 @@ export function getBeaconBlockApi({
626
638
  const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
627
639
  const fork = config.getForkName(block.message.slot);
628
640
  const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
641
+ const blockRootHex = toRootHex(blockRoot);
629
642
 
630
643
  let data: deneb.BlobSidecars;
631
644
 
@@ -642,10 +655,7 @@ export function getBeaconBlockApi({
642
655
  const blobCount = blobKzgCommitments.length;
643
656
 
644
657
  if (blobCount > 0) {
645
- let dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
646
- if (dataColumnSidecars.length === 0) {
647
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
648
- }
658
+ const dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, blockRootHex);
649
659
 
650
660
  if (dataColumnSidecars.length === 0) {
651
661
  throw new ApiError(
@@ -682,10 +692,7 @@ export function getBeaconBlockApi({
682
692
  data = [];
683
693
  }
684
694
  } else if (isForkPostDeneb(fork)) {
685
- let {blobSidecars} = (await db.blobSidecars.get(blockRoot)) ?? {};
686
- if (!blobSidecars) {
687
- ({blobSidecars} = (await db.blobSidecarsArchive.get(block.message.slot)) ?? {});
688
- }
695
+ const blobSidecars = await chain.getBlobSidecars(block.message.slot, blockRootHex);
689
696
 
690
697
  if (!blobSidecars) {
691
698
  throw new ApiError(
@@ -715,6 +722,7 @@ export function getBeaconBlockApi({
715
722
  const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
716
723
  const fork = config.getForkName(block.message.slot);
717
724
  const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
725
+ const blockRootHex = toRootHex(blockRoot);
718
726
 
719
727
  let blobs: deneb.Blobs;
720
728
 
@@ -731,10 +739,7 @@ export function getBeaconBlockApi({
731
739
  const blobCount = blobKzgCommitments.length;
732
740
 
733
741
  if (blobCount > 0) {
734
- let dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
735
- if (dataColumnSidecars.length === 0) {
736
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
737
- }
742
+ const dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, blockRootHex);
738
743
 
739
744
  if (dataColumnSidecars.length === 0) {
740
745
  throw new ApiError(
@@ -766,10 +771,7 @@ export function getBeaconBlockApi({
766
771
  blobs = [];
767
772
  }
768
773
  } else if (isForkPostDeneb(fork)) {
769
- let {blobSidecars} = (await db.blobSidecars.get(blockRoot)) ?? {};
770
- if (!blobSidecars) {
771
- ({blobSidecars} = (await db.blobSidecarsArchive.get(block.message.slot)) ?? {});
772
- }
774
+ const blobSidecars = await chain.getBlobSidecars(block.message.slot, blockRootHex);
773
775
 
774
776
  if (!blobSidecars) {
775
777
  throw new ApiError(
@@ -5,6 +5,8 @@ import {
5
5
  BASE_REWARDS_PER_EPOCH,
6
6
  BLOB_TX_TYPE,
7
7
  BLS_WITHDRAWAL_PREFIX,
8
+ BUILDER_INDEX_FLAG,
9
+ BUILDER_INDEX_SELF_BUILD,
8
10
  BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
9
11
  BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
10
12
  BUILDER_WITHDRAWAL_PREFIX,
@@ -21,6 +23,7 @@ import {
21
23
  DOMAIN_BLS_TO_EXECUTION_CHANGE,
22
24
  DOMAIN_CONTRIBUTION_AND_PROOF,
23
25
  DOMAIN_DEPOSIT,
26
+ DOMAIN_PROPOSER_PREFERENCES,
24
27
  DOMAIN_PTC_ATTESTER,
25
28
  DOMAIN_RANDAO,
26
29
  DOMAIN_SELECTION_PROOF,
@@ -82,6 +85,7 @@ export const specConstants = {
82
85
  DOMAIN_APPLICATION_MASK,
83
86
  DOMAIN_APPLICATION_BUILDER,
84
87
  DOMAIN_BEACON_BUILDER,
88
+ DOMAIN_PROPOSER_PREFERENCES,
85
89
  DOMAIN_PTC_ATTESTER,
86
90
 
87
91
  // phase0/validator.md
@@ -128,6 +132,10 @@ export const specConstants = {
128
132
  DEPOSIT_REQUEST_TYPE: toHexByte(DEPOSIT_REQUEST_TYPE),
129
133
  WITHDRAWAL_REQUEST_TYPE: toHexByte(WITHDRAWAL_REQUEST_TYPE),
130
134
  CONSOLIDATION_REQUEST_TYPE: toHexByte(CONSOLIDATION_REQUEST_TYPE),
135
+
136
+ // gloas
137
+ BUILDER_INDEX_FLAG,
138
+ BUILDER_INDEX_SELF_BUILD,
131
139
  BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
132
140
  BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
133
141
  };
@@ -3,7 +3,7 @@ import {ApplicationMethods} from "@lodestar/api/server";
3
3
  import {ExecutionStatus} from "@lodestar/fork-choice";
4
4
  import {ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
5
5
  import {BeaconState, deneb, fulu, sszTypesFor} from "@lodestar/types";
6
- import {fromAsync, toRootHex} from "@lodestar/utils";
6
+ import {toRootHex} from "@lodestar/utils";
7
7
  import {isOptimisticBlock} from "../../../util/forkChoice.js";
8
8
  import {getStateSlotFromBytes} from "../../../util/multifork.js";
9
9
  import {getBlockResponse} from "../beacon/blocks/utils.js";
@@ -14,7 +14,6 @@ import {assertUniqueItems} from "../utils.js";
14
14
  export function getDebugApi({
15
15
  chain,
16
16
  config,
17
- db,
18
17
  }: Pick<ApiModules, "chain" | "config" | "db">): ApplicationMethods<routes.debug.Endpoints> {
19
18
  return {
20
19
  async getDebugChainHeadsV2() {
@@ -104,10 +103,7 @@ export function getDebugApi({
104
103
  : 0;
105
104
 
106
105
  if (isForkPostFulu(fork) && blobCount > 0) {
107
- dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
108
- if (dataColumnSidecars.length === 0) {
109
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
110
- }
106
+ dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, toRootHex(blockRoot));
111
107
 
112
108
  if (dataColumnSidecars.length === 0) {
113
109
  throw Error(
@@ -154,6 +154,23 @@ export function getLodestarApi({
154
154
  await network.disconnectPeer(peerId);
155
155
  },
156
156
 
157
+ async addDirectPeer({peer}) {
158
+ const peerId = await network.addDirectPeer(peer);
159
+ if (peerId === null) {
160
+ throw new ApiError(400, `Failed to add direct peer: invalid peer address or ENR "${peer}"`);
161
+ }
162
+ return {data: {peerId}};
163
+ },
164
+
165
+ async removeDirectPeer({peerId}) {
166
+ const removed = await network.removeDirectPeer(peerId);
167
+ return {data: {removed}};
168
+ },
169
+
170
+ async getDirectPeers() {
171
+ return {data: await network.getDirectPeers()};
172
+ },
173
+
157
174
  async getPeers({state, direction}) {
158
175
  const peers = (await network.dumpPeers()).filter(
159
176
  (nodePeer) =>
@@ -238,6 +255,24 @@ export function getLodestarApi({
238
255
  },
239
256
  };
240
257
  },
258
+
259
+ async getMonitoredValidatorIndices() {
260
+ return {
261
+ data: chain.validatorMonitor?.getMonitoredValidatorIndices() ?? [],
262
+ };
263
+ },
264
+
265
+ async getCustodyInfo() {
266
+ const {custodyColumns, targetCustodyGroupCount} = chain.custodyConfig;
267
+
268
+ return {
269
+ data: {
270
+ earliestCustodiedSlot: chain.earliestAvailableSlot,
271
+ custodyGroupCount: targetCustodyGroupCount,
272
+ custodyColumns,
273
+ },
274
+ };
275
+ },
241
276
  };
242
277
  }
243
278
 
@@ -249,9 +284,6 @@ function regenRequestToJson(config: ChainForkConfig, regenRequest: RegenRequest)
249
284
  slot: regenRequest.args[1],
250
285
  };
251
286
 
252
- case "getCheckpointState":
253
- return ssz.phase0.Checkpoint.toJson(regenRequest.args[0]);
254
-
255
287
  case "getPreState": {
256
288
  const slot = regenRequest.args[0].slot;
257
289
  return {
@@ -1,7 +1,7 @@
1
1
  import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
2
2
  import {routes} from "@lodestar/api";
3
3
  import {ApplicationMethods} from "@lodestar/api/server";
4
- import {ExecutionStatus} from "@lodestar/fork-choice";
4
+ import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
5
5
  import {
6
6
  ForkName,
7
7
  ForkPostBellatrix,
@@ -67,10 +67,11 @@ import {
67
67
  SyncCommitteeError,
68
68
  SyncCommitteeErrorCode,
69
69
  } from "../../../chain/errors/index.js";
70
- import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js";
70
+ import {ChainEvent, CommonBlockBody} from "../../../chain/index.js";
71
71
  import {PREPARE_NEXT_SLOT_BPS} from "../../../chain/prepareNextSlot.js";
72
72
  import {BlockType, ProduceFullDeneb} from "../../../chain/produceBlock/index.js";
73
73
  import {RegenCaller} from "../../../chain/regen/index.js";
74
+ import {CheckpointHex} from "../../../chain/stateCache/types.js";
74
75
  import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
75
76
  import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js";
76
77
  import {ZERO_HASH} from "../../../constants/index.js";
@@ -413,10 +414,10 @@ export function getValidatorApi(
413
414
  // as of now fee recipient checks can not be performed because builder does not return bid recipient
414
415
  {
415
416
  commonBlockBodyPromise,
416
- parentBlockRoot,
417
+ parentBlock,
417
418
  }: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
418
419
  commonBlockBodyPromise: Promise<CommonBlockBody>;
419
- parentBlockRoot: Root;
420
+ parentBlock: ProtoBlock;
420
421
  }
421
422
  ): Promise<ProduceBlindedBlockRes> {
422
423
  const version = config.getForkName(slot);
@@ -447,7 +448,7 @@ export function getValidatorApi(
447
448
  timer = metrics?.blockProductionTime.startTimer();
448
449
  const {block, executionPayloadValue, consensusBlockValue} = await chain.produceBlindedBlock({
449
450
  slot,
450
- parentBlockRoot,
451
+ parentBlock,
451
452
  randaoReveal,
452
453
  graffiti,
453
454
  commonBlockBodyPromise,
@@ -482,10 +483,10 @@ export function getValidatorApi(
482
483
  feeRecipient,
483
484
  strictFeeRecipientCheck,
484
485
  commonBlockBodyPromise,
485
- parentBlockRoot,
486
+ parentBlock,
486
487
  }: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
487
488
  commonBlockBodyPromise: Promise<CommonBlockBody>;
488
- parentBlockRoot: Root;
489
+ parentBlock: ProtoBlock;
489
490
  }
490
491
  ): Promise<ProduceBlockContentsRes & {shouldOverrideBuilder?: boolean}> {
491
492
  const source = ProducedBlockSource.engine;
@@ -496,7 +497,7 @@ export function getValidatorApi(
496
497
  timer = metrics?.blockProductionTime.startTimer();
497
498
  const {block, executionPayloadValue, consensusBlockValue, shouldOverrideBuilder} = await chain.produceBlock({
498
499
  slot,
499
- parentBlockRoot,
500
+ parentBlock,
500
501
  randaoReveal,
501
502
  graffiti,
502
503
  feeRecipient,
@@ -569,7 +570,8 @@ export function getValidatorApi(
569
570
  notWhileSyncing();
570
571
  await waitForSlot(slot); // Must never request for a future slot > currentSlot
571
572
 
572
- const {blockRoot: parentBlockRootHex, slot: parentSlot} = chain.getProposerHead(slot);
573
+ const parentBlock = chain.getProposerHead(slot);
574
+ const {blockRoot: parentBlockRootHex, slot: parentSlot} = parentBlock;
573
575
  const parentBlockRoot = fromHex(parentBlockRootHex);
574
576
  notOnOutOfRangeData(parentBlockRoot);
575
577
  metrics?.blockProductionSlotDelta.set(slot - parentSlot);
@@ -638,7 +640,7 @@ export function getValidatorApi(
638
640
  // can't do fee recipient checks as builder bid doesn't return feeRecipient as of now
639
641
  strictFeeRecipientCheck: false,
640
642
  commonBlockBodyPromise,
641
- parentBlockRoot,
643
+ parentBlock,
642
644
  })
643
645
  : Promise.reject(new Error("Builder disabled"));
644
646
 
@@ -647,7 +649,7 @@ export function getValidatorApi(
647
649
  feeRecipient,
648
650
  strictFeeRecipientCheck,
649
651
  commonBlockBodyPromise,
650
- parentBlockRoot,
652
+ parentBlock,
651
653
  }).then((engineBlock) => {
652
654
  // Once the engine returns a block, in the event of either:
653
655
  // - suspected builder censorship
@@ -689,7 +691,7 @@ export function getValidatorApi(
689
691
  chain
690
692
  .produceCommonBlockBody({
691
693
  slot,
692
- parentBlockRoot,
694
+ parentBlock,
693
695
  randaoReveal,
694
696
  graffiti: graffitiBytes,
695
697
  })
@@ -8,12 +8,12 @@ import {ChainEventEmitter} from "./emitter.js";
8
8
  /**
9
9
  * Minimum time to wait before attempting reconstruction
10
10
  */
11
- const RECONSTRUCTION_DELAY_MIN_MS = 800;
11
+ const RECONSTRUCTION_DELAY_MIN_BPS = 667;
12
12
 
13
13
  /**
14
14
  * Maximum time to wait before attempting reconstruction
15
15
  */
16
- const RECONSTRUCTION_DELAY_MAX_MS = 1200;
16
+ const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
17
17
 
18
18
  export type ColumnReconstructionTrackerInit = {
19
19
  logger: Logger;
@@ -41,11 +41,16 @@ export class ColumnReconstructionTracker {
41
41
  /** Track if a reconstruction attempt is in-flight */
42
42
  running = false;
43
43
 
44
+ private readonly minDelayMs: number;
45
+ private readonly maxDelayMs: number;
46
+
44
47
  constructor(init: ColumnReconstructionTrackerInit) {
45
48
  this.logger = init.logger;
46
49
  this.emitter = init.emitter;
47
50
  this.metrics = init.metrics;
48
51
  this.config = init.config;
52
+ this.minDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MIN_BPS);
53
+ this.maxDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MAX_BPS);
49
54
  }
50
55
 
51
56
  triggerColumnReconstruction(blockInput: BlockInputColumns): void {
@@ -61,8 +66,7 @@ export class ColumnReconstructionTracker {
61
66
  // just that it has been triggered for this block root.
62
67
  this.running = true;
63
68
  this.lastBlockRootHex = blockInput.blockRootHex;
64
- const delay =
65
- RECONSTRUCTION_DELAY_MIN_MS + Math.random() * (RECONSTRUCTION_DELAY_MAX_MS - RECONSTRUCTION_DELAY_MIN_MS);
69
+ const delay = this.minDelayMs + Math.random() * (this.maxDelayMs - this.minDelayMs);
66
70
  sleep(delay)
67
71
  .then(() => {
68
72
  const logCtx = {slot: blockInput.slot, root: blockInput.blockRootHex};
@@ -238,6 +238,7 @@ async function migrateBlocksFromHotToColdDb(db: IBeaconDb, blocks: BlockRootSlot
238
238
  // load Buffer instead of SignedBeaconBlock to improve performance
239
239
  const canonicalBlockEntries: BlockArchiveBatchPutBinaryItem[] = await Promise.all(
240
240
  canonicalBlocks.map(async (block) => {
241
+ // Here we assume the blocks are already in the hot db
241
242
  const blockBuffer = await db.block.getBinary(block.root);
242
243
  if (!blockBuffer) {
243
244
  throw Error(`Block not found for slot ${block.slot} root ${toRootHex(block.root)}`);
@@ -294,6 +295,8 @@ async function migrateBlobSidecarsFromHotToColdDb(
294
295
  );
295
296
  })
296
297
  .map(async (block) => {
298
+ // Here we assume the blob sidecars are already in the hot db
299
+ // instead of checking first the block input cache
297
300
  const bytes = await db.blobSidecars.getBinary(block.root);
298
301
  if (!bytes) {
299
302
  throw Error(`No blobSidecars found for slot ${block.slot} root ${toRootHex(block.root)}`);
@@ -343,6 +346,7 @@ async function migrateDataColumnSidecarsFromHotToColdDb(
343
346
  continue;
344
347
  }
345
348
 
349
+ // Here we assume the data column sidecars are already in the hot db
346
350
  const dataColumnSidecarBytes = await fromAsync(db.dataColumnSidecar.valuesStreamBinary(block.root));
347
351
  // there could be 0 dataColumnSidecarBytes if block has no blob
348
352
  logger.verbose("migrateDataColumnSidecarsFromHotToColdDb", {
@@ -1,4 +1,4 @@
1
- import {ForkName, ForkPostFulu, ForkPreDeneb, ForkPreGloas} from "@lodestar/params";
1
+ import {ForkName, ForkPostFulu, ForkPreDeneb, ForkPreGloas, NUMBER_OF_COLUMNS} from "@lodestar/params";
2
2
  import {BeaconBlockBody, BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
3
3
  import {fromHex, prettyBytes, toRootHex, withTimeout} from "@lodestar/utils";
4
4
  import {VersionedHashes} from "../../../execution/index.js";
@@ -412,6 +412,10 @@ export class BlockInputBlobs extends AbstractBlockInput<ForkBlobsDA, deneb.BlobS
412
412
  return this.blobsCache.has(blobIndex);
413
413
  }
414
414
 
415
+ getBlob(blobIndex: BlobIndex): deneb.BlobSidecar | undefined {
416
+ return this.blobsCache.get(blobIndex)?.blobSidecar;
417
+ }
418
+
415
419
  addBlob(
416
420
  {blockRootHex, blobSidecar, source, peerIdStr, seenTimestampSec}: AddBlob,
417
421
  opts = {throwOnDuplicateAdd: true}
@@ -557,6 +561,7 @@ type BlockInputColumnsState =
557
561
  | {
558
562
  hasBlock: true;
559
563
  hasAllData: true;
564
+ hasComputedAllData: boolean;
560
565
  versionedHashes: VersionedHashes;
561
566
  block: SignedBeaconBlock<ForkColumnsDA>;
562
567
  source: SourceMeta;
@@ -565,6 +570,7 @@ type BlockInputColumnsState =
565
570
  | {
566
571
  hasBlock: true;
567
572
  hasAllData: false;
573
+ hasComputedAllData: false;
568
574
  versionedHashes: VersionedHashes;
569
575
  block: SignedBeaconBlock<ForkColumnsDA>;
570
576
  source: SourceMeta;
@@ -572,11 +578,13 @@ type BlockInputColumnsState =
572
578
  | {
573
579
  hasBlock: false;
574
580
  hasAllData: true;
581
+ hasComputedAllData: boolean;
575
582
  versionedHashes: VersionedHashes;
576
583
  }
577
584
  | {
578
585
  hasBlock: false;
579
586
  hasAllData: false;
587
+ hasComputedAllData: false;
580
588
  versionedHashes: VersionedHashes;
581
589
  };
582
590
  /**
@@ -594,6 +602,12 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
594
602
  private columnsCache = new Map<ColumnIndex, ColumnWithSource>();
595
603
  private readonly sampledColumns: ColumnIndex[];
596
604
  private readonly custodyColumns: ColumnIndex[];
605
+ /**
606
+ * This promise resolves when all sampled columns are available
607
+ *
608
+ * This is different from `dataPromise` which resolves when all data is available or could become available (e.g. through reconstruction)
609
+ */
610
+ protected computedDataPromise = createPromise<fulu.DataColumnSidecars>();
597
611
 
598
612
  private constructor(
599
613
  init: BlockInputInit,
@@ -622,6 +636,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
622
636
  const state = {
623
637
  hasBlock: true,
624
638
  hasAllData,
639
+ hasComputedAllData: hasAllData,
625
640
  versionedHashes: props.block.message.body.blobKzgCommitments.map(kzgCommitmentToVersionedHash),
626
641
  block: props.block,
627
642
  source: {
@@ -645,6 +660,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
645
660
  blockInput.blockPromise.resolve(props.block);
646
661
  if (hasAllData) {
647
662
  blockInput.dataPromise.resolve([]);
663
+ blockInput.computedDataPromise.resolve([]);
648
664
  }
649
665
  return blockInput;
650
666
  }
@@ -657,6 +673,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
657
673
  const state: BlockInputColumnsState = {
658
674
  hasBlock: false,
659
675
  hasAllData,
676
+ hasComputedAllData: hasAllData as false,
660
677
  versionedHashes: props.columnSidecar.kzgCommitments.map(kzgCommitmentToVersionedHash),
661
678
  };
662
679
  const init: BlockInputInit = {
@@ -670,6 +687,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
670
687
  const blockInput = new BlockInputColumns(init, state, props.sampledColumns, props.custodyColumns);
671
688
  if (hasAllData) {
672
689
  blockInput.dataPromise.resolve([]);
690
+ blockInput.computedDataPromise.resolve([]);
673
691
  }
674
692
  return blockInput;
675
693
  }
@@ -718,11 +736,14 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
718
736
  const hasAllData =
719
737
  (props.block.message.body as BeaconBlockBody<ForkPostFulu & ForkPreGloas>).blobKzgCommitments.length === 0 ||
720
738
  this.state.hasAllData;
739
+ const hasComputedAllData =
740
+ props.block.message.body.blobKzgCommitments.length === 0 || this.state.hasComputedAllData;
721
741
 
722
742
  this.state = {
723
743
  ...this.state,
724
744
  hasBlock: true,
725
745
  hasAllData,
746
+ hasComputedAllData,
726
747
  block: props.block,
727
748
  source: {
728
749
  source: props.source,
@@ -770,23 +791,42 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
770
791
  this.columnsCache.set(columnSidecar.index, {columnSidecar, source, seenTimestampSec, peerIdStr});
771
792
 
772
793
  const sampledColumns = this.getSampledColumns();
773
- const hasAllData = this.state.hasAllData || sampledColumns.length === this.sampledColumns.length;
794
+ const hasAllData =
795
+ // already hasAllData
796
+ this.state.hasAllData ||
797
+ // has all sampled columns
798
+ sampledColumns.length === this.sampledColumns.length ||
799
+ // has enough columns to reconstruct the rest
800
+ this.columnsCache.size >= NUMBER_OF_COLUMNS / 2;
801
+
802
+ const hasComputedAllData =
803
+ // has all sampled columns
804
+ sampledColumns.length === this.sampledColumns.length;
774
805
 
775
806
  this.state = {
776
807
  ...this.state,
777
808
  hasAllData: hasAllData || this.state.hasAllData,
809
+ hasComputedAllData: hasComputedAllData || this.state.hasComputedAllData,
778
810
  timeCompleteSec: hasAllData ? seenTimestampSec : undefined,
779
811
  } as BlockInputColumnsState;
780
812
 
781
813
  if (hasAllData && sampledColumns !== null) {
782
814
  this.dataPromise.resolve(sampledColumns);
783
815
  }
816
+
817
+ if (hasComputedAllData && sampledColumns !== null) {
818
+ this.computedDataPromise.resolve(sampledColumns);
819
+ }
784
820
  }
785
821
 
786
822
  hasColumn(columnIndex: number): boolean {
787
823
  return this.columnsCache.has(columnIndex);
788
824
  }
789
825
 
826
+ getColumn(columnIndex: number): fulu.DataColumnSidecar | undefined {
827
+ return this.columnsCache.get(columnIndex)?.columnSidecar;
828
+ }
829
+
790
830
  getVersionedHashes(): VersionedHashes {
791
831
  return this.state.versionedHashes;
792
832
  }
@@ -851,4 +891,15 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
851
891
  versionedHashes: this.state.versionedHashes,
852
892
  };
853
893
  }
894
+
895
+ hasComputedAllData(): boolean {
896
+ return this.state.hasComputedAllData;
897
+ }
898
+
899
+ waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<fulu.DataColumnSidecars> {
900
+ if (!this.state.hasComputedAllData) {
901
+ return withTimeout(() => this.computedDataPromise.promise, timeout, signal);
902
+ }
903
+ return Promise.resolve(this.getSampledColumns());
904
+ }
854
905
  }
@@ -30,11 +30,10 @@ import type {BeaconChain} from "../chain.js";
30
30
  import {ChainEvent, ReorgEventData} from "../emitter.js";
31
31
  import {ForkchoiceCaller} from "../forkChoice/index.js";
32
32
  import {REPROCESS_MIN_TIME_TO_NEXT_SLOT_SEC} from "../reprocess.js";
33
- import {toCheckpointHex} from "../stateCache/index.js";
33
+ import {toCheckpointHex} from "../stateCache/persistentCheckpointsCache.js";
34
34
  import {isBlockInputBlobs, isBlockInputColumns} from "./blockInput/blockInput.js";
35
35
  import {AttestationImportOpt, FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
36
36
  import {getCheckpointFromState} from "./utils/checkpoint.js";
37
- import {writeBlockInputToDb} from "./writeBlockInputToDb.js";
38
37
 
39
38
  /**
40
39
  * Fork-choice allows to import attestations from current (0) or past (1) epoch.
@@ -91,11 +90,8 @@ export async function importBlock(
91
90
  throw Error("Unavailable block can not be imported in forkchoice");
92
91
  }
93
92
 
94
- // 1. Persist block to hot DB (pre-emptively)
95
- // If eagerPersistBlock = true we do that in verifyBlocksInEpoch to batch all I/O operations to save block time to head
96
- if (!opts.eagerPersistBlock) {
97
- await writeBlockInputToDb.call(this, [blockInput]);
98
- }
93
+ // 1. Persist block to hot DB (performed asynchronously to avoid blocking head selection)
94
+ void this.unfinalizedBlockWrites.push([blockInput]);
99
95
 
100
96
  // Without forcefully clearing this cache, we would rely on WeakMap to evict memory which is not reliable
101
97
  this.serializedCache.clear();
@@ -11,7 +11,6 @@ import {FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
11
11
  import {assertLinearChainSegment} from "./utils/chainSegment.js";
12
12
  import {verifyBlocksInEpoch} from "./verifyBlock.js";
13
13
  import {verifyBlocksSanityChecks} from "./verifyBlocksSanityChecks.js";
14
- import {removeEagerlyPersistedBlockInputs} from "./writeBlockInputToDb.js";
15
14
 
16
15
  export {AttestationImportOpt, type ImportBlockOpts} from "./types.js";
17
16
 
@@ -143,24 +142,6 @@ export async function processBlocks(
143
142
  }
144
143
  }
145
144
 
146
- // Clean db if we don't have blocks in forkchoice but already persisted them to db
147
- //
148
- // NOTE: this function is awaited to ensure that DB size remains constant, otherwise an attacker may bloat the
149
- // disk with big malicious payloads. Our sequential block importer will wait for this promise before importing
150
- // another block. The removal call error is not propagated since that would halt the chain.
151
- //
152
- // LOG: Because the error is not propagated and there's a risk of db bloat, the error is logged at warn level
153
- // to alert the user of potential db bloat. This error _should_ never happen user must act and report to us
154
- if (opts.eagerPersistBlock) {
155
- await removeEagerlyPersistedBlockInputs.call(this, blocks).catch((e) => {
156
- this.logger.warn(
157
- "Error pruning eagerly imported block inputs, DB may grow in size if this error happens frequently",
158
- {slot: blocks.map((block) => block.getBlock().message.slot).join(",")},
159
- e
160
- );
161
- });
162
- }
163
-
164
145
  throw err;
165
146
  }
166
147
  }