@lodestar/beacon-node 1.52.0-dev.269cf1aa5b → 1.52.0-dev.29dff83619

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 (353) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +47 -26
  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 +4 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.js +2 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +6 -2
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/validator/index.d.ts.map +1 -1
  14. package/lib/api/impl/validator/index.js +15 -8
  15. package/lib/api/impl/validator/index.js.map +1 -1
  16. package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
  17. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.js +4 -0
  19. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  20. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  21. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
  22. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  23. package/lib/chain/archiveStore/utils/archiveBlocks.js +1 -1
  24. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  25. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  26. package/lib/chain/archiveStore/utils/pruneHistory.js +8 -4
  27. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  28. package/lib/chain/blocks/importExecutionPayload.d.ts +1 -1
  29. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  30. package/lib/chain/blocks/importExecutionPayload.js +9 -3
  31. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  32. package/lib/chain/blocks/index.d.ts.map +1 -1
  33. package/lib/chain/blocks/index.js +3 -17
  34. package/lib/chain/blocks/index.js.map +1 -1
  35. package/lib/chain/chain.d.ts +6 -5
  36. package/lib/chain/chain.d.ts.map +1 -1
  37. package/lib/chain/chain.js +71 -25
  38. package/lib/chain/chain.js.map +1 -1
  39. package/lib/chain/errors/attestationError.d.ts +15 -1
  40. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  41. package/lib/chain/errors/attestationError.js +8 -0
  42. package/lib/chain/errors/attestationError.js.map +1 -1
  43. package/lib/chain/errors/executionPayloadBid.d.ts +9 -3
  44. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  45. package/lib/chain/errors/executionPayloadBid.js +2 -1
  46. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  47. package/lib/chain/errors/executionPayloadEnvelope.d.ts +55 -0
  48. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  49. package/lib/chain/errors/executionPayloadEnvelope.js +8 -0
  50. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  51. package/lib/chain/interface.d.ts +1 -1
  52. package/lib/chain/interface.d.ts.map +1 -1
  53. package/lib/chain/lightClient/index.d.ts +13 -6
  54. package/lib/chain/lightClient/index.d.ts.map +1 -1
  55. package/lib/chain/lightClient/index.js +95 -115
  56. package/lib/chain/lightClient/index.js.map +1 -1
  57. package/lib/chain/opPools/opPool.js +6 -6
  58. package/lib/chain/opPools/opPool.js.map +1 -1
  59. package/lib/chain/prepareNextSlot.d.ts +45 -0
  60. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  61. package/lib/chain/prepareNextSlot.js +265 -69
  62. package/lib/chain/prepareNextSlot.js.map +1 -1
  63. package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -0
  64. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  65. package/lib/chain/produceBlock/produceBlockBody.js +23 -15
  66. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  67. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  68. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  69. package/lib/chain/seenCache/seenAttesters.js +1 -1
  70. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  71. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  72. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  73. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  74. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  75. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  76. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  77. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  78. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  79. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  80. package/lib/chain/validation/aggregateAndProof.js +24 -7
  81. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  82. package/lib/chain/validation/attestation.d.ts.map +1 -1
  83. package/lib/chain/validation/attestation.js +32 -16
  84. package/lib/chain/validation/attestation.js.map +1 -1
  85. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  86. package/lib/chain/validation/attesterSlashing.js +4 -2
  87. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  88. package/lib/chain/validation/block.d.ts.map +1 -1
  89. package/lib/chain/validation/block.js +9 -1
  90. package/lib/chain/validation/block.js.map +1 -1
  91. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  92. package/lib/chain/validation/executionPayloadBid.js +47 -42
  93. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  94. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  95. package/lib/chain/validation/executionPayloadEnvelope.js +100 -9
  96. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  97. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  98. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  99. package/lib/chain/validation/proposerSlashing.js +4 -2
  100. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  101. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  102. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  103. package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
  104. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  105. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  106. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  107. package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
  108. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  109. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
  110. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  111. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  112. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  113. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  114. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  115. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +2 -2
  116. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  117. package/lib/chain/validation/syncCommittee.d.ts +1 -1
  118. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  119. package/lib/chain/validation/syncCommittee.js +5 -5
  120. package/lib/chain/validation/syncCommittee.js.map +1 -1
  121. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -3
  122. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  123. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  124. package/lib/chain/validation/voluntaryExit.js +39 -6
  125. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  126. package/lib/chain/validatorMonitor.js +43 -43
  127. package/lib/chain/validatorMonitor.js.map +1 -1
  128. package/lib/execution/engine/blockHash.d.ts +12 -0
  129. package/lib/execution/engine/blockHash.d.ts.map +1 -0
  130. package/lib/execution/engine/blockHash.js +17 -0
  131. package/lib/execution/engine/blockHash.js.map +1 -0
  132. package/lib/execution/engine/http.d.ts +2 -2
  133. package/lib/execution/engine/http.d.ts.map +1 -1
  134. package/lib/execution/engine/http.js +13 -7
  135. package/lib/execution/engine/http.js.map +1 -1
  136. package/lib/execution/engine/interface.d.ts +16 -3
  137. package/lib/execution/engine/interface.d.ts.map +1 -1
  138. package/lib/execution/engine/interface.js +11 -0
  139. package/lib/execution/engine/interface.js.map +1 -1
  140. package/lib/execution/engine/jsonRpcHttpClient.d.ts +2 -0
  141. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
  142. package/lib/execution/engine/jsonRpcHttpClient.js +14 -6
  143. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
  144. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -2
  145. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  146. package/lib/execution/engine/jsonRpcTransport.js +4 -4
  147. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  148. package/lib/execution/engine/mock.d.ts.map +1 -1
  149. package/lib/execution/engine/mock.js +6 -6
  150. package/lib/execution/engine/mock.js.map +1 -1
  151. package/lib/execution/engine/payloadIdCache.d.ts +6 -1
  152. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  153. package/lib/execution/engine/payloadIdCache.js +7 -2
  154. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  155. package/lib/execution/engine/restHttpClient.d.ts.map +1 -1
  156. package/lib/execution/engine/restHttpClient.js +9 -5
  157. package/lib/execution/engine/restHttpClient.js.map +1 -1
  158. package/lib/execution/engine/restTransport.d.ts +2 -2
  159. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  160. package/lib/execution/engine/restTransport.js +4 -4
  161. package/lib/execution/engine/restTransport.js.map +1 -1
  162. package/lib/execution/engine/signal.d.ts +6 -0
  163. package/lib/execution/engine/signal.d.ts.map +1 -0
  164. package/lib/execution/engine/signal.js +24 -0
  165. package/lib/execution/engine/signal.js.map +1 -0
  166. package/lib/execution/engine/transport.d.ts +2 -2
  167. package/lib/execution/engine/transport.d.ts.map +1 -1
  168. package/lib/index.d.ts +1 -1
  169. package/lib/index.d.ts.map +1 -1
  170. package/lib/index.js +1 -1
  171. package/lib/index.js.map +1 -1
  172. package/lib/metrics/metrics/beacon.d.ts +5 -0
  173. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  174. package/lib/metrics/metrics/beacon.js +5 -0
  175. package/lib/metrics/metrics/beacon.js.map +1 -1
  176. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  177. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  178. package/lib/metrics/metrics/lodestar.js +5 -0
  179. package/lib/metrics/metrics/lodestar.js.map +1 -1
  180. package/lib/network/core/events.d.ts +6 -2
  181. package/lib/network/core/events.d.ts.map +1 -1
  182. package/lib/network/core/events.js +9 -0
  183. package/lib/network/core/events.js.map +1 -1
  184. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  185. package/lib/network/core/networkCoreWorkerHandler.js +3 -2
  186. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  187. package/lib/network/gossip/gossipsub.d.ts +1 -0
  188. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  189. package/lib/network/gossip/gossipsub.js +5 -2
  190. package/lib/network/gossip/gossipsub.js.map +1 -1
  191. package/lib/network/gossip/topic.d.ts +1 -7
  192. package/lib/network/gossip/topic.d.ts.map +1 -1
  193. package/lib/network/gossip/topic.js +0 -13
  194. package/lib/network/gossip/topic.js.map +1 -1
  195. package/lib/network/network.d.ts +1 -0
  196. package/lib/network/network.d.ts.map +1 -1
  197. package/lib/network/network.js +26 -12
  198. package/lib/network/network.js.map +1 -1
  199. package/lib/network/peers/peerManager.d.ts.map +1 -1
  200. package/lib/network/peers/peerManager.js +22 -2
  201. package/lib/network/peers/peerManager.js.map +1 -1
  202. package/lib/network/peers/utils/prioritizePeers.d.ts +2 -0
  203. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  204. package/lib/network/peers/utils/prioritizePeers.js +11 -2
  205. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  206. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  207. package/lib/network/processor/gossipHandlers.js +19 -6
  208. package/lib/network/processor/gossipHandlers.js.map +1 -1
  209. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  210. package/lib/network/processor/gossipValidatorFn.js +4 -1
  211. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  212. package/lib/network/processor/index.d.ts.map +1 -1
  213. package/lib/network/processor/index.js +4 -2
  214. package/lib/network/processor/index.js.map +1 -1
  215. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -1
  216. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  217. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -1
  218. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  219. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  220. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  221. package/lib/network/reqresp/utils/collect.js +9 -8
  222. package/lib/network/reqresp/utils/collect.js.map +1 -1
  223. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  224. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  225. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  226. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  227. package/lib/sync/range/batch.d.ts +10 -0
  228. package/lib/sync/range/batch.d.ts.map +1 -1
  229. package/lib/sync/range/batch.js +29 -0
  230. package/lib/sync/range/batch.js.map +1 -1
  231. package/lib/sync/range/chain.d.ts +17 -2
  232. package/lib/sync/range/chain.d.ts.map +1 -1
  233. package/lib/sync/range/chain.js +60 -20
  234. package/lib/sync/range/chain.js.map +1 -1
  235. package/lib/sync/range/range.d.ts.map +1 -1
  236. package/lib/sync/range/range.js +44 -3
  237. package/lib/sync/range/range.js.map +1 -1
  238. package/lib/sync/range/utils/batches.d.ts +20 -4
  239. package/lib/sync/range/utils/batches.d.ts.map +1 -1
  240. package/lib/sync/range/utils/batches.js +31 -13
  241. package/lib/sync/range/utils/batches.js.map +1 -1
  242. package/lib/sync/range/utils/peerBalancer.d.ts +1 -1
  243. package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
  244. package/lib/sync/range/utils/peerBalancer.js +5 -2
  245. package/lib/sync/range/utils/peerBalancer.js.map +1 -1
  246. package/lib/sync/types.d.ts +14 -1
  247. package/lib/sync/types.d.ts.map +1 -1
  248. package/lib/sync/types.js +2 -0
  249. package/lib/sync/types.js.map +1 -1
  250. package/lib/sync/unknownBlock.d.ts +28 -1
  251. package/lib/sync/unknownBlock.d.ts.map +1 -1
  252. package/lib/sync/unknownBlock.js +340 -27
  253. package/lib/sync/unknownBlock.js.map +1 -1
  254. package/lib/sync/utils/downloadByRange.d.ts +22 -1
  255. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  256. package/lib/sync/utils/downloadByRange.js +55 -25
  257. package/lib/sync/utils/downloadByRange.js.map +1 -1
  258. package/lib/sync/utils/downloadByRoot.d.ts +24 -2
  259. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  260. package/lib/sync/utils/downloadByRoot.js +48 -5
  261. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  262. package/lib/util/asyncIterableToEvents.d.ts +20 -3
  263. package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
  264. package/lib/util/asyncIterableToEvents.js +76 -20
  265. package/lib/util/asyncIterableToEvents.js.map +1 -1
  266. package/lib/util/dataColumns.d.ts +1 -1
  267. package/lib/util/dataColumns.d.ts.map +1 -1
  268. package/lib/util/dataColumns.js +4 -1
  269. package/lib/util/dataColumns.js.map +1 -1
  270. package/lib/util/eventLoop.d.ts +3 -3
  271. package/lib/util/eventLoop.d.ts.map +1 -1
  272. package/lib/util/eventLoop.js +3 -3
  273. package/lib/util/eventLoop.js.map +1 -1
  274. package/package.json +27 -27
  275. package/src/api/impl/beacon/blocks/index.ts +53 -28
  276. package/src/api/impl/beacon/pool/index.ts +10 -8
  277. package/src/api/impl/beacon/state/utils.ts +2 -1
  278. package/src/api/impl/debug/index.ts +6 -2
  279. package/src/api/impl/validator/index.ts +17 -9
  280. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  281. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
  282. package/src/chain/archiveStore/utils/archiveBlocks.ts +1 -1
  283. package/src/chain/archiveStore/utils/pruneHistory.ts +9 -4
  284. package/src/chain/blocks/importExecutionPayload.ts +9 -2
  285. package/src/chain/blocks/index.ts +3 -31
  286. package/src/chain/chain.ts +104 -42
  287. package/src/chain/errors/attestationError.ts +11 -1
  288. package/src/chain/errors/executionPayloadBid.ts +9 -2
  289. package/src/chain/errors/executionPayloadEnvelope.ts +58 -0
  290. package/src/chain/interface.ts +1 -1
  291. package/src/chain/lightClient/index.ts +108 -142
  292. package/src/chain/opPools/opPool.ts +6 -6
  293. package/src/chain/prepareNextSlot.ts +347 -89
  294. package/src/chain/produceBlock/produceBlockBody.ts +25 -16
  295. package/src/chain/seenCache/seenAttesters.ts +1 -1
  296. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  297. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  298. package/src/chain/validation/aggregateAndProof.ts +24 -9
  299. package/src/chain/validation/attestation.ts +31 -20
  300. package/src/chain/validation/attesterSlashing.ts +4 -2
  301. package/src/chain/validation/block.ts +9 -1
  302. package/src/chain/validation/executionPayloadBid.ts +60 -44
  303. package/src/chain/validation/executionPayloadEnvelope.ts +115 -8
  304. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  305. package/src/chain/validation/proposerSlashing.ts +4 -2
  306. package/src/chain/validation/signatureSets/contributionAndProof.ts +4 -6
  307. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -3
  308. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  309. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -3
  310. package/src/chain/validation/syncCommittee.ts +3 -5
  311. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -3
  312. package/src/chain/validation/voluntaryExit.ts +44 -6
  313. package/src/chain/validatorMonitor.ts +43 -43
  314. package/src/execution/engine/blockHash.ts +27 -0
  315. package/src/execution/engine/http.ts +18 -10
  316. package/src/execution/engine/interface.ts +18 -3
  317. package/src/execution/engine/jsonRpcHttpClient.ts +26 -14
  318. package/src/execution/engine/jsonRpcTransport.ts +8 -4
  319. package/src/execution/engine/mock.ts +13 -8
  320. package/src/execution/engine/payloadIdCache.ts +12 -4
  321. package/src/execution/engine/restHttpClient.ts +17 -11
  322. package/src/execution/engine/restTransport.ts +5 -4
  323. package/src/execution/engine/signal.ts +28 -0
  324. package/src/execution/engine/transport.ts +3 -2
  325. package/src/index.ts +6 -1
  326. package/src/metrics/metrics/beacon.ts +9 -0
  327. package/src/metrics/metrics/lodestar.ts +5 -0
  328. package/src/network/core/events.ts +12 -0
  329. package/src/network/core/networkCoreWorkerHandler.ts +6 -2
  330. package/src/network/gossip/gossipsub.ts +6 -2
  331. package/src/network/gossip/topic.ts +1 -14
  332. package/src/network/network.ts +39 -13
  333. package/src/network/peers/peerManager.ts +26 -2
  334. package/src/network/peers/utils/prioritizePeers.ts +14 -1
  335. package/src/network/processor/gossipHandlers.ts +25 -13
  336. package/src/network/processor/gossipValidatorFn.ts +4 -0
  337. package/src/network/processor/index.ts +7 -2
  338. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +1 -1
  339. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
  340. package/src/network/reqresp/utils/collect.ts +16 -8
  341. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  342. package/src/sync/range/batch.ts +33 -0
  343. package/src/sync/range/chain.ts +72 -17
  344. package/src/sync/range/range.ts +57 -3
  345. package/src/sync/range/utils/batches.ts +38 -13
  346. package/src/sync/range/utils/peerBalancer.ts +4 -1
  347. package/src/sync/types.ts +13 -0
  348. package/src/sync/unknownBlock.ts +389 -29
  349. package/src/sync/utils/downloadByRange.ts +89 -29
  350. package/src/sync/utils/downloadByRoot.ts +75 -7
  351. package/src/util/asyncIterableToEvents.ts +100 -21
  352. package/src/util/dataColumns.ts +4 -1
  353. package/src/util/eventLoop.ts +3 -3
