@lodestar/beacon-node 1.51.0 → 1.52.0-dev.03eb33e6f1

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 (677) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +99 -127
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +25 -3
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +1 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js +2 -1
  10. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  11. package/lib/api/impl/debug/index.d.ts.map +1 -1
  12. package/lib/api/impl/debug/index.js +6 -2
  13. package/lib/api/impl/debug/index.js.map +1 -1
  14. package/lib/api/impl/validator/index.d.ts +6 -0
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +55 -32
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
  19. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  20. package/lib/chain/ColumnReconstructionTracker.js +4 -0
  21. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  22. package/lib/chain/GetBlobsTracker.d.ts +13 -2
  23. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  24. package/lib/chain/GetBlobsTracker.js +69 -35
  25. package/lib/chain/GetBlobsTracker.js.map +1 -1
  26. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  27. package/lib/chain/archiveStore/archiveStore.js +4 -4
  28. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  29. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  30. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
  31. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  32. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +12 -0
  33. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  34. package/lib/chain/archiveStore/utils/archiveBlocks.js +17 -2
  35. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  36. package/lib/chain/archiveStore/utils/pruneHistory.d.ts +9 -2
  37. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  38. package/lib/chain/archiveStore/utils/pruneHistory.js +19 -7
  39. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  40. package/lib/chain/blocks/blockInput/blockInput.d.ts +11 -56
  41. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  42. package/lib/chain/blocks/blockInput/blockInput.js +8 -242
  43. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  44. package/lib/chain/blocks/blockInput/errors.d.ts +2 -4
  45. package/lib/chain/blocks/blockInput/errors.d.ts.map +1 -1
  46. package/lib/chain/blocks/blockInput/errors.js.map +1 -1
  47. package/lib/chain/blocks/blockInput/types.d.ts +2 -18
  48. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  49. package/lib/chain/blocks/blockInput/types.js +0 -1
  50. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  51. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  52. package/lib/chain/blocks/importBlock.js +36 -53
  53. package/lib/chain/blocks/importBlock.js.map +1 -1
  54. package/lib/chain/blocks/importExecutionPayload.d.ts +11 -12
  55. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  56. package/lib/chain/blocks/importExecutionPayload.js +56 -22
  57. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  58. package/lib/chain/blocks/index.d.ts.map +1 -1
  59. package/lib/chain/blocks/index.js +5 -19
  60. package/lib/chain/blocks/index.js.map +1 -1
  61. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +10 -7
  62. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  63. package/lib/chain/blocks/payloadEnvelopeProcessor.js +22 -17
  64. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  65. package/lib/chain/blocks/types.d.ts +4 -20
  66. package/lib/chain/blocks/types.d.ts.map +1 -1
  67. package/lib/chain/blocks/types.js +0 -24
  68. package/lib/chain/blocks/types.js.map +1 -1
  69. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  70. package/lib/chain/blocks/verifyBlock.js +29 -14
  71. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  72. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +2 -2
  73. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  74. package/lib/chain/blocks/verifyBlocksDataAvailability.js +17 -5
  75. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  76. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
  77. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  78. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +14 -8
  79. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  80. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  81. package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
  82. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  83. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  84. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  85. package/lib/chain/blocks/verifyBlocksSignatures.js +12 -6
  86. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  87. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +2 -2
  88. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  89. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +12 -7
  90. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  91. package/lib/chain/blocks/writeBlockInputToDb.d.ts +0 -2
  92. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  93. package/lib/chain/blocks/writeBlockInputToDb.js +6 -24
  94. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  95. package/lib/chain/bls/interface.d.ts +2 -0
  96. package/lib/chain/bls/interface.d.ts.map +1 -1
  97. package/lib/chain/bls/multithread/index.d.ts +1 -1
  98. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  99. package/lib/chain/bls/multithread/index.js +50 -22
  100. package/lib/chain/bls/multithread/index.js.map +1 -1
  101. package/lib/chain/bls/multithread/types.d.ts +1 -1
  102. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  103. package/lib/chain/bls/multithread/worker.js +1 -1
  104. package/lib/chain/bls/multithread/worker.js.map +1 -1
  105. package/lib/chain/bls/singleThread.js +1 -1
  106. package/lib/chain/bls/singleThread.js.map +1 -1
  107. package/lib/chain/bls/utils.js +2 -2
  108. package/lib/chain/bls/utils.js.map +1 -1
  109. package/lib/chain/chain.d.ts +31 -9
  110. package/lib/chain/chain.d.ts.map +1 -1
  111. package/lib/chain/chain.js +193 -64
  112. package/lib/chain/chain.js.map +1 -1
  113. package/lib/chain/emitter.d.ts +7 -7
  114. package/lib/chain/emitter.d.ts.map +1 -1
  115. package/lib/chain/emitter.js +5 -5
  116. package/lib/chain/emitter.js.map +1 -1
  117. package/lib/chain/errors/attestationError.d.ts +15 -1
  118. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  119. package/lib/chain/errors/attestationError.js +8 -0
  120. package/lib/chain/errors/attestationError.js.map +1 -1
  121. package/lib/chain/errors/blockError.d.ts +1 -1
  122. package/lib/chain/errors/blockError.d.ts.map +1 -1
  123. package/lib/chain/errors/blockError.js +1 -1
  124. package/lib/chain/errors/blockError.js.map +1 -1
  125. package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
  126. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  127. package/lib/chain/errors/executionPayloadBid.js +1 -1
  128. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  129. package/lib/chain/errors/executionPayloadEnvelope.d.ts +55 -0
  130. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  131. package/lib/chain/errors/executionPayloadEnvelope.js +8 -0
  132. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  133. package/lib/chain/errors/index.d.ts +0 -1
  134. package/lib/chain/errors/index.d.ts.map +1 -1
  135. package/lib/chain/errors/index.js +0 -1
  136. package/lib/chain/errors/index.js.map +1 -1
  137. package/lib/chain/forkChoice/index.d.ts +8 -1
  138. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  139. package/lib/chain/forkChoice/index.js +8 -0
  140. package/lib/chain/forkChoice/index.js.map +1 -1
  141. package/lib/chain/forkChoiceExecutionEngine.d.ts +53 -0
  142. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
  143. package/lib/chain/forkChoiceExecutionEngine.js +140 -0
  144. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
  145. package/lib/chain/interface.d.ts +10 -8
  146. package/lib/chain/interface.d.ts.map +1 -1
  147. package/lib/chain/interface.js.map +1 -1
  148. package/lib/chain/lightClient/index.d.ts +13 -6
  149. package/lib/chain/lightClient/index.d.ts.map +1 -1
  150. package/lib/chain/lightClient/index.js +95 -115
  151. package/lib/chain/lightClient/index.js.map +1 -1
  152. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +17 -4
  153. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  154. package/lib/chain/opPools/aggregatedAttestationPool.js +199 -46
  155. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  156. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  157. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  158. package/lib/chain/opPools/attestationPool.js +15 -4
  159. package/lib/chain/opPools/attestationPool.js.map +1 -1
  160. package/lib/chain/opPools/inclusionListStore.d.ts +4 -1
  161. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
  162. package/lib/chain/opPools/inclusionListStore.js +5 -2
  163. package/lib/chain/opPools/inclusionListStore.js.map +1 -1
  164. package/lib/chain/opPools/index.d.ts +1 -0
  165. package/lib/chain/opPools/index.d.ts.map +1 -1
  166. package/lib/chain/opPools/index.js +1 -0
  167. package/lib/chain/opPools/index.js.map +1 -1
  168. package/lib/chain/opPools/opPool.js +6 -6
  169. package/lib/chain/opPools/opPool.js.map +1 -1
  170. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  171. package/lib/chain/opPools/payloadAttestationPool.js +17 -7
  172. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  173. package/lib/chain/opPools/singleAttestationPool.d.ts +77 -0
  174. package/lib/chain/opPools/singleAttestationPool.d.ts.map +1 -0
  175. package/lib/chain/opPools/singleAttestationPool.js +209 -0
  176. package/lib/chain/opPools/singleAttestationPool.js.map +1 -0
  177. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
  178. package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
  179. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  180. package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
  181. package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
  182. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  183. package/lib/chain/opPools/utils.d.ts +1 -1
  184. package/lib/chain/opPools/utils.d.ts.map +1 -1
  185. package/lib/chain/opPools/utils.js +1 -1
  186. package/lib/chain/opPools/utils.js.map +1 -1
  187. package/lib/chain/options.d.ts +5 -3
  188. package/lib/chain/options.d.ts.map +1 -1
  189. package/lib/chain/options.js +2 -3
  190. package/lib/chain/options.js.map +1 -1
  191. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  192. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  193. package/lib/chain/produceBlock/produceBlockBody.js +3 -2
  194. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  195. package/lib/chain/proposerTracker.d.ts +31 -0
  196. package/lib/chain/proposerTracker.d.ts.map +1 -0
  197. package/lib/chain/proposerTracker.js +75 -0
  198. package/lib/chain/proposerTracker.js.map +1 -0
  199. package/lib/chain/regen/interface.d.ts +1 -1
  200. package/lib/chain/regen/interface.d.ts.map +1 -1
  201. package/lib/chain/regen/queued.d.ts +1 -1
  202. package/lib/chain/regen/queued.d.ts.map +1 -1
  203. package/lib/chain/regen/queued.js +5 -3
  204. package/lib/chain/regen/queued.js.map +1 -1
  205. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  206. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  207. package/lib/chain/seenCache/seenAttesters.js +1 -1
  208. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  209. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  210. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  211. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  212. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  213. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  214. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  215. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  216. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  217. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -14
  218. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  219. package/lib/chain/seenCache/seenGossipBlockInput.js +6 -65
  220. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  221. package/lib/chain/shufflingCache.d.ts +5 -0
  222. package/lib/chain/shufflingCache.d.ts.map +1 -1
  223. package/lib/chain/shufflingCache.js +39 -1
  224. package/lib/chain/shufflingCache.js.map +1 -1
  225. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  226. package/lib/chain/validation/aggregateAndProof.js +38 -10
  227. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  228. package/lib/chain/validation/attestation.d.ts.map +1 -1
  229. package/lib/chain/validation/attestation.js +33 -17
  230. package/lib/chain/validation/attestation.js.map +1 -1
  231. package/lib/chain/validation/block.d.ts.map +1 -1
  232. package/lib/chain/validation/block.js +9 -1
  233. package/lib/chain/validation/block.js.map +1 -1
  234. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  235. package/lib/chain/validation/dataColumnSidecar.js +8 -1
  236. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  237. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  238. package/lib/chain/validation/executionPayloadBid.js +36 -46
  239. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  240. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  241. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  242. package/lib/chain/validation/executionPayloadEnvelope.js +132 -4
  243. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  244. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  245. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  246. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  247. package/lib/chain/validation/syncCommittee.js +16 -10
  248. package/lib/chain/validation/syncCommittee.js.map +1 -1
  249. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  250. package/lib/chain/validation/syncCommitteeContributionAndProof.js +11 -0
  251. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  252. package/lib/chain/validatorMonitor.d.ts +1 -2
  253. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  254. package/lib/chain/validatorMonitor.js +0 -3
  255. package/lib/chain/validatorMonitor.js.map +1 -1
  256. package/lib/db/dataColumnStore.d.ts +3 -2
  257. package/lib/db/dataColumnStore.d.ts.map +1 -1
  258. package/lib/db/dataColumnStore.js +3 -3
  259. package/lib/db/dataColumnStore.js.map +1 -1
  260. package/lib/db/flatFileStore/flatFileStore.d.ts +1 -1
  261. package/lib/db/flatFileStore/flatFileStore.d.ts.map +1 -1
  262. package/lib/db/flatFileStore/flatFileStore.js +10 -9
  263. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  264. package/lib/db/flatFileStore/interface.d.ts +2 -1
  265. package/lib/db/flatFileStore/interface.d.ts.map +1 -1
  266. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  267. package/lib/db/flatFileStore/slotIndex.js +2 -2
  268. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  269. package/lib/db/repositories/blobSidecars.d.ts +0 -1
  270. package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
  271. package/lib/db/repositories/blobSidecars.js +0 -1
  272. package/lib/db/repositories/blobSidecars.js.map +1 -1
  273. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +2 -1
  274. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  275. package/lib/db/repositories/dataColumnSidecarArchive.js +14 -4
  276. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  277. package/lib/execution/builder/apiClient.d.ts +14 -8
  278. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  279. package/lib/execution/builder/apiClient.js +12 -10
  280. package/lib/execution/builder/apiClient.js.map +1 -1
  281. package/lib/execution/builder/http.d.ts +2 -0
  282. package/lib/execution/builder/http.d.ts.map +1 -1
  283. package/lib/execution/builder/http.js +2 -0
  284. package/lib/execution/builder/http.js.map +1 -1
  285. package/lib/execution/engine/http.d.ts +4 -6
  286. package/lib/execution/engine/http.d.ts.map +1 -1
  287. package/lib/execution/engine/http.js +8 -10
  288. package/lib/execution/engine/http.js.map +1 -1
  289. package/lib/execution/engine/index.d.ts +1 -1
  290. package/lib/execution/engine/index.d.ts.map +1 -1
  291. package/lib/execution/engine/index.js +1 -1
  292. package/lib/execution/engine/index.js.map +1 -1
  293. package/lib/execution/engine/interface.d.ts +18 -6
  294. package/lib/execution/engine/interface.d.ts.map +1 -1
  295. package/lib/execution/engine/interface.js.map +1 -1
  296. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -4
  297. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  298. package/lib/execution/engine/jsonRpcTransport.js +2 -12
  299. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  300. package/lib/execution/engine/mock.d.ts +0 -1
  301. package/lib/execution/engine/mock.d.ts.map +1 -1
  302. package/lib/execution/engine/mock.js +0 -4
  303. package/lib/execution/engine/mock.js.map +1 -1
  304. package/lib/execution/engine/restTransport.d.ts +2 -4
  305. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  306. package/lib/execution/engine/restTransport.js +1 -15
  307. package/lib/execution/engine/restTransport.js.map +1 -1
  308. package/lib/execution/engine/sszTypes.d.ts +0 -9
  309. package/lib/execution/engine/sszTypes.d.ts.map +1 -1
  310. package/lib/execution/engine/sszTypes.js +0 -5
  311. package/lib/execution/engine/sszTypes.js.map +1 -1
  312. package/lib/execution/engine/transport.d.ts +1 -14
  313. package/lib/execution/engine/transport.d.ts.map +1 -1
  314. package/lib/execution/engine/types.d.ts +0 -8
  315. package/lib/execution/engine/types.d.ts.map +1 -1
  316. package/lib/execution/engine/types.js +2 -10
  317. package/lib/execution/engine/types.js.map +1 -1
  318. package/lib/execution/engine/utils.d.ts.map +1 -1
  319. package/lib/execution/engine/utils.js +3 -2
  320. package/lib/execution/engine/utils.js.map +1 -1
  321. package/lib/index.d.ts +1 -1
  322. package/lib/index.d.ts.map +1 -1
  323. package/lib/index.js +1 -1
  324. package/lib/index.js.map +1 -1
  325. package/lib/metrics/metrics/beacon.d.ts +4 -9
  326. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  327. package/lib/metrics/metrics/beacon.js +11 -32
  328. package/lib/metrics/metrics/beacon.js.map +1 -1
  329. package/lib/metrics/metrics/lodestar.d.ts +32 -8
  330. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  331. package/lib/metrics/metrics/lodestar.js +116 -46
  332. package/lib/metrics/metrics/lodestar.js.map +1 -1
  333. package/lib/metrics/server/http.js +5 -5
  334. package/lib/metrics/server/http.js.map +1 -1
  335. package/lib/monitoring/service.js +1 -1
  336. package/lib/monitoring/service.js.map +1 -1
  337. package/lib/network/core/networkCore.d.ts +4 -1
  338. package/lib/network/core/networkCore.d.ts.map +1 -1
  339. package/lib/network/core/networkCore.js +7 -0
  340. package/lib/network/core/networkCore.js.map +1 -1
  341. package/lib/network/core/networkCoreWorker.js +2 -0
  342. package/lib/network/core/networkCoreWorker.js.map +1 -1
  343. package/lib/network/core/networkCoreWorkerHandler.d.ts +4 -1
  344. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  345. package/lib/network/core/networkCoreWorkerHandler.js +6 -0
  346. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  347. package/lib/network/core/types.d.ts +6 -1
  348. package/lib/network/core/types.d.ts.map +1 -1
  349. package/lib/network/gossip/gossipsub.d.ts +1 -0
  350. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  351. package/lib/network/gossip/gossipsub.js +23 -6
  352. package/lib/network/gossip/gossipsub.js.map +1 -1
  353. package/lib/network/gossip/interface.d.ts +1 -8
  354. package/lib/network/gossip/interface.d.ts.map +1 -1
  355. package/lib/network/gossip/interface.js +0 -1
  356. package/lib/network/gossip/interface.js.map +1 -1
  357. package/lib/network/gossip/topic.d.ts +1 -23
  358. package/lib/network/gossip/topic.d.ts.map +1 -1
  359. package/lib/network/gossip/topic.js +0 -36
  360. package/lib/network/gossip/topic.js.map +1 -1
  361. package/lib/network/interface.d.ts +4 -5
  362. package/lib/network/interface.d.ts.map +1 -1
  363. package/lib/network/libp2p/index.d.ts.map +1 -1
  364. package/lib/network/libp2p/index.js +5 -1
  365. package/lib/network/libp2p/index.js.map +1 -1
  366. package/lib/network/network.d.ts +9 -7
  367. package/lib/network/network.d.ts.map +1 -1
  368. package/lib/network/network.js +73 -46
  369. package/lib/network/network.js.map +1 -1
  370. package/lib/network/options.d.ts +2 -0
  371. package/lib/network/options.d.ts.map +1 -1
  372. package/lib/network/options.js +2 -0
  373. package/lib/network/options.js.map +1 -1
  374. package/lib/network/peers/peerManager.d.ts +2 -1
  375. package/lib/network/peers/peerManager.d.ts.map +1 -1
  376. package/lib/network/peers/peerManager.js +28 -1
  377. package/lib/network/peers/peerManager.js.map +1 -1
  378. package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
  379. package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
  380. package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
  381. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  382. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  383. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  384. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  385. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  386. package/lib/network/peers/utils/subnetMap.d.ts +5 -2
  387. package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
  388. package/lib/network/peers/utils/subnetMap.js +6 -3
  389. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  390. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  391. package/lib/network/processor/extractSlotRootFns.js +1 -8
  392. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  393. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  394. package/lib/network/processor/gossipHandlers.js +72 -138
  395. package/lib/network/processor/gossipHandlers.js.map +1 -1
  396. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  397. package/lib/network/processor/gossipQueues/index.js +0 -6
  398. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  399. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  400. package/lib/network/processor/gossipValidatorFn.js +4 -5
  401. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  402. package/lib/network/processor/index.d.ts +6 -0
  403. package/lib/network/processor/index.d.ts.map +1 -1
  404. package/lib/network/processor/index.js +33 -6
  405. package/lib/network/processor/index.js.map +1 -1
  406. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  407. package/lib/network/reqresp/ReqRespBeaconNode.js +0 -3
  408. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  409. package/lib/network/reqresp/handlers/beaconBlocksByHead.js +1 -1
  410. package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -1
  411. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
  412. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  413. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  414. package/lib/network/reqresp/handlers/index.js +1 -12
  415. package/lib/network/reqresp/handlers/index.js.map +1 -1
  416. package/lib/network/reqresp/protocols.d.ts +0 -2
  417. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  418. package/lib/network/reqresp/protocols.js +0 -10
  419. package/lib/network/reqresp/protocols.js.map +1 -1
  420. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  421. package/lib/network/reqresp/rateLimit.js +1 -17
  422. package/lib/network/reqresp/rateLimit.js.map +1 -1
  423. package/lib/network/reqresp/types.d.ts +2 -8
  424. package/lib/network/reqresp/types.d.ts.map +1 -1
  425. package/lib/network/reqresp/types.js +1 -7
  426. package/lib/network/reqresp/types.js.map +1 -1
  427. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  428. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  429. package/lib/network/reqresp/utils/collect.js +9 -8
  430. package/lib/network/reqresp/utils/collect.js.map +1 -1
  431. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  432. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  433. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  434. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  435. package/lib/network/subnets/attnetsService.d.ts +35 -5
  436. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  437. package/lib/network/subnets/attnetsService.js +84 -6
  438. package/lib/network/subnets/attnetsService.js.map +1 -1
  439. package/lib/network/subnets/interface.d.ts +7 -0
  440. package/lib/network/subnets/interface.d.ts.map +1 -1
  441. package/lib/network/subnets/interface.js.map +1 -1
  442. package/lib/node/nodejs.d.ts +3 -1
  443. package/lib/node/nodejs.d.ts.map +1 -1
  444. package/lib/node/nodejs.js +38 -20
  445. package/lib/node/nodejs.js.map +1 -1
  446. package/lib/node/options.d.ts +3 -1
  447. package/lib/node/options.d.ts.map +1 -1
  448. package/lib/node/options.js +4 -2
  449. package/lib/node/options.js.map +1 -1
  450. package/lib/sync/interface.d.ts.map +1 -1
  451. package/lib/sync/interface.js.map +1 -1
  452. package/lib/sync/range/batch.d.ts +8 -3
  453. package/lib/sync/range/batch.d.ts.map +1 -1
  454. package/lib/sync/range/batch.js +26 -22
  455. package/lib/sync/range/batch.js.map +1 -1
  456. package/lib/sync/range/chain.d.ts.map +1 -1
  457. package/lib/sync/range/chain.js +10 -16
  458. package/lib/sync/range/chain.js.map +1 -1
  459. package/lib/sync/range/range.d.ts.map +1 -1
  460. package/lib/sync/range/range.js +43 -3
  461. package/lib/sync/range/range.js.map +1 -1
  462. package/lib/sync/sync.d.ts +15 -0
  463. package/lib/sync/sync.d.ts.map +1 -1
  464. package/lib/sync/sync.js +103 -25
  465. package/lib/sync/sync.js.map +1 -1
  466. package/lib/sync/types.d.ts +12 -1
  467. package/lib/sync/types.d.ts.map +1 -1
  468. package/lib/sync/types.js +2 -0
  469. package/lib/sync/types.js.map +1 -1
  470. package/lib/sync/unknownBlock.d.ts +28 -1
  471. package/lib/sync/unknownBlock.d.ts.map +1 -1
  472. package/lib/sync/unknownBlock.js +257 -31
  473. package/lib/sync/unknownBlock.js.map +1 -1
  474. package/lib/sync/utils/downloadByRange.d.ts +20 -35
  475. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  476. package/lib/sync/utils/downloadByRange.js +36 -130
  477. package/lib/sync/utils/downloadByRange.js.map +1 -1
  478. package/lib/sync/utils/downloadByRoot.d.ts +23 -17
  479. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  480. package/lib/sync/utils/downloadByRoot.js +57 -100
  481. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  482. package/lib/util/bitArray.d.ts +6 -6
  483. package/lib/util/bitArray.d.ts.map +1 -1
  484. package/lib/util/bitArray.js +25 -50
  485. package/lib/util/bitArray.js.map +1 -1
  486. package/lib/util/blobs.d.ts +1 -7
  487. package/lib/util/blobs.d.ts.map +1 -1
  488. package/lib/util/blobs.js +0 -19
  489. package/lib/util/blobs.js.map +1 -1
  490. package/lib/util/eventLoop.d.ts +5 -0
  491. package/lib/util/eventLoop.d.ts.map +1 -1
  492. package/lib/util/eventLoop.js +7 -0
  493. package/lib/util/eventLoop.js.map +1 -1
  494. package/lib/util/execution.d.ts +3 -4
  495. package/lib/util/execution.d.ts.map +1 -1
  496. package/lib/util/execution.js +1 -73
  497. package/lib/util/execution.js.map +1 -1
  498. package/lib/util/file.d.ts.map +1 -1
  499. package/lib/util/file.js +8 -9
  500. package/lib/util/file.js.map +1 -1
  501. package/lib/util/queue/itemQueue.js +1 -1
  502. package/lib/util/queue/itemQueue.js.map +1 -1
  503. package/lib/util/sszBytes.d.ts +5 -1
  504. package/lib/util/sszBytes.d.ts.map +1 -1
  505. package/lib/util/sszBytes.js +36 -19
  506. package/lib/util/sszBytes.js.map +1 -1
  507. package/lib/util/types.d.ts +0 -5
  508. package/lib/util/types.d.ts.map +1 -1
  509. package/lib/util/types.js +1 -2
  510. package/lib/util/types.js.map +1 -1
  511. package/package.json +27 -28
  512. package/src/api/impl/beacon/blocks/index.ts +133 -156
  513. package/src/api/impl/beacon/pool/index.ts +40 -8
  514. package/src/api/impl/beacon/state/utils.ts +3 -2
  515. package/src/api/impl/debug/index.ts +6 -2
  516. package/src/api/impl/validator/index.ts +62 -36
  517. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  518. package/src/chain/GetBlobsTracker.ts +82 -52
  519. package/src/chain/archiveStore/archiveStore.ts +6 -4
  520. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
  521. package/src/chain/archiveStore/utils/archiveBlocks.ts +21 -2
  522. package/src/chain/archiveStore/utils/pruneHistory.ts +24 -9
  523. package/src/chain/blocks/blockInput/blockInput.ts +15 -344
  524. package/src/chain/blocks/blockInput/errors.ts +1 -2
  525. package/src/chain/blocks/blockInput/types.ts +2 -20
  526. package/src/chain/blocks/importBlock.ts +56 -72
  527. package/src/chain/blocks/importExecutionPayload.ts +85 -38
  528. package/src/chain/blocks/index.ts +8 -33
  529. package/src/chain/blocks/payloadEnvelopeProcessor.ts +33 -22
  530. package/src/chain/blocks/types.ts +5 -31
  531. package/src/chain/blocks/verifyBlock.ts +47 -26
  532. package/src/chain/blocks/verifyBlocksDataAvailability.ts +20 -6
  533. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +16 -10
  534. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  535. package/src/chain/blocks/verifyBlocksSignatures.ts +13 -5
  536. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +16 -8
  537. package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
  538. package/src/chain/bls/interface.ts +2 -0
  539. package/src/chain/bls/multithread/index.ts +48 -24
  540. package/src/chain/bls/multithread/types.ts +1 -1
  541. package/src/chain/bls/multithread/worker.ts +1 -5
  542. package/src/chain/bls/singleThread.ts +1 -1
  543. package/src/chain/bls/utils.ts +2 -2
  544. package/src/chain/chain.ts +243 -81
  545. package/src/chain/emitter.ts +8 -8
  546. package/src/chain/errors/attestationError.ts +11 -1
  547. package/src/chain/errors/blockError.ts +1 -1
  548. package/src/chain/errors/executionPayloadBid.ts +3 -2
  549. package/src/chain/errors/executionPayloadEnvelope.ts +58 -0
  550. package/src/chain/errors/index.ts +0 -1
  551. package/src/chain/forkChoice/index.ts +8 -0
  552. package/src/chain/forkChoiceExecutionEngine.ts +216 -0
  553. package/src/chain/interface.ts +10 -7
  554. package/src/chain/lightClient/index.ts +108 -142
  555. package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
  556. package/src/chain/opPools/attestationPool.ts +16 -4
  557. package/src/chain/opPools/inclusionListStore.ts +5 -2
  558. package/src/chain/opPools/index.ts +1 -0
  559. package/src/chain/opPools/opPool.ts +6 -6
  560. package/src/chain/opPools/payloadAttestationPool.ts +18 -7
  561. package/src/chain/opPools/singleAttestationPool.ts +287 -0
  562. package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
  563. package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
  564. package/src/chain/opPools/utils.ts +1 -1
  565. package/src/chain/options.ts +7 -6
  566. package/src/chain/produceBlock/produceBlockBody.ts +7 -3
  567. package/src/chain/proposerTracker.ts +94 -0
  568. package/src/chain/regen/interface.ts +1 -1
  569. package/src/chain/regen/queued.ts +6 -4
  570. package/src/chain/seenCache/seenAttesters.ts +1 -1
  571. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  572. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  573. package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
  574. package/src/chain/shufflingCache.ts +40 -1
  575. package/src/chain/validation/aggregateAndProof.ts +44 -15
  576. package/src/chain/validation/attestation.ts +32 -21
  577. package/src/chain/validation/block.ts +9 -1
  578. package/src/chain/validation/dataColumnSidecar.ts +7 -1
  579. package/src/chain/validation/executionPayloadBid.ts +47 -48
  580. package/src/chain/validation/executionPayloadEnvelope.ts +155 -4
  581. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  582. package/src/chain/validation/syncCommittee.ts +31 -15
  583. package/src/chain/validation/syncCommitteeContributionAndProof.ts +13 -0
  584. package/src/chain/validatorMonitor.ts +0 -6
  585. package/src/db/dataColumnStore.ts +5 -4
  586. package/src/db/flatFileStore/flatFileStore.ts +12 -11
  587. package/src/db/flatFileStore/interface.ts +2 -1
  588. package/src/db/flatFileStore/slotIndex.ts +4 -3
  589. package/src/db/repositories/blobSidecars.ts +0 -1
  590. package/src/db/repositories/dataColumnSidecarArchive.ts +14 -4
  591. package/src/execution/builder/apiClient.ts +16 -13
  592. package/src/execution/builder/http.ts +4 -0
  593. package/src/execution/engine/http.ts +19 -42
  594. package/src/execution/engine/index.ts +1 -1
  595. package/src/execution/engine/interface.ts +19 -10
  596. package/src/execution/engine/jsonRpcTransport.ts +10 -22
  597. package/src/execution/engine/mock.ts +0 -7
  598. package/src/execution/engine/restTransport.ts +3 -22
  599. package/src/execution/engine/sszTypes.ts +0 -9
  600. package/src/execution/engine/transport.ts +8 -17
  601. package/src/execution/engine/types.ts +3 -18
  602. package/src/execution/engine/utils.ts +4 -2
  603. package/src/index.ts +1 -1
  604. package/src/metrics/metrics/beacon.ts +11 -32
  605. package/src/metrics/metrics/lodestar.ts +117 -46
  606. package/src/metrics/server/http.ts +5 -5
  607. package/src/monitoring/service.ts +1 -1
  608. package/src/network/core/networkCore.ts +11 -1
  609. package/src/network/core/networkCoreWorker.ts +2 -0
  610. package/src/network/core/networkCoreWorkerHandler.ts +8 -1
  611. package/src/network/core/types.ts +6 -1
  612. package/src/network/gossip/gossipsub.ts +24 -6
  613. package/src/network/gossip/interface.ts +0 -5
  614. package/src/network/gossip/topic.ts +1 -39
  615. package/src/network/interface.ts +2 -5
  616. package/src/network/libp2p/index.ts +5 -1
  617. package/src/network/network.ts +88 -69
  618. package/src/network/options.ts +4 -0
  619. package/src/network/peers/peerManager.ts +28 -3
  620. package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
  621. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  622. package/src/network/peers/utils/subnetMap.ts +6 -3
  623. package/src/network/processor/extractSlotRootFns.ts +0 -9
  624. package/src/network/processor/gossipHandlers.ts +91 -178
  625. package/src/network/processor/gossipQueues/index.ts +0 -6
  626. package/src/network/processor/gossipValidatorFn.ts +4 -5
  627. package/src/network/processor/index.ts +32 -6
  628. package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
  629. package/src/network/reqresp/handlers/beaconBlocksByHead.ts +1 -1
  630. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
  631. package/src/network/reqresp/handlers/index.ts +0 -17
  632. package/src/network/reqresp/protocols.ts +0 -12
  633. package/src/network/reqresp/rateLimit.ts +1 -17
  634. package/src/network/reqresp/types.ts +0 -13
  635. package/src/network/reqresp/utils/collect.ts +16 -8
  636. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  637. package/src/network/subnets/attnetsService.ts +94 -6
  638. package/src/network/subnets/interface.ts +7 -0
  639. package/src/node/nodejs.ts +40 -21
  640. package/src/node/options.ts +9 -6
  641. package/src/sync/interface.ts +1 -0
  642. package/src/sync/range/batch.ts +29 -21
  643. package/src/sync/range/chain.ts +10 -14
  644. package/src/sync/range/range.ts +56 -3
  645. package/src/sync/sync.ts +108 -26
  646. package/src/sync/types.ts +11 -0
  647. package/src/sync/unknownBlock.ts +296 -32
  648. package/src/sync/utils/downloadByRange.ts +60 -233
  649. package/src/sync/utils/downloadByRoot.ts +78 -139
  650. package/src/util/bitArray.ts +22 -43
  651. package/src/util/blobs.ts +0 -34
  652. package/src/util/eventLoop.ts +8 -0
  653. package/src/util/execution.ts +8 -102
  654. package/src/util/file.ts +8 -9
  655. package/src/util/queue/itemQueue.ts +1 -1
  656. package/src/util/sszBytes.ts +42 -24
  657. package/src/util/types.ts +1 -8
  658. package/lib/chain/errors/blobSidecarError.d.ts +0 -108
  659. package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
  660. package/lib/chain/errors/blobSidecarError.js +0 -38
  661. package/lib/chain/errors/blobSidecarError.js.map +0 -1
  662. package/lib/chain/validation/blobSidecar.d.ts +0 -16
  663. package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
  664. package/lib/chain/validation/blobSidecar.js +0 -276
  665. package/lib/chain/validation/blobSidecar.js.map +0 -1
  666. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
  667. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
  668. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
  669. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
  670. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
  671. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
  672. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
  673. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
  674. package/src/chain/errors/blobSidecarError.ts +0 -70
  675. package/src/chain/validation/blobSidecar.ts +0 -357
  676. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
  677. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
