@lodestar/beacon-node 1.46.0 → 1.47.0-dev.02d2dbea03

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 (348) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +6 -8
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +25 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +2 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/events/index.d.ts +1 -1
  11. package/lib/api/impl/events/index.d.ts.map +1 -1
  12. package/lib/api/impl/events/index.js +12 -3
  13. package/lib/api/impl/events/index.js.map +1 -1
  14. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  15. package/lib/api/impl/lodestar/index.js +12 -13
  16. package/lib/api/impl/lodestar/index.js.map +1 -1
  17. package/lib/api/impl/validator/index.d.ts.map +1 -1
  18. package/lib/api/impl/validator/index.js +12 -22
  19. package/lib/api/impl/validator/index.js.map +1 -1
  20. package/lib/api/impl/validator/utils.d.ts +5 -0
  21. package/lib/api/impl/validator/utils.d.ts.map +1 -1
  22. package/lib/api/impl/validator/utils.js +18 -12
  23. package/lib/api/impl/validator/utils.js.map +1 -1
  24. package/lib/api/rest/base.d.ts.map +1 -1
  25. package/lib/api/rest/base.js +7 -0
  26. package/lib/api/rest/base.js.map +1 -1
  27. package/lib/chain/archiveStore/archiveStore.js +1 -1
  28. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  29. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  30. package/lib/chain/archiveStore/historicalState/metrics.js +21 -0
  31. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  32. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  33. package/lib/chain/blocks/importBlock.js +3 -8
  34. package/lib/chain/blocks/importBlock.js.map +1 -1
  35. package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
  36. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  37. package/lib/chain/blocks/importExecutionPayload.js +12 -10
  38. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  39. package/lib/chain/blocks/index.d.ts.map +1 -1
  40. package/lib/chain/blocks/index.js +17 -11
  41. package/lib/chain/blocks/index.js.map +1 -1
  42. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
  43. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  44. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
  45. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  46. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
  47. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  48. package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
  49. package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
  50. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  51. package/lib/chain/blocks/verifyBlock.js +11 -16
  52. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  53. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  54. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
  55. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  56. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
  57. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
  58. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  59. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  60. package/lib/chain/bls/index.d.ts +1 -1
  61. package/lib/chain/bls/index.d.ts.map +1 -1
  62. package/lib/chain/bls/interface.d.ts +5 -5
  63. package/lib/chain/bls/interface.d.ts.map +1 -1
  64. package/lib/chain/bls/multithread/index.d.ts +5 -11
  65. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  66. package/lib/chain/bls/multithread/index.js +116 -101
  67. package/lib/chain/bls/multithread/index.js.map +1 -1
  68. package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
  69. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  70. package/lib/chain/bls/multithread/jobItem.js +10 -65
  71. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  72. package/lib/chain/bls/multithread/types.d.ts +29 -8
  73. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  74. package/lib/chain/bls/multithread/types.js +12 -0
  75. package/lib/chain/bls/multithread/types.js.map +1 -1
  76. package/lib/chain/bls/multithread/utils.d.ts +4 -0
  77. package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
  78. package/lib/chain/bls/multithread/utils.js +10 -0
  79. package/lib/chain/bls/multithread/utils.js.map +1 -1
  80. package/lib/chain/bls/multithread/worker.js +49 -23
  81. package/lib/chain/bls/multithread/worker.js.map +1 -1
  82. package/lib/chain/bls/singleThread.d.ts +4 -10
  83. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  84. package/lib/chain/bls/singleThread.js +8 -45
  85. package/lib/chain/bls/singleThread.js.map +1 -1
  86. package/lib/chain/bls/utils.d.ts +4 -4
  87. package/lib/chain/bls/utils.d.ts.map +1 -1
  88. package/lib/chain/bls/utils.js +18 -19
  89. package/lib/chain/bls/utils.js.map +1 -1
  90. package/lib/chain/builderCircuitBreaker.d.ts +6 -5
  91. package/lib/chain/builderCircuitBreaker.d.ts.map +1 -1
  92. package/lib/chain/builderCircuitBreaker.js +28 -15
  93. package/lib/chain/builderCircuitBreaker.js.map +1 -1
  94. package/lib/chain/chain.d.ts +5 -3
  95. package/lib/chain/chain.d.ts.map +1 -1
  96. package/lib/chain/chain.js +24 -8
  97. package/lib/chain/chain.js.map +1 -1
  98. package/lib/chain/errors/blockError.d.ts +2 -0
  99. package/lib/chain/errors/blockError.d.ts.map +1 -1
  100. package/lib/chain/errors/blockError.js +6 -1
  101. package/lib/chain/errors/blockError.js.map +1 -1
  102. package/lib/chain/errors/proposerPreferences.d.ts +6 -0
  103. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
  104. package/lib/chain/errors/proposerPreferences.js +1 -0
  105. package/lib/chain/errors/proposerPreferences.js.map +1 -1
  106. package/lib/chain/interface.d.ts +4 -2
  107. package/lib/chain/interface.d.ts.map +1 -1
  108. package/lib/chain/interface.js.map +1 -1
  109. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  110. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  111. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  112. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  113. package/lib/chain/opPools/attestationPool.js +1 -1
  114. package/lib/chain/opPools/attestationPool.js.map +1 -1
  115. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
  116. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
  117. package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
  118. package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
  119. package/lib/chain/opPools/index.d.ts +1 -0
  120. package/lib/chain/opPools/index.d.ts.map +1 -1
  121. package/lib/chain/opPools/index.js +1 -0
  122. package/lib/chain/opPools/index.js.map +1 -1
  123. package/lib/chain/opPools/payloadAttestationPool.js +3 -3
  124. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  125. package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
  126. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  127. package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
  128. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  129. package/lib/chain/opPools/utils.d.ts +1 -1
  130. package/lib/chain/opPools/utils.d.ts.map +1 -1
  131. package/lib/chain/opPools/utils.js +1 -1
  132. package/lib/chain/opPools/utils.js.map +1 -1
  133. package/lib/chain/options.d.ts +1 -3
  134. package/lib/chain/options.d.ts.map +1 -1
  135. package/lib/chain/options.js.map +1 -1
  136. package/lib/chain/prepareNextSlot.js +2 -2
  137. package/lib/chain/prepareNextSlot.js.map +1 -1
  138. package/lib/chain/produceBlock/produceBlockBody.d.ts +2 -0
  139. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  140. package/lib/chain/produceBlock/produceBlockBody.js +8 -3
  141. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  142. package/lib/chain/regen/interface.d.ts +4 -2
  143. package/lib/chain/regen/interface.d.ts.map +1 -1
  144. package/lib/chain/regen/interface.js +2 -0
  145. package/lib/chain/regen/interface.js.map +1 -1
  146. package/lib/chain/regen/queued.d.ts +2 -2
  147. package/lib/chain/regen/queued.d.ts.map +1 -1
  148. package/lib/chain/regen/queued.js +5 -5
  149. package/lib/chain/regen/queued.js.map +1 -1
  150. package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
  151. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  152. package/lib/chain/seenCache/seenAttesters.js +25 -4
  153. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  154. package/lib/chain/seenCache/seenBlockProposers.d.ts +5 -1
  155. package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
  156. package/lib/chain/seenCache/seenBlockProposers.js +17 -7
  157. package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
  158. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
  159. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  160. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
  161. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  162. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
  163. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  164. package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
  165. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  166. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
  167. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  168. package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
  169. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  170. package/lib/chain/stateCache/types.d.ts +3 -3
  171. package/lib/chain/stateCache/types.d.ts.map +1 -1
  172. package/lib/chain/validation/attestation.d.ts.map +1 -1
  173. package/lib/chain/validation/attestation.js +1 -4
  174. package/lib/chain/validation/attestation.js.map +1 -1
  175. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  176. package/lib/chain/validation/attesterSlashing.js +1 -1
  177. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  178. package/lib/chain/validation/block.d.ts.map +1 -1
  179. package/lib/chain/validation/block.js +21 -7
  180. package/lib/chain/validation/block.js.map +1 -1
  181. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  182. package/lib/chain/validation/executionPayloadBid.js +1 -2
  183. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  184. package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
  185. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  186. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  187. package/lib/chain/validation/payloadAttestationMessage.js +5 -14
  188. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  189. package/lib/chain/validation/proposerPreferences.d.ts +1 -1
  190. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
  191. package/lib/chain/validation/proposerPreferences.js +13 -4
  192. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  193. package/lib/chain/validation/proposerSlashing.js +1 -1
  194. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  195. package/lib/chain/validation/voluntaryExit.d.ts +9 -1
  196. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  197. package/lib/chain/validation/voluntaryExit.js +46 -1
  198. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  199. package/lib/execution/builder/http.d.ts +10 -7
  200. package/lib/execution/builder/http.d.ts.map +1 -1
  201. package/lib/execution/builder/http.js +11 -8
  202. package/lib/execution/builder/http.js.map +1 -1
  203. package/lib/metrics/metrics/beacon.d.ts +3 -3
  204. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  205. package/lib/metrics/metrics/beacon.js +9 -9
  206. package/lib/metrics/metrics/beacon.js.map +1 -1
  207. package/lib/metrics/metrics/lodestar.d.ts +71 -22
  208. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  209. package/lib/metrics/metrics/lodestar.js +126 -52
  210. package/lib/metrics/metrics/lodestar.js.map +1 -1
  211. package/lib/network/gossip/topic.d.ts +13 -0
  212. package/lib/network/gossip/topic.d.ts.map +1 -1
  213. package/lib/network/gossip/topic.js +37 -0
  214. package/lib/network/gossip/topic.js.map +1 -1
  215. package/lib/network/libp2p/index.d.ts.map +1 -1
  216. package/lib/network/libp2p/index.js +10 -2
  217. package/lib/network/libp2p/index.js.map +1 -1
  218. package/lib/network/network.d.ts.map +1 -1
  219. package/lib/network/network.js +22 -43
  220. package/lib/network/network.js.map +1 -1
  221. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  222. package/lib/network/processor/gossipHandlers.js +37 -6
  223. package/lib/network/processor/gossipHandlers.js.map +1 -1
  224. package/lib/network/reqresp/score.d.ts.map +1 -1
  225. package/lib/network/reqresp/score.js +5 -11
  226. package/lib/network/reqresp/score.js.map +1 -1
  227. package/lib/network/util.d.ts +0 -1
  228. package/lib/network/util.d.ts.map +1 -1
  229. package/lib/network/util.js +0 -4
  230. package/lib/network/util.js.map +1 -1
  231. package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
  232. package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
  233. package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
  234. package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
  235. package/lib/node/nodejs.d.ts +2 -1
  236. package/lib/node/nodejs.d.ts.map +1 -1
  237. package/lib/node/nodejs.js +2 -0
  238. package/lib/node/nodejs.js.map +1 -1
  239. package/lib/sync/range/batch.d.ts +23 -5
  240. package/lib/sync/range/batch.d.ts.map +1 -1
  241. package/lib/sync/range/batch.js +62 -23
  242. package/lib/sync/range/batch.js.map +1 -1
  243. package/lib/sync/range/chain.d.ts +2 -1
  244. package/lib/sync/range/chain.d.ts.map +1 -1
  245. package/lib/sync/range/chain.js +23 -10
  246. package/lib/sync/range/chain.js.map +1 -1
  247. package/lib/sync/range/utils/hashBlocks.d.ts +16 -4
  248. package/lib/sync/range/utils/hashBlocks.d.ts.map +1 -1
  249. package/lib/sync/range/utils/hashBlocks.js +49 -18
  250. package/lib/sync/range/utils/hashBlocks.js.map +1 -1
  251. package/lib/sync/types.d.ts +32 -0
  252. package/lib/sync/types.d.ts.map +1 -1
  253. package/lib/sync/types.js +33 -0
  254. package/lib/sync/types.js.map +1 -1
  255. package/lib/sync/unknownBlock.d.ts +9 -0
  256. package/lib/sync/unknownBlock.d.ts.map +1 -1
  257. package/lib/sync/unknownBlock.js +187 -47
  258. package/lib/sync/unknownBlock.js.map +1 -1
  259. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  260. package/lib/sync/utils/downloadByRange.js +16 -11
  261. package/lib/sync/utils/downloadByRange.js.map +1 -1
  262. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  263. package/lib/sync/utils/downloadByRoot.js +3 -1
  264. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  265. package/package.json +37 -37
  266. package/src/api/impl/beacon/blocks/index.ts +7 -8
  267. package/src/api/impl/beacon/pool/index.ts +27 -2
  268. package/src/api/impl/beacon/state/utils.ts +2 -1
  269. package/src/api/impl/events/index.ts +12 -4
  270. package/src/api/impl/lodestar/index.ts +12 -13
  271. package/src/api/impl/validator/index.ts +22 -27
  272. package/src/api/impl/validator/utils.ts +30 -15
  273. package/src/api/rest/base.ts +7 -0
  274. package/src/chain/archiveStore/archiveStore.ts +1 -1
  275. package/src/chain/archiveStore/historicalState/metrics.ts +22 -0
  276. package/src/chain/blocks/importBlock.ts +2 -7
  277. package/src/chain/blocks/importExecutionPayload.ts +13 -12
  278. package/src/chain/blocks/index.ts +21 -11
  279. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
  280. package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
  281. package/src/chain/blocks/verifyBlock.ts +21 -25
  282. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
  283. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
  284. package/src/chain/bls/index.ts +1 -1
  285. package/src/chain/bls/interface.ts +7 -3
  286. package/src/chain/bls/multithread/index.ts +148 -120
  287. package/src/chain/bls/multithread/jobItem.ts +12 -82
  288. package/src/chain/bls/multithread/types.ts +33 -8
  289. package/src/chain/bls/multithread/utils.ts +11 -0
  290. package/src/chain/bls/multithread/worker.ts +85 -27
  291. package/src/chain/bls/singleThread.ts +11 -55
  292. package/src/chain/bls/utils.ts +23 -24
  293. package/src/chain/builderCircuitBreaker.ts +31 -17
  294. package/src/chain/chain.ts +25 -7
  295. package/src/chain/errors/blockError.ts +9 -3
  296. package/src/chain/errors/proposerPreferences.ts +7 -0
  297. package/src/chain/interface.ts +4 -1
  298. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  299. package/src/chain/opPools/attestationPool.ts +1 -1
  300. package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
  301. package/src/chain/opPools/index.ts +1 -0
  302. package/src/chain/opPools/payloadAttestationPool.ts +3 -3
  303. package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
  304. package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
  305. package/src/chain/opPools/utils.ts +1 -1
  306. package/src/chain/options.ts +1 -3
  307. package/src/chain/prepareNextSlot.ts +2 -2
  308. package/src/chain/produceBlock/produceBlockBody.ts +15 -2
  309. package/src/chain/regen/interface.ts +4 -2
  310. package/src/chain/regen/queued.ts +5 -5
  311. package/src/chain/seenCache/seenAttesters.ts +31 -5
  312. package/src/chain/seenCache/seenBlockProposers.ts +24 -7
  313. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
  314. package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
  315. package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
  316. package/src/chain/stateCache/types.ts +3 -3
  317. package/src/chain/validation/attestation.ts +1 -7
  318. package/src/chain/validation/attesterSlashing.ts +1 -8
  319. package/src/chain/validation/block.ts +21 -7
  320. package/src/chain/validation/executionPayloadBid.ts +1 -2
  321. package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
  322. package/src/chain/validation/payloadAttestationMessage.ts +6 -17
  323. package/src/chain/validation/proposerPreferences.ts +15 -5
  324. package/src/chain/validation/proposerSlashing.ts +1 -1
  325. package/src/chain/validation/voluntaryExit.ts +59 -2
  326. package/src/execution/builder/http.ts +11 -11
  327. package/src/metrics/metrics/beacon.ts +9 -9
  328. package/src/metrics/metrics/lodestar.ts +138 -57
  329. package/src/network/gossip/topic.ts +38 -0
  330. package/src/network/libp2p/index.ts +11 -2
  331. package/src/network/network.ts +27 -55
  332. package/src/network/processor/gossipHandlers.ts +40 -4
  333. package/src/network/reqresp/score.ts +5 -11
  334. package/src/network/util.ts +0 -5
  335. package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
  336. package/src/node/nodejs.ts +5 -1
  337. package/src/sync/range/batch.ts +84 -29
  338. package/src/sync/range/chain.ts +26 -11
  339. package/src/sync/range/utils/hashBlocks.ts +56 -21
  340. package/src/sync/types.ts +36 -1
  341. package/src/sync/unknownBlock.ts +212 -53
  342. package/src/sync/utils/downloadByRange.ts +21 -12
  343. package/src/sync/utils/downloadByRoot.ts +3 -1
  344. package/lib/chain/bls/maybeBatch.d.ts +0 -12
  345. package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
  346. package/lib/chain/bls/maybeBatch.js +0 -35
  347. package/lib/chain/bls/maybeBatch.js.map +0 -1
  348. package/src/chain/bls/maybeBatch.ts +0 -45
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ChainSafe/lodestar/issues"
13
13
  },
