@lodestar/beacon-node 1.40.0-dev.c975f70481 → 1.40.0-dev.cfd894719f

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 (334) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +8 -18
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/debug/index.d.ts +1 -1
  5. package/lib/api/impl/debug/index.d.ts.map +1 -1
  6. package/lib/api/impl/debug/index.js +3 -6
  7. package/lib/api/impl/debug/index.js.map +1 -1
  8. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  9. package/lib/api/impl/lodestar/index.js +5 -2
  10. package/lib/api/impl/lodestar/index.js.map +1 -1
  11. package/lib/api/impl/validator/index.d.ts.map +1 -1
  12. package/lib/api/impl/validator/index.js +9 -8
  13. package/lib/api/impl/validator/index.js.map +1 -1
  14. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  15. package/lib/chain/archiveStore/utils/archiveBlocks.js +4 -0
  16. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  17. package/lib/chain/blocks/blockInput/blockInput.d.ts +2 -0
  18. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  19. package/lib/chain/blocks/blockInput/blockInput.js +6 -0
  20. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  21. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  22. package/lib/chain/blocks/importBlock.js +2 -6
  23. package/lib/chain/blocks/importBlock.js.map +1 -1
  24. package/lib/chain/blocks/index.d.ts.map +1 -1
  25. package/lib/chain/blocks/index.js +0 -14
  26. package/lib/chain/blocks/index.js.map +1 -1
  27. package/lib/chain/blocks/types.d.ts +0 -2
  28. package/lib/chain/blocks/types.d.ts.map +1 -1
  29. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  30. package/lib/chain/blocks/verifyBlock.js +1 -8
  31. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  32. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  33. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  34. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  35. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  36. package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
  37. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  38. package/lib/chain/blocks/writeBlockInputToDb.js +20 -28
  39. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  40. package/lib/chain/bls/multithread/index.d.ts +3 -1
  41. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  42. package/lib/chain/bls/multithread/index.js +5 -3
  43. package/lib/chain/bls/multithread/index.js.map +1 -1
  44. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  45. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  46. package/lib/chain/bls/multithread/jobItem.js +2 -2
  47. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  48. package/lib/chain/bls/singleThread.d.ts +4 -2
  49. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  50. package/lib/chain/bls/singleThread.js +4 -2
  51. package/lib/chain/bls/singleThread.js.map +1 -1
  52. package/lib/chain/bls/utils.d.ts +2 -2
  53. package/lib/chain/bls/utils.d.ts.map +1 -1
  54. package/lib/chain/bls/utils.js +9 -6
  55. package/lib/chain/bls/utils.js.map +1 -1
  56. package/lib/chain/chain.d.ts +21 -4
  57. package/lib/chain/chain.d.ts.map +1 -1
  58. package/lib/chain/chain.js +180 -15
  59. package/lib/chain/chain.js.map +1 -1
  60. package/lib/chain/errors/attestationError.d.ts +14 -1
  61. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  62. package/lib/chain/errors/attestationError.js +8 -0
  63. package/lib/chain/errors/attestationError.js.map +1 -1
  64. package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
  65. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
  66. package/lib/chain/errors/executionPayloadBid.js +15 -0
  67. package/lib/chain/errors/executionPayloadBid.js.map +1 -0
  68. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  69. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
  70. package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
  71. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
  72. package/lib/chain/errors/index.d.ts +3 -0
  73. package/lib/chain/errors/index.d.ts.map +1 -1
  74. package/lib/chain/errors/index.js +3 -0
  75. package/lib/chain/errors/index.js.map +1 -1
  76. package/lib/chain/errors/payloadAttestation.d.ts +34 -0
  77. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
  78. package/lib/chain/errors/payloadAttestation.js +13 -0
  79. package/lib/chain/errors/payloadAttestation.js.map +1 -0
  80. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  81. package/lib/chain/forkChoice/index.js +18 -0
  82. package/lib/chain/forkChoice/index.js.map +1 -1
  83. package/lib/chain/interface.d.ts +21 -3
  84. package/lib/chain/interface.d.ts.map +1 -1
  85. package/lib/chain/interface.js.map +1 -1
  86. package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
  87. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
  88. package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
  89. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
  90. package/lib/chain/opPools/index.d.ts +2 -0
  91. package/lib/chain/opPools/index.d.ts.map +1 -1
  92. package/lib/chain/opPools/index.js +2 -0
  93. package/lib/chain/opPools/index.js.map +1 -1
  94. package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
  95. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
  96. package/lib/chain/opPools/payloadAttestationPool.js +109 -0
  97. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
  98. package/lib/chain/prepareNextSlot.js +6 -4
  99. package/lib/chain/prepareNextSlot.js.map +1 -1
  100. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  101. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  102. package/lib/chain/produceBlock/produceBlockBody.js +5 -3
  103. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  104. package/lib/chain/regen/interface.d.ts +3 -8
  105. package/lib/chain/regen/interface.d.ts.map +1 -1
  106. package/lib/chain/regen/interface.js +1 -1
  107. package/lib/chain/regen/interface.js.map +1 -1
  108. package/lib/chain/regen/queued.d.ts +1 -2
  109. package/lib/chain/regen/queued.d.ts.map +1 -1
  110. package/lib/chain/regen/queued.js +2 -16
  111. package/lib/chain/regen/queued.js.map +1 -1
  112. package/lib/chain/regen/regen.d.ts +3 -7
  113. package/lib/chain/regen/regen.d.ts.map +1 -1
  114. package/lib/chain/regen/regen.js +3 -16
  115. package/lib/chain/regen/regen.js.map +1 -1
  116. package/lib/chain/seenCache/index.d.ts +3 -1
  117. package/lib/chain/seenCache/index.d.ts.map +1 -1
  118. package/lib/chain/seenCache/index.js +3 -1
  119. package/lib/chain/seenCache/index.js.map +1 -1
  120. package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
  121. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  122. package/lib/chain/seenCache/seenAttesters.js +5 -0
  123. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  124. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
  125. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
  126. package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
  127. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
  128. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
  129. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
  130. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
  131. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
  132. package/lib/chain/validation/aggregateAndProof.js +35 -14
  133. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  134. package/lib/chain/validation/attestation.d.ts +2 -2
  135. package/lib/chain/validation/attestation.d.ts.map +1 -1
  136. package/lib/chain/validation/attestation.js +27 -8
  137. package/lib/chain/validation/attestation.js.map +1 -1
  138. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  139. package/lib/chain/validation/attesterSlashing.js +1 -1
  140. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  141. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  142. package/lib/chain/validation/blobSidecar.js +3 -3
  143. package/lib/chain/validation/blobSidecar.js.map +1 -1
  144. package/lib/chain/validation/block.d.ts.map +1 -1
  145. package/lib/chain/validation/block.js +5 -4
  146. package/lib/chain/validation/block.js.map +1 -1
  147. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  148. package/lib/chain/validation/dataColumnSidecar.js +3 -3
  149. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  150. package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
  151. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
  152. package/lib/chain/validation/executionPayloadBid.js +103 -0
  153. package/lib/chain/validation/executionPayloadBid.js.map +1 -0
  154. package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
  155. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
  156. package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
  157. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
  158. package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
  159. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
  160. package/lib/chain/validation/payloadAttestationMessage.js +72 -0
  161. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
  162. package/lib/chain/validation/proposerSlashing.js +1 -1
  163. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  164. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
  165. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  166. package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
  167. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  168. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  169. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  170. package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
  171. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  172. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
  173. package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
  174. package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
  175. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  176. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  177. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  178. package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
  179. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  180. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
  181. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  182. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  183. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  184. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  185. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  186. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  187. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  188. package/lib/chain/validation/syncCommittee.js +1 -1
  189. package/lib/chain/validation/syncCommittee.js.map +1 -1
  190. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  191. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
  192. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  193. package/lib/chain/validation/voluntaryExit.js +1 -1
  194. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  195. package/lib/chain/validatorMonitor.d.ts +2 -0
  196. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  197. package/lib/chain/validatorMonitor.js +42 -3
  198. package/lib/chain/validatorMonitor.js.map +1 -1
  199. package/lib/db/repositories/checkpointState.js +0 -1
  200. package/lib/db/repositories/checkpointState.js.map +1 -1
  201. package/lib/metrics/metrics/lodestar.d.ts +27 -0
  202. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  203. package/lib/metrics/metrics/lodestar.js +64 -0
  204. package/lib/metrics/metrics/lodestar.js.map +1 -1
  205. package/lib/network/gossip/interface.d.ts +20 -2
  206. package/lib/network/gossip/interface.d.ts.map +1 -1
  207. package/lib/network/gossip/interface.js +3 -0
  208. package/lib/network/gossip/interface.js.map +1 -1
  209. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  210. package/lib/network/gossip/scoringParameters.js +38 -2
  211. package/lib/network/gossip/scoringParameters.js.map +1 -1
  212. package/lib/network/gossip/topic.d.ts +77 -1
  213. package/lib/network/gossip/topic.d.ts.map +1 -1
  214. package/lib/network/gossip/topic.js +20 -0
  215. package/lib/network/gossip/topic.js.map +1 -1
  216. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  217. package/lib/network/processor/gossipHandlers.js +34 -3
  218. package/lib/network/processor/gossipHandlers.js.map +1 -1
  219. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  220. package/lib/network/processor/gossipQueues/index.js +16 -0
  221. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  222. package/lib/network/processor/index.d.ts.map +1 -1
  223. package/lib/network/processor/index.js +3 -0
  224. package/lib/network/processor/index.js.map +1 -1
  225. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  226. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
  227. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  228. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
  229. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  230. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
  231. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  232. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
  233. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  234. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
  235. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  236. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  237. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
  238. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  239. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
  240. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
  241. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  242. package/lib/network/reqresp/handlers/index.js +2 -2
  243. package/lib/network/reqresp/handlers/index.js.map +1 -1
  244. package/lib/sync/backfill/backfill.js +2 -2
  245. package/lib/sync/backfill/backfill.js.map +1 -1
  246. package/lib/sync/backfill/verify.d.ts +1 -2
  247. package/lib/sync/backfill/verify.d.ts.map +1 -1
  248. package/lib/sync/backfill/verify.js +2 -2
  249. package/lib/sync/backfill/verify.js.map +1 -1
  250. package/lib/sync/range/chain.d.ts.map +1 -1
  251. package/lib/sync/range/chain.js +0 -1
  252. package/lib/sync/range/chain.js.map +1 -1
  253. package/lib/sync/range/range.d.ts.map +1 -1
  254. package/lib/sync/range/range.js +0 -3
  255. package/lib/sync/range/range.js.map +1 -1
  256. package/lib/sync/unknownBlock.d.ts.map +1 -1
  257. package/lib/sync/unknownBlock.js +0 -3
  258. package/lib/sync/unknownBlock.js.map +1 -1
  259. package/package.json +15 -15
  260. package/src/api/impl/beacon/blocks/index.ts +8 -18
  261. package/src/api/impl/debug/index.ts +2 -6
  262. package/src/api/impl/lodestar/index.ts +6 -3
  263. package/src/api/impl/validator/index.ts +12 -11
  264. package/src/chain/archiveStore/utils/archiveBlocks.ts +4 -0
  265. package/src/chain/blocks/blockInput/blockInput.ts +8 -0
  266. package/src/chain/blocks/importBlock.ts +2 -6
  267. package/src/chain/blocks/index.ts +0 -19
  268. package/src/chain/blocks/types.ts +0 -2
  269. package/src/chain/blocks/verifyBlock.ts +0 -9
  270. package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
  271. package/src/chain/blocks/writeBlockInputToDb.ts +24 -30
  272. package/src/chain/bls/multithread/index.ts +7 -4
  273. package/src/chain/bls/multithread/jobItem.ts +7 -3
  274. package/src/chain/bls/singleThread.ts +5 -3
  275. package/src/chain/bls/utils.ts +15 -7
  276. package/src/chain/chain.ts +205 -23
  277. package/src/chain/errors/attestationError.ts +11 -1
  278. package/src/chain/errors/executionPayloadBid.ts +35 -0
  279. package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
  280. package/src/chain/errors/index.ts +3 -0
  281. package/src/chain/errors/payloadAttestation.ts +25 -0
  282. package/src/chain/forkChoice/index.ts +19 -0
  283. package/src/chain/interface.ts +32 -1
  284. package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
  285. package/src/chain/opPools/index.ts +2 -0
  286. package/src/chain/opPools/payloadAttestationPool.ts +157 -0
  287. package/src/chain/prepareNextSlot.ts +6 -6
  288. package/src/chain/produceBlock/produceBlockBody.ts +7 -5
  289. package/src/chain/regen/interface.ts +2 -12
  290. package/src/chain/regen/queued.ts +3 -23
  291. package/src/chain/regen/regen.ts +4 -24
  292. package/src/chain/seenCache/index.ts +3 -1
  293. package/src/chain/seenCache/seenAttesters.ts +5 -0
  294. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
  295. package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
  296. package/src/chain/validation/aggregateAndProof.ts +36 -14
  297. package/src/chain/validation/attestation.ts +33 -16
  298. package/src/chain/validation/attesterSlashing.ts +1 -6
  299. package/src/chain/validation/blobSidecar.ts +2 -7
  300. package/src/chain/validation/block.ts +5 -4
  301. package/src/chain/validation/dataColumnSidecar.ts +2 -7
  302. package/src/chain/validation/executionPayloadBid.ts +140 -0
  303. package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
  304. package/src/chain/validation/payloadAttestationMessage.ts +109 -0
  305. package/src/chain/validation/proposerSlashing.ts +1 -6
  306. package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
  307. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
  308. package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
  309. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
  310. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  311. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
  312. package/src/chain/validation/syncCommittee.ts +1 -1
  313. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
  314. package/src/chain/validation/voluntaryExit.ts +1 -1
  315. package/src/chain/validatorMonitor.ts +52 -3
  316. package/src/db/repositories/checkpointState.ts +1 -1
  317. package/src/metrics/metrics/lodestar.ts +65 -0
  318. package/src/network/gossip/interface.ts +17 -0
  319. package/src/network/gossip/scoringParameters.ts +44 -2
  320. package/src/network/gossip/topic.ts +21 -0
  321. package/src/network/processor/gossipHandlers.ts +48 -3
  322. package/src/network/processor/gossipQueues/index.ts +16 -0
  323. package/src/network/processor/index.ts +3 -0
  324. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
  325. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
  326. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
  327. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
  328. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
  329. package/src/network/reqresp/handlers/index.ts +2 -2
  330. package/src/sync/backfill/backfill.ts +2 -2
  331. package/src/sync/backfill/verify.ts +2 -3
  332. package/src/sync/range/chain.ts +0 -1
  333. package/src/sync/range/range.ts +0 -3
  334. package/src/sync/unknownBlock.ts +0 -3