@@ -1,12 +1,14 @@
1
1
  import path from "node:path";
2
2
  import {PrivateKey} from "@libp2p/interface";
3
- import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
4
3
  import {Type} from "@chainsafe/ssz";
5
4
  import {routes} from "@lodestar/api";
6
5
  import {BeaconConfig} from "@lodestar/config";
7
6
  import {
7
+ AncestorStatus,
8
8
  CheckpointWithHex,
9
9
  EpochDifference,
10
+ ForkChoiceError,
11
+ ForkChoiceErrorCode,
10
12
  ForkChoiceStateGetter,
11
13
  IForkChoice,
12
14
  PayloadStatus,
@@ -14,12 +16,14 @@ import {
14
16
  UpdateHeadOpt,
15
17
  } from "@lodestar/fork-choice";
16
18
  import {LoggerNode} from "@lodestar/logger/node";
19
+ import {type PubkeyCache} from "@lodestar/native/pubkeys";
17
20
  import {
18
21
  EFFECTIVE_BALANCE_INCREMENT,
19
22
  type ForkPostFulu,
20
23
  type ForkPostGloas,
21
24
  GENESIS_SLOT,
22
25
  SLOTS_PER_EPOCH,
26
+ isForkPostFulu,
23
27
  isForkPostGloas,
24
28
  } from "@lodestar/params";
25
29
  import {
@@ -33,6 +37,7 @@ import {
33
37
  isStatePostAltair,
34
38
  isStatePostElectra,
35
39
  isStatePostGloas,
40
+ proposerShufflingDecisionRoot,
36
41
  } from "@lodestar/state-transition";
37
42
  import {
38
43
  BeaconBlock,
@@ -60,7 +65,6 @@ import {Logger, fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRoot
60
65
  import {ProcessShutdownCallback} from "@lodestar/validator";
61
66
  import {GENESIS_EPOCH, HALF_SLOT_BPS, ZERO_HASH} from "../constants/index.js";
62
67
  import {IBeaconDb} from "../db/index.js";
63
- import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../db/repositories/blobSidecars.js";
64
68
  import {decodeArchivedEnvelope} from "../db/repositories/index.js";
65
69
  import {BuilderApiClient, BuilderApiClientOpts} from "../execution/builder/apiClient.js";
66
70
  import {BuilderStatus} from "../execution/builder/http.js";
@@ -80,7 +84,7 @@ import {getSlotFromSignedBeaconBlockSerialized} from "../util/sszBytes.js";
80
84
  import {ArchiveStore} from "./archiveStore/archiveStore.js";
81
85
  import {CheckpointBalancesCache} from "./balancesCache.js";
82
86
  import {BeaconProposerCache} from "./beaconProposerCache.js";
83
- import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
87
+ import {IBlockInput, isBlockInputColumns} from "./blocks/blockInput/index.js";
84
88
  import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
85
89
  import {PayloadEnvelopeInputSource} from "./blocks/payloadEnvelopeInput/index.js";
86
90
  import {PayloadEnvelopeProcessor} from "./blocks/payloadEnvelopeProcessor.js";
@@ -89,9 +93,10 @@ import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
89
93
  import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToDb.js";
90
94
  import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
91
95
  import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
92
- import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
93
- import {ChainEvent, ChainEventEmitter} from "./emitter.js";
96
+ import {ColumnReconstructionTracker, RECONSTRUCTED_COLUMNS_WAIT_BPS} from "./ColumnReconstructionTracker.js";
97
+ import {ChainEvent, ChainEventEmitter, ReorgEventData} from "./emitter.js";
94
98
  import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js";
99
+ import {ForkChoiceExecutionEngine} from "./forkChoiceExecutionEngine.js";
95
100
  import {GetBlobsTracker} from "./GetBlobsTracker.js";
96
101
  import {CommonBlockBody, FindHeadFnName, IBeaconChain, ProposerPreparationData, StateGetOpts} from "./interface.js";
97
102
  import {LightClientServer} from "./lightClient/index.js";
@@ -104,6 +109,7 @@ import {
104
109
  OpPool,
105
110
  PayloadAttestationPool,
106
111
  ProposerPreferencesPool,
112
+ SingleAttestationPool,
107
113
  SyncCommitteeMessagePool,
108
114
  SyncContributionAndProofPool,
109
115
  } from "./opPools/index.js";
@@ -112,6 +118,7 @@ import {PrepareNextSlotScheduler} from "./prepareNextSlot.js";
112
118
  import {computeNewStateRoot} from "./produceBlock/computeNewStateRoot.js";
113
119
  import {AssembledBlockType, BlockType, ProduceResult} from "./produceBlock/index.js";
114
120
  import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produceBlock/produceBlockBody.js";
121
+ import {ProposerTracker} from "./proposerTracker.js";
115
122
  import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js";
116
123
  import {ReprocessController} from "./reprocess.js";
117
124
  import {
@@ -166,7 +173,7 @@ const DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES = 16;
166
173
  export class BeaconChain implements IBeaconChain {
167
174
  readonly genesisTime: UintNum64;
168
175
  readonly genesisValidatorsRoot: Root;
169
- readonly executionEngine: IExecutionEngine;
176
+ readonly executionEngine: ForkChoiceExecutionEngine;
170
177
  readonly executionBuilder?: IExecutionBuilder;
171
178
  readonly builderCircuitBreaker: BuilderCircuitBreaker;
172
179
  readonly builderApiClient: BuilderApiClient;
@@ -194,6 +201,13 @@ export class BeaconChain implements IBeaconChain {
194
201
  // Ops pool
195
202
  readonly attestationPool: AttestationPool;
196
203
  readonly aggregatedAttestationPool: AggregatedAttestationPool;
204
+ readonly singleAttestationPool: SingleAttestationPool;
205
+ readonly proposerTracker: ProposerTracker;
206
+ /**
207
+ * Head state epoch and decision root of its next epoch proposers when local proposals were last refreshed. The root
208
+ * alone is not enough: a reorg onto a branch without blocks in a whole epoch keeps the root but moves the epoch
209
+ */
210
+ private localProposalsKey: string | null = null;
197
211
  readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
198
212
  readonly syncContributionAndProofPool;
199
213
  readonly executionPayloadBidPool: ExecutionPayloadBidPool;
@@ -317,7 +331,6 @@ export class BeaconChain implements IBeaconChain {
317
331
  this.genesisTime = anchorState.genesisTime;
318
332
  this.anchorStateLatestBlockSlot = anchorState.latestBlockHeader.slot;
319
333
  this.genesisValidatorsRoot = anchorState.genesisValidatorsRoot;
320
- this.executionEngine = executionEngine;
321
334
  this.executionBuilder = executionBuilder;
322
335
  const signal = this.abortController.signal;
323
336
  const emitter = new ChainEventEmitter();
@@ -331,6 +344,8 @@ export class BeaconChain implements IBeaconChain {
331
344
  this.blacklistedBlocks = new Map((opts.blacklistedBlocks ?? []).map((hex) => [hex, null]));
332
345
  this.attestationPool = new AttestationPool(config, clock, this.opts?.preaggregateSlotDistance, metrics);
333
346
  this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics, logger);
347
+ this.singleAttestationPool = new SingleAttestationPool(metrics);
348
+ this.proposerTracker = new ProposerTracker(this.opts.singleAttestationIgnoreProposalDuty ?? false, metrics);
334
349
  this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
335
350
  this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
336
351
  this.executionPayloadBidPool = new ExecutionPayloadBidPool();
@@ -457,6 +472,12 @@ export class BeaconChain implements IBeaconChain {
457
472
  this.payloadEnvelopeProcessor = new PayloadEnvelopeProcessor(this, metrics, signal);
458
473
 
459
474
  this.forkChoice = forkChoice;
475
+ this.executionEngine = new ForkChoiceExecutionEngine(executionEngine, {
476
+ forkChoice,
477
+ recomputeHeadAfterELInvalidResponse: () => this.recomputeHeadAfterELInvalidResponse(),
478
+ logger,
479
+ metrics,
480
+ });
460
481
 
461
482
  this.builderCircuitBreaker = new BuilderCircuitBreaker(
462
483
  {faultInspectionWindow: opts.faultInspectionWindow, allowedFaults: opts.allowedFaults},
@@ -680,7 +701,8 @@ export class BeaconChain implements IBeaconChain {
680
701
  const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
681
702
  return {
682
703
  state,
683
- executionOptimistic: isOptimisticBlock(block),
704
+ // The canonical variant can be FULL, a state reports the status of the payload its block builds on
705
+ executionOptimistic: isOptimisticBlock(this.forkChoice.getBlockHexDefaultStatus(block.blockRoot) ?? block),
684
706
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
685
707
  };
686
708
  }
@@ -696,7 +718,7 @@ export class BeaconChain implements IBeaconChain {
696
718
  return (
697
719
  state && {
698
720
  state,
699
- executionOptimistic: isOptimisticBlock(block),
721
+ executionOptimistic: isOptimisticBlock(this.forkChoice.getBlockHexDefaultStatus(block.blockRoot) ?? block),
700
722
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
701
723
  }
702
724
  );
@@ -844,7 +866,9 @@ export class BeaconChain implements IBeaconChain {
844
866
  const finalizedBlock = this.forkChoice.getFinalizedBlock();
845
867
  if (slot > finalizedBlock.slot) {
846
868
  // Unfinalized slot, attempt to find in fork-choice
847
- const block = this.forkChoice.getCanonicalBlockAtSlot(slot);
869
+ const canonicalBlock = this.forkChoice.getCanonicalBlockAtSlot(slot);
870
+ // The canonical variant can be FULL, a block reports the status of the payload it builds on
871
+ const block = canonicalBlock && this.forkChoice.getBlockHexDefaultStatus(canonicalBlock.blockRoot);
848
872
  if (block) {
849
873
  // Block found in fork-choice.
850
874
  // It may be in the block input cache, awaiting full DA reconstruction, check there first
@@ -933,16 +957,6 @@ export class BeaconChain implements IBeaconChain {
933
957
  }
934
958
 
935
959
  async getBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<deneb.BlobSidecars | null> {
936
- const blockInput = this.seenBlockInputCache.get(blockRootHex);
937
- if (blockInput) {
938
- if (!isBlockInputBlobs(blockInput)) {
939
- throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
940
- }
941
- if (!blockInput.hasAllData()) {
942
- return null;
943
- }
944
- return blockInput.getBlobs();
945
- }
946
960
  const unfinalizedBlobSidecars = (await this.db.blobSidecars.get(fromHex(blockRootHex)))?.blobSidecars ?? null;
947
961
  if (unfinalizedBlobSidecars) {
948
962
  return unfinalizedBlobSidecars;
@@ -950,28 +964,6 @@ export class BeaconChain implements IBeaconChain {
950
964
  return (await this.db.blobSidecarsArchive.get(blockSlot))?.blobSidecars ?? null;
951
965
  }
952
966
 
953
- async getSerializedBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
954
- const blockInput = this.seenBlockInputCache.get(blockRootHex);
955
- if (blockInput) {
956
- if (!isBlockInputBlobs(blockInput)) {
957
- throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
958
- }
959
- if (!blockInput.hasAllData()) {
960
- return null;
961
- }
962
- return ssz.deneb.BlobSidecars.serialize(blockInput.getBlobs());
963
- }
964
- const unfinalizedBlobSidecarsWrapper = await this.db.blobSidecars.getBinary(fromHex(blockRootHex));
965
- if (unfinalizedBlobSidecarsWrapper) {
966
- return unfinalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
967
- }
968
- const finalizedBlobSidecarsWrapper = await this.db.blobSidecarsArchive.getBinary(blockSlot);
969
- if (finalizedBlobSidecarsWrapper) {
970
- return finalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
971
- }
972
- return null;
973
- }
974
-
975
967
  async getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
976
968
  const [bytes] = await this.getSerializedExecutionPayloadEnvelopes([{blockSlot, blockRootHex}]);
977
969
  return bytes;
@@ -1137,6 +1129,17 @@ export class BeaconChain implements IBeaconChain {
1137
1129
  // After gloas, columns are tracked in PayloadEnvelopeInput
1138
1130
  const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
1139
1131
  if (payloadInput) {
1132
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1133
+ if (
1134
+ !payloadInput.hasComputedAllData() &&
1135
+ payloadInput.hasAllData() &&
1136
+ indices.some((index) => !payloadInput.hasColumn(index))
1137
+ ) {
1138
+ this.columnReconstructionTracker.triggerColumnReconstruction(payloadInput);
1139
+ await payloadInput
1140
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1141
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1142
+ }
1140
1143
  for (let i = 0; i < indices.length; i++) {
1141
1144
  const index = indices[i];
1142
1145
  const sidecar = payloadInput.getColumn(index);
@@ -1158,6 +1161,17 @@ export class BeaconChain implements IBeaconChain {
1158
1161
  if (!isBlockInputColumns(blockInput)) {
1159
1162
  throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
1160
1163
  }
1164
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1165
+ if (
1166
+ !blockInput.hasComputedAllData() &&
1167
+ blockInput.hasAllData() &&
1168
+ indices.some((index) => !blockInput.hasColumn(index))
1169
+ ) {
1170
+ this.columnReconstructionTracker.triggerColumnReconstruction(blockInput);
1171
+ await blockInput
1172
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1173
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1174
+ }
1161
1175
  for (let i = 0; i < indices.length; i++) {
1162
1176
  const index = indices[i];
1163
1177
  const sidecar = blockInput.getColumn(index);
@@ -1430,11 +1444,64 @@ export class BeaconChain implements IBeaconChain {
1430
1444
  }
1431
1445
  }
1432
1446
 
1447
+ /**
1448
+ * Apply chain side effects of a fork choice head change: head state, head metrics, and reorg detection
1449
+ */
1450
+ onHeadChanged(oldHead: ProtoBlock, newHead: ProtoBlock, maybeHeadState?: IBeaconStateView): void {
1451
+ // Set head state as strong reference
1452
+ this.regen.updateHeadState(newHead, maybeHeadState);
1453
+
1454
+ const delaySec = this.clock.secFromSlot(newHead.slot);
1455
+ this.logger.verbose("New chain head", {
1456
+ slot: newHead.slot,
1457
+ root: newHead.blockRoot,
1458
+ payloadStatus: newHead.payloadStatus,
1459
+ delaySec,
1460
+ });
1461
+ this.metrics?.headSlot.set(newHead.slot);
1462
+
1463
+ this.onNewHead(newHead);
1464
+ this.metrics?.forkChoice.changedHead.inc();
1465
+
1466
+ const ancestorResult = this.forkChoice.getCommonAncestorDepth(oldHead, newHead);
1467
+ if (ancestorResult.code === AncestorStatus.CommonAncestor) {
1468
+ // CommonAncestor = chain reorg, old head and new head not direct descendants
1469
+
1470
+ const forkChoiceReorgEventData: ReorgEventData = {
1471
+ depth: ancestorResult.depth,
1472
+ epoch: computeEpochAtSlot(newHead.slot),
1473
+ slot: newHead.slot,
1474
+ newHeadBlock: newHead.blockRoot,
1475
+ oldHeadBlock: oldHead.blockRoot,
1476
+ newHeadState: newHead.stateRoot,
1477
+ oldHeadState: oldHead.stateRoot,
1478
+ executionOptimistic: isOptimisticBlock(newHead),
1479
+ };
1480
+
1481
+ this.emitter.emit(routes.events.EventType.chainReorg, forkChoiceReorgEventData);
1482
+ this.logger.verbose("Chain reorg", forkChoiceReorgEventData);
1483
+
1484
+ this.metrics?.forkChoice.reorg.inc();
1485
+ this.metrics?.forkChoice.reorgDistance.observe(ancestorResult.depth);
1486
+ }
1487
+ }
1488
+
1489
+ private recomputeHeadAfterELInvalidResponse(): void {
1490
+ // validateLatestHash only re-scores proto-array, the cached head is still the old one
1491
+ const oldHead = this.forkChoice.getHead();
1492
+ const newHead = this.recomputeForkChoiceHead(ForkchoiceCaller.executionInvalid);
1493
+ if (newHead.blockRoot === oldHead.blockRoot && newHead.payloadStatus === oldHead.payloadStatus) {
1494
+ return;
1495
+ }
1496
+ this.onHeadChanged(oldHead, newHead);
1497
+ }
1498
+
1433
1499
  /**
1434
1500
  * Emit `head` and `head_v2` when the fork choice head differs between two observations. Every caller that
1435
- * can move the head, `updateAndGetHead()` and `updateTime()`, must capture the head before and pass both.
1501
+ * can move the head, `updateAndGetHead()`, `updateTime()` and `onExecutionPayload()`, must capture the head before
1502
+ * and pass both.
1436
1503
  */
1437
- private emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1504
+ emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1438
1505
  const headRootChanged = head.blockRoot !== prevHead.blockRoot;
1439
1506
 
1440
1507
  if (!headRootChanged && prevHead.payloadStatus === head.payloadStatus) {
@@ -1565,38 +1632,76 @@ export class BeaconChain implements IBeaconChain {
1565
1632
  }
1566
1633
 
1567
1634
  /**
1568
- * Invalid state root error is critical and it causes the node to stale most of the time so we want to always
1569
- * persist preState, postState and block for further investigation.
1635
+ * Invalid state root error is critical and it causes the node to stale most of the time so we want to persist
1636
+ * preState, postState and block for further investigation.
1570
1637
  */
1571
1638
  async persistInvalidStateRoot(
1572
1639
  preState: IBeaconStateView,
1573
1640
  postState: IBeaconStateView,
1574
1641
  block: SignedBeaconBlock
1575
1642
  ): Promise<void> {
1643
+ if (!this.opts.persistInvalidSszObjects) {
1644
+ return;
1645
+ }
1576
1646
  const blockSlot = block.message.slot;
1577
- const blockType = this.config.getForkTypes(blockSlot).SignedBeaconBlock;
1578
- const postStateRoot = postState.hashTreeRoot();
1579
- const logStr = `slot_${blockSlot}_invalid_state_root_${toRootHex(postStateRoot)}`;
1580
- await Promise.all([
1581
- this.persistSszObject(
1582
- `SignedBeaconBlock_slot_${blockSlot}`,
1583
- blockType.serialize(block),
1584
- toRootHex(this.config.getForkTypes(blockSlot).BeaconBlock.hashTreeRoot(block.message)),
1585
- `${logStr}_block`
1586
- ),
1587
- this.persistSszObject(
1588
- `preState_slot_${preState.slot}_BeaconState`,
1589
- preState.serialize(),
1590
- toRootHex(preState.hashTreeRoot()),
1591
- `${logStr}_pre_state`
1592
- ),
1593
- this.persistSszObject(
1594
- `postState_slot_${postState.slot}_BeaconState`,
1595
- postState.serialize(),
1596
- toRootHex(postStateRoot),
1597
- `${logStr}_post_state`
1598
- ),
1599
- ]);
1647
+ const forkTypes = this.config.getForkTypes(blockSlot);
1648
+ const preStateRoot = toRootHex(preState.hashTreeRoot());
1649
+ const postStateRoot = toRootHex(postState.hashTreeRoot());
1650
+ const logStr = `slot_${blockSlot}_invalid_state_root_${postStateRoot}`;
1651
+ try {
1652
+ await Promise.all([
1653
+ this.persistSszObject(
1654
+ `SignedBeaconBlock_slot_${blockSlot}`,
1655
+ forkTypes.SignedBeaconBlock.serialize(block),
1656
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1657
+ `${logStr}_block`
1658
+ ),
1659
+ this.persistSszObject(
1660
+ `preState_slot_${preState.slot}_BeaconState`,
1661
+ preState.serialize(),
1662
+ preStateRoot,
1663
+ `${logStr}_pre_state`
1664
+ ),
1665
+ this.persistSszObject(
1666
+ `postState_slot_${postState.slot}_BeaconState`,
1667
+ postState.serialize(),
1668
+ postStateRoot,
1669
+ `${logStr}_post_state`
1670
+ ),
1671
+ ]);
1672
+ } catch (e) {
1673
+ this.logger.error(
1674
+ "Error persisting invalid state root objects",
1675
+ {slot: blockSlot, preStateRoot, postStateRoot},
1676
+ e as Error
1677
+ );
1678
+ }
1679
+ }
1680
+
1681
+ async persistInvalidSignature(state: IBeaconStateView, block: SignedBeaconBlock): Promise<void> {
1682
+ if (!this.opts.persistInvalidSszObjects) {
1683
+ return;
1684
+ }
1685
+ const blockSlot = block.message.slot;
1686
+ const forkTypes = this.config.getForkTypes(blockSlot);
1687
+ try {
1688
+ await Promise.all([
1689
+ this.persistSszObject(
1690
+ forkTypes.SignedBeaconBlock.typeName,
1691
+ forkTypes.SignedBeaconBlock.serialize(block),
1692
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1693
+ `${blockSlot}_invalid_signature`
1694
+ ),
1695
+ this.persistSszObject(
1696
+ "BeaconState",
1697
+ state.serialize(),
1698
+ toRootHex(state.hashTreeRoot()),
1699
+ `${state.slot}_invalid_signature`
1700
+ ),
1701
+ ]);
1702
+ } catch (e) {
1703
+ this.logger.error("Error persisting invalid signature objects", {slot: blockSlot}, e as Error);
1704
+ }
1600
1705
  }
1601
1706
 
1602
1707
  persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string, rootHex?: RootHex): void {
@@ -1611,12 +1716,6 @@ export class BeaconChain implements IBeaconChain {
1611
1716
  }
1612
1717
  }
1613
1718
 
1614
- persistInvalidSszBytes(typeName: string, sszBytes: Uint8Array, rootHex: RootHex, suffix?: string): void {
1615
- if (this.opts.persistInvalidSszObjects) {
1616
- void this.persistSszObject(typeName, sszBytes, rootHex, suffix);
1617
- }
1618
- }
1619
-
1620
1719
  /**
1621
1720
  * Regenerate state for attestation verification, this does not happen with default chain option of maxSkipSlots = 32 .
1622
1721
  * However, need to handle just in case. Lodestar doesn't support multiple regen state requests for attestation verification
@@ -1816,19 +1915,25 @@ export class BeaconChain implements IBeaconChain {
1816
1915
  private onClockSlot(slot: Slot): void {
1817
1916
  this.logger.verbose("Clock slot", {slot});
1818
1917
 
1819
- // CRITICAL UPDATE
1820
- if (this.forkChoice.irrecoverableError) {
1821
- this.processShutdownCallback(this.forkChoice.irrecoverableError);
1822
- }
1823
-
1824
1918
  // updateTime() recomputes the head on epoch-boundary checkpoint pull-up and under fast confirmation
1825
1919
  const prevHead = this.forkChoice.getHead();
1826
- this.forkChoice.updateTime(slot);
1920
+ try {
1921
+ this.forkChoice.updateTime(slot);
1922
+ } catch (e) {
1923
+ // Per optimistic sync the node MAY exit once the justified checkpoint is INVALIDATED, fork choice has no head
1924
+ if (e instanceof ForkChoiceError && e.type.code === ForkChoiceErrorCode.INVALID_JUSTIFIED_EXECUTION_STATUS) {
1925
+ this.processShutdownCallback(e);
1926
+ return;
1927
+ }
1928
+ throw e;
1929
+ }
1827
1930
  this.emitHeadEvents(prevHead, this.forkChoice.getHead());
1828
1931
  this.metrics?.clockSlot.set(slot);
1829
1932
 
1830
1933
  this.attestationPool.prune(slot);
1831
1934
  this.aggregatedAttestationPool.prune(slot);
1935
+ this.proposerTracker.prune(slot);
1936
+ this.singleAttestationPool.prune(this.proposerTracker);
1832
1937
  this.syncCommitteeMessagePool.prune(slot);
1833
1938
  this.seenSyncCommitteeMessages.prune(slot);
1834
1939
  this.payloadAttestationPool.prune(slot);
@@ -1855,6 +1960,55 @@ export class BeaconChain implements IBeaconChain {
1855
1960
  }
1856
1961
  }
1857
1962
 
1963
+ /**
1964
+ * Track upcoming proposals of validators connected to this node, so that SingleAttestationPool only collects and
1965
+ * the network only subscribes to all attestation subnets before them. Proposals only change when the decision block
1966
+ * of next epoch proposers changes (the head enters a new epoch or reorgs that block) or a new validator connects,
1967
+ * set localProposalsKey to null before calling for the latter.
1968
+ * Never throws, it runs during block import.
1969
+ */
1970
+ private refreshLocalProposals(): void {
1971
+ const clockSlot = this.clock.currentSlot;
1972
+ try {
1973
+ const headState = this.getHeadState();
1974
+ const headFork = this.config.getForkName(headState.slot);
1975
+ // post-fulu, the head state knows proposers of its epoch and the next one thanks to the proposer lookahead,
1976
+ // a pre-fulu state only predicts next epoch proposers
1977
+ if (!isForkPostFulu(headFork) || headState.epoch < computeEpochAtSlot(clockSlot) - 1) {
1978
+ return;
1979
+ }
1980
+
1981
+ const decisionRoot = proposerShufflingDecisionRoot(headFork, headState, headState.epoch + 1);
1982
+ if (decisionRoot === null) {
1983
+ return;
1984
+ }
1985
+ const localProposalsKey = `${headState.epoch}_${toRootHex(decisionRoot)}`;
1986
+ if (localProposalsKey === this.localProposalsKey) {
1987
+ return;
1988
+ }
1989
+ this.localProposalsKey = localProposalsKey;
1990
+
1991
+ const startSlot = computeStartSlotAtEpoch(headState.epoch);
1992
+ const newProposalSlots: Slot[] = [];
1993
+ for (const [i, proposerIndex] of [...headState.currentProposers, ...headState.nextProposers].entries()) {
1994
+ const proposalSlot = startSlot + i;
1995
+ if (
1996
+ proposalSlot >= clockSlot &&
1997
+ this.beaconProposerCache.has(proposerIndex) &&
1998
+ this.proposerTracker.addProposal(proposalSlot)
1999
+ ) {
2000
+ newProposalSlots.push(proposalSlot);
2001
+ }
2002
+ }
2003
+
2004
+ if (newProposalSlots.length > 0) {
2005
+ this.emitter.emit(ChainEvent.localProposalSlots, newProposalSlots);
2006
+ }
2007
+ } catch (e) {
2008
+ this.logger.debug("Error refreshing local proposals", {slot: clockSlot}, e as Error);
2009
+ }
2010
+ }
2011
+
1858
2012
  private onClockEpoch(epoch: Epoch): void {
1859
2013
  this.metrics?.clockEpoch.set(epoch);
1860
2014
 
@@ -1869,6 +2023,8 @@ export class BeaconChain implements IBeaconChain {
1869
2023
  protected onNewHead(head: ProtoBlock): void {
1870
2024
  this.syncContributionAndProofPool.prune(head.slot);
1871
2025
  this.seenContributionAndProof.prune(head.slot);
2026
+
2027
+ this.refreshLocalProposals();
1872
2028
  }
1873
2029
 
1874
2030
  private onForkChoiceJustified(this: BeaconChain, cp: CheckpointWithHex): void {
@@ -1937,6 +2093,9 @@ export class BeaconChain implements IBeaconChain {
1937
2093
 
1938
2094
  // Only update validator custody if we discovered new validators
1939
2095
  if (newValidatorCount > previousValidatorCount) {
2096
+ // new validators may propose in the current or next epoch, a failed attempt leaves null so the next head retries
2097
+ this.localProposalsKey = null;
2098
+ this.refreshLocalProposals();
1940
2099
  const finalizedCheckpoint = this.forkChoice.getFinalizedCheckpoint();
1941
2100
  await this.updateValidatorsCustodyRequirement(finalizedCheckpoint);
1942
2101
  }
@@ -1952,6 +2111,9 @@ export class BeaconChain implements IBeaconChain {
1952
2111
 
1953
2112
  // Only update validator custody if we discovered new validators
1954
2113
  if (hasNewValidators) {
2114
+ // new validators may propose in the current or next epoch, a failed attempt leaves null so the next head retries
2115
+ this.localProposalsKey = null;
2116
+ this.refreshLocalProposals();
1955
2117
  const finalizedCheckpoint = this.forkChoice.getFinalizedCheckpoint();
1956
2118
  await this.updateValidatorsCustodyRequirement(finalizedCheckpoint);
1957
2119
  }
@@ -3,7 +3,7 @@ import {StrictEventEmitter} from "strict-event-emitter-types";
3
3
  import {routes} from "@lodestar/api";
4
4
  import {CheckpointWithHex, PtcQuorumEvent} from "@lodestar/fork-choice";
5
5
  import {IBeaconStateView} from "@lodestar/state-transition";
6
- import {DataColumnSidecar, RootHex, Slot, deneb, phase0} from "@lodestar/types";
6
+ import {DataColumnSidecar, RootHex, Slot, phase0} from "@lodestar/types";
7
7
  import {PeerIdStr} from "../util/peerId.js";
8
8
  import {BlockInputSource, IBlockInput} from "./blocks/blockInput/types.js";
9
9
  import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
@@ -50,16 +50,16 @@ export enum ChainEvent {
50
50
  * and are ready to be published.
51
51
  */
52
52
  publishDataColumns = "publishDataColumns",
53
- /**
54
- * This event signals that blobs have been fetched from the execution engine
55
- * and are ready to be published.
56
- */
57
- publishBlobSidecars = "publishBlobSidecars",
58
53
  /**
59
54
  * This event signals that a proposer slashing has been produced from an observed equivocation
60
55
  * and is ready to be published.
61
56
  */
62
57
  publishProposerSlashing = "publishProposerSlashing",
58
+ /**
59
+ * New block proposal slots of validators connected to this node, the network subscribes to all attestation
60
+ * subnets before them, see `slotsToSubscribeBeforeProposalDuty`
61
+ */
62
+ localProposalSlots = "localProposalSlots",
63
63
  /**
64
64
  * Trigger an update of status so reqresp by peers have current earliestAvailableSlot
65
65
  */
@@ -123,10 +123,10 @@ export type IChainEvents = ApiEvents & {
123
123
 
124
124
  [ChainEvent.publishDataColumns]: (sidecars: DataColumnSidecar[]) => void;
125
125
 
126
- [ChainEvent.publishBlobSidecars]: (sidecars: deneb.BlobSidecar[]) => void;
127
-
128
126
  [ChainEvent.publishProposerSlashing]: (proposerSlashing: phase0.ProposerSlashing) => void;
129
127
 
128
+ [ChainEvent.localProposalSlots]: (proposalSlots: Slot[]) => void;
129
+
130
130
  [ChainEvent.updateStatus]: () => void;
131
131
 
132
132
  // Sync events that are chain->chain. Initiated from network requests but do not cross the network
@@ -151,6 +151,14 @@ export enum AttestationErrorCode {
151
151
  * Gloas: index-1 attestation but the execution payload has not been seen yet
152
152
  */
153
153
  EXECUTION_PAYLOAD_NOT_SEEN = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_NOT_SEEN",
154
+ /**
155
+ * Gloas: index-1 attestation to a block whose execution payload is not yet validated by the execution engine
156
+ */
157
+ EXECUTION_PAYLOAD_OPTIMISTIC = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_OPTIMISTIC",
158
+ /**
159
+ * Gloas: index-1 attestation to a block whose execution payload was invalidated
160
+ */
161
+ EXECUTION_PAYLOAD_INVALID = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_INVALID",
154
162
  }
155
163
 
156
164
  export type AttestationErrorType =
@@ -190,7 +198,9 @@ export type AttestationErrorType =
190
198
  | {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE}
191
199
  | {code: AttestationErrorCode.INVALID_PAYLOAD_STATUS_VALUE; attDataIndex: number}
192
200
  | {code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT}
193
- | {code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN; beaconBlockRoot: RootHex};
201
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN; beaconBlockRoot: RootHex}
202
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_OPTIMISTIC; beaconBlockRoot: RootHex}
203
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_INVALID; beaconBlockRoot: RootHex};
194
204
 
195
205
  export class AttestationError extends GossipActionError<AttestationErrorType> {
196
206
  getMetadata(): Record<string, string | number | null> {
@@ -72,7 +72,7 @@ export enum BlockErrorCode {
72
72
  * whoever served the block MAY be downscored. Mirrors PayloadErrorCode.EXECUTION_ENGINE_INVALID.
73
73
  */
74
74
  EXECUTION_ENGINE_INVALID = "BLOCK_ERROR_EXECUTION_INVALID",
75
- /** The blobs are unavailable */
75
+ /** The blob or column data did not arrive within the availability wait */
76
76
  DATA_UNAVAILABLE = "BLOCK_ERROR_DATA_UNAVAILABLE",
77
77
  /** Block contains too many kzg commitments */
78
78
  TOO_MANY_KZG_COMMITMENTS = "BLOCK_ERROR_TOO_MANY_KZG_COMMITMENTS",
@@ -7,7 +7,7 @@ export enum ExecutionPayloadBidErrorCode {
7
7
  NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
8
8
  BLOCK_HASH_EQUALS_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_BLOCK_HASH_EQUALS_PARENT_BLOCK_HASH",
9
9
  INCOMPATIBLE_WITH_HEAD = "EXECUTION_PAYLOAD_BID_ERROR_INCOMPATIBLE_WITH_HEAD",
10
- BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
10
+ BID_LIMIT_REACHED = "EXECUTION_PAYLOAD_BID_ERROR_BID_LIMIT_REACHED",
11
11
  BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
12
12
  BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
13
13
  BUILDER_MAY_EXIT = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_MAY_EXIT",
@@ -46,11 +46,12 @@ export type ExecutionPayloadBidErrorType =
46
46
  headBlockRoot: RootHex;
47
47
  }
48
48
  | {
49
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
49
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED;
50
50
  builderIndex: BuilderIndex;
51
51
  slot: Slot;
52
52
  parentBlockRoot: RootHex;
53
53
  parentBlockHash: RootHex;
54
+ bidLimit: number;
54
55
  }
55
56
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
56
57
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}