@lodestar/beacon-node 1.47.0-dev.f591cb177e → 1.48.0-dev.67344272c0

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 (342) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +44 -12
  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 +21 -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.map +1 -1
  11. package/lib/api/impl/events/index.js +2 -0
  12. package/lib/api/impl/events/index.js.map +1 -1
  13. package/lib/api/impl/lodestar/index.js +1 -1
  14. package/lib/api/impl/lodestar/index.js.map +1 -1
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +237 -49
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/api/impl/validator/utils.js +1 -1
  19. package/lib/api/impl/validator/utils.js.map +1 -1
  20. package/lib/api/rest/base.d.ts.map +1 -1
  21. package/lib/api/rest/base.js +7 -0
  22. package/lib/api/rest/base.js.map +1 -1
  23. package/lib/chain/archiveStore/archiveStore.js +1 -1
  24. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  25. package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
  26. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  27. package/lib/chain/blocks/importExecutionPayload.js +11 -9
  28. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  29. package/lib/chain/blocks/index.d.ts.map +1 -1
  30. package/lib/chain/blocks/index.js +21 -13
  31. package/lib/chain/blocks/index.js.map +1 -1
  32. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
  33. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  34. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
  35. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  36. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
  37. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  38. package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
  39. package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
  40. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  41. package/lib/chain/blocks/verifyBlock.js +5 -2
  42. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  43. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  44. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
  45. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  46. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
  47. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  49. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  50. package/lib/chain/bls/index.d.ts +1 -1
  51. package/lib/chain/bls/index.d.ts.map +1 -1
  52. package/lib/chain/bls/interface.d.ts +5 -5
  53. package/lib/chain/bls/interface.d.ts.map +1 -1
  54. package/lib/chain/bls/multithread/index.d.ts +5 -11
  55. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  56. package/lib/chain/bls/multithread/index.js +116 -101
  57. package/lib/chain/bls/multithread/index.js.map +1 -1
  58. package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
  59. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  60. package/lib/chain/bls/multithread/jobItem.js +10 -65
  61. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  62. package/lib/chain/bls/multithread/types.d.ts +29 -8
  63. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  64. package/lib/chain/bls/multithread/types.js +12 -0
  65. package/lib/chain/bls/multithread/types.js.map +1 -1
  66. package/lib/chain/bls/multithread/utils.d.ts +4 -0
  67. package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
  68. package/lib/chain/bls/multithread/utils.js +10 -0
  69. package/lib/chain/bls/multithread/utils.js.map +1 -1
  70. package/lib/chain/bls/multithread/worker.js +49 -23
  71. package/lib/chain/bls/multithread/worker.js.map +1 -1
  72. package/lib/chain/bls/singleThread.d.ts +4 -10
  73. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  74. package/lib/chain/bls/singleThread.js +8 -45
  75. package/lib/chain/bls/singleThread.js.map +1 -1
  76. package/lib/chain/bls/utils.d.ts +4 -4
  77. package/lib/chain/bls/utils.d.ts.map +1 -1
  78. package/lib/chain/bls/utils.js +18 -19
  79. package/lib/chain/bls/utils.js.map +1 -1
  80. package/lib/chain/chain.d.ts +9 -4
  81. package/lib/chain/chain.d.ts.map +1 -1
  82. package/lib/chain/chain.js +22 -8
  83. package/lib/chain/chain.js.map +1 -1
  84. package/lib/chain/errors/blockError.d.ts +1 -0
  85. package/lib/chain/errors/blockError.d.ts.map +1 -1
  86. package/lib/chain/errors/blockError.js +6 -1
  87. package/lib/chain/errors/blockError.js.map +1 -1
  88. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  89. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  90. package/lib/chain/errors/executionPayloadBid.js +1 -0
  91. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  92. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  93. package/lib/chain/forkChoice/index.js +4 -0
  94. package/lib/chain/forkChoice/index.js.map +1 -1
  95. package/lib/chain/interface.d.ts +8 -4
  96. package/lib/chain/interface.d.ts.map +1 -1
  97. package/lib/chain/interface.js.map +1 -1
  98. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  99. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  100. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  101. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  102. package/lib/chain/opPools/attestationPool.js +1 -1
  103. package/lib/chain/opPools/attestationPool.js.map +1 -1
  104. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
  105. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
  106. package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
  107. package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
  108. package/lib/chain/opPools/executionPayloadBidPool.d.ts +7 -2
  109. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
  110. package/lib/chain/opPools/executionPayloadBidPool.js +4 -4
  111. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
  112. package/lib/chain/opPools/index.d.ts +2 -1
  113. package/lib/chain/opPools/index.d.ts.map +1 -1
  114. package/lib/chain/opPools/index.js +1 -0
  115. package/lib/chain/opPools/index.js.map +1 -1
  116. package/lib/chain/opPools/payloadAttestationPool.js +3 -3
  117. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  118. package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
  119. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  120. package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
  121. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  122. package/lib/chain/opPools/utils.d.ts +1 -1
  123. package/lib/chain/opPools/utils.d.ts.map +1 -1
  124. package/lib/chain/opPools/utils.js +1 -1
  125. package/lib/chain/opPools/utils.js.map +1 -1
  126. package/lib/chain/prepareNextSlot.d.ts +5 -0
  127. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  128. package/lib/chain/prepareNextSlot.js +47 -6
  129. package/lib/chain/prepareNextSlot.js.map +1 -1
  130. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  131. package/lib/chain/produceBlock/computeNewStateRoot.js +3 -25
  132. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  133. package/lib/chain/produceBlock/produceBlockBody.js +1 -1
  134. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  135. package/lib/chain/regen/interface.d.ts +5 -2
  136. package/lib/chain/regen/interface.d.ts.map +1 -1
  137. package/lib/chain/regen/interface.js +3 -0
  138. package/lib/chain/regen/interface.js.map +1 -1
  139. package/lib/chain/regen/queued.d.ts +2 -2
  140. package/lib/chain/regen/queued.d.ts.map +1 -1
  141. package/lib/chain/regen/queued.js +5 -5
  142. package/lib/chain/regen/queued.js.map +1 -1
  143. package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
  144. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  145. package/lib/chain/seenCache/seenAttesters.js +25 -4
  146. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  147. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
  148. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  149. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
  150. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  151. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
  152. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  153. package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
  154. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  155. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
  156. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  157. package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
  158. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  159. package/lib/chain/stateCache/types.d.ts +3 -3
  160. package/lib/chain/stateCache/types.d.ts.map +1 -1
  161. package/lib/chain/validation/attestation.d.ts.map +1 -1
  162. package/lib/chain/validation/attestation.js +1 -4
  163. package/lib/chain/validation/attestation.js.map +1 -1
  164. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  165. package/lib/chain/validation/attesterSlashing.js +1 -1
  166. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  167. package/lib/chain/validation/block.d.ts.map +1 -1
  168. package/lib/chain/validation/block.js +40 -10
  169. package/lib/chain/validation/block.js.map +1 -1
  170. package/lib/chain/validation/executionPayloadBid.d.ts +15 -3
  171. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  172. package/lib/chain/validation/executionPayloadBid.js +166 -12
  173. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  174. package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
  175. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  176. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  177. package/lib/chain/validation/payloadAttestationMessage.js +5 -14
  178. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  179. package/lib/chain/validation/proposerPreferences.js +2 -2
  180. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  181. package/lib/chain/validation/proposerSlashing.js +1 -1
  182. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  183. package/lib/chain/validation/voluntaryExit.d.ts +9 -1
  184. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  185. package/lib/chain/validation/voluntaryExit.js +46 -1
  186. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  187. package/lib/execution/builder/apiClient.d.ts +70 -0
  188. package/lib/execution/builder/apiClient.d.ts.map +1 -0
  189. package/lib/execution/builder/apiClient.js +202 -0
  190. package/lib/execution/builder/apiClient.js.map +1 -0
  191. package/lib/execution/builder/validateBid.d.ts +23 -0
  192. package/lib/execution/builder/validateBid.d.ts.map +1 -0
  193. package/lib/execution/builder/validateBid.js +119 -0
  194. package/lib/execution/builder/validateBid.js.map +1 -0
  195. package/lib/metrics/metrics/lodestar.d.ts +84 -23
  196. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  197. package/lib/metrics/metrics/lodestar.js +161 -55
  198. package/lib/metrics/metrics/lodestar.js.map +1 -1
  199. package/lib/network/gossip/topic.d.ts +13 -0
  200. package/lib/network/gossip/topic.d.ts.map +1 -1
  201. package/lib/network/gossip/topic.js +37 -0
  202. package/lib/network/gossip/topic.js.map +1 -1
  203. package/lib/network/network.d.ts.map +1 -1
  204. package/lib/network/network.js +23 -43
  205. package/lib/network/network.js.map +1 -1
  206. package/lib/network/processor/constants.d.ts +7 -0
  207. package/lib/network/processor/constants.d.ts.map +1 -0
  208. package/lib/network/processor/constants.js +7 -0
  209. package/lib/network/processor/constants.js.map +1 -0
  210. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  211. package/lib/network/processor/gossipHandlers.js +6 -2
  212. package/lib/network/processor/gossipHandlers.js.map +1 -1
  213. package/lib/network/processor/gossipQueues/indexed.d.ts.map +1 -1
  214. package/lib/network/processor/gossipQueues/indexed.js +0 -1
  215. package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
  216. package/lib/network/processor/index.d.ts +3 -0
  217. package/lib/network/processor/index.d.ts.map +1 -1
  218. package/lib/network/processor/index.js +52 -23
  219. package/lib/network/processor/index.js.map +1 -1
  220. package/lib/network/reqresp/score.d.ts.map +1 -1
  221. package/lib/network/reqresp/score.js +5 -11
  222. package/lib/network/reqresp/score.js.map +1 -1
  223. package/lib/network/util.d.ts +0 -1
  224. package/lib/network/util.d.ts.map +1 -1
  225. package/lib/network/util.js +0 -4
  226. package/lib/network/util.js.map +1 -1
  227. package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
  228. package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
  229. package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
  230. package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
  231. package/lib/node/nodejs.d.ts +2 -1
  232. package/lib/node/nodejs.d.ts.map +1 -1
  233. package/lib/node/nodejs.js +7 -0
  234. package/lib/node/nodejs.js.map +1 -1
  235. package/lib/sync/range/batch.d.ts +23 -5
  236. package/lib/sync/range/batch.d.ts.map +1 -1
  237. package/lib/sync/range/batch.js +61 -22
  238. package/lib/sync/range/batch.js.map +1 -1
  239. package/lib/sync/range/chain.d.ts +2 -1
  240. package/lib/sync/range/chain.d.ts.map +1 -1
  241. package/lib/sync/range/chain.js +32 -12
  242. package/lib/sync/range/chain.js.map +1 -1
  243. package/lib/sync/range/range.js +1 -1
  244. package/lib/sync/range/range.js.map +1 -1
  245. package/lib/sync/types.d.ts +32 -0
  246. package/lib/sync/types.d.ts.map +1 -1
  247. package/lib/sync/types.js +33 -0
  248. package/lib/sync/types.js.map +1 -1
  249. package/lib/sync/unknownBlock.d.ts +6 -2
  250. package/lib/sync/unknownBlock.d.ts.map +1 -1
  251. package/lib/sync/unknownBlock.js +143 -68
  252. package/lib/sync/unknownBlock.js.map +1 -1
  253. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  254. package/lib/sync/utils/downloadByRange.js +16 -11
  255. package/lib/sync/utils/downloadByRange.js.map +1 -1
  256. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  257. package/lib/sync/utils/downloadByRoot.js +3 -1
  258. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  259. package/package.json +35 -35
  260. package/src/api/impl/beacon/blocks/index.ts +51 -15
  261. package/src/api/impl/beacon/pool/index.ts +22 -2
  262. package/src/api/impl/beacon/state/utils.ts +2 -1
  263. package/src/api/impl/events/index.ts +3 -1
  264. package/src/api/impl/lodestar/index.ts +1 -1
  265. package/src/api/impl/validator/index.ts +290 -49
  266. package/src/api/impl/validator/utils.ts +1 -1
  267. package/src/api/rest/base.ts +7 -0
  268. package/src/chain/archiveStore/archiveStore.ts +1 -1
  269. package/src/chain/blocks/importExecutionPayload.ts +12 -11
  270. package/src/chain/blocks/index.ts +25 -13
  271. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
  272. package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
  273. package/src/chain/blocks/verifyBlock.ts +5 -2
  274. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
  275. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
  276. package/src/chain/bls/index.ts +1 -1
  277. package/src/chain/bls/interface.ts +7 -3
  278. package/src/chain/bls/multithread/index.ts +148 -120
  279. package/src/chain/bls/multithread/jobItem.ts +12 -82
  280. package/src/chain/bls/multithread/types.ts +33 -8
  281. package/src/chain/bls/multithread/utils.ts +11 -0
  282. package/src/chain/bls/multithread/worker.ts +85 -27
  283. package/src/chain/bls/singleThread.ts +11 -55
  284. package/src/chain/bls/utils.ts +23 -24
  285. package/src/chain/chain.ts +25 -7
  286. package/src/chain/errors/blockError.ts +8 -2
  287. package/src/chain/errors/executionPayloadBid.ts +6 -0
  288. package/src/chain/forkChoice/index.ts +4 -0
  289. package/src/chain/interface.ts +8 -3
  290. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  291. package/src/chain/opPools/attestationPool.ts +1 -1
  292. package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
  293. package/src/chain/opPools/executionPayloadBidPool.ts +13 -7
  294. package/src/chain/opPools/index.ts +2 -1
  295. package/src/chain/opPools/payloadAttestationPool.ts +3 -3
  296. package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
  297. package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
  298. package/src/chain/opPools/utils.ts +1 -1
  299. package/src/chain/prepareNextSlot.ts +49 -6
  300. package/src/chain/produceBlock/computeNewStateRoot.ts +3 -38
  301. package/src/chain/produceBlock/produceBlockBody.ts +1 -1
  302. package/src/chain/regen/interface.ts +5 -2
  303. package/src/chain/regen/queued.ts +5 -5
  304. package/src/chain/seenCache/seenAttesters.ts +31 -5
  305. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
  306. package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
  307. package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
  308. package/src/chain/stateCache/types.ts +3 -3
  309. package/src/chain/validation/attestation.ts +1 -7
  310. package/src/chain/validation/attesterSlashing.ts +1 -8
  311. package/src/chain/validation/block.ts +43 -10
  312. package/src/chain/validation/executionPayloadBid.ts +193 -14
  313. package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
  314. package/src/chain/validation/payloadAttestationMessage.ts +6 -17
  315. package/src/chain/validation/proposerPreferences.ts +3 -3
  316. package/src/chain/validation/proposerSlashing.ts +1 -1
  317. package/src/chain/validation/voluntaryExit.ts +59 -2
  318. package/src/execution/builder/apiClient.ts +264 -0
  319. package/src/execution/builder/validateBid.ts +181 -0
  320. package/src/metrics/metrics/lodestar.ts +176 -61
  321. package/src/network/gossip/topic.ts +38 -0
  322. package/src/network/network.ts +29 -54
  323. package/src/network/processor/constants.ts +6 -0
  324. package/src/network/processor/gossipHandlers.ts +6 -2
  325. package/src/network/processor/gossipQueues/indexed.ts +0 -1
  326. package/src/network/processor/index.ts +67 -30
  327. package/src/network/reqresp/score.ts +5 -11
  328. package/src/network/util.ts +0 -5
  329. package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
  330. package/src/node/nodejs.ts +10 -1
  331. package/src/sync/range/batch.ts +83 -28
  332. package/src/sync/range/chain.ts +35 -13
  333. package/src/sync/range/range.ts +1 -1
  334. package/src/sync/types.ts +33 -0
  335. package/src/sync/unknownBlock.ts +167 -73
  336. package/src/sync/utils/downloadByRange.ts +21 -12
  337. package/src/sync/utils/downloadByRoot.ts +3 -1
  338. package/lib/chain/bls/maybeBatch.d.ts +0 -12
  339. package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
  340. package/lib/chain/bls/maybeBatch.js +0 -35
  341. package/lib/chain/bls/maybeBatch.js.map +0 -1
  342. package/src/chain/bls/maybeBatch.ts +0 -45