@@ -37,14 +37,19 @@ import {
37
37
  UintNum64,
38
38
  ValidatorIndex,
39
39
  Wei,
40
+ deneb,
41
+ fulu,
40
42
  isBlindedBeaconBlock,
41
43
  phase0,
42
44
  rewards,
45
+ ssz,
46
+ sszTypesFor,
43
47
  } from "@lodestar/types";
44
48
  import {Logger, fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRootHex} from "@lodestar/utils";
45
49
  import {ProcessShutdownCallback} from "@lodestar/validator";
46
50
  import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
47
51
  import {IBeaconDb} from "../db/index.js";
52
+ import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../db/repositories/blobSidecars.ts";
48
53
  import {BuilderStatus} from "../execution/builder/http.js";
49
54
  import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
50
55
  import {Metrics} from "../metrics/index.js";
@@ -55,12 +60,15 @@ import {CustodyConfig, getValidatorsCustodyRequirement} from "../util/dataColumn
55
60
  import {callInNextEventLoop} from "../util/eventLoop.js";
56
61
  import {ensureDir, writeIfNotExist} from "../util/file.js";
57
62
  import {isOptimisticBlock} from "../util/forkChoice.js";
63
+ import {JobItemQueue} from "../util/queue/itemQueue.ts";
58
64
  import {SerializedCache} from "../util/serializedCache.js";