14
- "version": "1.46.0",
14
+ "version": "1.47.0-dev.02d2dbea03",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -100,51 +100,51 @@
100
100
  "check-readme": "pnpm exec tsx ../../scripts/check_readme.ts"
101
101
  },
102
102
  "dependencies": {
103
- "@chainsafe/as-sha256": "^1.2.4",
104
- "@chainsafe/blst": "^2.2.0",
105
- "@chainsafe/discv5": "^12.0.1",
106
- "@chainsafe/enr": "^6.0.1",
103
+ "@chainsafe/as-sha256": "^1.2.5",
104
+ "@chainsafe/discv5": "^12.0.2",
105
+ "@chainsafe/enr": "^6.0.2",
107
106
  "@chainsafe/libp2p-noise": "^17.0.0",
108
107
  "@chainsafe/libp2p-quic": "^2.1.3",
109
- "@chainsafe/persistent-merkle-tree": "^1.3.0",
108
+ "@chainsafe/lodestar-z": "catalog:",
109
+ "@chainsafe/persistent-merkle-tree": "^1.3.1",
110
110
  "@chainsafe/prometheus-gc-stats": "^1.0.0",
111
111
  "@chainsafe/snappy-wasm": "^0.5.0",
112
- "@chainsafe/ssz": "^1.6.2",
112
+ "@chainsafe/ssz": "^1.6.3",
113
113
  "@chainsafe/threads": "^1.11.3",
114
114
  "@crate-crypto/node-eth-kzg": "0.9.1",
115
115
  "@fastify/bearer-auth": "^10.0.1",
116
116
  "@fastify/cors": "^10.0.1",
117
117
  "@fastify/swagger": "^9.0.0",
118
118
  "@fastify/swagger-ui": "^5.0.1",
119
- "@libp2p/bootstrap": "^12.0.14",
120
- "@libp2p/crypto": "^5.1.13",
121
- "@libp2p/gossipsub": "^16.0.2",
122
- "@libp2p/identify": "^4.0.13",
123
- "@libp2p/interface": "^3.1.0",
124
- "@libp2p/mdns": "^12.0.14",
125
- "@libp2p/mplex": "^12.0.14",
126
- "@libp2p/peer-id": "^6.0.4",
127
- "@libp2p/prometheus-metrics": "^5.0.14",
128
- "@libp2p/tcp": "^11.0.13",
129
- "@lodestar/api": "^1.46.0",
130
- "@lodestar/config": "^1.46.0",
131
- "@lodestar/db": "^1.46.0",
132
- "@lodestar/fork-choice": "^1.46.0",
133
- "@lodestar/logger": "^1.46.0",
134
- "@lodestar/params": "^1.46.0",
135
- "@lodestar/reqresp": "^1.46.0",
136
- "@lodestar/state-transition": "^1.46.0",
137
- "@lodestar/types": "^1.46.0",
138
- "@lodestar/utils": "^1.46.0",
139
- "@lodestar/validator": "^1.46.0",
119
+ "@libp2p/bootstrap": "^12.0.30",
120
+ "@libp2p/crypto": "^5.1.23",
121
+ "@libp2p/gossipsub": "^16.1.1",
122
+ "@libp2p/identify": "^4.1.13",
123
+ "@libp2p/interface": "^3.3.0",
124
+ "@libp2p/mdns": "^12.0.30",
125
+ "@libp2p/mplex": "^12.0.30",
126
+ "@libp2p/peer-id": "^6.0.15",
127
+ "@libp2p/prometheus-metrics": "^5.0.28",
128
+ "@libp2p/tcp": "^11.0.27",
129
+ "@lodestar/api": "^1.47.0-dev.02d2dbea03",
130
+ "@lodestar/config": "^1.47.0-dev.02d2dbea03",
131
+ "@lodestar/db": "^1.47.0-dev.02d2dbea03",
132
+ "@lodestar/fork-choice": "^1.47.0-dev.02d2dbea03",
133
+ "@lodestar/logger": "^1.47.0-dev.02d2dbea03",
134
+ "@lodestar/params": "^1.47.0-dev.02d2dbea03",
135
+ "@lodestar/reqresp": "^1.47.0-dev.02d2dbea03",
136
+ "@lodestar/state-transition": "^1.47.0-dev.02d2dbea03",
137
+ "@lodestar/types": "^1.47.0-dev.02d2dbea03",
138
+ "@lodestar/utils": "^1.47.0-dev.02d2dbea03",
139
+ "@lodestar/validator": "^1.47.0-dev.02d2dbea03",
140
140
  "@multiformats/multiaddr": "^13.0.1",
141
- "datastore-core": "^11.0.2",
142
- "datastore-level": "^12.0.2",
141
+ "datastore-core": "^12.0.1",
142
+ "datastore-level": "^13.0.1",
143
143
  "deepmerge": "^4.3.1",
144
144
  "fastify": "^5.8.1",
145
- "interface-datastore": "^9.0.2",
145
+ "interface-datastore": "^10.0.1",
146
146
  "jwt-simple": "0.5.6",
147
- "libp2p": "3.1.6",
147
+ "libp2p": "3.3.9",
148
148
  "multiformats": "^13.4.2",
149
149
  "prom-client": "^15.1.0",
150
150
  "qs": "^6.14.2",
@@ -155,10 +155,10 @@
155
155
  },