@@ -17,3 +17,14 @@ export function chunkifyMaximizeChunkSize<T>(arr: T[], minPerChunk: number): T[]
17
17
 
18
18
  return arrArr;
19
19
  }
20
+
21
+ /**
22
+ * Splits an array into chunks that do not exceed a maximum size.
23
+ */
24
+ export function chunkifyMaxChunkSize<T>(arr: T[], maxPerChunk: number): T[][] {
25
+ const chunks: T[][] = [];
26
+ for (let i = 0; i < arr.length; i += maxPerChunk) {
27
+ chunks.push(arr.slice(i, i + maxPerChunk));
28
+ }
29
+ return chunks;
30
+ }
@@ -1,8 +1,20 @@
1
1
  import worker from "node:worker_threads";
2
- import {PublicKey} from "@chainsafe/blst";
2
+ import {
3
+ type BlsSignatureSet,
4
+ verifySignatureSets,
5
+ verifySignatureSetsSameMessage,
6
+ } from "@chainsafe/lodestar-z/bls-verifier";
3
7
  import {expose} from "@chainsafe/threads/worker";
4
- import {SignatureSetDeserialized, verifySignatureSetsMaybeBatch} from "../maybeBatch.js";
5
- import {BlsWorkReq, BlsWorkResult, SerializedSet, WorkResult, WorkResultCode, WorkerData} from "./types.js";
8
+ import {
9
+ BlsWorkReq,
10
+ BlsWorkResult,
11
+ JobQueueItemType,
12
+ VerificationCall,
13
+ VerificationCallOperation,
14
+ WorkResult,
15
+ WorkResultCode,
16
+ WorkerData,
17
+ } from "./types.js";
6
18
  import {chunkifyMaximizeChunkSize} from "./utils.js";