@@ -1,4 +1,5 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
+ import {GENESIS_SLOT} from "@lodestar/params";
2
3
  import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
3
4
  import {Epoch, Slot} from "@lodestar/types";
4
5
  import {Logger, prettyPrintIndices} from "@lodestar/utils";
@@ -13,6 +14,9 @@ import {Metrics} from "../../../metrics/index.js";
13
14
  */
14
15
  export const MAX_PRUNE_BLOCK_SLOTS_PER_RUN = 4096;
15
16
 
17
+ // Genesis is kept so the block and state stay available via the API, e.g. for checkpoint providers
18
+ const FIRST_PRUNABLE_SLOT = GENESIS_SLOT + 1;
19
+
16
20
  export async function pruneHistory(
17
21
  config: ChainForkConfig,
18
22
  db: IBeaconDb,
@@ -30,11 +34,12 @@ export async function pruneHistory(
30
34
  // ensure that during (extremely lol) long periods of non-finality we don't delete unfinalized epoch data
31
35
  finalizedEpoch
32
36
  );
33
- const firstBlockSlot = (await db.blockArchive.firstKey()) ?? 0;
37
+ const [firstBlockSlot = FIRST_PRUNABLE_SLOT] = await db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, limit: 1});
34
38
  const blockCutoffSlot = Math.min(computeStartSlotAtEpoch(blockCutoffEpoch), firstBlockSlot + maxBlockSlots);
