@lodestar/beacon-node 1.42.0 → 1.43.0-dev.05a33e512f

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 (462) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +37 -9
  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 +49 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/index.js +13 -10
  9. package/lib/api/impl/beacon/state/index.js.map +1 -1
  10. package/lib/api/impl/beacon/state/utils.d.ts +2 -2
  11. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  12. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  13. package/lib/api/impl/debug/index.d.ts.map +1 -1
  14. package/lib/api/impl/debug/index.js +0 -1
  15. package/lib/api/impl/debug/index.js.map +1 -1
  16. package/lib/api/impl/lodestar/attesterSlashing.d.ts +8 -0
  17. package/lib/api/impl/lodestar/attesterSlashing.d.ts.map +1 -0
  18. package/lib/api/impl/lodestar/attesterSlashing.js +29 -0
  19. package/lib/api/impl/lodestar/attesterSlashing.js.map +1 -0
  20. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  21. package/lib/api/impl/lodestar/index.js +40 -1
  22. package/lib/api/impl/lodestar/index.js.map +1 -1
  23. package/lib/api/impl/validator/index.d.ts.map +1 -1
  24. package/lib/api/impl/validator/index.js +74 -5
  25. package/lib/api/impl/validator/index.js.map +1 -1
  26. package/lib/chain/GetBlobsTracker.d.ts +1 -1
  27. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  28. package/lib/chain/GetBlobsTracker.js +1 -2
  29. package/lib/chain/GetBlobsTracker.js.map +1 -1
  30. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  31. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  32. package/lib/chain/archiveStore/interface.d.ts +4 -4
  33. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  34. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
  35. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
  36. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +2 -4
  37. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
  38. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +2 -2
  39. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  40. package/lib/chain/archiveStore/utils/archiveBlocks.js +110 -58
  41. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  42. package/lib/chain/blocks/blockInput/blockInput.d.ts +3 -0
  43. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  44. package/lib/chain/blocks/blockInput/blockInput.js +4 -1
  45. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  46. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  47. package/lib/chain/blocks/importBlock.js +40 -58
  48. package/lib/chain/blocks/importBlock.js.map +1 -1
  49. package/lib/chain/blocks/importExecutionPayload.d.ts +32 -14
  50. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  51. package/lib/chain/blocks/importExecutionPayload.js +107 -87
  52. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  53. package/lib/chain/blocks/index.d.ts +5 -3
  54. package/lib/chain/blocks/index.d.ts.map +1 -1
  55. package/lib/chain/blocks/index.js +58 -26
  56. package/lib/chain/blocks/index.js.map +1 -1
  57. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +15 -1
  58. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  59. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +48 -2
  60. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  61. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +17 -0
  62. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  63. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +5 -0
  64. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  65. package/lib/chain/blocks/payloadEnvelopeProcessor.js +7 -5
  66. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  67. package/lib/chain/blocks/types.d.ts +16 -21
  68. package/lib/chain/blocks/types.d.ts.map +1 -1
  69. package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
  70. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  71. package/lib/chain/blocks/utils/chainSegment.js +89 -12
  72. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  73. package/lib/chain/blocks/verifyBlock.d.ts +5 -3
  74. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  75. package/lib/chain/blocks/verifyBlock.js +50 -7
  76. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  77. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
  78. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  79. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +8 -4
  80. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  81. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
  82. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  83. package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
  84. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  85. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  86. package/lib/chain/blocks/verifyBlocksSignatures.js +4 -2
  87. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  88. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +24 -0
  89. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -0
  90. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +80 -0
  91. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -0
  92. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +14 -0
  93. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -0
  94. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +30 -0
  95. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -0
  96. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +1 -1
  97. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
  98. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +2 -11
  99. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
  100. package/lib/chain/chain.d.ts +9 -6
  101. package/lib/chain/chain.d.ts.map +1 -1
  102. package/lib/chain/chain.js +73 -49
  103. package/lib/chain/chain.js.map +1 -1
  104. package/lib/chain/emitter.d.ts +16 -15
  105. package/lib/chain/emitter.d.ts.map +1 -1
  106. package/lib/chain/emitter.js +5 -4
  107. package/lib/chain/emitter.js.map +1 -1
  108. package/lib/chain/errors/attestationError.d.ts +8 -1
  109. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  110. package/lib/chain/errors/attestationError.js +4 -0
  111. package/lib/chain/errors/attestationError.js.map +1 -1
  112. package/lib/chain/errors/blockError.d.ts +18 -1
  113. package/lib/chain/errors/blockError.d.ts.map +1 -1
  114. package/lib/chain/errors/blockError.js +6 -0
  115. package/lib/chain/errors/blockError.js.map +1 -1
  116. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  117. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  118. package/lib/chain/errors/executionPayloadBid.js +1 -0
  119. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  120. package/lib/chain/errors/executionPayloadEnvelope.d.ts +5 -0
  121. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  122. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  123. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  124. package/lib/chain/errors/index.d.ts +1 -0
  125. package/lib/chain/errors/index.d.ts.map +1 -1
  126. package/lib/chain/errors/index.js +1 -0
  127. package/lib/chain/errors/index.js.map +1 -1
  128. package/lib/chain/errors/proposerPreferences.d.ts +40 -0
  129. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  130. package/lib/chain/errors/proposerPreferences.js +14 -0
  131. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  132. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  133. package/lib/chain/forkChoice/index.js +21 -23
  134. package/lib/chain/forkChoice/index.js.map +1 -1
  135. package/lib/chain/initState.d.ts.map +1 -1
  136. package/lib/chain/initState.js +6 -1
  137. package/lib/chain/initState.js.map +1 -1
  138. package/lib/chain/interface.d.ts +8 -5
  139. package/lib/chain/interface.d.ts.map +1 -1
  140. package/lib/chain/interface.js.map +1 -1
  141. package/lib/chain/lightClient/index.d.ts +2 -2
  142. package/lib/chain/lightClient/index.d.ts.map +1 -1
  143. package/lib/chain/lightClient/index.js +7 -0
  144. package/lib/chain/lightClient/index.js.map +1 -1
  145. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  146. package/lib/chain/opPools/aggregatedAttestationPool.js +5 -2
  147. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  148. package/lib/chain/opPools/executionPayloadBidPool.d.ts +2 -2
  149. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
  150. package/lib/chain/opPools/executionPayloadBidPool.js +2 -2
  151. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
  152. package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
  153. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  154. package/lib/chain/opPools/payloadAttestationPool.js +26 -4
  155. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  156. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  157. package/lib/chain/prepareNextSlot.js +48 -18
  158. package/lib/chain/prepareNextSlot.js.map +1 -1
  159. package/lib/chain/produceBlock/computeNewStateRoot.d.ts +1 -7
  160. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  161. package/lib/chain/produceBlock/computeNewStateRoot.js +1 -28
  162. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  163. package/lib/chain/produceBlock/produceBlockBody.d.ts +15 -10
  164. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  165. package/lib/chain/produceBlock/produceBlockBody.js +83 -21
  166. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  167. package/lib/chain/regen/errors.d.ts +1 -11
  168. package/lib/chain/regen/errors.d.ts.map +1 -1
  169. package/lib/chain/regen/errors.js +0 -2
  170. package/lib/chain/regen/errors.js.map +1 -1
  171. package/lib/chain/regen/interface.d.ts +7 -12
  172. package/lib/chain/regen/interface.d.ts.map +1 -1
  173. package/lib/chain/regen/interface.js +1 -0
  174. package/lib/chain/regen/interface.js.map +1 -1
  175. package/lib/chain/regen/queued.d.ts +6 -11
  176. package/lib/chain/regen/queued.d.ts.map +1 -1
  177. package/lib/chain/regen/queued.js +9 -44
  178. package/lib/chain/regen/queued.js.map +1 -1
  179. package/lib/chain/regen/regen.d.ts +0 -5
  180. package/lib/chain/regen/regen.d.ts.map +1 -1
  181. package/lib/chain/regen/regen.js +8 -38
  182. package/lib/chain/regen/regen.js.map +1 -1
  183. package/lib/chain/seenCache/index.d.ts +1 -0
  184. package/lib/chain/seenCache/index.d.ts.map +1 -1
  185. package/lib/chain/seenCache/index.js +1 -0
  186. package/lib/chain/seenCache/index.js.map +1 -1
  187. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +24 -7
  188. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  189. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +69 -17
  190. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  191. package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
  192. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  193. package/lib/chain/seenCache/seenProposerPreferences.js +26 -0
  194. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  195. package/lib/chain/stateCache/datastore/db.d.ts +5 -4
  196. package/lib/chain/stateCache/datastore/db.d.ts.map +1 -1
  197. package/lib/chain/stateCache/datastore/db.js +10 -32
  198. package/lib/chain/stateCache/datastore/db.js.map +1 -1
  199. package/lib/chain/stateCache/datastore/file.d.ts +1 -1
  200. package/lib/chain/stateCache/datastore/file.d.ts.map +1 -1
  201. package/lib/chain/stateCache/datastore/file.js +5 -5
  202. package/lib/chain/stateCache/datastore/file.js.map +1 -1
  203. package/lib/chain/stateCache/datastore/types.d.ts +1 -1
  204. package/lib/chain/stateCache/datastore/types.d.ts.map +1 -1
  205. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -7
  206. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  207. package/lib/chain/stateCache/fifoBlockStateCache.js +0 -8
  208. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  209. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +13 -30
  210. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  211. package/lib/chain/stateCache/persistentCheckpointsCache.js +120 -216
  212. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  213. package/lib/chain/stateCache/types.d.ts +8 -15
  214. package/lib/chain/stateCache/types.d.ts.map +1 -1
  215. package/lib/chain/stateCache/types.js.map +1 -1
  216. package/lib/chain/validation/aggregateAndProof.js +12 -0
  217. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  218. package/lib/chain/validation/attestation.d.ts.map +1 -1
  219. package/lib/chain/validation/attestation.js +12 -0
  220. package/lib/chain/validation/attestation.js.map +1 -1
  221. package/lib/chain/validation/block.d.ts.map +1 -1
  222. package/lib/chain/validation/block.js +28 -5
  223. package/lib/chain/validation/block.js.map +1 -1
  224. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  225. package/lib/chain/validation/executionPayloadBid.js +30 -12
  226. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  227. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  228. package/lib/chain/validation/executionPayloadEnvelope.js +27 -12
  229. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  230. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  231. package/lib/chain/validation/payloadAttestationMessage.js +8 -4
  232. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  233. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  234. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  235. package/lib/chain/validation/proposerPreferences.js +91 -0
  236. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  237. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  238. package/lib/chain/validation/syncCommittee.js +4 -0
  239. package/lib/chain/validation/syncCommittee.js.map +1 -1
  240. package/lib/chain/validation/syncCommitteeContributionAndProof.js +4 -1
  241. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  242. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  243. package/lib/chain/validatorMonitor.js +3 -3
  244. package/lib/chain/validatorMonitor.js.map +1 -1
  245. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +1 -1
  246. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  247. package/lib/execution/engine/http.d.ts.map +1 -1
  248. package/lib/execution/engine/http.js +21 -14
  249. package/lib/execution/engine/http.js.map +1 -1
  250. package/lib/execution/engine/interface.d.ts +1 -0
  251. package/lib/execution/engine/interface.d.ts.map +1 -1
  252. package/lib/execution/engine/mock.d.ts.map +1 -1
  253. package/lib/execution/engine/mock.js +6 -0
  254. package/lib/execution/engine/mock.js.map +1 -1
  255. package/lib/execution/engine/types.d.ts +20 -0
  256. package/lib/execution/engine/types.d.ts.map +1 -1
  257. package/lib/execution/engine/types.js +18 -0
  258. package/lib/execution/engine/types.js.map +1 -1
  259. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  260. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  261. package/lib/metrics/metrics/lodestar.js +4 -0
  262. package/lib/metrics/metrics/lodestar.js.map +1 -1
  263. package/lib/network/gossip/interface.d.ts +7 -1
  264. package/lib/network/gossip/interface.d.ts.map +1 -1
  265. package/lib/network/gossip/interface.js +1 -0
  266. package/lib/network/gossip/interface.js.map +1 -1
  267. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  268. package/lib/network/gossip/scoringParameters.js +12 -1
  269. package/lib/network/gossip/scoringParameters.js.map +1 -1
  270. package/lib/network/gossip/topic.d.ts +32 -748
  271. package/lib/network/gossip/topic.d.ts.map +1 -1
  272. package/lib/network/gossip/topic.js +6 -0
  273. package/lib/network/gossip/topic.js.map +1 -1
  274. package/lib/network/interface.d.ts +1 -0
  275. package/lib/network/interface.d.ts.map +1 -1
  276. package/lib/network/network.d.ts +1 -0
  277. package/lib/network/network.d.ts.map +1 -1
  278. package/lib/network/network.js +6 -1
  279. package/lib/network/network.js.map +1 -1
  280. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  281. package/lib/network/processor/gossipHandlers.js +64 -22
  282. package/lib/network/processor/gossipHandlers.js.map +1 -1
  283. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  284. package/lib/network/processor/gossipQueues/index.js +5 -0
  285. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  286. package/lib/network/processor/index.d.ts.map +1 -1
  287. package/lib/network/processor/index.js +6 -5
  288. package/lib/network/processor/index.js.map +1 -1
  289. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  290. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +16 -7
  291. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  292. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  293. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +2 -0
  294. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  295. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +2 -2
  296. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
  297. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +18 -8
  298. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  299. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  300. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +6 -0
  301. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  302. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts +2 -2
  303. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  304. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +24 -8
  305. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  306. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  307. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +9 -5
  308. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  309. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
  310. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +3 -8
  311. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
  312. package/lib/node/nodejs.d.ts.map +1 -1
  313. package/lib/node/nodejs.js +7 -2
  314. package/lib/node/nodejs.js.map +1 -1
  315. package/lib/node/notifier.d.ts.map +1 -1
  316. package/lib/node/notifier.js +2 -2
  317. package/lib/node/notifier.js.map +1 -1
  318. package/lib/sync/constants.d.ts +3 -1
  319. package/lib/sync/constants.d.ts.map +1 -1
  320. package/lib/sync/constants.js +3 -4
  321. package/lib/sync/constants.js.map +1 -1
  322. package/lib/sync/range/batch.d.ts +35 -5
  323. package/lib/sync/range/batch.d.ts.map +1 -1
  324. package/lib/sync/range/batch.js +240 -59
  325. package/lib/sync/range/batch.js.map +1 -1
  326. package/lib/sync/range/chain.d.ts +19 -4
  327. package/lib/sync/range/chain.d.ts.map +1 -1
  328. package/lib/sync/range/chain.js +64 -11
  329. package/lib/sync/range/chain.js.map +1 -1
  330. package/lib/sync/range/range.d.ts.map +1 -1
  331. package/lib/sync/range/range.js +31 -9
  332. package/lib/sync/range/range.js.map +1 -1
  333. package/lib/sync/sync.d.ts.map +1 -1
  334. package/lib/sync/sync.js +13 -0
  335. package/lib/sync/sync.js.map +1 -1
  336. package/lib/sync/types.d.ts +34 -0
  337. package/lib/sync/types.d.ts.map +1 -1
  338. package/lib/sync/types.js +34 -0
  339. package/lib/sync/types.js.map +1 -1
  340. package/lib/sync/unknownBlock.d.ts +29 -1
  341. package/lib/sync/unknownBlock.d.ts.map +1 -1
  342. package/lib/sync/unknownBlock.js +738 -61
  343. package/lib/sync/unknownBlock.js.map +1 -1
  344. package/lib/sync/utils/downloadByRange.d.ts +67 -10
  345. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  346. package/lib/sync/utils/downloadByRange.js +211 -26
  347. package/lib/sync/utils/downloadByRange.js.map +1 -1
  348. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  349. package/lib/sync/utils/downloadByRoot.js +16 -2
  350. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  351. package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
  352. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  353. package/lib/sync/utils/pendingBlocksTree.js +0 -9
  354. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  355. package/lib/util/sszBytes.d.ts.map +1 -1
  356. package/lib/util/sszBytes.js +20 -5
  357. package/lib/util/sszBytes.js.map +1 -1
  358. package/package.json +17 -16
  359. package/src/api/impl/beacon/blocks/index.ts +51 -9
  360. package/src/api/impl/beacon/pool/index.ts +87 -1
  361. package/src/api/impl/beacon/state/index.ts +15 -15
  362. package/src/api/impl/beacon/state/utils.ts +2 -2
  363. package/src/api/impl/debug/index.ts +0 -1
  364. package/src/api/impl/lodestar/attesterSlashing.ts +43 -0
  365. package/src/api/impl/lodestar/index.ts +52 -2
  366. package/src/api/impl/validator/index.ts +91 -6
  367. package/src/chain/GetBlobsTracker.ts +1 -2
  368. package/src/chain/archiveStore/archiveStore.ts +5 -5
  369. package/src/chain/archiveStore/interface.ts +4 -4
  370. package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +6 -8
  371. package/src/chain/archiveStore/utils/archiveBlocks.ts +153 -94
  372. package/src/chain/blocks/blockInput/blockInput.ts +4 -1
  373. package/src/chain/blocks/importBlock.ts +45 -86
  374. package/src/chain/blocks/importExecutionPayload.ts +133 -103
  375. package/src/chain/blocks/index.ts +72 -24
  376. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +64 -3
  377. package/src/chain/blocks/payloadEnvelopeInput/types.ts +18 -0
  378. package/src/chain/blocks/payloadEnvelopeProcessor.ts +7 -6
  379. package/src/chain/blocks/types.ts +16 -26
  380. package/src/chain/blocks/utils/chainSegment.ts +114 -17
  381. package/src/chain/blocks/verifyBlock.ts +70 -9
  382. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +8 -5
  383. package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
  384. package/src/chain/blocks/verifyBlocksSignatures.ts +9 -2
  385. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +137 -0
  386. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +41 -0
  387. package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
  388. package/src/chain/chain.ts +102 -72
  389. package/src/chain/emitter.ts +15 -14
  390. package/src/chain/errors/attestationError.ts +6 -1
  391. package/src/chain/errors/blockError.ts +10 -1
  392. package/src/chain/errors/executionPayloadBid.ts +6 -0
  393. package/src/chain/errors/executionPayloadEnvelope.ts +6 -0
  394. package/src/chain/errors/index.ts +1 -0
  395. package/src/chain/errors/proposerPreferences.ts +47 -0
  396. package/src/chain/forkChoice/index.ts +19 -28
  397. package/src/chain/initState.ts +9 -1
  398. package/src/chain/interface.ts +16 -3
  399. package/src/chain/lightClient/index.ts +15 -3
  400. package/src/chain/opPools/aggregatedAttestationPool.ts +6 -1
  401. package/src/chain/opPools/executionPayloadBidPool.ts +3 -3
  402. package/src/chain/opPools/payloadAttestationPool.ts +29 -8
  403. package/src/chain/prepareNextSlot.ts +58 -19
  404. package/src/chain/produceBlock/computeNewStateRoot.ts +1 -37
  405. package/src/chain/produceBlock/produceBlockBody.ts +120 -26
  406. package/src/chain/regen/errors.ts +1 -6
  407. package/src/chain/regen/interface.ts +7 -12
  408. package/src/chain/regen/queued.ts +14 -55
  409. package/src/chain/regen/regen.ts +10 -43
  410. package/src/chain/seenCache/index.ts +1 -0
  411. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +89 -21
  412. package/src/chain/seenCache/seenProposerPreferences.ts +32 -0
  413. package/src/chain/stateCache/datastore/db.ts +10 -33
  414. package/src/chain/stateCache/datastore/file.ts +5 -6
  415. package/src/chain/stateCache/datastore/types.ts +2 -3
  416. package/src/chain/stateCache/fifoBlockStateCache.ts +1 -10
  417. package/src/chain/stateCache/persistentCheckpointsCache.ts +139 -247
  418. package/src/chain/stateCache/types.ts +8 -14
  419. package/src/chain/validation/aggregateAndProof.ts +13 -0
  420. package/src/chain/validation/attestation.ts +13 -0
  421. package/src/chain/validation/block.ts +31 -7
  422. package/src/chain/validation/executionPayloadBid.ts +32 -11
  423. package/src/chain/validation/executionPayloadEnvelope.ts +32 -13
  424. package/src/chain/validation/payloadAttestationMessage.ts +9 -3
  425. package/src/chain/validation/proposerPreferences.ts +110 -0
  426. package/src/chain/validation/syncCommittee.ts +5 -1
  427. package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -1
  428. package/src/chain/validatorMonitor.ts +3 -2
  429. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +1 -1
  430. package/src/execution/engine/http.ts +21 -14
  431. package/src/execution/engine/interface.ts +1 -0
  432. package/src/execution/engine/mock.ts +8 -1
  433. package/src/execution/engine/types.ts +41 -0
  434. package/src/metrics/metrics/lodestar.ts +4 -0
  435. package/src/network/gossip/interface.ts +6 -0
  436. package/src/network/gossip/scoringParameters.ts +14 -1
  437. package/src/network/gossip/topic.ts +6 -0
  438. package/src/network/interface.ts +1 -0
  439. package/src/network/network.ts +12 -1
  440. package/src/network/processor/gossipHandlers.ts +84 -27
  441. package/src/network/processor/gossipQueues/index.ts +5 -0
  442. package/src/network/processor/index.ts +6 -5
  443. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +17 -7
  444. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +3 -0
  445. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +26 -8
  446. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +11 -0
  447. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +36 -8
  448. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +10 -5
  449. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +3 -12
  450. package/src/node/nodejs.ts +8 -3
  451. package/src/node/notifier.ts +7 -2
  452. package/src/sync/constants.ts +4 -4
  453. package/src/sync/range/batch.ts +320 -67
  454. package/src/sync/range/chain.ts +89 -14
  455. package/src/sync/range/range.ts +34 -9
  456. package/src/sync/sync.ts +13 -1
  457. package/src/sync/types.ts +72 -0
  458. package/src/sync/unknownBlock.ts +928 -65
  459. package/src/sync/utils/downloadByRange.ts +378 -39
  460. package/src/sync/utils/downloadByRoot.ts +24 -2
  461. package/src/sync/utils/pendingBlocksTree.ts +0 -15
  462. package/src/util/sszBytes.ts +25 -5