7
19
 
8
20
  /**
@@ -27,23 +39,45 @@ expose({
27
39
 
28
40
  function verifyManySignatureSets(workReqArr: BlsWorkReq[]): BlsWorkResult {
29
41
  const [startSec, startNs] = process.hrtime();
30
- const results: WorkResult<boolean>[] = [];
42
+ const results: WorkResult<boolean[]>[] = [];
43
+ const verificationCalls: VerificationCall[] = [];
31
44
  let batchRetries = 0;
32
45
  let batchSigsSuccess = 0;
33
46
 
34
47
  // If there are multiple batchable sets attempt batch verification with them
35
- const batchableSets: {idx: number; sets: SignatureSetDeserialized[]}[] = [];
36
- const nonBatchableSets: {idx: number; sets: SignatureSetDeserialized[]}[] = [];
48
+ const batchableSets: {idx: number; sets: BlsSignatureSet[]}[] = [];
49
+ const nonBatchableSets: {
50
+ idx: number;
51
+ sets: BlsSignatureSet[];
52
+ operation: VerificationCallOperation.single | VerificationCallOperation.fallback;
53
+ }[] = [];
37
54
 
38
55
  // Split sets between batchable and non-batchable preserving their original index in the req array
39
56
  for (let i = 0; i < workReqArr.length; i++) {
40
57
  const workReq = workReqArr[i];
41
- const sets = workReq.sets.map(deserializeSet);
42
-
43
- if (workReq.opts.batchable) {
44
- batchableSets.push({idx: i, sets});
45
- } else {
46
- nonBatchableSets.push({idx: i, sets});
58
+ switch (workReq.type) {
59
+ case JobQueueItemType.default: {
60
+ const {sets} = workReq;
61
+ if (workReq.opts.batchable) {
62
+ batchableSets.push({idx: i, sets});
63
+ } else {
64
+ nonBatchableSets.push({idx: i, sets, operation: VerificationCallOperation.single});
65
+ }
66
+ break;
67
+ }
68
+ case JobQueueItemType.sameMessage:
69
+ try {
70
+ const result = recordVerificationCall(
71
+ verificationCalls,
72
+ VerificationCallOperation.sameMessage,
73
+ workReq.sets.length,
74
+ () => verifySignatureSetsSameMessage(workReq.sets, workReq.message)
75
+ );
76
+ results[i] = {code: WorkResultCode.success, result};
77
+ } catch (e) {
78
+ results[i] = {code: WorkResultCode.error, error: e as Error};
79
+ }
80
+ break;
47
81
  }
48
82
  }
49
83
 
@@ -52,7 +86,7 @@ function verifyManySignatureSets(workReqArr: BlsWorkReq[]): BlsWorkResult {
52
86
  const batchableChunks = chunkifyMaximizeChunkSize(batchableSets, BATCHABLE_MIN_PER_CHUNK);
53
87
 
54
88
  for (const batchableChunk of batchableChunks) {
55
- const allSets: SignatureSetDeserialized[] = [];
89
+ const allSets: BlsSignatureSet[] = [];
56
90
  for (const {sets} of batchableChunk) {
57
91
  for (const set of sets) {
58
92
  allSets.push(set);
@@ -61,33 +95,49 @@ function verifyManySignatureSets(workReqArr: BlsWorkReq[]): BlsWorkResult {
61
95
 
62
96
  try {
63
97
  // Attempt to verify multiple sets at once
64
- const isValid = verifySignatureSetsMaybeBatch(allSets);
98
+ const isValid = recordVerificationCall(verificationCalls, VerificationCallOperation.batch, allSets.length, () =>
99
+ verifySignatureSets(allSets)
100
+ );
65
101
 
66
102
  if (isValid) {
67
103
  // The entire batch is valid, return success to all
68
104
  for (const {idx, sets} of batchableChunk) {
69
105
  batchSigsSuccess += sets.length;
70
- results[idx] = {code: WorkResultCode.success, result: isValid};
106
+ results[idx] = {code: WorkResultCode.success, result: [isValid]};
71
107
  }
72
108
  } else {
73
109
  batchRetries++;
74
110
  // Re-verify all sigs
75
- nonBatchableSets.push(...batchableChunk);
111
+ nonBatchableSets.push(
112
+ ...batchableChunk.map(({idx, sets}) => ({
113
+ idx,
114
+ sets,
115
+ operation: VerificationCallOperation.fallback as const,
116
+ }))
117
+ );
76
118
  }
77
119
  } catch (_e) {
78
120
  // TODO: Ignore this error expecting that the same error will happen when re-verifying the set individually
79
- // It's not ideal but '@chainsafe/blst' may throw errors on some conditions
121
+ // It's not ideal but the BLS implementation may throw errors on some conditions
80
122
  batchRetries++;
81
123
  // Re-verify all sigs
82
- nonBatchableSets.push(...batchableChunk);
124
+ nonBatchableSets.push(
125
+ ...batchableChunk.map(({idx, sets}) => ({
126
+ idx,
127
+ sets,
128
+ operation: VerificationCallOperation.fallback as const,
129
+ }))
130
+ );
83
131
  }
84
132
  }
85
133
  }
86
134
 
87
- for (const {idx, sets} of nonBatchableSets) {
135
+ for (const {idx, sets, operation} of nonBatchableSets) {
88
136
  try {
89
- const isValid = verifySignatureSetsMaybeBatch(sets);
90
- results[idx] = {code: WorkResultCode.success, result: isValid};
137
+ const isValid = recordVerificationCall(verificationCalls, operation, sets.length, () =>
138
+ verifySignatureSets(sets)
139
+ );
140
+ results[idx] = {code: WorkResultCode.success, result: [isValid]};
91
141
  } catch (e) {
92
142
  results[idx] = {code: WorkResultCode.error, error: e as Error};
93
143
  }
@@ -99,16 +149,24 @@ function verifyManySignatureSets(workReqArr: BlsWorkReq[]): BlsWorkResult {
99
149
  workerId,
100
150
  batchRetries,
101
151
  batchSigsSuccess,
152
+ verificationCalls,
102
153
  workerStartTime: [startSec, startNs],
103
154
  workerEndTime: [workerEndSec, workerEndNs],
104
155
  results,
105
156
  };
106
157
  }
107
158
 
108
- function deserializeSet(set: SerializedSet): SignatureSetDeserialized {
109
- return {
110
- publicKey: PublicKey.fromBytes(set.publicKey),
111
- message: set.message,
112
- signature: set.signature,
113
- };
159
+ function recordVerificationCall<T>(
160
+ calls: VerificationCall[],
161
+ operation: VerificationCallOperation,
162
+ signatureSets: number,
163
+ verify: () => T
164
+ ): T {
165
+ const startTime = process.hrtime();
166
+ try {
167
+ return verify();
168
+ } finally {
169
+ const [seconds, nanoseconds] = process.hrtime(startTime);
170
+ calls.push({operation, signatureSets, duration: seconds + nanoseconds / 1e9});
171
+ }
114
172
  }
@@ -1,31 +1,20 @@
1
- import {PublicKey, Signature, aggregatePublicKeys, aggregateSignatures, verify} from "@chainsafe/blst";
2
- import {ISignatureSet, PubkeyCache} from "@lodestar/state-transition";
1
+ import {verifySignatureSetsSameMessage} from "@chainsafe/lodestar-z/bls-verifier";
2
+ import {ISignatureSet} from "@lodestar/state-transition";
3
3
  import {Metrics} from "../../metrics/index.js";
4
- import {IBlsVerifier} from "./interface.js";
5
- import {verifySignatureSetsMaybeBatch} from "./maybeBatch.js";
6
- import {getAggregatedPubkey, getAggregatedPubkeysCount} from "./utils.js";
4
+ import {IBlsVerifier, SameMessageSignatureSet} from "./interface.js";
5
+ import {chunkSameMessageSignatureSets, getAggregatedPubkeysCount, verifySignatureSetsInBatches} from "./utils.js";
7
6
 
8
7
  export class BlsSingleThreadVerifier implements IBlsVerifier {
9
8
  private readonly metrics: Metrics | null;
10
- private readonly pubkeyCache: PubkeyCache;
11
-
12
- constructor({metrics = null, pubkeyCache}: {metrics: Metrics | null; pubkeyCache: PubkeyCache}) {
9
+ constructor({metrics = null}: {metrics: Metrics | null}) {
13
10
  this.metrics = metrics;
14
- this.pubkeyCache = pubkeyCache;
15
11
  }
16
12
 
17
13
  async verifySignatureSets(sets: ISignatureSet[]): Promise<boolean> {
18
14
  this.metrics?.bls.aggregatedPubkeys.inc(getAggregatedPubkeysCount(sets));
19
15
 
20
- const setsAggregated = sets.map((set) => ({
21
- publicKey: getAggregatedPubkey(set, this.pubkeyCache, this.metrics),
22
- message: set.signingRoot,
23
- signature: set.signature,
24
- }));
25
-
26
- // Count time after aggregating
27
16
  const timer = this.metrics?.blsThreadPool.mainThreadDurationInThreadPool.startTimer();
28
- const isValid = verifySignatureSetsMaybeBatch(setsAggregated);
17
+ const isValid = verifySignatureSetsInBatches(sets);
29
18
 
30
19
  // Don't use a try/catch, only count run without exceptions
31
20
  if (timer) {
@@ -35,46 +24,13 @@ export class BlsSingleThreadVerifier implements IBlsVerifier {
35
24
  return isValid;
36
25
  }
37
26
 
38
- async verifySignatureSetsSameMessage(
39
- sets: {publicKey: PublicKey; signature: Uint8Array}[],
40
- message: Uint8Array
41
- ): Promise<boolean[]> {
27
+ async verifySignatureSetsSameMessage(sets: SameMessageSignatureSet[], message: Uint8Array): Promise<boolean[]> {
42
28
  const timer = this.metrics?.blsThreadPool.mainThreadDurationInThreadPool.startTimer();
43
- const pubkey = aggregatePublicKeys(sets.map((set) => set.publicKey));
44
- let isAllValid = true;
45
- // validate signature = true
46
- const signatures = sets.map((set) => {
47
- try {
48
- return Signature.fromBytes(set.signature, true);
49
- } catch (_) {
50
- // at least one set has malformed signature
51
- isAllValid = false;
52
- return null;
53
- }
54
- });
55
-
56
- if (isAllValid) {
57
- const signature = aggregateSignatures(signatures as Signature[]);
58
- isAllValid = verify(message, pubkey, signature);
59
- }
60
-
61
- let result: boolean[];
62
- if (isAllValid) {
63
- result = sets.map(() => true);
64
- } else {
65
- result = sets.map((set, i) => {
66
- const sig = signatures[i];
67
- if (sig === null) {
68
- return false;
69
- }
70
- return verify(message, set.publicKey, sig);
71
- });
29
+ const result: boolean[] = [];
30
+ for (const setsChunk of chunkSameMessageSignatureSets(sets)) {
31
+ result.push(...verifySignatureSetsSameMessage(setsChunk, message));
72
32
  }
73
-
74
- if (timer) {
75
- timer();
76
- }
77
-
33
+ timer?.();
78
34
  return result;
79
35
  }
80
36
 
@@ -1,33 +1,32 @@
1
- import {PublicKey, aggregatePublicKeys} from "@chainsafe/blst";
2
- import {ISignatureSet, PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
3
- import {Metrics} from "../../metrics/metrics.js";
1
+ import {
2
+ BLS_VERIFIER_MAX_BATCH_SIZE,
3
+ BLS_VERIFIER_MAX_SAME_MESSAGE_BATCH_SIZE,
4
+ verifySignatureSets,
5
+ } from "@chainsafe/lodestar-z/bls-verifier";
6
+ import {ISignatureSet, SignatureSetType, toBlsSignatureSet} from "@lodestar/state-transition";
7
+ import {SameMessageSignatureSet} from "./interface.js";
4
8
 
5
- export function getAggregatedPubkey(
6
- signatureSet: ISignatureSet,
7
- pubkeyCache: PubkeyCache,
8
- metrics: Metrics | null = null
9
- ): PublicKey {
10
- switch (signatureSet.type) {
11
- case SignatureSetType.single:
12
- return signatureSet.pubkey;
9
+ export function verifySignatureSetsInBatches(signatureSets: ISignatureSet[]): boolean {
10
+ if (signatureSets.length === 0) {
11
+ return false;
12
+ }
13
13
 
14
- case SignatureSetType.indexed: {
15
- return pubkeyCache.getOrThrow(signatureSet.index);
14
+ for (let start = 0; start < signatureSets.length; start += BLS_VERIFIER_MAX_BATCH_SIZE) {
15
+ const sets = signatureSets.slice(start, start + BLS_VERIFIER_MAX_BATCH_SIZE).map(toBlsSignatureSet);
16
+ if (!verifySignatureSets(sets)) {
17
+ return false;
16
18
  }
19
+ }
17
20
 
18
- case SignatureSetType.aggregate: {
19
- const timer = metrics?.blsThreadPool.pubkeysAggregationMainThreadDuration.startTimer();
20
- const pubkeys = signatureSet.indices.map((i) => {
21
- return pubkeyCache.getOrThrow(i);
22
- });
23
- const aggregated = aggregatePublicKeys(pubkeys);
24
- timer?.();
25
- return aggregated;
26
- }
21
+ return true;
22
+ }
27
23
 
28
- default:
29
- throw Error("Unknown signature set type");
24
+ export function chunkSameMessageSignatureSets(sets: SameMessageSignatureSet[]): SameMessageSignatureSet[][] {
25
+ const chunks: SameMessageSignatureSet[][] = [];
26
+ for (let start = 0; start < sets.length; start += BLS_VERIFIER_MAX_SAME_MESSAGE_BATCH_SIZE) {
27
+ chunks.push(sets.slice(start, start + BLS_VERIFIER_MAX_SAME_MESSAGE_BATCH_SIZE));
30
28
  }
29
+ return chunks;
31
30
  }
32
31
 
33
32
  export function getAggregatedPubkeysCount(signatureSets: ISignatureSet[]): number {
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import {PrivateKey} from "@libp2p/interface";
3
+ import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
3
4
  import {Type} from "@chainsafe/ssz";
4
5
  import {routes} from "@lodestar/api";
5
6
  import {BeaconConfig} from "@lodestar/config";
@@ -25,7 +26,6 @@ import {
25
26
  EffectiveBalanceIncrements,
26
27
  EpochShuffling,
27
28
  IBeaconStateView,
28
- PubkeyCache,
29
29
  computeEndSlotAtEpoch,
30
30
  computeEpochAtSlot,
31
31
  computeStartSlotAtEpoch,
@@ -61,6 +61,7 @@ import {ProcessShutdownCallback} from "@lodestar/validator";
61
61
  import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
62
62
  import {IBeaconDb} from "../db/index.js";
63
63
  import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../db/repositories/blobSidecars.js";
64
+ import {BuilderApiClient, BuilderApiClientOpts} from "../execution/builder/apiClient.js";
64
65
  import {BuilderStatus} from "../execution/builder/http.js";
65
66
  import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
66
67
  import {Metrics} from "../metrics/index.js";
@@ -79,6 +80,7 @@ import {CheckpointBalancesCache} from "./balancesCache.js";
79
80
  import {BeaconProposerCache} from "./beaconProposerCache.js";
80
81
  import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
81
82
  import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
83
+ import {PayloadEnvelopeInputSource} from "./blocks/payloadEnvelopeInput/index.js";
82
84
  import {PayloadEnvelopeProcessor} from "./blocks/payloadEnvelopeProcessor.js";
83
85
  import {ImportPayloadOpts} from "./blocks/types.js";
84
86
  import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
@@ -94,6 +96,7 @@ import {LightClientServer} from "./lightClient/index.js";
94
96
  import {
95
97
  AggregatedAttestationPool,
96
98
  AttestationPool,
99
+ DeferredVoluntaryExitPool,
97
100
  ExecutionPayloadBidPool,
98
101
  OpPool,
99
102
  PayloadAttestationPool,
@@ -163,6 +166,7 @@ export class BeaconChain implements IBeaconChain {
163
166
  readonly executionEngine: IExecutionEngine;
164
167
  readonly executionBuilder?: IExecutionBuilder;
165
168
  readonly builderCircuitBreaker: BuilderCircuitBreaker;
169
+ readonly builderApiClient: BuilderApiClient;
166
170
  // Expose config for convenience in modularized functions
167
171
  readonly config: BeaconConfig;
168
172
  readonly custodyConfig: CustodyConfig;
@@ -193,6 +197,7 @@ export class BeaconChain implements IBeaconChain {
193
197
  readonly payloadAttestationPool: PayloadAttestationPool;
194
198
  readonly proposerPreferencesPool = new ProposerPreferencesPool();
195
199
  readonly opPool: OpPool;
200
+ readonly deferredVoluntaryExitPool: DeferredVoluntaryExitPool;
196
201
 
197
202
  // Gossip seen cache
198
203
  readonly seenAttesters = new SeenAttesters();
@@ -272,6 +277,7 @@ export class BeaconChain implements IBeaconChain {
272
277
  isAnchorStateFinalized,
273
278
  executionEngine,
274
279
  executionBuilder,
280
+ builderApiClientOpts,
275
281
  }: {
276
282
  privateKey: PrivateKey;
277
283
  config: BeaconConfig;
@@ -289,6 +295,7 @@ export class BeaconChain implements IBeaconChain {
289
295
  isAnchorStateFinalized: boolean;
290
296
  executionEngine: IExecutionEngine;
291
297
  executionBuilder?: IExecutionBuilder;
298
+ builderApiClientOpts?: BuilderApiClientOpts;
292
299
  }
293
300
  ) {
294
301
  this.opts = opts;
@@ -307,8 +314,8 @@ export class BeaconChain implements IBeaconChain {
307
314
  const emitter = new ChainEventEmitter();
308
315
  // by default, verify signatures on both main threads and worker threads
309
316
  const bls = opts.blsVerifyAllMainThread
310
- ? new BlsSingleThreadVerifier({metrics, pubkeyCache})
311
- : new BlsMultiThreadWorkerPool(opts, {logger, metrics, pubkeyCache});
317
+ ? new BlsSingleThreadVerifier({metrics})
318
+ : new BlsMultiThreadWorkerPool(opts, {logger, metrics});
312
319
 
313
320
  if (!clock) clock = new Clock({config, genesisTime: this.genesisTime, signal});
314
321
 
@@ -320,6 +327,7 @@ export class BeaconChain implements IBeaconChain {
320
327
  this.executionPayloadBidPool = new ExecutionPayloadBidPool();
321
328
  this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
322
329
  this.opPool = new OpPool(config);
330
+ this.deferredVoluntaryExitPool = new DeferredVoluntaryExitPool(logger);
323
331
 
324
332
  this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
325
333
  this.seenContributionAndProof = new SeenContributionAndProof(metrics);
@@ -444,6 +452,8 @@ export class BeaconChain implements IBeaconChain {
444
452
  {forkChoice, logger, metrics}
445
453
  );
446
454
 
455
+ this.builderApiClient = new BuilderApiClient(builderApiClientOpts ?? {}, config, clock, bls, metrics, logger);
456
+
447
457
  this.seenPayloadEnvelopeInputCache = new SeenPayloadEnvelopeInput({
448
458
  config,
449
459
  clock,
@@ -451,6 +461,9 @@ export class BeaconChain implements IBeaconChain {
451
461
  chainEvents: emitter,
452
462
  signal,
453
463
  serializedCache: this.serializedCache,
464
+ db,
465
+ seenBlockInputCache: this.seenBlockInputCache,
466
+ custodyConfig: this.custodyConfig,
454
467
  metrics,
455
468
  logger,
456
469
  });
@@ -466,7 +479,8 @@ export class BeaconChain implements IBeaconChain {
466
479
  bid: anchorBid,
467
480
  sampledColumns: this.custodyConfig.sampledColumns,
468
481
  custodyColumns: this.custodyConfig.custodyColumns,
469
- timeCreatedSec: Math.floor(Date.now() / 1000),
482
+ seenTimestampSec: Date.now() / 1000,
483
+ source: PayloadEnvelopeInputSource.anchorState,
470
484
  });
471
485
  }
472
486
 
@@ -579,7 +593,7 @@ export class BeaconChain implements IBeaconChain {
579
593
  // seenAggregators = single aggregator index, not participants of the aggregate
580
594
  this.seenAggregators.isKnown(epoch, index) ||
581
595
  // seenPayloadAttesters = single signer of payload attestation message
582
- this.seenPayloadAttesters.isKnown(epoch, index) ||
596
+ this.seenPayloadAttesters.seenAtEpoch(epoch, index) ||
583
597
  // seenBlockProposers = single block proposer
584
598
  this.seenBlockProposers.seenAtEpoch(epoch, index)
585
599
  );
@@ -1090,7 +1104,7 @@ export class BeaconChain implements IBeaconChain {
1090
1104
  RegenCaller.produceBlock
1091
1105
  );
1092
1106
  const proposerIndex = state.getBeaconProposer(slot);
1093
- const proposerPubKey = this.pubkeyCache.getOrThrow(proposerIndex).toBytes();
1107
+ const proposerPubKey = this.pubkeyCache.getPubkeyBytesOrThrow(proposerIndex);
1094
1108
 
1095
1109
  const {body, produceResult, executionPayloadValue, shouldOverrideBuilder} = await produceBlockBody.call(
1096
1110
  this,
@@ -1313,9 +1327,10 @@ export class BeaconChain implements IBeaconChain {
1313
1327
  }
1314
1328
  }
1315
1329
 
1316
- predictProposerHead(slot: Slot): ProtoBlock {
1330
+ predictProposerHead(): ProtoBlock {
1317
1331
  this.metrics?.forkChoice.requests.inc();
1318
1332
  const timer = this.metrics?.forkChoice.findHead.startTimer({caller: FindHeadFnName.predictProposerHead});
1333
+ const slot = this.clock.currentSlot;
1319
1334
  const secFromSlot = this.clock.secFromSlot(slot);
1320
1335
 
1321
1336
  try {
@@ -1569,6 +1584,7 @@ export class BeaconChain implements IBeaconChain {
1569
1584
  // aggregatedAttestationPool tracks metrics on its own
1570
1585
  metrics.opPool.attestationPool.size.set(this.attestationPool.getAttestationCount());
1571
1586
  metrics.opPool.attesterSlashingPoolSize.set(this.opPool.attesterSlashingsSize);
1587
+ metrics.opPool.deferredVoluntaryExitPool.size.set(this.deferredVoluntaryExitPool.size());
1572
1588
  metrics.opPool.proposerSlashingPoolSize.set(this.opPool.proposerSlashingsSize);
1573
1589
  metrics.opPool.voluntaryExitPoolSize.set(this.opPool.voluntaryExitsSize);
1574
1590
  metrics.opPool.syncCommitteeMessagePoolSize.set(this.syncCommitteeMessagePool.size);
@@ -1577,6 +1593,8 @@ export class BeaconChain implements IBeaconChain {
1577
1593
  // syncContributionAndProofPool tracks metrics on its own
1578
1594
  metrics.opPool.blsToExecutionChangePoolSize.set(this.opPool.blsToExecutionChangeSize);
1579
1595
  metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
1596
+ metrics.bls.pubkeyCacheSize.set(this.pubkeyCache.size);
1597
+ metrics.bls.pubkeyCacheCapacity.set(this.pubkeyCache.capacity);
1580
1598
 
1581
1599
  const headState = this.getHeadState();
1582
1600
  if (isStatePostElectra(headState)) {
@@ -136,7 +136,7 @@ export type BlockErrorType =
136
136
  | {code: BlockErrorCode.NON_LINEAR_PARENT_ROOTS}
137
137
  | {code: BlockErrorCode.NON_LINEAR_SLOTS}
138
138
  | {code: BlockErrorCode.ENVELOPE_BLOCK_ROOT_MISMATCH; envelopeBlockRoot: RootHex; blockRoot: RootHex}
139
- | {code: BlockErrorCode.PER_BLOCK_PROCESSING_ERROR; error: Error}
139
+ | {code: BlockErrorCode.PER_BLOCK_PROCESSING_ERROR; blockRoot: RootHex; error: Error}
140
140
  | {code: BlockErrorCode.BEACON_CHAIN_ERROR; error: Error}
141
141
  | {code: BlockErrorCode.KNOWN_BAD_BLOCK}
142
142
  | {code: BlockErrorCode.BLACKLISTED_BLOCK}
@@ -184,13 +184,19 @@ export function isBlockErrorAborted(e: unknown): e is BlockError {
184
184
  export function renderBlockErrorType(type: BlockErrorType): Record<string, string | number | null> {
185
185
  switch (type.code) {
186
186
  case BlockErrorCode.PRESTATE_MISSING:
187
- case BlockErrorCode.PER_BLOCK_PROCESSING_ERROR:
188
187
  case BlockErrorCode.BEACON_CHAIN_ERROR:
189
188
  return {
190
189
  code: type.code,
191
190
  error: type.error.message,
192
191
  };
193
192
 
193
+ case BlockErrorCode.PER_BLOCK_PROCESSING_ERROR:
194
+ return {
195
+ code: type.code,
196
+ blockRoot: type.blockRoot,
197
+ error: type.error.message,
198
+ };
199
+
194
200
  case BlockErrorCode.INVALID_SIGNATURE:
195
201
  return {
196
202
  code: type.code,
@@ -9,6 +9,7 @@ export enum ExecutionPayloadBidErrorCode {
9
9
  BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
10
10
  BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
11
11
  BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
12
+ BUILDER_MAY_EXIT = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_MAY_EXIT",
12
13
  TOO_MANY_KZG_COMMITMENTS = "EXECUTION_PAYLOAD_BID_ERROR_TOO_MANY_KZG_COMMITMENTS",
13
14
  UNKNOWN_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_BLOCK_ROOT",
14
15
  UNKNOWN_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_PARENT_BLOCK_HASH",
@@ -50,6 +51,11 @@ export type ExecutionPayloadBidErrorType =
50
51
  }
51
52
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
52
53
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}
54
+ | {
55
+ code: ExecutionPayloadBidErrorCode.BUILDER_MAY_EXIT;
56
+ builderIndex: BuilderIndex;
57
+ parentBlockRoot: RootHex;
58
+ }
53
59
  | {
54
60
  code: ExecutionPayloadBidErrorCode.TOO_MANY_KZG_COMMITMENTS;
55
61
  blobKzgCommitmentsLen: number;
@@ -134,6 +134,8 @@ export function initializeForkChoiceFromFinalizedState(
134
134
  stateRoot: toRootHex(blockHeader.stateRoot),
135
135
  blockRoot: toRootHex(checkpoint.root),
136
136
  timeliness: true, // Optimistically assume is timely
137
+ ptcTimeliness: true, // Spec: block_timeliness for anchor = [True, True]
138
+ proposerIndex: blockHeader.proposerIndex,
137
139
 
138
140
  justifiedEpoch: justifiedCheckpoint.epoch,
139
141
  justifiedRoot: toRootHex(justifiedCheckpoint.root),
@@ -230,6 +232,8 @@ export function initializeForkChoiceFromUnfinalizedState(
230
232
  blockRoot: headRoot,
231
233
  targetRoot: headRoot,
232
234
  timeliness: true, // Optimistically assume is timely
235
+ ptcTimeliness: true, // Spec: block_timeliness for anchor = [True, True]
236
+ proposerIndex: blockHeader.proposerIndex,
233
237
 
234
238
  justifiedEpoch: justifiedCheckpoint.epoch,
235
239
  justifiedRoot: toRootHex(justifiedCheckpoint.root),
@@ -1,7 +1,8 @@
1
+ import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
1
2
  import {Type} from "@chainsafe/ssz";
2
3
  import {BeaconConfig} from "@lodestar/config";
3
4
  import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
4
- import {EpochShuffling, IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
5
+ import {EpochShuffling, IBeaconStateView} from "@lodestar/state-transition";
5
6
  import {
6
7
  BeaconBlock,
7
8
  BlindedBeaconBlock,
@@ -23,6 +24,7 @@ import {
23
24
  rewards,
24
25
  } from "@lodestar/types";
25
26
  import {Logger} from "@lodestar/utils";
27
+ import {BuilderApiClient} from "../execution/builder/apiClient.js";
26
28
  import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
27
29
  import {Metrics} from "../metrics/metrics.js";
28
30
  import {BufferPool} from "../util/bufferPool.js";
@@ -44,6 +46,7 @@ import {LightClientServer} from "./lightClient/index.js";
44
46
  import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js";
45
47
  import {
46
48
  AttestationPool,
49
+ DeferredVoluntaryExitPool,
47
50
  ExecutionPayloadBidPool,
48
51
  OpPool,
49
52
  PayloadAttestationPool,
@@ -97,6 +100,7 @@ export interface IBeaconChain {
97
100
  readonly executionEngine: IExecutionEngine;
98
101
  readonly executionBuilder?: IExecutionBuilder;
99
102
  readonly builderCircuitBreaker: BuilderCircuitBreaker;
103
+ readonly builderApiClient: BuilderApiClient;
100
104
  // Expose config for convenience in modularized functions
101
105
  readonly config: BeaconConfig;
102
106
  readonly custodyConfig: CustodyConfig;
@@ -127,6 +131,7 @@ export interface IBeaconChain {
127
131
  readonly payloadAttestationPool: PayloadAttestationPool;
128
132
  readonly proposerPreferencesPool: ProposerPreferencesPool;
129
133
  readonly opPool: OpPool;
134
+ readonly deferredVoluntaryExitPool: DeferredVoluntaryExitPool;
130
135
 
131
136
  // Gossip seen cache
132
137
  readonly seenAttesters: SeenAttesters;
@@ -269,8 +274,8 @@ export interface IBeaconChain {
269
274
 
270
275
  recomputeForkChoiceHead(caller: ForkchoiceCaller): ProtoBlock;
271
276
 
272
- /** When proposerBoostReorg is enabled, this is called at slot n-1 to predict the head block to build on if we are proposing at slot n */
273
- predictProposerHead(slot: Slot): ProtoBlock;
277
+ /** When proposerBoostReorg is enabled, predict (as of the current slot) the head block a proposer would build on next slot */
278
+ predictProposerHead(): ProtoBlock;
274
279
 
275
280
  /** When proposerBoostReorg is enabled and we are proposing a block, this is called to determine which head block to build on */
276
281
  getProposerHead(slot: Slot): ProtoBlock;
@@ -1,4 +1,4 @@
1
- import {Signature, aggregateSignatures} from "@chainsafe/blst";
1
+ import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
2
2
  import {BitArray} from "@chainsafe/ssz";
3
3
  import {BeaconConfig} from "@lodestar/config";
4
4
  import {IForkChoice} from "@lodestar/fork-choice";
@@ -1,4 +1,4 @@
1
- import {Signature, aggregateSignatures} from "@chainsafe/blst";
1
+ import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
2
2
  import {BitArray} from "@chainsafe/ssz";
3
3
  import {ChainForkConfig} from "@lodestar/config";
4
4
  import {MAX_COMMITTEES_PER_SLOT, isForkPostElectra} from "@lodestar/params";