156
156
  "devDependencies": {
157
157
  "@chainsafe/swap-or-not-shuffle": "^1.2.1",
158
- "@libp2p/interface-internal": "^3.0.13",
159
- "@libp2p/logger": "^6.2.2",
160
- "@libp2p/utils": "^7.0.13",
161
- "@lodestar/spec-test-util": "^1.46.0",
158
+ "@libp2p/interface-internal": "^3.1.12",
159
+ "@libp2p/logger": "^6.2.13",
160
+ "@libp2p/utils": "^7.4.0",
161
+ "@lodestar/spec-test-util": "^1.47.0-dev.02d2dbea03",
162
162
  "@types/js-yaml": "^4.0.5",
163
163
  "@types/qs": "^6.9.7",
164
164
  "@types/tmp": "^0.2.3",
@@ -175,5 +175,5 @@
175
175
  "beacon",
176
176
  "blockchain"
177
177
  ],
178
- "gitHead": "3873dd5b032d0ad82581fc3416e9628b4f6f2642"
178
+ "gitHead": "4dfb544428ee8bda82f94c10cfa569a5f132f4e0"
179
179
  }
@@ -128,7 +128,8 @@ export function getBeaconBlockApi({
128
128
  forkName: fork,
129
129
  sampledColumns: chain.custodyConfig.sampledColumns,
130
130
  custodyColumns: chain.custodyConfig.custodyColumns,
131
- timeCreatedSec: seenTimestampSec,
131
+ seenTimestampSec,
132
+ source: PayloadEnvelopeInputSource.api,
132
133
  });