65
+ import {getSlotFromSignedBeaconBlockSerialized} from "../util/sszBytes.ts";
59
66
  import {ArchiveStore} from "./archiveStore/archiveStore.js";
60
67
  import {CheckpointBalancesCache} from "./balancesCache.js";
61
68
  import {BeaconProposerCache} from "./beaconProposerCache.js";
62
- import {IBlockInput} from "./blocks/blockInput/index.js";
69
+ import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
63
70
  import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
71
+ import {persistBlockInputs} from "./blocks/writeBlockInputToDb.ts";
64
72
  import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
65
73
  import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
66
74
  import {ChainEvent, ChainEventEmitter} from "./emitter.js";
@@ -71,7 +79,9 @@ import {LightClientServer} from "./lightClient/index.js";
71
79
  import {
72
80
  AggregatedAttestationPool,
73
81
  AttestationPool,
82
+ ExecutionPayloadBidPool,
74
83
  OpPool,
84
+ PayloadAttestationPool,
75
85
  SyncCommitteeMessagePool,
76
86
  SyncContributionAndProofPool,
77
87
  } from "./opPools/index.js";
@@ -87,6 +97,9 @@ import {
87
97
  SeenAttesters,
88
98
  SeenBlockProposers,
89
99
  SeenContributionAndProof,
100
+ SeenExecutionPayloadBids,
101
+ SeenExecutionPayloadEnvelopes,
102
+ SeenPayloadAttesters,
90
103
  SeenSyncCommitteeMessages,
91
104
  } from "./seenCache/index.js";
92
105
  import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
@@ -113,6 +126,11 @@ import {ValidatorMonitor} from "./validatorMonitor.js";
113
126
  */
114
127
  const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
115
128
 