@@ -14,7 +14,15 @@ import {
14
14
  isForkPostBellatrix,
15
15
  isForkPostGloas,
16
16
  } from "@lodestar/params";
17
- import {G2_POINT_AT_INFINITY, IBeaconStateView, computeTimeAtSlot} from "@lodestar/state-transition";
17
+ import {
18
+ G2_POINT_AT_INFINITY,
19
+ IBeaconStateView,
20
+ type IBeaconStateViewBellatrix,
21
+ computeTimeAtSlot,
22
+ isStatePostBellatrix,
23
+ isStatePostCapella,
24
+ isStatePostGloas,
25
+ } from "@lodestar/state-transition";
18
26
  import {
19
27
  BLSPubkey,
20
28
  BLSSignature,
@@ -38,8 +46,9 @@ import {
38
46
  electra,
39
47
  fulu,
40
48
  gloas,
49
+ ssz,
41
50
  } from "@lodestar/types";
42
- import {Logger, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
51
+ import {Logger, byteArrayEquals, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
43
52
  import {ZERO_HASH_HEX} from "../../constants/index.js";
44
53
  import {numToQuantity} from "../../execution/engine/utils.js";
45
54
  import {
@@ -102,12 +111,7 @@ export type ProduceFullGloas = {
102
111
  executionRequests: electra.ExecutionRequests;
103
112
  blobsBundle: BlobsBundle<ForkPostGloas>;
104
113
  cells: fulu.Cell[][];
105
- /**
106
- * Cached envelope state root computed during block production.
107
- * This is the state root after running `processExecutionPayloadEnvelope` on the
108
- * post-block state, and later used to construct the `ExecutionPayloadEnvelope`.
109
- */
110
- envelopeStateRoot: Root;
114
+ parentBlockRoot: Root;
111
115
  };
112
116
  export type ProduceFullFulu = {
113
117
  type: BlockType.Full;
@@ -191,6 +195,10 @@ export async function produceBlockBody<T extends BlockType>(
191
195
  this.logger.verbose("Producing beacon block body", logMeta);
192
196
 
193
197
  if (isForkPostGloas(fork)) {
198
+ if (!isStatePostGloas(currentState)) {
199
+ throw new Error("Expected Gloas state for Gloas block production");
200
+ }
201
+
194
202
  // TODO GLOAS: support non self-building here, the block type differentiation between
195
203
  // full and blinded no longer makes sense in gloas, it might be a good idea to move
196
204
  // this into a completely separate function and have pre/post gloas more separated
@@ -207,14 +215,28 @@ export async function produceBlockBody<T extends BlockType>(
207
215
  });
208
216
 
209
217
  // Get execution payload from EL
218
+ let parentBlockHash: Bytes32;
219
+ let parentExecutionRequests: electra.ExecutionRequests;
220
+ // Apply parent payload once here as it's reused by EL prep and voluntary exit filtering below
221
+ let stateAfterParentPayload: IBeaconStateViewBellatrix = currentState;
222
+ const isExtendingPayload = this.forkChoice.shouldExtendPayload(toRootHex(parentBlockRoot));
223
+ if (isExtendingPayload) {
224
+ parentBlockHash = currentState.latestExecutionPayloadBid.blockHash;
225
+ parentExecutionRequests = await this.getParentExecutionRequests(parentBlock.slot, parentBlock.blockRoot);
226
+ stateAfterParentPayload = currentState.withParentPayloadApplied(parentExecutionRequests);
227
+ } else {
228
+ parentBlockHash = currentState.latestExecutionPayloadBid.parentBlockHash;
229
+ parentExecutionRequests = ssz.electra.ExecutionRequests.defaultValue();
230
+ }
210
231
  const prepareRes = await prepareExecutionPayload(
211
232
  this,
212
233
  this.logger,
213
234
  fork,
214
235
  parentBlockRoot,
236
+ parentBlockHash,
215
237
  safeBlockHash,
216
238
  finalizedBlockHash ?? ZERO_HASH_HEX,
217
- currentState,
239
+ stateAfterParentPayload,
218
240
  feeRecipient
219
241
  );
220
242
 
@@ -248,8 +270,8 @@ export async function produceBlockBody<T extends BlockType>(
248
270
 
249
271
  // Create self-build execution payload bid
250
272
  const bid: gloas.ExecutionPayloadBid = {
251
- parentBlockHash: currentState.latestBlockHash,
252
- parentBlockRoot: parentBlockRoot,
273
+ parentBlockHash,
274
+ parentBlockRoot,
253
275
  blockHash: executionPayload.blockHash,
254
276
  prevRandao: currentState.getRandaoMix(currentState.epoch),
255
277
  feeRecipient: executionPayload.feeRecipient,
@@ -259,6 +281,7 @@ export async function produceBlockBody<T extends BlockType>(
259
281
  value: 0,
260
282
  executionPayment: 0,
261
283
  blobKzgCommitments: blobsBundle.commitments,
284
+ executionRequestsRoot: ssz.electra.ExecutionRequests.hashTreeRoot(executionRequests),
262
285
  };
263
286
  const signedBid: gloas.SignedExecutionPayloadBid = {
264
287
  message: bid,
@@ -268,8 +291,19 @@ export async function produceBlockBody<T extends BlockType>(
268
291
  const commonBlockBody = await commonBlockBodyPromise;
269
292
  const gloasBody = Object.assign({}, commonBlockBody) as gloas.BeaconBlockBody;
270
293
  gloasBody.signedExecutionPayloadBid = signedBid;
271
- // TODO GLOAS: Get payload attestations from pool for previous slot
272
- gloasBody.payloadAttestations = [];
294
+ gloasBody.payloadAttestations = this.payloadAttestationPool.getPayloadAttestationsForBlock(
295
+ parentBlock.blockRoot,
296
+ blockSlot - 1
297
+ );
298
+ gloasBody.parentExecutionRequests = parentExecutionRequests;
299
+ // Drop voluntary exits that parent_execution_requests have invalidated (e.g. a withdrawal
300
+ // request initiating an exit on the same validator). Op pool selected against the unapplied
301
+ // state, so re-validate against the post-apply state to avoid producing an invalid block.
302
+ if (isExtendingPayload && commonBlockBody.voluntaryExits.length > 0) {
303
+ gloasBody.voluntaryExits = commonBlockBody.voluntaryExits.filter((signedVoluntaryExit) =>
304
+ stateAfterParentPayload.isValidVoluntaryExit(signedVoluntaryExit, false)
305
+ );
306
+ }
273
307
  blockBody = gloasBody as AssembledBodyType<T>;
274
308
 
275
309
  // Store execution payload data required to construct execution payload envelope later
@@ -278,6 +312,7 @@ export async function produceBlockBody<T extends BlockType>(
278
312
  gloasResult.executionRequests = executionRequests;
279
313
  gloasResult.blobsBundle = blobsBundle;
280
314
  gloasResult.cells = cells;
315
+ gloasResult.parentBlockRoot = fromHex(parentBlock.blockRoot);
281
316
 
282
317
  const fetchedTime = Date.now() / 1000 - computeTimeAtSlot(this.config, blockSlot, this.genesisTime);
283
318
  this.metrics?.blockPayload.payloadFetchedTime.observe({prepType}, fetchedTime);
@@ -297,6 +332,10 @@ export async function produceBlockBody<T extends BlockType>(
297
332
  shouldOverrideBuilder,
298
333
  });
299
334
  } else if (isForkPostBellatrix(fork)) {
335
+ if (!isStatePostBellatrix(currentState)) {
336
+ throw new Error("Expected Bellatrix state for execution block production");
337
+ }
338
+
300
339
  const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
301
340
  const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
302
341
  const feeRecipient = requestedFeeRecipient ?? this.beaconProposerCache.getOrDefault(proposerIndex);
@@ -323,6 +362,7 @@ export async function produceBlockBody<T extends BlockType>(
323
362
  this.logger,
324
363
  fork,
325
364
  parentBlockRoot,
365
+ currentState.latestExecutionPayloadHeader.blockHash,
326
366
  safeBlockHash,
327
367
  finalizedBlockHash ?? ZERO_HASH_HEX,
328
368
  currentState,
@@ -431,6 +471,7 @@ export async function produceBlockBody<T extends BlockType>(
431
471
  this.logger,
432
472
  fork,
433
473
  parentBlockRoot,
474
+ currentState.latestExecutionPayloadHeader.blockHash,
434
475
  safeBlockHash,
435
476
  finalizedBlockHash ?? ZERO_HASH_HEX,
436
477
  currentState,
@@ -596,17 +637,21 @@ export async function prepareExecutionPayload(
596
637
  logger: Logger,
597
638
  fork: ForkPostBellatrix,
598
639
  parentBlockRoot: Root,
640
+ parentBlockHash: Bytes32,
599
641
  safeBlockHash: RootHex,
600
642
  finalizedBlockHash: RootHex,
601
- state: IBeaconStateView,
643
+ /**
644
+ * Post-gloas, when extending a full parent, callers must apply
645
+ * parent execution payload first (see `withParentPayloadApplied`).
646
+ */
647
+ state: IBeaconStateViewBellatrix,
602
648
  suggestedFeeRecipient: string
603
649
  ): Promise<{prepType: PayloadPreparationType; payloadId: PayloadId}> {
604
- const parentHash = state.latestBlockHash;
605
650
  const timestamp = computeTimeAtSlot(chain.config, state.slot, state.genesisTime);
606
651
  const prevRandao = state.getRandaoMix(state.epoch);
607
652
 
608
653
  const payloadIdCached = chain.executionEngine.payloadIdCache.get({
609
- headBlockHash: toRootHex(parentHash),
654
+ headBlockHash: toRootHex(parentBlockHash),
610
655
  finalizedBlockHash,
611
656
  timestamp: numToQuantity(timestamp),
612
657
  prevRandao: toHex(prevRandao),
@@ -635,12 +680,13 @@ export async function prepareExecutionPayload(
635
680
  prepareState: state,
636
681
  prepareSlot: state.slot,
637
682
  parentBlockRoot,
683
+ parentBlockHash,
638
684
  feeRecipient: suggestedFeeRecipient,
639
685
  });
640
686
 
641
687
  payloadId = await chain.executionEngine.notifyForkchoiceUpdate(
642
688
  fork,
643
- toRootHex(parentHash),
689
+ toRootHex(parentBlockHash),
644
690
  safeBlockHash,
645
691
  finalizedBlockHash,
646
692
  attributes
@@ -666,7 +712,7 @@ async function prepareExecutionPayloadHeader(
666
712
  config: ChainForkConfig;
667
713
  },
668
714
  fork: ForkPostBellatrix,
669
- state: IBeaconStateView,
715
+ state: IBeaconStateViewBellatrix,
670
716
  proposerPubKey: BLSPubkey
671
717
  ): Promise<{
672
718
  header: ExecutionPayloadHeader;
@@ -692,20 +738,34 @@ export function getPayloadAttributesForSSE(
692
738
  prepareState,
693
739
  prepareSlot,
694
740
  parentBlockRoot,
741
+ parentBlockHash,
695
742
  feeRecipient,
696
- }: {prepareState: IBeaconStateView; prepareSlot: Slot; parentBlockRoot: Root; feeRecipient: string}
743
+ }: {
744
+ /**
745
+ * Post-gloas, when extending a full parent, callers must apply
746
+ * parent execution payload first (see `withParentPayloadApplied`).
747
+ */
748
+ prepareState: IBeaconStateViewBellatrix;
749
+ prepareSlot: Slot;
750
+ parentBlockRoot: Root;
751
+ parentBlockHash: Bytes32;
752
+ feeRecipient: string;
753
+ }
697
754
  ): SSEPayloadAttributes {
698
- const parentHash = prepareState.latestBlockHash;
699
755
  const payloadAttributes = preparePayloadAttributes(fork, chain, {
700
756
  prepareState,
701
757
  prepareSlot,
702
758
  parentBlockRoot,
759
+ parentBlockHash,
703
760
  feeRecipient,
704
761
  });
705
762
 
706
763
  let parentBlockNumber: number;
707
764
  if (isForkPostGloas(fork)) {
708
- const parentBlock = chain.forkChoice.getBlockHexAndBlockHash(toRootHex(parentBlockRoot), toRootHex(parentHash));
765
+ const parentBlock = chain.forkChoice.getBlockHexAndBlockHash(
766
+ toRootHex(parentBlockRoot),
767
+ toRootHex(parentBlockHash)
768
+ );
709
769
  if (parentBlock?.executionPayloadBlockHash == null) {
710
770
  throw Error(`Parent block not found in fork choice root=${toRootHex(parentBlockRoot)}`);
711
771
  }
@@ -719,7 +779,7 @@ export function getPayloadAttributesForSSE(
719
779
  proposalSlot: prepareSlot,
720
780
  parentBlockNumber,
721
781
  parentBlockRoot,
722
- parentBlockHash: parentHash,
782
+ parentBlockHash,
723
783
  payloadAttributes,
724
784
  };
725
785
  return ssePayloadAttributes;
@@ -734,11 +794,17 @@ function preparePayloadAttributes(
734
794
  prepareState,
735
795
  prepareSlot,
736
796
  parentBlockRoot,
797
+ parentBlockHash,
737
798
  feeRecipient,
738
799
  }: {
739
- prepareState: IBeaconStateView;
800
+ /**
801
+ * Post-gloas, when extending a full parent, callers must apply
802
+ * parent execution payload first (see `withParentPayloadApplied`).
803
+ */
804
+ prepareState: IBeaconStateViewBellatrix;
740
805
  prepareSlot: Slot;
741
806
  parentBlockRoot: Root;
807
+ parentBlockHash: Bytes32;
742
808
  feeRecipient: string;
743
809
  }
744
810
  ): SSEPayloadAttributes["payloadAttributes"] {
@@ -751,15 +817,43 @@ function preparePayloadAttributes(
751
817
  };
752
818
 
753
819
  if (ForkSeq[fork] >= ForkSeq.capella) {
754
- // withdrawals logic is now fork aware as it changes on electra fork post capella
755
- (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
756
- prepareState.getExpectedWithdrawals().expectedWithdrawals;
820
+ if (!isStatePostCapella(prepareState)) {
821
+ throw new Error("Expected Capella state for withdrawals");
822
+ }
823
+
824
+ if (isStatePostGloas(prepareState)) {
825
+ const isExtendingPayload = byteArrayEquals(parentBlockHash, prepareState.latestExecutionPayloadBid.blockHash);
826
+ if (isExtendingPayload) {
827
+ // applyParentExecutionPayload sets latestBlockHash = parentBid.blockHash, so a mismatch
828
+ // here means the caller did not apply parent payload to prepareState
829
+ if (!byteArrayEquals(prepareState.latestBlockHash, prepareState.latestExecutionPayloadBid.blockHash)) {
830
+ throw new Error("Expected state with parent execution payload applied for withdrawals");
831
+ }
832
+ (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
833
+ prepareState.getExpectedWithdrawals().expectedWithdrawals;
834
+ } else {
835
+ // When the parent block is empty, state.payloadExpectedWithdrawals holds a batch
836
+ // already deducted from CL balances but never credited on the EL (the envelope
837
+ // was not delivered). The next payload must carry those same withdrawals to
838
+ // restore CL/EL consistency, otherwise validators permanently lose that balance.
839
+ (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
840
+ prepareState.payloadExpectedWithdrawals;
841
+ }
842
+ } else {
843
+ // withdrawals logic is now fork aware as it changes on electra fork post capella
844
+ (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
845
+ prepareState.getExpectedWithdrawals().expectedWithdrawals;
846
+ }
757
847
  }
758
848
 
759
849
  if (ForkSeq[fork] >= ForkSeq.deneb) {
760
850
  (payloadAttributes as deneb.SSEPayloadAttributes["payloadAttributes"]).parentBeaconBlockRoot = parentBlockRoot;
761
851
  }
762
852
 
853
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
854
+ (payloadAttributes as gloas.SSEPayloadAttributes["payloadAttributes"]).slotNumber = prepareSlot;
855
+ }
856
+
763
857
  return payloadAttributes;
764
858
  }
765
859
 
@@ -1,4 +1,3 @@
1
- import {PayloadStatus} from "@lodestar/fork-choice";
2
1
  import {Root, RootHex, Slot} from "@lodestar/types";
3
2
 
4
3
  export enum RegenErrorCode {
@@ -10,8 +9,6 @@ export enum RegenErrorCode {
10
9
  BLOCK_NOT_IN_DB = "REGEN_ERROR_BLOCK_NOT_IN_DB",
11
10
  STATE_TRANSITION_ERROR = "REGEN_ERROR_STATE_TRANSITION_ERROR",
12
11
  INVALID_STATE_ROOT = "REGEN_ERROR_INVALID_STATE_ROOT",
13
- UNEXPECTED_PAYLOAD_STATUS = "REGEN_ERROR_UNEXPECTED_PAYLOAD_STATUS",
14
- INTERNAL_ERROR = "REGEN_ERROR_INTERNAL_ERROR",
15
12
  }
16
13
 
17
14
  export type RegenErrorType =
@@ -22,9 +19,7 @@ export type RegenErrorType =
22
19
  | {code: RegenErrorCode.TOO_MANY_BLOCK_PROCESSED; stateRoot: RootHex | Root}
23
20
  | {code: RegenErrorCode.BLOCK_NOT_IN_DB; blockRoot: RootHex | Root}
24
21
  | {code: RegenErrorCode.STATE_TRANSITION_ERROR; error: Error}
25
- | {code: RegenErrorCode.INVALID_STATE_ROOT; slot: Slot; expected: RootHex; actual: RootHex}
26
- | {code: RegenErrorCode.UNEXPECTED_PAYLOAD_STATUS; blockRoot: RootHex | Root; payloadStatus: PayloadStatus}
27
- | {code: RegenErrorCode.INTERNAL_ERROR; message: string};
22
+ | {code: RegenErrorCode.INVALID_STATE_ROOT; slot: Slot; expected: RootHex; actual: RootHex};
28
23
 
29
24
  export class RegenError extends Error {
30
25
  type: RegenErrorType;
@@ -2,7 +2,7 @@ import {routes} from "@lodestar/api";
2
2
  import {ProtoBlock} from "@lodestar/fork-choice";
3
3
  import {IBeaconStateView} from "@lodestar/state-transition";
4
4
  import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types";
5
- import {CheckpointHexPayload} from "../stateCache/types.js";
5
+ import {CheckpointHex} from "../stateCache/types.js";
6
6
 
7
7
  export enum RegenCaller {
8
8
  getDuties = "getDuties",
@@ -21,6 +21,7 @@ export enum RegenCaller {
21
21
  validateGossipAttestation = "validateGossipAttestation",
22
22
  validateGossipVoluntaryExit = "validateGossipVoluntaryExit",
23
23
  validateGossipExecutionPayloadBid = "validateGossipExecutionPayloadBid",
24
+ validateGossipProposerPreferences = "validateGossipProposerPreferences",
24
25
  onForkChoiceFinalized = "onForkChoiceFinalized",
25
26
  restApi = "restApi",
26
27
  }
@@ -40,21 +41,15 @@ export interface IStateRegenerator extends IStateRegeneratorInternal {
40
41
  dumpCacheSummary(): routes.lodestar.StateCacheItem[];
41
42
  getStateSync(stateRoot: RootHex): IBeaconStateView | null;
42
43
  getPreStateSync(block: BeaconBlock): IBeaconStateView | null;
43
- getCheckpointStateOrBytes(cp: CheckpointHexPayload): Promise<IBeaconStateView | Uint8Array | null>;
44
- getCheckpointStateSync(cp: CheckpointHexPayload): IBeaconStateView | null;
44
+ getCheckpointStateOrBytes(cp: CheckpointHex): Promise<IBeaconStateView | Uint8Array | null>;
45
+ getCheckpointStateSync(cp: CheckpointHex): IBeaconStateView | null;
45
46
  getClosestHeadState(head: ProtoBlock): IBeaconStateView | null;
46
47
  pruneOnCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void;
47
48
  pruneOnFinalized(finalizedEpoch: Epoch): void;
48
- processBlockState(blockRootHex: RootHex, postState: IBeaconStateView): void;
49
- processPayloadState(payloadState: IBeaconStateView): void;
50
- /**
51
- * payloadPresent is true if this is payload state, false if block state.
52
- * payloadPresent is always true for pre-gloas.
53
- */
54
- addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView, payloadPresent: boolean): void;
49
+ processState(blockRootHex: RootHex, postState: IBeaconStateView): void;
50
+ addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView): void;
55
51
  updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void;
56
- updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch, payloadPresent: boolean): number | null;
57
- upgradeForGloas(epoch: Epoch): void;
52
+ updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null;
58
53
  }
59
54
 
60
55
  /**
@@ -1,11 +1,11 @@
1
1
  import {routes} from "@lodestar/api";
2
- import {IForkChoice, PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
2
+ import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
3
3
  import {IBeaconStateView, computeEpochAtSlot} from "@lodestar/state-transition";
4
- import {BeaconBlock, Epoch, RootHex, Slot, isGloasBeaconBlock, phase0} from "@lodestar/types";
5
- import {Logger, fromHex, toRootHex} from "@lodestar/utils";
4
+ import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types";
5
+ import {Logger, toRootHex} from "@lodestar/utils";
6
6
  import {Metrics} from "../../metrics/index.js";
7
7
  import {JobItemQueue} from "../../util/queue/index.js";
8
- import {BlockStateCache, CheckpointHexPayload, CheckpointStateCache} from "../stateCache/types.js";
8
+ import {BlockStateCache, CheckpointHex, CheckpointStateCache} from "../stateCache/types.js";
9
9
  import {RegenError, RegenErrorCode} from "./errors.js";
10
10
  import {
11
11
  IStateRegenerator,
@@ -88,12 +88,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
88
88
  */
89
89
  getPreStateSync(block: BeaconBlock): IBeaconStateView | null {
90
90
  const parentRoot = toRootHex(block.parentRoot);
91
- const parentBlock = isGloasBeaconBlock(block)
92
- ? this.forkChoice.getBlockHexAndBlockHash(
93
- parentRoot,
94
- toRootHex(block.body.signedExecutionPayloadBid.message.parentBlockHash)
95
- )
96
- : this.forkChoice.getBlockHexDefaultStatus(parentRoot);
91
+ const parentBlock = this.forkChoice.getBlockHexDefaultStatus(parentRoot);
97
92
  if (!parentBlock) {
98
93
  throw new RegenError({
99
94
  code: RegenErrorCode.BLOCK_NOT_IN_FORKCHOICE,
@@ -104,19 +99,9 @@ export class QueuedStateRegenerator implements IStateRegenerator {
104
99
  const parentEpoch = computeEpochAtSlot(parentBlock.slot);
105
100
  const blockEpoch = computeEpochAtSlot(block.slot);
106
101
 
107
- // Convert PayloadStatus to payloadPresent boolean
108
- if (parentBlock.payloadStatus === PayloadStatus.PENDING) {
109
- throw new RegenError({
110
- code: RegenErrorCode.UNEXPECTED_PAYLOAD_STATUS,
111
- blockRoot: block.parentRoot,
112
- payloadStatus: parentBlock.payloadStatus,
113
- });
114
- }
115
- const payloadPresent = parentBlock.payloadStatus === PayloadStatus.FULL;
116
-
117
102
  // Check the checkpoint cache (if the pre-state is a checkpoint state)
118
103
  if (parentEpoch < blockEpoch) {
119
- const checkpointState = this.checkpointStateCache.getLatest(parentRoot, blockEpoch, payloadPresent);
104
+ const checkpointState = this.checkpointStateCache.getLatest(parentRoot, blockEpoch);
120
105
  if (checkpointState && computeEpochAtSlot(checkpointState.slot) === blockEpoch) {
121
106
  return checkpointState;
122
107
  }
@@ -135,14 +120,14 @@ export class QueuedStateRegenerator implements IStateRegenerator {
135
120
  return null;
136
121
  }
137
122
 
138
- async getCheckpointStateOrBytes(cp: CheckpointHexPayload): Promise<IBeaconStateView | Uint8Array | null> {
123
+ async getCheckpointStateOrBytes(cp: CheckpointHex): Promise<IBeaconStateView | Uint8Array | null> {
139
124
  return this.checkpointStateCache.getStateOrBytes(cp);
140
125
  }
141
126
 
142
127
  /**
143
128
  * Get checkpoint state from cache
144
129
  */
145
- getCheckpointStateSync(cp: CheckpointHexPayload): IBeaconStateView | null {
130
+ getCheckpointStateSync(cp: CheckpointHex): IBeaconStateView | null {
146
131
  return this.checkpointStateCache.get(cp);
147
132
  }
148
133
 
@@ -150,19 +135,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
150
135
  * Get state closest to head
151
136
  */
152
137
  getClosestHeadState(head: ProtoBlock): IBeaconStateView | null {
153
- // Convert PayloadStatus to payloadPresent boolean
154
- if (head.payloadStatus === PayloadStatus.PENDING) {
155
- throw new RegenError({
156
- code: RegenErrorCode.UNEXPECTED_PAYLOAD_STATUS,
157
- blockRoot: fromHex(head.blockRoot),
158
- payloadStatus: head.payloadStatus,
159
- });
160
- }
161
- const payloadPresent = head.payloadStatus === PayloadStatus.FULL;
162
- return (
163
- this.checkpointStateCache.getLatest(head.blockRoot, Infinity, payloadPresent) ||
164
- this.blockStateCache.get(head.stateRoot)
165
- );
138
+ return this.checkpointStateCache.getLatest(head.blockRoot, Infinity) || this.blockStateCache.get(head.stateRoot);
166
139
  }
167
140
 
168
141
  pruneOnCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void {
@@ -175,24 +148,15 @@ export class QueuedStateRegenerator implements IStateRegenerator {
175
148
  this.blockStateCache.deleteAllBeforeEpoch(finalizedEpoch);
176
149
  }
177
150
 
178
- processBlockState(blockRootHex: RootHex, postState: IBeaconStateView): void {
151
+ processState(blockRootHex: RootHex, postState: IBeaconStateView): void {
179
152
  this.blockStateCache.add(postState);
180
153
  this.checkpointStateCache.processState(blockRootHex, postState).catch((e) => {
181
154
  this.logger.debug("Error processing block state", {blockRootHex, slot: postState.slot}, e);
182
155
  });
183
156
  }
184
157
 
185
- /**
186
- * Process payload state for caching after importing execution payload.
187
- */
188
- processPayloadState(payloadState: IBeaconStateView): void {
189
- // Add payload state to block state cache (keyed by payload state root)
190
- this.blockStateCache.add(payloadState);
191
- }
192
-
193
- // TODO GLOAS: This should also be called when importing execution payload after we implement it
194
- addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView, payloadPresent: boolean): void {
195
- this.checkpointStateCache.add(cp, item, payloadPresent);
158
+ addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView): void {
159
+ this.checkpointStateCache.add(cp, item);
196
160
  }
197
161
 
198
162
  updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void {
@@ -228,13 +192,8 @@ export class QueuedStateRegenerator implements IStateRegenerator {
228
192
  }
229
193
  }
230
194
 
231
- updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch, payloadPresent: boolean): number | null {
232
- return this.checkpointStateCache.updatePreComputedCheckpoint(rootHex, epoch, payloadPresent);
233
- }
234
-
235
- upgradeForGloas(epoch: Epoch): void {
236
- this.logger.verbose("Upgrading block state cache for Gloas fork", {epoch});
237
- this.blockStateCache.upgradeToGloas();
195
+ updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null {
196
+ return this.checkpointStateCache.updatePreComputedCheckpoint(rootHex, epoch);
238
197
  }
239
198
 
240
199
  /**
@@ -1,6 +1,6 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
- import {IForkChoice, PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
3
- import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
2
+ import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
3
+ import {SLOTS_PER_EPOCH} from "@lodestar/params";
4
4
  import {
5
5
  DataAvailabilityStatus,
6
6
  ExecutionPayloadStatus,
@@ -9,7 +9,7 @@ import {
9
9
  computeEpochAtSlot,
10
10
  computeStartSlotAtEpoch,
11
11
  } from "@lodestar/state-transition";
12
- import {BeaconBlock, RootHex, SignedBeaconBlock, Slot, isGloasBeaconBlock} from "@lodestar/types";
12
+ import {BeaconBlock, RootHex, SignedBeaconBlock, Slot} from "@lodestar/types";
13
13
  import {Logger, fromHex, toRootHex} from "@lodestar/utils";
14
14
  import {IBeaconDb} from "../../db/index.js";
15
15
  import {Metrics} from "../../metrics/index.js";
@@ -57,12 +57,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
57
57
  regenCaller: RegenCaller
58
58
  ): Promise<IBeaconStateView> {
59
59
  const parentRoot = toRootHex(block.parentRoot);
60
- const parentBlock = isGloasBeaconBlock(block)
61
- ? this.modules.forkChoice.getBlockHexAndBlockHash(
62
- parentRoot,
63
- toRootHex(block.body.signedExecutionPayloadBid.message.parentBlockHash)
64
- )
65
- : this.modules.forkChoice.getBlockHexDefaultStatus(parentRoot);
60
+ const parentBlock = this.modules.forkChoice.getBlockHexDefaultStatus(parentRoot);
66
61
  if (!parentBlock) {
67
62
  throw new RegenError({
68
63
  code: RegenErrorCode.BLOCK_NOT_IN_FORKCHOICE,
@@ -110,19 +105,9 @@ export class StateRegenerator implements IStateRegeneratorInternal {
110
105
  const {checkpointStateCache} = this.modules;
111
106
  const epoch = computeEpochAtSlot(slot);
112
107
 
113
- // Convert PayloadStatus to payloadPresent boolean
114
- if (block.payloadStatus === PayloadStatus.PENDING) {
115
- throw new RegenError({
116
- code: RegenErrorCode.UNEXPECTED_PAYLOAD_STATUS,
117
- blockRoot: fromHex(blockRoot),
118
- payloadStatus: block.payloadStatus,
119
- });
120
- }
121
- const payloadPresent = block.payloadStatus === PayloadStatus.FULL;
122
-
123
108
  const latestCheckpointStateCtx = allowDiskReload
124
- ? await checkpointStateCache.getOrReloadLatest(blockRoot, epoch, payloadPresent)
125
- : checkpointStateCache.getLatest(blockRoot, epoch, payloadPresent);
109
+ ? await checkpointStateCache.getOrReloadLatest(blockRoot, epoch)
110
+ : checkpointStateCache.getLatest(blockRoot, epoch);
126
111
 
127
112
  // If a checkpoint state exists with the given checkpoint root, it either is in requested epoch
128
113
  // or needs to have empty slots processed until the requested epoch
@@ -176,18 +161,9 @@ export class StateRegenerator implements IStateRegeneratorInternal {
176
161
  if (!lastBlockToReplay) continue;
177
162
  const epoch = computeEpochAtSlot(lastBlockToReplay.slot - 1);
178
163
 
179
- // Convert PayloadStatus to payloadPresent boolean
180
- if (b.payloadStatus === PayloadStatus.PENDING) {
181
- throw new RegenError({
182
- code: RegenErrorCode.INTERNAL_ERROR,
183
- message: `Unexpected PENDING payloadStatus for ancestor block ${b.blockRoot} at slot ${b.slot}`,
184
- });
185
- }
186
- const payloadPresent = b.payloadStatus === PayloadStatus.FULL;
187
-
188
164
  state = allowDiskReload
189
- ? await checkpointStateCache.getOrReloadLatest(b.blockRoot, epoch, payloadPresent)
190
- : checkpointStateCache.getLatest(b.blockRoot, epoch, payloadPresent);
165
+ ? await checkpointStateCache.getOrReloadLatest(b.blockRoot, epoch)
166
+ : checkpointStateCache.getLatest(b.blockRoot, epoch);
191
167
  if (state) {
192
168
  break;
193
169
  }
@@ -351,11 +327,6 @@ async function processSlotsByCheckpoint(
351
327
  * emitting "checkpoint" events after every epoch processed.
352
328
  *
353
329
  * Stops processing after no more full epochs can be processed.
354
- *
355
- * Output state variant:
356
- * - Post-Gloas: If slots are processed, returns block state (payloadPresent=false).
357
- * If no slots processed, returns preState as-is (preserves variant).
358
- * - Pre-Gloas: Always payloadPresent=true (no block/payload distinction).
359
330
  */
360
331
  export async function processSlotsToNearestCheckpoint(
361
332
  modules: {
@@ -375,7 +346,7 @@ export async function processSlotsToNearestCheckpoint(
375
346
  const postSlot = slot;
376
347
  const preEpoch = computeEpochAtSlot(preSlot);
377
348
  let postState = preState;
378
- const {config, checkpointStateCache, emitter, metrics, logger} = modules;
349
+ const {checkpointStateCache, emitter, metrics, logger} = modules;
379
350
  let count = 0;
380
351
 
381
352
  for (
@@ -399,11 +370,7 @@ export async function processSlotsToNearestCheckpoint(
399
370
  // This may becomes the "official" checkpoint state if the 1st block of epoch is skipped
400
371
  const checkpointState = postState;
401
372
  const cp = getCheckpointFromState(checkpointState);
402
- // processSlots() only does epoch transitions, never processes payloads
403
- // Pre-Gloas: payloadPresent is always true (execution payload embedded in block)
404
- // Post-Gloas: result is a block state (payloadPresent=false)
405
- const isPayloadPresent = config.getForkSeq(checkpointState.slot) < ForkSeq.gloas;
406
- checkpointStateCache.add(cp, checkpointState, isPayloadPresent);
373
+ checkpointStateCache.add(cp, checkpointState);
407
374
  // consumers should not mutate state ever
408
375
  emitter?.emit(ChainEvent.checkpoint, cp, checkpointState);
409
376
 
@@ -5,3 +5,4 @@ export {SeenContributionAndProof} from "./seenCommitteeContribution.js";
5
5
  export {SeenExecutionPayloadBids} from "./seenExecutionPayloadBids.js";
6
6
  export {SeenBlockInput} from "./seenGossipBlockInput.js";
7
7
  export {PayloadEnvelopeInput, SeenPayloadEnvelopeInput} from "./seenPayloadEnvelopeInput.js";
8
+ export {SeenProposerPreferences} from "./seenProposerPreferences.js";