133
134
  }
134
135
 
@@ -220,12 +221,6 @@ export function getBeaconBlockApi({
220
221
  // Block has already been seen, e.g. via gossip racing the publish API. Benign.
221
222
  chain.logger.debug("Ignoring already-known block during publishing", valLogMeta);
222
223
  return;
223
- case BlockErrorCode.REPEAT_PROPOSAL:
224
- // The proposer already produced a block for this slot. For a solo setup this is a
225
- // notable signal (duplicate-proposal attempt). For fallback / DVT setups it is
226
- // expected on every block where another node published first.
227
- chain.logger.warn("Ignoring repeat-proposal block during publishing", valLogMeta);
228
- return;
229
224
  }
230
225
  }
231
226
 
@@ -407,7 +402,7 @@ export function getBeaconBlockApi({
407
402
  for (let i = 0; i < dataColumnSidecars.length; i++) {
408
403
  // + 1 because we publish to beacon_block first
409
404
  const {sentPeers, alreadyPublished} = sentPeersArr[i + 1] as {sentPeers: number; alreadyPublished: boolean};
410
- // sent peers could be 0 as we set `allowPublishToZeroTopicPeers=true` in network.publishDataColumnSidecar()
405
+ // sent peers could be 0, data_column_sidecar opts out of the zero peers publish error, see gossipTopicAllowPublishToZeroPeers
411
406
  metrics?.dataColumns.sentPeersPerSubnet.observe(sentPeers);
412
407
  // A duplicate publish (alreadyPublished=true) means the column is already propagating on the network —
413
408
  // expected in self-build flows where peers gossip columns back to us before we publish the envelope.
@@ -1032,6 +1027,7 @@ export function getBeaconBlockApi({
1032
1027
  },
1033
1028
 
1034
1029
  async publishExecutionPayloadBid({signedExecutionPayloadBid}) {
1030
+ const seenTimestampSec = Date.now() / 1000;
1035
1031
  const bid = signedExecutionPayloadBid.message;
1036
1032
  const slot = bid.slot;
1037
1033
  const fork = config.getForkName(slot);
@@ -1042,6 +1038,9 @@ export function getBeaconBlockApi({
1042
1038
 
1043
1039
  await validateApiExecutionPayloadBid(chain, signedExecutionPayloadBid);
1044
1040
 
1041
+ const elapsedSec = chain.clock.secFromSlot(slot, seenTimestampSec);
1042
+ metrics?.gossipExecutionPayloadBid.elapsedTimeTillReceived.observe({source: OpSource.api}, elapsedSec);
1043
+
1045
1044
  try {
1046
1045
  const insertOutcome = chain.executionPayloadBidPool.add(signedExecutionPayloadBid);
1047
1046
  metrics?.opPool.executionPayloadBidPool.apiInsertOutcome.inc({insertOutcome});
@@ -25,6 +25,7 @@ import {validateApiPayloadAttestationMessage} from "../../../../chain/validation
25
25
  import {validateApiProposerSlashing} from "../../../../chain/validation/proposerSlashing.js";
26
26
  import {validateApiSyncCommittee} from "../../../../chain/validation/syncCommittee.js";
27
27
  import {validateApiVoluntaryExit} from "../../../../chain/validation/voluntaryExit.js";
28
+ import {OpSource} from "../../../../chain/validatorMonitor.js";
28
29
  import {validateGossipFnRetryUnknownRoot} from "../../../../network/processor/gossipHandlers.js";
29
30
  import {ApiError, FailureList, IndexedError} from "../../errors.js";
30
31
  import {ApiModules} from "../../types.js";
@@ -99,7 +100,9 @@ export function getBeaconPoolApi({
99
100
  const {indexedAttestation, subnet, attDataRootHex, committeeIndex, validatorCommitteeIndex, committeeSize} =
100
101
  await validateGossipFnRetryUnknownRoot(validateFn, network, chain, slot, beaconBlockRoot);
101
102
 
102
- if (network.shouldAggregate(subnet, slot)) {
103
+ try {
104
+ // `is_aggregator` only covers aggregating what we receive on the subnet via gossip, not what
105
+ // a validator client hands us directly, see https://github.com/ChainSafe/lodestar/issues/7548
103
106
  const insertOutcome = chain.attestationPool.add(
104
107
  committeeIndex,
105
108
  attestation,
@@ -109,6 +112,10 @@ export function getBeaconPoolApi({
109
112
  priority
110
113
  );
111
114
  metrics?.opPool.attestationPool.apiInsertOutcome.inc({insertOutcome});
115
+ } catch (e) {
116
+ // The pool is a local optimization, failing to insert must not stop us from publishing a
117
+ // validated attestation, which the route requires us to do. Same handling as the gossip path
118
+ logger.debug("Error adding unaggregated attestation to pool", {subnet}, e as Error);
112
119
  }
113
120
 
114
121
  if (isForkPostElectra(fork)) {
@@ -172,7 +179,21 @@ export function getBeaconPoolApi({
172
179
  },
173
180
 
174
181
  async submitPoolVoluntaryExit({signedVoluntaryExit}) {
175
- await validateApiVoluntaryExit(chain, signedVoluntaryExit);
182
+ const result = await validateApiVoluntaryExit(chain, signedVoluntaryExit);
183
+
184
+ if (result.status === "deferred") {
185
+ const currentEpoch = chain.clock.currentEpoch;
186
+ const inserted = chain.deferredVoluntaryExitPool.insert(signedVoluntaryExit, result.validity, currentEpoch);
187
+ if (!inserted) {
188
+ throw new ApiError(400, "Deferred voluntary exit pool is full or already contains this validator");
189
+ }
190
+ logger.info("Voluntary exit deferred until transient conditions are met", {
191
+ validatorIndex: signedVoluntaryExit.message.validatorIndex,
192
+ reason: result.validity,
193
+ });
194
+ return;
195
+ }
196
+
176
197
  chain.opPool.insertVoluntaryExit(signedVoluntaryExit);
177
198
  chain.emitter.emit(routes.events.EventType.voluntaryExit, signedVoluntaryExit);
178
199
  await network.publishVoluntaryExit(signedVoluntaryExit);
@@ -211,6 +232,7 @@ export function getBeaconPoolApi({
211
232
  },
212
233
 
213
234
  async submitPayloadAttestationMessages({payloadAttestationMessages}) {
235
+ const seenTimestampSec = Date.now() / 1000;
214
236
  const failures: FailureList = [];
215
237
 
216
238
  await Promise.all(
@@ -226,6 +248,9 @@ export function getBeaconPoolApi({
226
248
  beaconBlockRoot
227
249
  );
228
250
 
251
+ const delaySec = chain.clock.secFromSlot(slot, seenTimestampSec);
252
+ metrics?.gossipPayloadAttestationMessage.elapsedTimeTillReceived.observe({source: OpSource.api}, delaySec);
253
+
229
254
  const insertOutcome = chain.payloadAttestationPool.add(
230
255
  payloadAttestationMessage,
231
256
  attDataRootHex,
@@ -1,7 +1,8 @@
1
+ import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
1
2
  import {routes} from "@lodestar/api";
2
3
  import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
3
4
  import {GENESIS_SLOT} from "@lodestar/params";
4
- import {IBeaconStateView, IBeaconStateViewGloas, PubkeyCache} from "@lodestar/state-transition";
5
+ import {IBeaconStateView, IBeaconStateViewGloas} from "@lodestar/state-transition";
5
6
  import {
6
7
  BLSPubkey,
7
8
  BuilderIndex,
@@ -4,7 +4,8 @@ import {ApiModules} from "../types.js";
4
4
 
5
5
  export function getEventsApi({
6
6
  chain,
7
- }: Pick<ApiModules, "chain" | "config">): ApplicationMethods<routes.events.Endpoints> {
7
+ logger,
8
+ }: Pick<ApiModules, "chain" | "config" | "logger">): ApplicationMethods<routes.events.Endpoints> {
8
9
  return {
9
10
  async eventstream({topics, signal, onEvent}) {
10
11
  const onAbortFns: (() => void)[] = [];
@@ -12,9 +13,16 @@ export function getEventsApi({
12
13
  for (const topic of topics) {
13
14
  // biome-ignore lint/suspicious/noExplicitAny: We need to use `any` type here
14
15
  const handler = (data: any): void => {
15
- // TODO: What happens if this handler throws? Does it break the other chain.emitter listeners?
16
-
17
- onEvent({type: topic, message: data});
16
+ try {
17
+ // TS only relates `{type, message}` to the `BeaconEvent` discriminated union while
18
+ // `EventType` stays within its ~25-member cap; without the cast, adding events trips TS2345.
19
+ onEvent({type: topic, message: data} as routes.events.BeaconEvent);
20
+ } catch (e) {
21
+ // `chain.emitter` emits synchronously, a throwing listener would propagate the error to
22
+ // whoever emitted the event, e.g. a gossip handler, and skip the remaining listeners.
23
+ // A single misbehaving event or client must not affect the node or other subscribers.
24
+ logger.warn("Error sending event to client", {topic}, e as Error);
25
+ }
18
26
  };
19
27
 
20
28
  chain.emitter.on(topic, handler);
@@ -147,7 +147,7 @@ export function getLodestarApi({
147
147
  },
148
148
 
149
149
  async dropStateCache() {
150
- chain.regen.dropCache();
150
+ await chain.regen.dropCache();
151
151
  },
152
152
 
153
153
  async connectPeer({peerId, multiaddrs}) {
@@ -280,7 +280,7 @@ export function getLodestarApi({
280
280
  },
281
281
 
282
282
  async getFastConfirmationInfo() {
283
- const confirmedRoot = chain.forkChoice.getConfirmedRoot();
283
+ const fcrStore = chain.forkChoice.getFastConfirmationStore();
284
284
  const confirmedBlock = chain.forkChoice.getConfirmedBlock();
285
285
  const justifiedCheckpoint = chain.forkChoice.getJustifiedCheckpoint();
286
286
  const finalizedCheckpoint = chain.forkChoice.getFinalizedCheckpoint();
@@ -290,21 +290,20 @@ export function getLodestarApi({
290
290
  return {
291
291
  data: {
292
292
  confirmed: {
293
- rootHex: confirmedRoot,
294
- slot: confirmedBlock?.slot ?? null,
293
+ root: fromHex(fcrStore.confirmedRoot),
294
+ slot: confirmedBlock?.slot ?? 0,
295
295
  },
296
296
  head: {
297
- rootHex: headRoot,
297
+ root: fromHex(headRoot),
298
298
  slot: head.slot,
299
299
  },
300
- justifiedCheckpoint: {
301
- rootHex: justifiedCheckpoint.rootHex,
302
- epoch: justifiedCheckpoint.epoch,
303
- },
304
- finalizedCheckpoint: {
305
- rootHex: finalizedCheckpoint.rootHex,
306
- epoch: finalizedCheckpoint.epoch,
307
- },
300
+ justifiedCheckpoint,
301
+ finalizedCheckpoint,
302
+ previousEpochObservedJustifiedCheckpoint: fcrStore.previousEpochObservedJustifiedCheckpoint,
303
+ currentEpochObservedJustifiedCheckpoint: fcrStore.currentEpochObservedJustifiedCheckpoint,
304
+ previousEpochGreatestUnrealizedCheckpoint: fcrStore.previousEpochGreatestUnrealizedCheckpoint,
305
+ previousSlotHead: fromHex(fcrStore.previousSlotHead),
306
+ currentSlotHead: fromHex(fcrStore.currentSlotHead),
308
307
  },
309
308
  };
310
309
  },
@@ -92,7 +92,12 @@ import {getStateResponseWithRegen} from "../beacon/state/utils.js";
92
92
  import {ApiError, FailureList, IndexedError, NodeIsSyncing, OnlySupportedByDVT} from "../errors.js";
93
93
  import {ApiModules} from "../types.js";
94
94
  import {notWhileSyncing} from "../utils.js";
95
- import {computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProductionSource} from "./utils.js";
95
+ import {
96
+ computeSubnetForCommitteesAtSlot,
97
+ getPubkeysForIndices,
98
+ selectBlockProductionSource,
99
+ selectBlockProductionSourceByBoostFactor,
100
+ } from "./utils.js";
96
101
 
97
102
  /**
98
103
  * Cutoff time to wait from start of the slot for execution and builder block production apis to resolve.
@@ -577,8 +582,7 @@ export function getValidatorApi(
577
582
  builderSelection,
578
583
  isBuilderEnabled,
579
584
  strictFeeRecipientCheck,
580
- // winston logger doesn't like bigint
581
- builderBoostFactor: `${builderBoostFactor}`,
585
+ builderBoostFactor,
582
586
  };
583
587
 
584
588
  logger.verbose("Assembling block with produceEngineOrBuilderBlock", loggerContext);
@@ -851,8 +855,8 @@ export function getValidatorApi(
851
855
  randaoReveal,
852
856
  graffiti,
853
857
  feeRecipient,
858
+ strictFeeRecipientCheck,
854
859
  includePayload,
855
- builderSelection,
856
860
  builderBoostFactor,
857
861
  }) {
858
862
  const fork = config.getForkName(slot);
@@ -861,11 +865,6 @@ export function getValidatorApi(
861
865
  throw new ApiError(400, `produceBlockV4 not supported for pre-gloas fork=${fork}`);
862
866
  }
863
867
 
864
- builderSelection = builderSelection ?? routes.validator.BuilderSelection.MaxProfit;
865
- if (builderSelection === routes.validator.BuilderSelection.BuilderOnly) {
866
- logger.warn("Builder selection builderonly is no longer supported, treating as builderalways");
867
- builderSelection = routes.validator.BuilderSelection.BuilderAlways;
868
- }
869
868
  builderBoostFactor = builderBoostFactor ?? BigInt(100);
870
869
  if (builderBoostFactor > MAX_BUILDER_BOOST_FACTOR) {
871
870
  throw new ApiError(400, `Invalid builderBoostFactor=${builderBoostFactor} > MAX_BUILDER_BOOST_FACTOR`);
@@ -896,14 +895,11 @@ export function getValidatorApi(
896
895
  // TODO GLOAS: add external builder api support when it is implemented
897
896
  const isBuildingOnFull = chain.forkChoice.shouldBuildOnFull(parentBlock, slot);
898
897
  const bidParentBlockHash = isBuildingOnFull ? parentBlock.executionPayloadBlockHash : parentBlock.parentBlockHash;
899
- // Bids are only skipped entirely with executiononly or while the circuit breaker is active,
900
- // other engine-preferring selections still build a block with the best bid as fallback in
901
- // case local production fails
902
- const circuitBreakerActive = chain.builderCircuitBreaker.isActive(slot);
903
- const builderBid =
904
- builderSelection === routes.validator.BuilderSelection.ExecutionOnly || circuitBreakerActive
905
- ? null
906
- : chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex);
898
+ const circuitBreakerActive = chain.builderCircuitBreaker.isActive(slot, parentBlock);
899
+ // Keep a builder bid as fallback unless the circuit breaker is active
900
+ const builderBid = circuitBreakerActive
901
+ ? null
902
+ : chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex);
907
903
 
908
904
  const logCtx = {
909
905
  slot,
@@ -911,8 +907,8 @@ export function getValidatorApi(
911
907
  parentBlockRoot: parentBlockRootHex,
912
908
  parentBlockHash: parentBlock.executionPayloadBlockHash,
913
909
  fork,
914
- builderSelection,
915
910
  builderBoostFactor,
911
+ strictFeeRecipientCheck,
916
912
  circuitBreakerActive,
917
913
  ...(builderBid !== null
918
914
  ? {
@@ -936,6 +932,7 @@ export function getValidatorApi(
936
932
  randaoReveal,
937
933
  graffiti: graffitiBytes,
938
934
  feeRecipient,
935
+ strictFeeRecipientCheck,
939
936
  commonBlockBodyPromise,
940
937
  };
941
938
 
@@ -960,12 +957,8 @@ export function getValidatorApi(
960
957
  chain.produceBlock(baseAttrs)
961
958
  ).then((engineBlock) => {
962
959
  // No need to wait for the bid block if the engine block will always be selected due to
963
- // suspected builder censorship, a builder boost factor of 0 or executionalways selection
964
- if (
965
- engineBlock.shouldOverrideBuilder ||
966
- builderBoostFactor === BigInt(0) ||
967
- builderSelection === routes.validator.BuilderSelection.ExecutionAlways
968
- ) {
960
+ // suspected builder censorship or a builder boost factor of 0
961
+ if (engineBlock.shouldOverrideBuilder || builderBoostFactor === BigInt(0)) {
969
962
  controller.abort();
970
963
  }
971
964
  return engineBlock;
@@ -994,8 +987,7 @@ export function getValidatorApi(
994
987
  });
995
988
  logger.warn("Selected local block: censorship suspected in builder bid", logCtx);
996
989
  } else if (engineResult.status === "fulfilled" && bidResult.status === "fulfilled") {
997
- const result = selectBlockProductionSource({
998
- builderSelection,
990
+ const result = selectBlockProductionSourceByBoostFactor({
999
991
  builderBoostFactor,
1000
992
  engineExecutionPayloadValue: engineResult.value.executionPayloadValue,
1001
993
  // The bid value is the payment to the proposer, in Gwei
@@ -1061,7 +1053,10 @@ export function getValidatorApi(
1061
1053
  root: blockRoot,
1062
1054
  });
1063
1055
  if (chain.opts.persistProducedBlocks) {
1064
- void chain.persistBlock(block, "produced_engine_block");
1056
+ void chain.persistBlock(
1057
+ block,
1058
+ source === ProducedBlockSource.builder ? "produced_builder_block" : "produced_engine_block"
1059
+ );
1065
1060
  }
1066
1061
 
1067
1062
  // Include the payload for self-builds unless disabled (stateless flow)
@@ -59,24 +59,39 @@ export function selectBlockProductionSource({
59
59
  return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.EnginePreferred};
60
60
 
61
61
  case routes.validator.BuilderSelection.Default:
62
- case routes.validator.BuilderSelection.MaxProfit: {
63
- if (builderBoostFactor === BigInt(0)) {
64
- return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.EnginePreferred};
65
- }
66
-
67
- if (builderBoostFactor === MAX_BUILDER_BOOST_FACTOR) {
68
- return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BuilderPreferred};
69
- }
70
-
71
- if (engineExecutionPayloadValue >= (builderExecutionPayloadValue * builderBoostFactor) / BigInt(100)) {
72
- return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.BlockValue};
73
- }
74
-
75
- return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BlockValue};
76
- }
62
+ case routes.validator.BuilderSelection.MaxProfit:
63
+ return selectBlockProductionSourceByBoostFactor({
64
+ engineExecutionPayloadValue,
65
+ builderExecutionPayloadValue,
66
+ builderBoostFactor,
67
+ });
77
68
 
78
69
  case routes.validator.BuilderSelection.BuilderAlways:
79
70
  case routes.validator.BuilderSelection.BuilderOnly:
80
71
  return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BuilderPreferred};
81
72
  }
82
73
  }
74
+
75
+ export function selectBlockProductionSourceByBoostFactor({
76
+ engineExecutionPayloadValue,
77
+ builderExecutionPayloadValue,
78
+ builderBoostFactor,
79
+ }: {
80
+ engineExecutionPayloadValue: bigint;
81
+ builderExecutionPayloadValue: bigint;
82
+ builderBoostFactor: bigint;
83
+ }): BlockSelectionResult {
84
+ if (builderBoostFactor === BigInt(0)) {
85
+ return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.EnginePreferred};
86
+ }
87
+
88
+ if (builderBoostFactor === MAX_BUILDER_BOOST_FACTOR) {
89
+ return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BuilderPreferred};
90
+ }
91
+
92
+ if (engineExecutionPayloadValue >= (builderExecutionPayloadValue * builderBoostFactor) / BigInt(100)) {
93
+ return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.BlockValue};
94
+ }
95
+
96
+ return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BlockValue};
97
+ }
@@ -104,6 +104,13 @@ export class RestApiServer {
104
104
 
105
105
  // To parse our ApiError -> statusCode
106
106
  server.setErrorHandler<FastifyError | Error>((err, _req, res) => {
107
+ if (res.raw.headersSent) {
108
+ // A status code can no longer be written, e.g. if a long-lived SSE stream failed mid-flight.
109
+ // End the response instead, else the socket is left open and the client never notices.
110
+ if (!res.raw.writableEnded && !res.raw.destroyed) res.raw.end();
111
+ return;
112
+ }
113
+
107
114
  const stacktraces = opts.stacktraces ? err.stack?.split("\n") : undefined;
108
115
  if ("validation" in err && err.validation) {
109
116
  const {instancePath = "unknown", message} = err.validation?.[0] ?? {};
@@ -192,7 +192,7 @@ export class ArchiveStore {
192
192
 
193
193
  private onCheckpoint = (): void => {
194
194
  const headStateRoot = this.chain.forkChoice.getHead().stateRoot;
195
- this.chain.regen.pruneOnCheckpoint(
195
+ this.chain.regen.onCheckpoint(
196
196
  this.chain.forkChoice.getFinalizedCheckpoint().epoch,
197
197
  this.chain.forkChoice.getJustifiedCheckpoint().epoch,
198
198
  headStateRoot
@@ -1,3 +1,4 @@
1
+ import {ForkName} from "@lodestar/params";
1
2
  import {
2
3
  BeaconStateTransitionMetrics,
3
4
  EpochTransitionStep,
@@ -45,6 +46,27 @@ export function createHistoricalStateTransitionMetrics(
45
46
  labelNames: ["step"],
46
47
  buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1],
47
48
  }),
49
+ forkUpgradeTime: metricsRegister.histogram<{fork: ForkName}>({
50
+ name: "lodestar_historical_state_stfn_fork_upgrade_seconds",
51
+ help: "Time to upgrade the state at a fork boundary in seconds",
52
+ labelNames: ["fork"],
53
+ buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30],
54
+ }),
55
+ onboardBuildersTime: metricsRegister.histogram({
56
+ name: "lodestar_historical_state_stfn_gloas_onboard_builders_seconds",
57
+ help: "Time spent in onboardBuildersFromPendingDeposits at the gloas fork transition",
58
+ buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30],
59
+ }),
60
+ onboardBuildersDeposits: metricsRegister.gauge<{outcome: "onboarded" | "topup" | "kept" | "dropped"}>({
61
+ name: "lodestar_historical_state_stfn_gloas_onboard_builders_deposits",
62
+ help: "Pending deposits handled at the gloas fork transition, by outcome",
63
+ labelNames: ["outcome"],
64
+ }),
65
+ onboardBuildersSignatureChecks: metricsRegister.gauge<{source: "cache" | "verified"}>({
66
+ name: "lodestar_historical_state_stfn_gloas_onboard_builders_signature_checks",
67
+ help: "Builder deposit signature checks at the gloas fork transition, by whether the pre-verify cache served them",
68
+ labelNames: ["source"],
69
+ }),
48
70
  processBlockTime: metricsRegister.histogram({
49
71
  name: "lodestar_historical_state_stfn_process_block_seconds",
50
72
  help: "Time to process a single block in seconds",
@@ -22,7 +22,6 @@ import {
22
22
  RootCache,
23
23
  computeEpochAtSlot,
24
24
  computeTimeAtSlot,
25
- isStartSlotOfEpoch,
26
25
  isStatePostAltair,
27
26
  isStatePostBellatrix,
28
27
  } from "@lodestar/state-transition";
@@ -404,11 +403,7 @@ export async function importBlock(
404
403
  notOverrideFcuReason = NotReorgedReason.NotProposerOfNextSlot;
405
404
  }
406
405
  } catch (e) {
407
- if (isStartSlotOfEpoch(proposalSlot)) {
408
- notOverrideFcuReason = NotReorgedReason.AtEpochBoundary;
409
- } else {
410
- this.logger.warn("Unable to get beacon proposer. Do not override fcu.", {proposalSlot}, e as Error);
411
- }
406
+ this.logger.warn("Unable to get beacon proposer. Do not override fcu.", {proposalSlot}, e as Error);
412
407
  }
413
408
 
414
409
  if (shouldOverrideFcu) {
@@ -445,7 +440,7 @@ export async function importBlock(
445
440
  * zero block hash (pre TTD)
446
441
  */
447
442
  const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice, this.logger);
448
- const finalizedBlockHash = getFinalizedExecutionBlockHash(this.forkChoice, this.logger);
443
+ const finalizedBlockHash = getFinalizedExecutionBlockHash(this.forkChoice);
449
444
  if (headBlockHash !== ZERO_HASH_HEX) {
450
445
  this.executionEngine
451
446
  .notifyForkchoiceUpdate(