35
39
  // The latest archived state is the anchor on restart and can trail finalization by a few epochs
36
40
  const lastArchivedStateSlot = (await db.stateArchive.lastKey()) ?? 0;
37
41
  const stateCutoffSlot = Math.min(computeStartSlotAtEpoch(finalizedEpoch), lastArchivedStateSlot);
42
+ const stateStartSlot = Math.max(statePruneFromSlot, FIRST_PRUNABLE_SLOT);
38
43
 
39
44
  logger.debug("Preparing to prune history", {
40
45
  currentEpoch,
@@ -46,9 +51,9 @@ export async function pruneHistory(
46
51
 
47
52
  const step0 = metrics?.pruneHistory.fetchKeys.startTimer();
48
53
  const [blocks, envelopes, states] = await Promise.all([
49
- db.blockArchive.keys({gte: 0, lt: blockCutoffSlot}),
50
- db.executionPayloadEnvelopeArchive.keys({gte: 0, lt: blockCutoffSlot}),
51
- stateCutoffSlot > statePruneFromSlot ? db.stateArchive.keys({gte: statePruneFromSlot, lt: stateCutoffSlot}) : [],
54
+ db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
55
+ db.executionPayloadEnvelopeArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
56
+ stateCutoffSlot > stateStartSlot ? db.stateArchive.keys({gte: stateStartSlot, lt: stateCutoffSlot}) : [],
52
57
  ]);
53
58
  step0?.();
54
59
 
@@ -7,6 +7,7 @@ import {
7
7
  InvalidBlockCode,
8
8
  LVHInvalidJudged,
9
9
  PayloadExecutionStatus,
10
+ PayloadStatus,
10
11
  getFinalizedExecutionBlockHash,
11
12
  getSafeExecutionBlockHash,
12
13
  } from "@lodestar/fork-choice";
@@ -117,7 +118,7 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
117
118
  * 3. Regenerate state for envelope verification
118
119
  * 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
119
120
  * 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
120
- * 6. Update fork choice (transitions the block's PENDING variant to FULL)
121
+ * 6. Update fork choice (transitions the block's PENDING variant to FULL) and emit head events if the head changed
121
122
  * 7. Queue notifyForkchoiceUpdate to engine api
122
123
  * 8. Record metrics for payload envelope and column sources
123
124
  * 9. Emit `execution_payload` event
@@ -356,6 +357,7 @@ export async function importExecutionPayload(
356
357
 
357
358
  // 6. Update fork choice, transitions the block's PENDING variant to FULL
358
359
  const execStatus = toForkChoiceExecutionStatus(execResult.status);
360
+ const prevHead = this.forkChoice.getHead();
359
361
  try {
360
362
  this.forkChoice.onExecutionPayload(
361
363
  blockRootHex,
@@ -376,12 +378,17 @@ export async function importExecutionPayload(
376
378
  }
377
379
  throw e;
378
380
  }
381
+ const head = this.forkChoice.getHead();
382
+ this.emitHeadEvents(prevHead, head);
383
+ if (head.blockRoot !== prevHead.blockRoot) {
384
+ this.onHeadChanged(prevHead, head);
385
+ }
379
386
 
380
387
  // 7. Queue notifyForkchoiceUpdate to engine api
381
- const head = this.forkChoice.getHead();
382
388
  if (
383
389
  !this.opts.disableImportExecutionFcU &&
384
390
  blockRootHex === head.blockRoot &&
391
+ head.payloadStatus === PayloadStatus.FULL &&
385
392
  // Skip a payload that does not satisfy the inclusion list constraints, fork choice keeps the EMPTY
386
393
  // variant as head and the next prepare fcU keeps the engine on the parent payload
387
394
  this.forkChoice.isPayloadInclusionListSatisfied(blockRootHex)
@@ -1,7 +1,7 @@
1
1
  import {PayloadStatus} from "@lodestar/fork-choice";
2
2
  import {computeEpochAtSlot} from "@lodestar/state-transition";
3
3
  import {SignedBeaconBlock, Slot} from "@lodestar/types";
4
- import {isErrorAborted, toRootHex} from "@lodestar/utils";
4
+ import {isErrorAborted} from "@lodestar/utils";
5
5
  import {Metrics} from "../../metrics/metrics.js";
6
6
  import {nextEventLoop} from "../../util/eventLoop.js";
7
7
  import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
@@ -208,36 +208,9 @@ export async function processBlocks(
208
208
  this.logger.debug("Block error", {slot: err.signedBlock.message.slot}, err);
209
209
 
210
210
  if (err.type.code === BlockErrorCode.INVALID_SIGNATURE) {
211
- const {signedBlock} = err;
212
- const blockSlot = signedBlock.message.slot;
213
- const {state} = err.type;
214
- const forkTypes = this.config.getForkTypes(blockSlot);
215
- const blockRootHex = toRootHex(forkTypes.BeaconBlock.hashTreeRoot(signedBlock.message));
216
- this.persistInvalidSszValue(
217
- forkTypes.SignedBeaconBlock,
218
- signedBlock,
219
- `${blockSlot}_invalid_signature`,
220
- blockRootHex
221
- );
222
- this.persistInvalidSszBytes(
223
- "BeaconState",
224
- state.serialize(),
225
- toRootHex(state.hashTreeRoot()),
226
- `${state.slot}_invalid_signature`
227
- );
211
+ void this.persistInvalidSignature(err.type.state, err.signedBlock);
228
212
  } else if (err.type.code === BlockErrorCode.INVALID_STATE_ROOT) {
229
- const {signedBlock} = err;
230
- const blockSlot = signedBlock.message.slot;
231
- const {preState, postState} = err.type;
232
- const preRoot = preState.hashTreeRoot();
233
- const postRoot = postState.hashTreeRoot();
234
- this.persistInvalidStateRoot(preState, postState, signedBlock).catch((e) => {
235
- this.logger.error(
236
- "Error persisting invalid state root objects",
237
- {slot: blockSlot, preStateRoot: toRootHex(preRoot), postStateRoot: toRootHex(postRoot)},
238
- e
239
- );
240
- });
213
+ void this.persistInvalidStateRoot(err.type.preState, err.type.postState, err.signedBlock);
241
214
  }
242
215
  }
243
216
 
@@ -307,7 +280,6 @@ async function importPayloadEnvelopesOfKnownBlocks(
307
280
  });
308
281
  await importExecutionPayload.call(this, payloadInputs[i], dataAvailabilityStatuses[i], {validSignature: false});
309
282
  }
310
- // the new FULL variants are not seen by the head cached from the last block import
311
283
  this.recomputeForkChoiceHead(ForkchoiceCaller.importBlock);
312
284
 
313
285
  return result;
@@ -93,7 +93,7 @@ import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
93
93
  import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToDb.js";
94
94
  import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
95
95
  import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
96
- import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
96
+ import {ColumnReconstructionTracker, RECONSTRUCTED_COLUMNS_WAIT_BPS} from "./ColumnReconstructionTracker.js";
97
97
  import {ChainEvent, ChainEventEmitter, ReorgEventData} from "./emitter.js";
98
98
  import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js";
99
99
  import {ForkChoiceExecutionEngine} from "./forkChoiceExecutionEngine.js";
@@ -701,7 +701,8 @@ export class BeaconChain implements IBeaconChain {
701
701
  const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
702
702
  return {
703
703
  state,
704
- 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),
705
706
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
706
707
  };
707
708
  }
@@ -717,7 +718,7 @@ export class BeaconChain implements IBeaconChain {
717
718
  return (
718
719
  state && {
719
720
  state,
720
- executionOptimistic: isOptimisticBlock(block),
721
+ executionOptimistic: isOptimisticBlock(this.forkChoice.getBlockHexDefaultStatus(block.blockRoot) ?? block),
721
722
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
722
723
  }
723
724
  );
@@ -865,7 +866,9 @@ export class BeaconChain implements IBeaconChain {
865
866
  const finalizedBlock = this.forkChoice.getFinalizedBlock();
866
867
  if (slot > finalizedBlock.slot) {
867
868
  // Unfinalized slot, attempt to find in fork-choice
868
- 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);
869
872
  if (block) {
870
873
  // Block found in fork-choice.
871
874
  // It may be in the block input cache, awaiting full DA reconstruction, check there first
@@ -893,16 +896,18 @@ export class BeaconChain implements IBeaconChain {
893
896
  ): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null> {
894
897
  const block = this.forkChoice.getBlockHexDefaultStatus(root);
895
898
  if (block) {
899
+ // The finalized block stays in fork-choice and the hot db until the archiver has migrated it
900
+ const finalized = block.slot <= this.forkChoice.getFinalizedBlock().slot;
896
901
  // Block found in fork-choice.
897
902
  // It may be in the block input cache, awaiting full DA reconstruction, check there first
898
903
  // Otherwise (most likely), check the hot db
899
904
  const blockInput = this.seenBlockInputCache.get(block.blockRoot);
900
905
  if (blockInput?.hasBlock()) {
901
- return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false};
906
+ return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized};
902
907
  }
903
908
  const data = await this.db.block.get(fromHex(root));
904
909
  if (data) {
905
- return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false};
910
+ return {block: data, executionOptimistic: isOptimisticBlock(block), finalized};
906
911
  }
907
912
  // If block is not found in hot db, try cold db since there could be an archive cycle happening
908
913
  // TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
@@ -917,6 +922,8 @@ export class BeaconChain implements IBeaconChain {
917
922
  ): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null> {
918
923
  const block = this.forkChoice.getBlockHexDefaultStatus(root);
919
924
  if (block) {
925
+ // The finalized block stays in fork-choice and the hot db until the archiver has migrated it
926
+ const finalized = block.slot <= this.forkChoice.getFinalizedBlock().slot;
920
927
  // Block found in fork-choice.
921
928
  // It may be in the block input cache, awaiting full DA reconstruction, check there first
922
929
  // Otherwise (most likely), check the hot db
@@ -928,14 +935,14 @@ export class BeaconChain implements IBeaconChain {
928
935
  return {
929
936
  block: serialized,
930
937
  executionOptimistic: isOptimisticBlock(block),
931
- finalized: false,
938
+ finalized,
932
939
  slot: blockInput.slot,
933
940
  };
934
941
  }
935
942
  return {
936
943
  block: sszTypesFor(blockInput.forkName).SignedBeaconBlock.serialize(signedBlock),
937
944
  executionOptimistic: isOptimisticBlock(block),
938
- finalized: false,
945
+ finalized,
939
946
  slot: blockInput.slot,
940
947
  };
941
948
  }
@@ -943,7 +950,7 @@ export class BeaconChain implements IBeaconChain {
943
950
  if (data) {
944
951
  const slot = getSlotFromSignedBeaconBlockSerialized(data);
945
952
  if (slot === null) throw new Error(`Invalid block data stored in DB for root: ${root}`);
946
- return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false, slot};
953
+ return {block: data, executionOptimistic: isOptimisticBlock(block), finalized, slot};
947
954
  }
948
955
  // If block is not found in hot db, try cold db since there could be an archive cycle happening
949
956
  // TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
@@ -1126,6 +1133,17 @@ export class BeaconChain implements IBeaconChain {
1126
1133
  // After gloas, columns are tracked in PayloadEnvelopeInput
1127
1134
  const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
1128
1135
  if (payloadInput) {
1136
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1137
+ if (
1138
+ !payloadInput.hasComputedAllData() &&
1139
+ payloadInput.hasAllData() &&
1140
+ indices.some((index) => !payloadInput.hasColumn(index))
1141
+ ) {
1142
+ this.columnReconstructionTracker.triggerColumnReconstruction(payloadInput);
1143
+ await payloadInput
1144
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1145
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1146
+ }
1129
1147
  for (let i = 0; i < indices.length; i++) {
1130
1148
  const index = indices[i];
1131
1149
  const sidecar = payloadInput.getColumn(index);
@@ -1147,6 +1165,17 @@ export class BeaconChain implements IBeaconChain {
1147
1165
  if (!isBlockInputColumns(blockInput)) {
1148
1166
  throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
1149
1167
  }
1168
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1169
+ if (
1170
+ !blockInput.hasComputedAllData() &&
1171
+ blockInput.hasAllData() &&
1172
+ indices.some((index) => !blockInput.hasColumn(index))
1173
+ ) {
1174
+ this.columnReconstructionTracker.triggerColumnReconstruction(blockInput);
1175
+ await blockInput
1176
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1177
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1178
+ }
1150
1179
  for (let i = 0; i < indices.length; i++) {
1151
1180
  const index = indices[i];
1152
1181
  const sidecar = blockInput.getColumn(index);
@@ -1473,9 +1502,10 @@ export class BeaconChain implements IBeaconChain {
1473
1502
 
1474
1503
  /**
1475
1504
  * Emit `head` and `head_v2` when the fork choice head differs between two observations. Every caller that
1476
- * can move the head, `updateAndGetHead()` and `updateTime()`, must capture the head before and pass both.
1505
+ * can move the head, `updateAndGetHead()`, `updateTime()` and `onExecutionPayload()`, must capture the head before
1506
+ * and pass both.
1477
1507
  */
1478
- private emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1508
+ emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1479
1509
  const headRootChanged = head.blockRoot !== prevHead.blockRoot;
1480
1510
 
1481
1511
  if (!headRootChanged && prevHead.payloadStatus === head.payloadStatus) {
@@ -1606,38 +1636,76 @@ export class BeaconChain implements IBeaconChain {
1606
1636
  }
1607
1637
 
1608
1638
  /**
1609
- * Invalid state root error is critical and it causes the node to stale most of the time so we want to always
1610
- * persist preState, postState and block for further investigation.
1639
+ * Invalid state root error is critical and it causes the node to stale most of the time so we want to persist
1640
+ * preState, postState and block for further investigation.
1611
1641
  */
1612
1642
  async persistInvalidStateRoot(
1613
1643
  preState: IBeaconStateView,
1614
1644
  postState: IBeaconStateView,
1615
1645
  block: SignedBeaconBlock
1616
1646
  ): Promise<void> {
1647
+ if (!this.opts.persistInvalidSszObjects) {
1648
+ return;
1649
+ }
1617
1650
  const blockSlot = block.message.slot;
1618
- const blockType = this.config.getForkTypes(blockSlot).SignedBeaconBlock;
1619
- const postStateRoot = postState.hashTreeRoot();
1620
- const logStr = `slot_${blockSlot}_invalid_state_root_${toRootHex(postStateRoot)}`;
1621
- await Promise.all([
1622
- this.persistSszObject(
1623
- `SignedBeaconBlock_slot_${blockSlot}`,
1624
- blockType.serialize(block),
1625
- toRootHex(this.config.getForkTypes(blockSlot).BeaconBlock.hashTreeRoot(block.message)),
1626
- `${logStr}_block`
1627
- ),
1628
- this.persistSszObject(
1629
- `preState_slot_${preState.slot}_BeaconState`,
1630
- preState.serialize(),
1631
- toRootHex(preState.hashTreeRoot()),
1632
- `${logStr}_pre_state`
1633
- ),
1634
- this.persistSszObject(
1635
- `postState_slot_${postState.slot}_BeaconState`,
1636
- postState.serialize(),
1637
- toRootHex(postStateRoot),
1638
- `${logStr}_post_state`
1639
- ),
1640
- ]);
1651
+ const forkTypes = this.config.getForkTypes(blockSlot);
1652
+ const preStateRoot = toRootHex(preState.hashTreeRoot());
1653
+ const postStateRoot = toRootHex(postState.hashTreeRoot());
1654
+ const logStr = `slot_${blockSlot}_invalid_state_root_${postStateRoot}`;
1655
+ try {
1656
+ await Promise.all([
1657
+ this.persistSszObject(
1658
+ `SignedBeaconBlock_slot_${blockSlot}`,
1659
+ forkTypes.SignedBeaconBlock.serialize(block),
1660
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1661
+ `${logStr}_block`
1662
+ ),
1663
+ this.persistSszObject(
1664
+ `preState_slot_${preState.slot}_BeaconState`,
1665
+ preState.serialize(),
1666
+ preStateRoot,
1667
+ `${logStr}_pre_state`
1668
+ ),
1669
+ this.persistSszObject(
1670
+ `postState_slot_${postState.slot}_BeaconState`,
1671
+ postState.serialize(),
1672
+ postStateRoot,
1673
+ `${logStr}_post_state`
1674
+ ),
1675
+ ]);
1676
+ } catch (e) {
1677
+ this.logger.error(
1678
+ "Error persisting invalid state root objects",
1679
+ {slot: blockSlot, preStateRoot, postStateRoot},
1680
+ e as Error
1681
+ );
1682
+ }
1683
+ }
1684
+
1685
+ async persistInvalidSignature(state: IBeaconStateView, block: SignedBeaconBlock): Promise<void> {
1686
+ if (!this.opts.persistInvalidSszObjects) {
1687
+ return;
1688
+ }
1689
+ const blockSlot = block.message.slot;
1690
+ const forkTypes = this.config.getForkTypes(blockSlot);
1691
+ try {
1692
+ await Promise.all([
1693
+ this.persistSszObject(
1694
+ forkTypes.SignedBeaconBlock.typeName,
1695
+ forkTypes.SignedBeaconBlock.serialize(block),
1696
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1697
+ `${blockSlot}_invalid_signature`
1698
+ ),
1699
+ this.persistSszObject(
1700
+ "BeaconState",
1701
+ state.serialize(),
1702
+ toRootHex(state.hashTreeRoot()),
1703
+ `${state.slot}_invalid_signature`
1704
+ ),
1705
+ ]);
1706
+ } catch (e) {
1707
+ this.logger.error("Error persisting invalid signature objects", {slot: blockSlot}, e as Error);
1708
+ }
1641
1709
  }
1642
1710
 
1643
1711
  persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string, rootHex?: RootHex): void {
@@ -1652,12 +1720,6 @@ export class BeaconChain implements IBeaconChain {
1652
1720
  }
1653
1721
  }
1654
1722
 
1655
- persistInvalidSszBytes(typeName: string, sszBytes: Uint8Array, rootHex: RootHex, suffix?: string): void {
1656
- if (this.opts.persistInvalidSszObjects) {
1657
- void this.persistSszObject(typeName, sszBytes, rootHex, suffix);
1658
- }
1659
- }
1660
-
1661
1723
  /**
1662
1724
  * Regenerate state for attestation verification, this does not happen with default chain option of maxSkipSlots = 32 .
1663
1725
  * However, need to handle just in case. Lodestar doesn't support multiple regen state requests for attestation verification
@@ -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> {
@@ -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",
@@ -23,6 +23,7 @@ export enum ExecutionPayloadBidErrorCode {
23
23
  PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH",
24
24
  INCLUSION_LIST_BITS_NOT_INCLUSIVE = "EXECUTION_PAYLOAD_BID_ERROR_INCLUSION_LIST_BITS_NOT_INCLUSIVE",
25
25
  BEFORE_INCLUSION_LIST_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_INCLUSION_LIST_DEADLINE",
26
+ BEFORE_PAYLOAD_ATTESTATION_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_PAYLOAD_ATTESTATION_DEADLINE",
26
27
  }
27
28
 
28
29
  export type ExecutionPayloadBidErrorType =
@@ -46,11 +47,12 @@ export type ExecutionPayloadBidErrorType =
46
47
  headBlockRoot: RootHex;
47
48
  }
48
49
  | {
49
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
50
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED;
50
51
  builderIndex: BuilderIndex;
51
52
  slot: Slot;
52
53
  parentBlockRoot: RootHex;
53
54
  parentBlockHash: RootHex;
55
+ bidLimit: number;
54
56
  }
55
57
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
56
58
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}
@@ -98,6 +100,11 @@ export type ExecutionPayloadBidErrorType =
98
100
  builderIndex: BuilderIndex;
99
101
  slot: Slot;
100
102
  }
103
+ | {
104
+ code: ExecutionPayloadBidErrorCode.BEFORE_PAYLOAD_ATTESTATION_DEADLINE;
105
+ builderIndex: BuilderIndex;
106
+ slot: Slot;
107
+ }
101
108
  | {
102
109
  code: ExecutionPayloadBidErrorCode.PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH;
103
110
  builderIndex: BuilderIndex;
@@ -9,10 +9,18 @@ export enum ExecutionPayloadEnvelopeErrorCode {
9
9
  ENVELOPE_ALREADY_KNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_ALREADY_KNOWN",
10
10
  INVALID_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK",
11
11
  SLOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISMATCH",
12
+ PARENT_BEACON_BLOCK_ROOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PARENT_BEACON_BLOCK_ROOT_MISMATCH",
12
13
  BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
14
+ PREV_RANDAO_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PREV_RANDAO_MISMATCH",
15
+ GAS_LIMIT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_GAS_LIMIT_MISMATCH",
13
16
  BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
14
17
  EXECUTION_REQUESTS_ROOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EXECUTION_REQUESTS_ROOT_MISMATCH",
15
18
  TOO_MANY_TRANSACTIONS = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_TOO_MANY_TRANSACTIONS",
19
+ PARENT_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PARENT_HASH_MISMATCH",
20
+ INCORRECT_TIMESTAMP = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INCORRECT_TIMESTAMP",
21
+ EMPTY_TRANSACTION = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EMPTY_TRANSACTION",
22
+ WITHDRAWALS_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_WITHDRAWALS_MISMATCH",
23
+ INVALID_BLOCK_HASH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK_HASH",
16
24
  INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
17
25
  PAYLOAD_ENVELOPE_INPUT_MISSING = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PAYLOAD_ENVELOPE_INPUT_MISSING",
18
26
  }
@@ -34,6 +42,13 @@ export type ExecutionPayloadEnvelopeErrorType =
34
42
  envelopeSlot: Slot;
35
43
  blockSlot: Slot;
36
44
  }
45
+ | {
46
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_BEACON_BLOCK_ROOT_MISMATCH;
47
+ slot: Slot;
48
+ root: RootHex;
49
+ envelopeParentBeaconBlockRoot: RootHex;
50
+ blockParentRoot: RootHex;
51
+ }
37
52
  | {
38
53
  code: ExecutionPayloadEnvelopeErrorCode.BUILDER_INDEX_MISMATCH;
39
54
  slot: Slot;
@@ -41,6 +56,20 @@ export type ExecutionPayloadEnvelopeErrorType =
41
56
  envelopeBuilderIndex: BuilderIndex;
42
57
  bidBuilderIndex: BuilderIndex | null;
43
58
  }
59
+ | {
60
+ code: ExecutionPayloadEnvelopeErrorCode.PREV_RANDAO_MISMATCH;
61
+ slot: Slot;
62
+ root: RootHex;
63
+ envelopePrevRandao: RootHex;
64
+ bidPrevRandao: RootHex;
65
+ }
66
+ | {
67
+ code: ExecutionPayloadEnvelopeErrorCode.GAS_LIMIT_MISMATCH;
68
+ slot: Slot;
69
+ root: RootHex;
70
+ envelopeGasLimit: number;
71
+ bidGasLimit: bigint;
72
+ }
44
73
  | {
45
74
  code: ExecutionPayloadEnvelopeErrorCode.BLOCK_HASH_MISMATCH;
46
75
  slot: Slot;
@@ -62,6 +91,35 @@ export type ExecutionPayloadEnvelopeErrorType =
62
91
  transactionCount: number;
63
92
  maxTransactionCount: number;
64
93
  }
94
+ | {
95
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_HASH_MISMATCH;
96
+ slot: Slot;
97
+ root: RootHex;
98
+ envelopeParentHash: RootHex;
99
+ latestBlockHash: RootHex;
100
+ }
101
+ | {
102
+ code: ExecutionPayloadEnvelopeErrorCode.INCORRECT_TIMESTAMP;
103
+ slot: Slot;
104
+ root: RootHex;
105
+ envelopeTimestamp: number;
106
+ expectedTimestamp: number;
107
+ }
108
+ | {code: ExecutionPayloadEnvelopeErrorCode.EMPTY_TRANSACTION; slot: Slot; root: RootHex; transactionIndex: number}
109
+ | {
110
+ code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_MISMATCH;
111
+ slot: Slot;
112
+ root: RootHex;
113
+ envelopeWithdrawalsRoot: RootHex;
114
+ expectedWithdrawalsRoot: RootHex;
115
+ }
116
+ | {
117
+ code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK_HASH;
118
+ slot: Slot;
119
+ root: RootHex;
120
+ blockHash: RootHex;
121
+ computedBlockHash: RootHex;
122
+ }
65
123
  | {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE; slot: Slot; root: RootHex}
66
124
  | {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
67
125
 
@@ -303,8 +303,8 @@ export interface IBeaconChain {
303
303
  postState: IBeaconStateView,
304
304
  block: SignedBeaconBlock
305
305
  ): Promise<void>;
306
+ persistInvalidSignature(state: IBeaconStateView, block: SignedBeaconBlock): Promise<void>;
306
307
  persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string, rootHex?: RootHex): void;
307
- persistInvalidSszBytes(type: string, sszBytes: Uint8Array, rootHex: RootHex, suffix?: string): void;
308
308
  regenStateForAttestationVerification(
309
309
  attEpoch: Epoch,
310
310
  shufflingDependentRoot: RootHex,