129
+ /**
130
+ * The maximum number of pending unfinalized block writes to the database before backpressure is applied.
131
+ */
132
+ const DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES = 32;
133
+
116
134
  export class BeaconChain implements IBeaconChain {
117
135
  readonly genesisTime: UintNum64;
118
136
  readonly genesisValidatorsRoot: Root;
@@ -136,18 +154,24 @@ export class BeaconChain implements IBeaconChain {
136
154
  readonly lightClientServer?: LightClientServer;
137
155
  readonly reprocessController: ReprocessController;
138
156
  readonly archiveStore: ArchiveStore;
157
+ readonly unfinalizedBlockWrites: JobItemQueue<[IBlockInput[]], void>;
139
158
 
140
159
  // Ops pool
141
160
  readonly attestationPool: AttestationPool;
142
161
  readonly aggregatedAttestationPool: AggregatedAttestationPool;
143
162
  readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
144
163
  readonly syncContributionAndProofPool;
164
+ readonly executionPayloadBidPool: ExecutionPayloadBidPool;
165
+ readonly payloadAttestationPool: PayloadAttestationPool;
145
166
  readonly opPool: OpPool;
146
167
 
147
168
  // Gossip seen cache
148
169
  readonly seenAttesters = new SeenAttesters();
149
170
  readonly seenAggregators = new SeenAggregators();
171
+ readonly seenPayloadAttesters = new SeenPayloadAttesters();
150
172
  readonly seenAggregatedAttestations: SeenAggregatedAttestations;
173
+ readonly seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
174
+ readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
151
175
  readonly seenBlockProposers = new SeenBlockProposers();
152
176
  readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
153
177
  readonly seenContributionAndProof: SeenContributionAndProof;
@@ -254,8 +278,8 @@ export class BeaconChain implements IBeaconChain {
254
278
  const emitter = new ChainEventEmitter();
255
279
  // by default, verify signatures on both main threads and worker threads
256
280
  const bls = opts.blsVerifyAllMainThread
257
- ? new BlsSingleThreadVerifier({metrics})
258
- : new BlsMultiThreadWorkerPool(opts, {logger, metrics});
281
+ ? new BlsSingleThreadVerifier({metrics, index2pubkey})
282
+ : new BlsMultiThreadWorkerPool(opts, {logger, metrics, index2pubkey});
259
283
 
260
284
  if (!clock) clock = new Clock({config, genesisTime: this.genesisTime, signal});
261
285
 
@@ -264,6 +288,8 @@ export class BeaconChain implements IBeaconChain {
264
288
  this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
265
289
  this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
266
290
  this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
291
+ this.executionPayloadBidPool = new ExecutionPayloadBidPool();
292
+ this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
267
293
  this.opPool = new OpPool(config);
268
294
 
269
295
  this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
@@ -405,6 +431,15 @@ export class BeaconChain implements IBeaconChain {
405
431
  signal
406
432
  );
407
433
 
434
+ this.unfinalizedBlockWrites = new JobItemQueue(
435
+ persistBlockInputs.bind(this),
436
+ {
437
+ maxLength: DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES,
438
+ signal,
439
+ },
440
+ metrics?.unfinalizedBlockWritesQueue
441
+ );
442
+
408
443
  // always run PrepareNextSlotScheduler except for fork_choice spec tests
409
444
  if (!opts?.disablePrepareNextSlot) {
410
445
  new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
@@ -430,6 +465,12 @@ export class BeaconChain implements IBeaconChain {
430
465
  async close(): Promise<void> {
431
466
  await this.archiveStore.close();
432
467
  await this.bls.close();
468
+
469
+ // Since we don't persist unfinalized fork-choice,
470
+ // we can abort any ongoing unfinalized block writes.
471
+ // TODO: persist fork choice to disk and allow unfinalized block writes to complete.
472
+ this.unfinalizedBlockWrites.dropAllJobs();
473
+
433
474
  this.abortController.abort();
434
475
  }
435
476
 
@@ -459,6 +500,8 @@ export class BeaconChain implements IBeaconChain {
459
500
  this.seenAttesters.isKnown(epoch, index) ||
460
501
  // seenAggregators = single aggregator index, not participants of the aggregate
461
502
  this.seenAggregators.isKnown(epoch, index) ||
503
+ // seenPayloadAttesters = single signer of payload attestation message
504
+ this.seenPayloadAttesters.isKnown(epoch, index) ||
462
505
  // seenBlockProposers = single block proposer
463
506
  this.seenBlockProposers.seenAtEpoch(epoch, index)
464
507
  );
@@ -501,7 +544,7 @@ export class BeaconChain implements IBeaconChain {
501
544
  // only use regen queue if necessary, it'll cache in checkpointStateCache if regen gets through epoch transition
502
545
  const head = this.forkChoice.getHead();
503
546
  const startSlot = computeStartSlotAtEpoch(epoch);
504
- return this.regen.getBlockSlotState(head.blockRoot, startSlot, {dontTransferCache: true}, regenCaller);
547
+ return this.regen.getBlockSlotState(head, startSlot, {dontTransferCache: true}, regenCaller);
505
548
  }
506
549
 
507
550
  async getStateBySlot(
@@ -519,12 +562,7 @@ export class BeaconChain implements IBeaconChain {
519
562
  if (opts?.allowRegen) {
520
563
  // Find closest canonical block to slot, then trigger regen
521
564
  const block = this.forkChoice.getCanonicalBlockClosestLteSlot(slot) ?? finalizedBlock;
522
- const state = await this.regen.getBlockSlotState(
523
- block.blockRoot,
524
- slot,
525
- {dontTransferCache: true},
526
- RegenCaller.restApi
527
- );
565
+ const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
528
566
  return {
529
567
  state,
530
568
  executionOptimistic: isOptimisticBlock(block),
@@ -652,6 +690,13 @@ export class BeaconChain implements IBeaconChain {
652
690
  // Unfinalized slot, attempt to find in fork-choice
653
691
  const block = this.forkChoice.getCanonicalBlockAtSlot(slot);
654
692
  if (block) {
693
+ // Block found in fork-choice.
694
+ // It may be in the block input cache, awaiting full DA reconstruction, check there first
695
+ // Otherwise (most likely), check the hot db
696
+ const blockInput = this.seenBlockInputCache.get(block.blockRoot);
697
+ if (blockInput?.hasBlock()) {
698
+ return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false};
699
+ }
655
700
  const data = await this.db.block.get(fromHex(block.blockRoot));
656
701
  if (data) {
657
702
  return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false};
@@ -671,6 +716,13 @@ export class BeaconChain implements IBeaconChain {
671
716
  ): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null> {
672
717
  const block = this.forkChoice.getBlockHex(root);
673
718
  if (block) {
719
+ // Block found in fork-choice.
720
+ // It may be in the block input cache, awaiting full DA reconstruction, check there first
721
+ // Otherwise (most likely), check the hot db
722
+ const blockInput = this.seenBlockInputCache.get(block.blockRoot);
723
+ if (blockInput?.hasBlock()) {
724
+ return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false};
725
+ }
674
726
  const data = await this.db.block.get(fromHex(root));
675
727
  if (data) {
676
728
  return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false};
@@ -683,10 +735,137 @@ export class BeaconChain implements IBeaconChain {
683
735
  return data && {block: data, executionOptimistic: false, finalized: true};
684
736
  }
685
737
 
738
+ async getSerializedBlockByRoot(
739
+ root: string
740
+ ): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null> {
741
+ const block = this.forkChoice.getBlockHex(root);
742
+ if (block) {
743
+ // Block found in fork-choice.
744
+ // It may be in the block input cache, awaiting full DA reconstruction, check there first
745
+ // Otherwise (most likely), check the hot db
746
+ const blockInput = this.seenBlockInputCache.get(block.blockRoot);
747
+ if (blockInput?.hasBlock()) {
748
+ const signedBlock = blockInput.getBlock();
749
+ const serialized = this.serializedCache.get(signedBlock);
750
+ if (serialized) {
751
+ return {
752
+ block: serialized,
753
+ executionOptimistic: isOptimisticBlock(block),
754
+ finalized: false,
755
+ slot: blockInput.slot,
756
+ };
757
+ }
758
+ return {
759
+ block: sszTypesFor(blockInput.forkName).SignedBeaconBlock.serialize(signedBlock),
760
+ executionOptimistic: isOptimisticBlock(block),
761
+ finalized: false,
762
+ slot: blockInput.slot,
763
+ };
764
+ }
765
+ const data = await this.db.block.getBinary(fromHex(root));
766
+ if (data) {
767
+ const slot = getSlotFromSignedBeaconBlockSerialized(data);
768
+ if (slot === null) throw new Error(`Invalid block data stored in DB for root: ${root}`);
769
+ return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false, slot};
770
+ }
771
+ // If block is not found in hot db, try cold db since there could be an archive cycle happening
772
+ // TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
773
+ }
774
+
775
+ const data = await this.db.blockArchive.getBinaryEntryByRoot(fromHex(root));
776
+ return data && {block: data.value, executionOptimistic: false, finalized: true, slot: data.key};
777
+ }
778
+
779
+ async getBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<deneb.BlobSidecars | null> {
780
+ const blockInput = this.seenBlockInputCache.get(blockRootHex);
781
+ if (blockInput) {
782
+ if (!isBlockInputBlobs(blockInput)) {
783
+ throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
784
+ }
785
+ if (!blockInput.hasAllData()) {
786
+ return null;
787
+ }
788
+ return blockInput.getBlobs();
789
+ }
790
+ const unfinalizedBlobSidecars = (await this.db.blobSidecars.get(fromHex(blockRootHex)))?.blobSidecars ?? null;
791
+ if (unfinalizedBlobSidecars) {
792
+ return unfinalizedBlobSidecars;
793
+ }
794
+ return (await this.db.blobSidecarsArchive.get(blockSlot))?.blobSidecars ?? null;
795
+ }
796
+
797
+ async getSerializedBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
798
+ const blockInput = this.seenBlockInputCache.get(blockRootHex);
799
+ if (blockInput) {
800
+ if (!isBlockInputBlobs(blockInput)) {
801
+ throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
802
+ }
803
+ if (!blockInput.hasAllData()) {
804
+ return null;
805
+ }
806
+ return ssz.deneb.BlobSidecars.serialize(blockInput.getBlobs());
807
+ }
808
+ const unfinalizedBlobSidecarsWrapper = await this.db.blobSidecars.getBinary(fromHex(blockRootHex));
809
+ if (unfinalizedBlobSidecarsWrapper) {
810
+ return unfinalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
811
+ }
812
+ const finalizedBlobSidecarsWrapper = await this.db.blobSidecarsArchive.getBinary(blockSlot);
813
+ if (finalizedBlobSidecarsWrapper) {
814
+ return finalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
815
+ }
816
+ return null;
817
+ }
818
+
819
+ async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<fulu.DataColumnSidecars> {
820
+ const blockInput = this.seenBlockInputCache.get(blockRootHex);
821
+ if (blockInput) {
822
+ if (!isBlockInputColumns(blockInput)) {
823
+ throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
824
+ }
825
+ return blockInput.getAllColumns();
826
+ }
827
+ const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
828
+ if (sidecarsUnfinalized.length > 0) {
829
+ return sidecarsUnfinalized;
830
+ }
831
+ const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
832
+ return sidecarsFinalized;
833
+ }
834
+
835
+ async getSerializedDataColumnSidecars(
836
+ blockSlot: Slot,
837
+ blockRootHex: string,
838
+ indices: number[]
839
+ ): Promise<(Uint8Array | undefined)[]> {
840
+ const blockInput = this.seenBlockInputCache.get(blockRootHex);
841
+ if (blockInput) {
842
+ if (!isBlockInputColumns(blockInput)) {
843
+ throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
844
+ }
845
+ return indices.map((index) => {
846
+ const sidecar = blockInput.getColumn(index);
847
+ if (!sidecar) {
848
+ return undefined;
849
+ }
850
+ const serialized = this.serializedCache.get(sidecar);
851
+ if (serialized) {
852
+ return serialized;
853
+ }
854
+ return ssz.fulu.DataColumnSidecar.serialize(sidecar);
855
+ });
856
+ }
857
+ const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
858
+ if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
859
+ return sidecarsUnfinalized;
860
+ }
861
+ const sidecarsFinalized = await this.db.dataColumnSidecarArchive.getManyBinary(blockSlot, indices);
862
+ return sidecarsFinalized;
863
+ }
864
+
686
865
  async produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody> {
687
- const {slot, parentBlockRoot} = blockAttributes;
866
+ const {slot, parentBlock} = blockAttributes;
688
867
  const state = await this.regen.getBlockSlotState(
689
- toRootHex(parentBlockRoot),
868
+ parentBlock,
690
869
  slot,
691
870
  {dontTransferCache: true},
692
871
  RegenCaller.produceBlock
@@ -723,7 +902,7 @@ export class BeaconChain implements IBeaconChain {
723
902
  slot,
724
903
  feeRecipient,
725
904
  commonBlockBodyPromise,
726
- parentBlockRoot,
905
+ parentBlock,
727
906
  }: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}
728
907
  ): Promise<{
729
908
  block: AssembledBlockType<T>;
@@ -732,7 +911,7 @@ export class BeaconChain implements IBeaconChain {
732
911
  shouldOverrideBuilder?: boolean;
733
912
  }> {
734
913
  const state = await this.regen.getBlockSlotState(
735
- toRootHex(parentBlockRoot),
914
+ parentBlock,
736
915
  slot,
737
916
  {dontTransferCache: true},
738
917
  RegenCaller.produceBlock
@@ -749,7 +928,7 @@ export class BeaconChain implements IBeaconChain {
749
928
  graffiti,
750
929
  slot,
751
930
  feeRecipient,
752
- parentBlockRoot,
931
+ parentBlock,
753
932
  proposerIndex,
754
933
  proposerPubKey,
755
934
  commonBlockBodyPromise,
@@ -772,7 +951,7 @@ export class BeaconChain implements IBeaconChain {
772
951
  const block = {
773
952
  slot,
774
953
  proposerIndex,
775
- parentRoot: parentBlockRoot,
954
+ parentRoot: fromHex(parentBlock.blockRoot),
776
955
  stateRoot: ZERO_HASH,
777
956
  body,
778
957
  } as AssembledBlockType<T>;
@@ -968,12 +1147,7 @@ export class BeaconChain implements IBeaconChain {
968
1147
  // thanks to one epoch look ahead, we don't need to dial up to attEpoch
969
1148
  const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
970
1149
  this.metrics?.gossipAttestation.useHeadBlockStateDialedToTargetEpoch.inc({caller: regenCaller});
971
- state = await this.regen.getBlockSlotState(
972
- attHeadBlock.blockRoot,
973
- targetSlot,
974
- {dontTransferCache: true},
975
- regenCaller
976
- );
1150
+ state = await this.regen.getBlockSlotState(attHeadBlock, targetSlot, {dontTransferCache: true}, regenCaller);
977
1151
  } else if (blockEpoch > attEpoch) {
978
1152
  // should not happen, handled inside attestation verification code
979
1153
  throw Error(`Block epoch ${blockEpoch} is after attestation epoch ${attEpoch}`);
@@ -1102,6 +1276,8 @@ export class BeaconChain implements IBeaconChain {
1102
1276
  metrics.opPool.proposerSlashingPoolSize.set(this.opPool.proposerSlashingsSize);
1103
1277
  metrics.opPool.voluntaryExitPoolSize.set(this.opPool.voluntaryExitsSize);
1104
1278
  metrics.opPool.syncCommitteeMessagePoolSize.set(this.syncCommitteeMessagePool.size);
1279
+ metrics.opPool.payloadAttestationPool.size.set(this.payloadAttestationPool.size);
1280
+ metrics.opPool.executionPayloadBidPool.size.set(this.executionPayloadBidPool.size);
1105
1281
  // syncContributionAndProofPool tracks metrics on its own
1106
1282
  metrics.opPool.blsToExecutionChangePoolSize.set(this.opPool.blsToExecutionChangeSize);
1107
1283
  metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
@@ -1132,6 +1308,9 @@ export class BeaconChain implements IBeaconChain {
1132
1308
  this.aggregatedAttestationPool.prune(slot);
1133
1309
  this.syncCommitteeMessagePool.prune(slot);
1134
1310
  this.seenSyncCommitteeMessages.prune(slot);
1311
+ this.payloadAttestationPool.prune(slot);
1312
+ this.executionPayloadBidPool.prune(slot);
1313
+ this.seenExecutionPayloadBids.prune(slot);
1135
1314
  this.seenAttestationDatas.onSlot(slot);
1136
1315
  this.reprocessController.onSlot(slot);
1137
1316
 
@@ -1155,6 +1334,7 @@ export class BeaconChain implements IBeaconChain {
1155
1334
 
1156
1335
  this.seenAttesters.prune(epoch);
1157
1336
  this.seenAggregators.prune(epoch);
1337
+ this.seenPayloadAttesters.prune(epoch);
1158
1338
  this.seenAggregatedAttestations.prune(epoch);
1159
1339
  this.seenBlockAttesters.prune(epoch);
1160
1340
  this.beaconProposerCache.prune(epoch);
@@ -1178,7 +1358,9 @@ export class BeaconChain implements IBeaconChain {
1178
1358
 
1179
1359
  private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithHex): Promise<void> {
1180
1360
  this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
1181
- this.seenBlockProposers.prune(computeStartSlotAtEpoch(cp.epoch));
1361
+ const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
1362
+ this.seenBlockProposers.prune(finalizedSlot);
1363
+ this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
1182
1364
 
1183
1365
  // Update validator custody to account for effective balance changes
1184
1366
  await this.updateValidatorsCustodyRequirement(cp);
@@ -139,6 +139,14 @@ export enum AttestationErrorCode {
139
139
  * Electra: Attester not in committee
140
140
  */
141
141
  ATTESTER_NOT_IN_COMMITTEE = "ATTESTATION_ERROR_ATTESTER_NOT_IN_COMMITTEE",
142
+ /**
143
+ * Gloas: Invalid attestationData index: is non-zero and non-one
144
+ */
145
+ INVALID_PAYLOAD_STATUS_VALUE = "ATTESTATION_ERROR_INVALID_PAYLOAD_STATUS_VALUE",
146
+ /**
147
+ * Gloas: Current slot attestation is marking payload as present
148
+ */
149
+ PREMATURELY_INDICATED_PAYLOAD_PRESENT = "ATTESTATION_ERROR_PREMATURELY_INDICATED_PAYLOAD_PRESENT",
142
150
  }
143
151
 
144
152
  export type AttestationErrorType =
@@ -175,7 +183,9 @@ export type AttestationErrorType =
175
183
  | {code: AttestationErrorCode.TOO_MANY_SKIPPED_SLOTS; headBlockSlot: Slot; attestationSlot: Slot}
176
184
  | {code: AttestationErrorCode.NOT_EXACTLY_ONE_COMMITTEE_BIT_SET}
177
185
  | {code: AttestationErrorCode.NON_ZERO_ATTESTATION_DATA_INDEX}
178
- | {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE};
186
+ | {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE}
187
+ | {code: AttestationErrorCode.INVALID_PAYLOAD_STATUS_VALUE; attDataIndex: number}
188
+ | {code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT};
179
189
 
180
190
  export class AttestationError extends GossipActionError<AttestationErrorType> {
181
191
  getMetadata(): Record<string, string | number | null> {
@@ -0,0 +1,35 @@
1
+ import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
2
+ import {GossipActionError} from "./gossipValidation.ts";
3
+
4
+ export enum ExecutionPayloadBidErrorCode {
5
+ BUILDER_NOT_ELIGIBLE = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_NOT_ELIGIBLE",
6
+ NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
7
+ BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
8
+ BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
9
+ BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
10
+ UNKNOWN_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_BLOCK_ROOT",
11
+ INVALID_SLOT = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SLOT",
12
+ INVALID_SIGNATURE = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SIGNATURE",
13
+ }
14
+
15
+ export type ExecutionPayloadBidErrorType =
16
+ | {code: ExecutionPayloadBidErrorCode.BUILDER_NOT_ELIGIBLE; builderIndex: BuilderIndex}
17
+ | {
18
+ code: ExecutionPayloadBidErrorCode.NON_ZERO_EXECUTION_PAYMENT;
19
+ builderIndex: BuilderIndex;
20
+ executionPayment: number;
21
+ }
22
+ | {
23
+ code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
24
+ builderIndex: BuilderIndex;
25
+ slot: Slot;
26
+ parentBlockRoot: RootHex;
27
+ parentBlockHash: RootHex;
28
+ }
29
+ | {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
30
+ | {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}
31
+ | {code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT; parentBlockRoot: RootHex}
32
+ | {code: ExecutionPayloadBidErrorCode.INVALID_SLOT; builderIndex: BuilderIndex; slot: Slot}
33
+ | {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot};
34
+
35
+ export class ExecutionPayloadBidError extends GossipActionError<ExecutionPayloadBidErrorType> {}
@@ -0,0 +1,34 @@
1
+ import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
2
+ import {GossipActionError} from "./gossipValidation.js";
3
+
4
+ export enum ExecutionPayloadEnvelopeErrorCode {
5
+ BELONG_TO_FINALIZED_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BELONG_TO_FINALIZED_BLOCK",
6
+ BLOCK_ROOT_UNKNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_ROOT_UNKNOWN",
7
+ ENVELOPE_ALREADY_KNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_ALREADY_KNOWN",
8
+ INVALID_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK",
9
+ SLOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISMATCH",
10
+ BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
11
+ BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
12
+ INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
13
+ CACHE_FAIL = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_CACHE_FAIL",
14
+ }
15
+ export type ExecutionPayloadEnvelopeErrorType =
16
+ | {code: ExecutionPayloadEnvelopeErrorCode.BELONG_TO_FINALIZED_BLOCK; envelopeSlot: Slot; finalizedSlot: Slot}
17
+ | {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN; blockRoot: RootHex}
18
+ | {
19
+ code: ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN;
20
+ blockRoot: RootHex;
21
+ slot: Slot;
22
+ }
23
+ | {code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK; blockRoot: RootHex}
24
+ | {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH; envelopeSlot: Slot; blockSlot: Slot}
25
+ | {
26
+ code: ExecutionPayloadEnvelopeErrorCode.BUILDER_INDEX_MISMATCH;
27
+ envelopeBuilderIndex: BuilderIndex;
28
+ bidBuilderIndex: BuilderIndex;
29
+ }
30
+ | {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_HASH_MISMATCH; envelopeBlockHash: RootHex; bidBlockHash: RootHex}
31
+ | {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE}
32
+ | {code: ExecutionPayloadEnvelopeErrorCode.CACHE_FAIL; blockRoot: RootHex};
33
+
34
+ export class ExecutionPayloadEnvelopeError extends GossipActionError<ExecutionPayloadEnvelopeErrorType> {}
@@ -4,7 +4,10 @@ export * from "./blobSidecarError.js";
4
4
  export * from "./blockError.js";
5
5
  export * from "./blsToExecutionChangeError.js";
6
6
  export * from "./dataColumnSidecarError.js";
7
+ export * from "./executionPayloadBid.js";
8
+ export * from "./executionPayloadEnvelope.js";
7
9
  export * from "./gossipValidation.js";
10
+ export * from "./payloadAttestation.js";
8
11
  export * from "./proposerSlashingError.js";
9
12
  export * from "./syncCommitteeError.js";
10
13
  export * from "./voluntaryExitError.js";
@@ -0,0 +1,25 @@
1
+ import {RootHex, Slot, ValidatorIndex} from "@lodestar/types";
2
+ import {GossipActionError} from "./gossipValidation.ts";
3
+
4
+ export enum PayloadAttestationErrorCode {
5
+ NOT_CURRENT_SLOT = "PAYLOAD_ATTESTATION_ERROR_NOT_CURRENT_SLOT",
6
+ PAYLOAD_ATTESTATION_ALREADY_KNOWN = "PAYLOAD_ATTESTATION_ERROR_PAYLOAD_ATTESTATION_ALREADY_KNOWN",
7
+ UNKNOWN_BLOCK_ROOT = "PAYLOAD_ATTESTATION_ERROR_UNKNOWN_BLOCK_ROOT",
8
+ INVALID_BLOCK = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK",
9
+ INVALID_ATTESTER = "PAYLOAD_ATTESTATION_ERROR_INVALID_ATTESTER",
10
+ INVALID_SIGNATURE = "PAYLOAD_ATTESTATION_ERROR_INVALID_SIGNATURE",
11
+ }
12
+ export type PayloadAttestationErrorType =
13
+ | {code: PayloadAttestationErrorCode.NOT_CURRENT_SLOT; currentSlot: Slot; slot: Slot}
14
+ | {
15
+ code: PayloadAttestationErrorCode.PAYLOAD_ATTESTATION_ALREADY_KNOWN;
16
+ validatorIndex: ValidatorIndex;
17
+ slot: Slot;
18
+ blockRoot: RootHex;
19
+ }
20
+ | {code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT; blockRoot: RootHex}
21
+ | {code: PayloadAttestationErrorCode.INVALID_BLOCK; blockRoot: RootHex}
22
+ | {code: PayloadAttestationErrorCode.INVALID_ATTESTER; attesterIndex: ValidatorIndex}
23
+ | {code: PayloadAttestationErrorCode.INVALID_SIGNATURE};
24
+
25
+ export class PayloadAttestationError extends GossipActionError<PayloadAttestationErrorType> {}
@@ -11,6 +11,7 @@ import {
11
11
  import {ZERO_HASH_HEX} from "@lodestar/params";
12
12
  import {
13
13
  CachedBeaconStateAllForks,
14
+ CachedBeaconStateGloas,
14
15
  DataAvailabilityStatus,
15
16
  computeAnchorCheckpoint,
16
17
  computeEpochAtSlot,
@@ -144,6 +145,15 @@ export function initializeForkChoiceFromFinalizedState(
144
145
  : {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
145
146
 
146
147
  dataAvailabilityStatus: DataAvailabilityStatus.PreData,
148
+ ...(computeEpochAtSlot(blockHeader.slot) < state.config.GLOAS_FORK_EPOCH
149
+ ? {
150
+ builderIndex: undefined,
151
+ blockHashHex: undefined,
152
+ }
153
+ : {
154
+ builderIndex: (state as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex,
155
+ blockHashHex: toRootHex((state as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash),
156
+ }),
147
157
  },
148
158
  currentSlot
149
159
  ),
@@ -225,6 +235,15 @@ export function initializeForkChoiceFromUnfinalizedState(
225
235
  : {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
226
236
 
227
237
  dataAvailabilityStatus: DataAvailabilityStatus.PreData,
238
+ ...(computeEpochAtSlot(blockHeader.slot) < unfinalizedState.config.GLOAS_FORK_EPOCH
239
+ ? {
240
+ builderIndex: undefined,
241
+ blockHashHex: undefined,
242
+ }
243
+ : {
244
+ builderIndex: (unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex,
245
+ blockHashHex: toRootHex((unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash),
246
+ }),
228
247
  };
229
248
 
230
249
  const parentSlot = blockHeader.slot - 1;
@@ -22,6 +22,8 @@ import {
22
22
  Wei,
23
23
  altair,
24
24
  capella,
25
+ deneb,
26
+ fulu,
25
27
  phase0,
26
28
  rewards,
27
29
  } from "@lodestar/types";
@@ -44,7 +46,14 @@ import {ForkchoiceCaller} from "./forkChoice/index.js";
44
46
  import {GetBlobsTracker} from "./GetBlobsTracker.js";
45
47
  import {LightClientServer} from "./lightClient/index.js";
46
48
  import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js";
47
- import {AttestationPool, OpPool, SyncCommitteeMessagePool, SyncContributionAndProofPool} from "./opPools/index.js";
49
+ import {
50
+ AttestationPool,
51
+ ExecutionPayloadBidPool,
52
+ OpPool,
53
+ PayloadAttestationPool,
54
+ SyncCommitteeMessagePool,
55
+ SyncContributionAndProofPool,
56
+ } from "./opPools/index.js";
48
57
  import {IChainOptions} from "./options.js";
49
58
  import {AssembledBlockType, BlockAttributes, BlockType, ProduceResult} from "./produceBlock/produceBlockBody.js";
50
59
  import {IStateRegenerator, RegenCaller} from "./regen/index.js";
@@ -54,6 +63,9 @@ import {
54
63
  SeenAttesters,
55
64
  SeenBlockProposers,
56
65
  SeenContributionAndProof,
66
+ SeenExecutionPayloadBids,
67
+ SeenExecutionPayloadEnvelopes,
68
+ SeenPayloadAttesters,
57
69
  SeenSyncCommitteeMessages,
58
70
  } from "./seenCache/index.js";
59
71
  import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
@@ -114,12 +126,17 @@ export interface IBeaconChain {
114
126
  readonly aggregatedAttestationPool: AggregatedAttestationPool;
115
127
  readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
116
128
  readonly syncContributionAndProofPool: SyncContributionAndProofPool;
129
+ readonly executionPayloadBidPool: ExecutionPayloadBidPool;
130
+ readonly payloadAttestationPool: PayloadAttestationPool;
117
131
  readonly opPool: OpPool;
118
132
 
119
133
  // Gossip seen cache
120
134
  readonly seenAttesters: SeenAttesters;
121
135
  readonly seenAggregators: SeenAggregators;
136
+ readonly seenPayloadAttesters: SeenPayloadAttesters;
122
137
  readonly seenAggregatedAttestations: SeenAggregatedAttestations;
138
+ readonly seenExecutionPayloadEnvelopes: SeenExecutionPayloadEnvelopes;
139
+ readonly seenExecutionPayloadBids: SeenExecutionPayloadBids;
123
140
  readonly seenBlockProposers: SeenBlockProposers;
124
141
  readonly seenSyncCommitteeMessages: SeenSyncCommitteeMessages;
125
142
  readonly seenContributionAndProof: SeenContributionAndProof;
@@ -193,12 +210,26 @@ export interface IBeaconChain {
193
210
  getCanonicalBlockAtSlot(
194
211
  slot: Slot
195
212
  ): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null>;
213
+ /**
214
+ * Get local block by root, does not fetch from the network
215
+ */
216
+ getSerializedBlockByRoot(
217
+ root: RootHex
218
+ ): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null>;
196
219
  /**
197
220
  * Get local block by root, does not fetch from the network
198
221
  */
199
222
  getBlockByRoot(
200
223
  root: RootHex
201
224
  ): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null>;
225
+ getBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<deneb.BlobSidecars | null>;
226
+ getSerializedBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null>;
227
+ getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<fulu.DataColumnSidecars>;
228
+ getSerializedDataColumnSidecars(
229
+ blockSlot: Slot,
230
+ blockRootHex: string,
231
+ indices: number[]
232
+ ): Promise<(Uint8Array | undefined)[]>;
202
233
 
203
234
  produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody>;
204
235
  produceBlock(blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}): Promise<{