@lodestar/beacon-node 1.47.0-dev.cec7fd63e3 → 1.47.0-dev.d79d81f994

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 (345) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +47 -18
  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.js +1 -1
  15. package/lib/api/impl/lodestar/index.js.map +1 -1
  16. package/lib/api/impl/validator/index.d.ts.map +1 -1
  17. package/lib/api/impl/validator/index.js +232 -49
  18. package/lib/api/impl/validator/index.js.map +1 -1
  19. package/lib/api/impl/validator/utils.js +1 -1
  20. package/lib/api/impl/validator/utils.js.map +1 -1
  21. package/lib/api/rest/base.d.ts.map +1 -1
  22. package/lib/api/rest/base.js +7 -0
  23. package/lib/api/rest/base.js.map +1 -1
  24. package/lib/chain/archiveStore/archiveStore.js +1 -1
  25. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  26. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  27. package/lib/chain/archiveStore/historicalState/metrics.js +21 -0
  28. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  29. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  30. package/lib/chain/blocks/importBlock.js +2 -7
  31. package/lib/chain/blocks/importBlock.js.map +1 -1
  32. package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
  33. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  34. package/lib/chain/blocks/importExecutionPayload.js +11 -9
  35. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  36. package/lib/chain/blocks/index.d.ts.map +1 -1
  37. package/lib/chain/blocks/index.js +14 -6
  38. package/lib/chain/blocks/index.js.map +1 -1
  39. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
  40. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  41. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
  42. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  43. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
  44. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  45. package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
  46. package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
  47. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
  49. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  50. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
  51. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
  52. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  53. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  54. package/lib/chain/bls/index.d.ts +1 -1
  55. package/lib/chain/bls/index.d.ts.map +1 -1
  56. package/lib/chain/bls/interface.d.ts +5 -5
  57. package/lib/chain/bls/interface.d.ts.map +1 -1
  58. package/lib/chain/bls/multithread/index.d.ts +5 -11
  59. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  60. package/lib/chain/bls/multithread/index.js +116 -101
  61. package/lib/chain/bls/multithread/index.js.map +1 -1
  62. package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
  63. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  64. package/lib/chain/bls/multithread/jobItem.js +10 -65
  65. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  66. package/lib/chain/bls/multithread/types.d.ts +29 -8
  67. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  68. package/lib/chain/bls/multithread/types.js +12 -0
  69. package/lib/chain/bls/multithread/types.js.map +1 -1
  70. package/lib/chain/bls/multithread/utils.d.ts +4 -0
  71. package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
  72. package/lib/chain/bls/multithread/utils.js +10 -0
  73. package/lib/chain/bls/multithread/utils.js.map +1 -1
  74. package/lib/chain/bls/multithread/worker.js +49 -23
  75. package/lib/chain/bls/multithread/worker.js.map +1 -1
  76. package/lib/chain/bls/singleThread.d.ts +4 -10
  77. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  78. package/lib/chain/bls/singleThread.js +8 -45
  79. package/lib/chain/bls/singleThread.js.map +1 -1
  80. package/lib/chain/bls/utils.d.ts +4 -4
  81. package/lib/chain/bls/utils.d.ts.map +1 -1
  82. package/lib/chain/bls/utils.js +18 -19
  83. package/lib/chain/bls/utils.js.map +1 -1
  84. package/lib/chain/chain.d.ts +9 -4
  85. package/lib/chain/chain.d.ts.map +1 -1
  86. package/lib/chain/chain.js +22 -8
  87. package/lib/chain/chain.js.map +1 -1
  88. package/lib/chain/errors/blockError.d.ts +1 -0
  89. package/lib/chain/errors/blockError.d.ts.map +1 -1
  90. package/lib/chain/errors/blockError.js +6 -1
  91. package/lib/chain/errors/blockError.js.map +1 -1
  92. package/lib/chain/errors/proposerPreferences.d.ts +6 -0
  93. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
  94. package/lib/chain/errors/proposerPreferences.js +1 -0
  95. package/lib/chain/errors/proposerPreferences.js.map +1 -1
  96. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  97. package/lib/chain/forkChoice/index.js +4 -0
  98. package/lib/chain/forkChoice/index.js.map +1 -1
  99. package/lib/chain/interface.d.ts +8 -4
  100. package/lib/chain/interface.d.ts.map +1 -1
  101. package/lib/chain/interface.js.map +1 -1
  102. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  103. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  104. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  105. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  106. package/lib/chain/opPools/attestationPool.js +1 -1
  107. package/lib/chain/opPools/attestationPool.js.map +1 -1
  108. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
  109. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
  110. package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
  111. package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
  112. package/lib/chain/opPools/executionPayloadBidPool.d.ts +7 -2
  113. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
  114. package/lib/chain/opPools/executionPayloadBidPool.js +4 -4
  115. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
  116. package/lib/chain/opPools/index.d.ts +2 -1
  117. package/lib/chain/opPools/index.d.ts.map +1 -1
  118. package/lib/chain/opPools/index.js +1 -0
  119. package/lib/chain/opPools/index.js.map +1 -1
  120. package/lib/chain/opPools/payloadAttestationPool.js +3 -3
  121. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  122. package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
  123. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  124. package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
  125. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  126. package/lib/chain/opPools/utils.d.ts +1 -1
  127. package/lib/chain/opPools/utils.d.ts.map +1 -1
  128. package/lib/chain/opPools/utils.js +1 -1
  129. package/lib/chain/opPools/utils.js.map +1 -1
  130. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  131. package/lib/chain/prepareNextSlot.js +24 -6
  132. package/lib/chain/prepareNextSlot.js.map +1 -1
  133. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  134. package/lib/chain/produceBlock/computeNewStateRoot.js +3 -25
  135. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  136. package/lib/chain/produceBlock/produceBlockBody.js +1 -1
  137. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  138. package/lib/chain/regen/interface.d.ts +5 -2
  139. package/lib/chain/regen/interface.d.ts.map +1 -1
  140. package/lib/chain/regen/interface.js +3 -0
  141. package/lib/chain/regen/interface.js.map +1 -1
  142. package/lib/chain/regen/queued.d.ts +2 -2
  143. package/lib/chain/regen/queued.d.ts.map +1 -1
  144. package/lib/chain/regen/queued.js +5 -5
  145. package/lib/chain/regen/queued.js.map +1 -1
  146. package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
  147. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  148. package/lib/chain/seenCache/seenAttesters.js +25 -4
  149. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  150. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
  151. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  152. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
  153. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  154. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
  155. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  156. package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
  157. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  158. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
  159. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  160. package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
  161. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  162. package/lib/chain/stateCache/types.d.ts +3 -3
  163. package/lib/chain/stateCache/types.d.ts.map +1 -1
  164. package/lib/chain/validation/attestation.d.ts.map +1 -1
  165. package/lib/chain/validation/attestation.js +1 -4
  166. package/lib/chain/validation/attestation.js.map +1 -1
  167. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  168. package/lib/chain/validation/attesterSlashing.js +1 -1
  169. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  170. package/lib/chain/validation/executionPayloadBid.d.ts +13 -3
  171. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  172. package/lib/chain/validation/executionPayloadBid.js +147 -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.d.ts +1 -1
  180. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
  181. package/lib/chain/validation/proposerPreferences.js +13 -4
  182. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  183. package/lib/chain/validation/proposerSlashing.js +1 -1
  184. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  185. package/lib/chain/validation/voluntaryExit.d.ts +9 -1
  186. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  187. package/lib/chain/validation/voluntaryExit.js +46 -1
  188. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  189. package/lib/execution/builder/apiClient.d.ts +64 -0
  190. package/lib/execution/builder/apiClient.d.ts.map +1 -0
  191. package/lib/execution/builder/apiClient.js +184 -0
  192. package/lib/execution/builder/apiClient.js.map +1 -0
  193. package/lib/execution/builder/validateBid.d.ts +22 -0
  194. package/lib/execution/builder/validateBid.d.ts.map +1 -0
  195. package/lib/execution/builder/validateBid.js +111 -0
  196. package/lib/execution/builder/validateBid.js.map +1 -0
  197. package/lib/metrics/metrics/lodestar.d.ts +88 -23
  198. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  199. package/lib/metrics/metrics/lodestar.js +164 -52
  200. package/lib/metrics/metrics/lodestar.js.map +1 -1
  201. package/lib/network/gossip/topic.d.ts +13 -0
  202. package/lib/network/gossip/topic.d.ts.map +1 -1
  203. package/lib/network/gossip/topic.js +37 -0
  204. package/lib/network/gossip/topic.js.map +1 -1
  205. package/lib/network/libp2p/index.d.ts.map +1 -1
  206. package/lib/network/libp2p/index.js +10 -2
  207. package/lib/network/libp2p/index.js.map +1 -1
  208. package/lib/network/network.d.ts.map +1 -1
  209. package/lib/network/network.js +23 -43
  210. package/lib/network/network.js.map +1 -1
  211. package/lib/network/processor/constants.d.ts +7 -0
  212. package/lib/network/processor/constants.d.ts.map +1 -0
  213. package/lib/network/processor/constants.js +7 -0
  214. package/lib/network/processor/constants.js.map +1 -0
  215. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  216. package/lib/network/processor/gossipHandlers.js +13 -4
  217. package/lib/network/processor/gossipHandlers.js.map +1 -1
  218. package/lib/network/processor/gossipQueues/indexed.d.ts.map +1 -1
  219. package/lib/network/processor/gossipQueues/indexed.js +0 -1
  220. package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
  221. package/lib/network/processor/index.d.ts +3 -0
  222. package/lib/network/processor/index.d.ts.map +1 -1
  223. package/lib/network/processor/index.js +41 -17
  224. package/lib/network/processor/index.js.map +1 -1
  225. package/lib/network/reqresp/score.d.ts.map +1 -1
  226. package/lib/network/reqresp/score.js +5 -11
  227. package/lib/network/reqresp/score.js.map +1 -1
  228. package/lib/network/util.d.ts +0 -1
  229. package/lib/network/util.d.ts.map +1 -1
  230. package/lib/network/util.js +0 -4
  231. package/lib/network/util.js.map +1 -1
  232. package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
  233. package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
  234. package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
  235. package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
  236. package/lib/node/nodejs.d.ts +2 -1
  237. package/lib/node/nodejs.d.ts.map +1 -1
  238. package/lib/node/nodejs.js +7 -0
  239. package/lib/node/nodejs.js.map +1 -1
  240. package/lib/sync/range/batch.d.ts +23 -5
  241. package/lib/sync/range/batch.d.ts.map +1 -1
  242. package/lib/sync/range/batch.js +61 -22
  243. package/lib/sync/range/batch.js.map +1 -1
  244. package/lib/sync/range/chain.d.ts +2 -1
  245. package/lib/sync/range/chain.d.ts.map +1 -1
  246. package/lib/sync/range/chain.js +23 -10
  247. package/lib/sync/range/chain.js.map +1 -1
  248. package/lib/sync/types.d.ts +32 -0
  249. package/lib/sync/types.d.ts.map +1 -1
  250. package/lib/sync/types.js +33 -0
  251. package/lib/sync/types.js.map +1 -1
  252. package/lib/sync/unknownBlock.d.ts +15 -2
  253. package/lib/sync/unknownBlock.d.ts.map +1 -1
  254. package/lib/sync/unknownBlock.js +220 -61
  255. package/lib/sync/unknownBlock.js.map +1 -1
  256. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  257. package/lib/sync/utils/downloadByRange.js +16 -11
  258. package/lib/sync/utils/downloadByRange.js.map +1 -1
  259. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  260. package/lib/sync/utils/downloadByRoot.js +3 -1
  261. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  262. package/package.json +35 -35
  263. package/src/api/impl/beacon/blocks/index.ts +55 -21
  264. package/src/api/impl/beacon/pool/index.ts +27 -2
  265. package/src/api/impl/beacon/state/utils.ts +2 -1
  266. package/src/api/impl/events/index.ts +12 -4
  267. package/src/api/impl/lodestar/index.ts +1 -1
  268. package/src/api/impl/validator/index.ts +285 -49
  269. package/src/api/impl/validator/utils.ts +1 -1
  270. package/src/api/rest/base.ts +7 -0
  271. package/src/chain/archiveStore/archiveStore.ts +1 -1
  272. package/src/chain/archiveStore/historicalState/metrics.ts +22 -0
  273. package/src/chain/blocks/importBlock.ts +1 -6
  274. package/src/chain/blocks/importExecutionPayload.ts +12 -11
  275. package/src/chain/blocks/index.ts +18 -6
  276. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
  277. package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
  278. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
  279. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
  280. package/src/chain/bls/index.ts +1 -1
  281. package/src/chain/bls/interface.ts +7 -3
  282. package/src/chain/bls/multithread/index.ts +148 -120
  283. package/src/chain/bls/multithread/jobItem.ts +12 -82
  284. package/src/chain/bls/multithread/types.ts +33 -8
  285. package/src/chain/bls/multithread/utils.ts +11 -0
  286. package/src/chain/bls/multithread/worker.ts +85 -27
  287. package/src/chain/bls/singleThread.ts +11 -55
  288. package/src/chain/bls/utils.ts +23 -24
  289. package/src/chain/chain.ts +25 -7
  290. package/src/chain/errors/blockError.ts +8 -2
  291. package/src/chain/errors/proposerPreferences.ts +7 -0
  292. package/src/chain/forkChoice/index.ts +4 -0
  293. package/src/chain/interface.ts +8 -3
  294. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  295. package/src/chain/opPools/attestationPool.ts +1 -1
  296. package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
  297. package/src/chain/opPools/executionPayloadBidPool.ts +13 -7
  298. package/src/chain/opPools/index.ts +2 -1
  299. package/src/chain/opPools/payloadAttestationPool.ts +3 -3
  300. package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
  301. package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
  302. package/src/chain/opPools/utils.ts +1 -1
  303. package/src/chain/prepareNextSlot.ts +24 -6
  304. package/src/chain/produceBlock/computeNewStateRoot.ts +3 -38
  305. package/src/chain/produceBlock/produceBlockBody.ts +1 -1
  306. package/src/chain/regen/interface.ts +5 -2
  307. package/src/chain/regen/queued.ts +5 -5
  308. package/src/chain/seenCache/seenAttesters.ts +31 -5
  309. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
  310. package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
  311. package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
  312. package/src/chain/stateCache/types.ts +3 -3
  313. package/src/chain/validation/attestation.ts +1 -7
  314. package/src/chain/validation/attesterSlashing.ts +1 -8
  315. package/src/chain/validation/executionPayloadBid.ts +168 -14
  316. package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
  317. package/src/chain/validation/payloadAttestationMessage.ts +6 -17
  318. package/src/chain/validation/proposerPreferences.ts +15 -5
  319. package/src/chain/validation/proposerSlashing.ts +1 -1
  320. package/src/chain/validation/voluntaryExit.ts +59 -2
  321. package/src/execution/builder/apiClient.ts +244 -0
  322. package/src/execution/builder/validateBid.ts +166 -0
  323. package/src/metrics/metrics/lodestar.ts +178 -58
  324. package/src/network/gossip/topic.ts +38 -0
  325. package/src/network/libp2p/index.ts +11 -2
  326. package/src/network/network.ts +29 -54
  327. package/src/network/processor/constants.ts +6 -0
  328. package/src/network/processor/gossipHandlers.ts +15 -2
  329. package/src/network/processor/gossipQueues/indexed.ts +0 -1
  330. package/src/network/processor/index.ts +53 -21
  331. package/src/network/reqresp/score.ts +5 -11
  332. package/src/network/util.ts +0 -5
  333. package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
  334. package/src/node/nodejs.ts +10 -1
  335. package/src/sync/range/batch.ts +83 -28
  336. package/src/sync/range/chain.ts +26 -11
  337. package/src/sync/types.ts +36 -1
  338. package/src/sync/unknownBlock.ts +258 -68
  339. package/src/sync/utils/downloadByRange.ts +21 -12
  340. package/src/sync/utils/downloadByRoot.ts +3 -1
  341. package/lib/chain/bls/maybeBatch.d.ts +0 -12
  342. package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
  343. package/lib/chain/bls/maybeBatch.js +0 -35
  344. package/lib/chain/bls/maybeBatch.js.map +0 -1
  345. package/src/chain/bls/maybeBatch.ts +0 -45
@@ -0,0 +1,64 @@
1
+ import { routes } from "@lodestar/api";
2
+ import { ChainForkConfig } from "@lodestar/config";
3
+ import { Logger } from "@lodestar/logger";
4
+ import { ForkPostGloas } from "@lodestar/params";
5
+ import { BLSPubkey, Root, SignedBeaconBlock, Slot, WithOptionalBytes, gloas } from "@lodestar/types";
6
+ import type { IBlsVerifier } from "../../chain/bls/index.js";
7
+ import { Metrics } from "../../metrics/metrics.js";
8
+ import { IClock } from "../../util/clock.js";
9
+ /**
10
+ * Duration given to a builder to provide a `SignedExecutionPayloadBid` before the deadline
11
+ * is reached, advertised on each bid request via the `X-Timeout-Ms` header. The p2p bid is
12
+ * selected after the same duration, only considering bids received up to that point.
13
+ */
14
+ export declare const BUILDER_BID_DEADLINE_MS = 500;
15
+ /** Local timeout for bid requests, event loop lag must not discard bids that arrived in time */
16
+ export declare const BUILDER_BID_REQUEST_TIMEOUT_MS: number;
17
+ export type BuilderApiClientOpts = {
18
+ /** Timeout for builder api requests, bid requests always use `BUILDER_BID_REQUEST_TIMEOUT_MS` */
19
+ timeout?: number;
20
+ userAgent?: string;
21
+ };
22
+ type BuilderUrl = string;
23
+ /** Decode the SSZ URL bytes without allowing replacement characters or unsafe header values. */
24
+ export declare function decodeBuilderUrl(value: Uint8Array): BuilderUrl;
25
+ export type BuilderApiBid = {
26
+ url: BuilderUrl;
27
+ entry: routes.validator.BuilderEntry;
28
+ signedBid: gloas.SignedExecutionPayloadBid;
29
+ /** Time in milliseconds from the slot start when the bid was received */
30
+ receivedMs: number;
31
+ };
32
+ /**
33
+ * External builder integration post-gloas
34
+ *
35
+ * The builder set is driven by the resolved `BuilderConfig` the validator client supplies on
36
+ * each block production request, clients are dialed on demand based on the entry `url`.
37
+ */
38
+ export declare class BuilderApiClient {
39
+ private readonly opts;
40
+ private readonly config;
41
+ private readonly clock;
42
+ private readonly bls;
43
+ private readonly metrics;
44
+ private readonly logger?;
45
+ private readonly clients;
46
+ constructor(opts: BuilderApiClientOpts, config: ChainForkConfig, clock: IClock, bls: IBlsVerifier, metrics?: Metrics | null, logger?: Logger | undefined);
47
+ /**
48
+ * Fan out bid requests to the builders named by the entries, one request per unique
49
+ * `(url, auth.message.data)` pair. Errors and empty responses (204) are logged and filtered
50
+ * out so a single unresponsive builder never fails block production.
51
+ */
52
+ getExecutionPayloadBids(entries: routes.validator.BuilderEntry[], slot: Slot, parentHash: Root, parentRoot: Root, proposerPubkey: BLSPubkey): Promise<BuilderApiBid[]>;
53
+ /** Forward a proposer's builder preferences to the builder at the given url */
54
+ submitBuilderPreferences(url: BuilderUrl, proposerPubkey: BLSPubkey, request: gloas.BuilderPreferencesRequest): Promise<void>;
55
+ /**
56
+ * Submit the signed beacon block to the builder whose bid was included. The builder is
57
+ * then responsible for constructing and broadcasting the corresponding
58
+ * `SignedExecutionPayloadEnvelope`, no further action is required by the proposer.
59
+ */
60
+ submitSignedBeaconBlock(url: BuilderUrl, signedBlock: WithOptionalBytes<SignedBeaconBlock<ForkPostGloas>>): Promise<void>;
61
+ private getOrCreateClient;
62
+ }
63
+ export {};
64
+ //# sourceMappingURL=apiClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/execution/builder/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAA8B,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAO5E,OAAO,EAAC,SAAS,EA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G,EAAE,YAAY,EACjB,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,MAAM,CAAC,EAAE,MAAM,YAAA,EAC9B;IAEJ;;;;OAIG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,EACxC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,IAAI,EAChB,UAAU,EAAE,IAAI,EAChB,cAAc,EAAE,SAAS,GACxB,OAAO,CAAC,aAAa,EAAE,CAAC,CAmE1B;IAED,+EAA+E;IACzE,wBAAwB,CAC5B,GAAG,EAAE,UAAU,EACf,cAAc,EAAE,SAAS,EACzB,OAAO,EAAE,KAAK,CAAC,yBAAyB,GACvC,OAAO,CAAC,IAAI,CAAC,CASf;IAED;;;;OAIG;IACG,uBAAuB,CAC3B,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,GAC/D,OAAO,CAAC,IAAI,CAAC,CAef;YAEa,iBAAiB;CAwChC"}
@@ -0,0 +1,184 @@
1
+ import { getClient } from "@lodestar/api/builder";
2
+ import { DOMAIN_BUILDER_REQUEST_AUTH } from "@lodestar/params";
3
+ import { ZERO_HASH, computeDomain, computeSigningRoot, createSingleSignatureSetFromComponents, } from "@lodestar/state-transition";
4
+ import { ssz } from "@lodestar/types";
5
+ import { isValidAsciiHttpUrl, toHex, toPrintableUrl } from "@lodestar/utils";
6
+ /**
7
+ * Additional duration to account for potential event loop lag which causes
8
+ * builder bids to be rejected even though the response was sent in time.
9
+ */
10
+ const EVENT_LOOP_LAG_BUFFER = 250;
11
+ /**
12
+ * Duration given to a builder to provide a `SignedExecutionPayloadBid` before the deadline
13
+ * is reached, advertised on each bid request via the `X-Timeout-Ms` header. The p2p bid is
14
+ * selected after the same duration, only considering bids received up to that point.
15
+ */
16
+ export const BUILDER_BID_DEADLINE_MS = 500;
17
+ /** Local timeout for bid requests, event loop lag must not discard bids that arrived in time */
18
+ export const BUILDER_BID_REQUEST_TIMEOUT_MS = BUILDER_BID_DEADLINE_MS + EVENT_LOOP_LAG_BUFFER;
19
+ /** Decode the SSZ URL bytes without allowing replacement characters or unsafe header values. */
20
+ export function decodeBuilderUrl(value) {
21
+ let url;
22
+ try {
23
+ url = new TextDecoder("utf8", { fatal: true }).decode(value);
24
+ }
25
+ catch {
26
+ throw Error("Builder url must be valid UTF-8");
27
+ }
28
+ if (!isValidAsciiHttpUrl(url)) {
29
+ throw Error("Invalid builder url");
30
+ }
31
+ return url;
32
+ }
33
+ /**
34
+ * External builder integration post-gloas
35
+ *
36
+ * The builder set is driven by the resolved `BuilderConfig` the validator client supplies on
37
+ * each block production request, clients are dialed on demand based on the entry `url`.
38
+ */
39
+ export class BuilderApiClient {
40
+ opts;
41
+ config;
42
+ clock;
43
+ bls;
44
+ metrics;
45
+ logger;
46
+ clients = new Map();
47
+ constructor(opts, config, clock, bls, metrics = null, logger) {
48
+ this.opts = opts;
49
+ this.config = config;
50
+ this.clock = clock;
51
+ this.bls = bls;
52
+ this.metrics = metrics;
53
+ this.logger = logger;
54
+ }
55
+ /**
56
+ * Fan out bid requests to the builders named by the entries, one request per unique
57
+ * `(url, auth.message.data)` pair. Errors and empty responses (204) are logged and filtered
58
+ * out so a single unresponsive builder never fails block production.
59
+ */
60
+ async getExecutionPayloadBids(entries, slot, parentHash, parentRoot, proposerPubkey) {
61
+ const seenRequests = new Set();
62
+ const requests = [];
63
+ for (const entry of entries) {
64
+ const urlForLog = Buffer.from(entry.url).toString("utf8");
65
+ let url;
66
+ try {
67
+ url = decodeBuilderUrl(entry.url);
68
+ }
69
+ catch {
70
+ this.logger?.warn("Ignoring builder entry with invalid url", { slot, url: urlForLog });
71
+ continue;
72
+ }
73
+ const requestKey = `${url}-${toHex(entry.auth.message.data)}`;
74
+ if (seenRequests.has(requestKey)) {
75
+ continue;
76
+ }
77
+ seenRequests.add(requestKey);
78
+ // The builder rejects a mismatch, an entry naming a different slot is not used for a bid request
79
+ if (entry.auth.message.slot !== slot) {
80
+ this.logger?.warn("Ignoring builder entry with auth for different slot", {
81
+ slot,
82
+ authSlot: entry.auth.message.slot,
83
+ builder: toPrintableUrl(url),
84
+ });
85
+ continue;
86
+ }
87
+ requests.push({ url, entry });
88
+ }
89
+ // Collected in arrival order so an earlier received bid wins ties during candidate ranking
90
+ const bids = [];
91
+ await Promise.all(requests.map(async ({ url, entry }) => {
92
+ this.metrics?.builderApi.bidRequests.inc();
93
+ try {
94
+ const client = await this.getOrCreateClient(url, proposerPubkey, entry.auth);
95
+ const res = await client.getExecutionPayloadBid({
96
+ slot,
97
+ parentHash,
98
+ parentRoot,
99
+ proposerPubkey,
100
+ requestAuth: entry.auth,
101
+ dateMilliseconds: Date.now(),
102
+ timeoutMs: BUILDER_BID_DEADLINE_MS,
103
+ }, { timeoutMs: BUILDER_BID_REQUEST_TIMEOUT_MS });
104
+ const signedBid = res.value();
105
+ if (signedBid === undefined) {
106
+ this.logger?.debug("No bid received from builder", { slot, builder: toPrintableUrl(url) });
107
+ return;
108
+ }
109
+ this.metrics?.builderApi.bidsReceived.inc();
110
+ bids.push({ url, entry, signedBid, receivedMs: this.clock.msFromSlot(slot) });
111
+ }
112
+ catch (e) {
113
+ this.metrics?.builderApi.bidRequestErrors.inc();
114
+ this.logger?.warn("Failed to get bid from builder", { slot, builder: toPrintableUrl(url) }, e);
115
+ }
116
+ }));
117
+ return bids;
118
+ }
119
+ /** Forward a proposer's builder preferences to the builder at the given url */
120
+ async submitBuilderPreferences(url, proposerPubkey, request) {
121
+ try {
122
+ const client = await this.getOrCreateClient(url, proposerPubkey, request.auth);
123
+ (await client.submitBuilderPreferences({ proposerPubkey, request })).assertOk();
124
+ this.metrics?.builderApi.preferencesForwarded.inc({ status: "success" });
125
+ }
126
+ catch (e) {
127
+ this.metrics?.builderApi.preferencesForwarded.inc({ status: "error" });
128
+ throw e;
129
+ }
130
+ }
131
+ /**
132
+ * Submit the signed beacon block to the builder whose bid was included. The builder is
133
+ * then responsible for constructing and broadcasting the corresponding
134
+ * `SignedExecutionPayloadEnvelope`, no further action is required by the proposer.
135
+ */
136
+ async submitSignedBeaconBlock(url, signedBlock) {
137
+ const client = this.clients.get(url);
138
+ if (client === undefined) {
139
+ this.metrics?.builderApi.blockSubmissions.inc({ status: "error" });
140
+ this.logger?.warn("Ignoring signed block submission to unauthenticated builder", { url });
141
+ return;
142
+ }
143
+ try {
144
+ (await client.submitSignedBeaconBlock({ signedBlock }, { redirect: "manual" })).assertOk();
145
+ this.metrics?.builderApi.blockSubmissions.inc({ status: "success" });
146
+ }
147
+ catch (e) {
148
+ this.metrics?.builderApi.blockSubmissions.inc({ status: "error" });
149
+ throw e;
150
+ }
151
+ }
152
+ async getOrCreateClient(url, proposerPubkey, auth) {
153
+ if (auth.message.data.length === 0) {
154
+ throw Error("Builder request auth data must not be empty");
155
+ }
156
+ let client = this.clients.get(url);
157
+ if (client === undefined) {
158
+ const domain = computeDomain(DOMAIN_BUILDER_REQUEST_AUTH, this.config.GENESIS_FORK_VERSION, ZERO_HASH);
159
+ const signingRoot = computeSigningRoot(ssz.gloas.BuilderRequestAuth, auth.message, domain);
160
+ const signatureSet = createSingleSignatureSetFromComponents(proposerPubkey, signingRoot, auth.signature);
161
+ let isValid = false;
162
+ try {
163
+ isValid = await this.bls.verifySignatureSets([signatureSet]);
164
+ }
165
+ catch {
166
+ // Malformed signatures are invalid request authentication.
167
+ }
168
+ if (!isValid) {
169
+ throw Error("Invalid builder request auth");
170
+ }
171
+ client = getClient({
172
+ baseUrl: url,
173
+ globalInit: {
174
+ timeoutMs: this.opts.timeout,
175
+ headers: this.opts.userAgent ? { "User-Agent": this.opts.userAgent } : undefined,
176
+ },
177
+ }, { config: this.config, metrics: this.metrics?.builderHttpClient, logger: this.logger });
178
+ this.clients.set(url, client);
179
+ this.logger?.debug("External builder registered", { url: toPrintableUrl(url) });
180
+ }
181
+ return client;
182
+ }
183
+ }
184
+ //# sourceMappingURL=apiClient.js.map
@@ -0,0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CAAC,CAAC;YAC3F,MAAM,YAAY,GAAG,sCAAsC,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAEzG,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC;gBACH,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;YAC/D,CAAC;YAAC,MAAM,CAAC;gBACP,2DAA2D;YAC7D,CAAC;YACD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAC9C,CAAC;YAED,MAAM,GAAG,SAAS,CAChB;gBACE,OAAO,EAAE,GAAG;gBACZ,UAAU,EAAE;oBACV,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO;oBAC5B,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,CAAC,CAAC,CAAC,SAAS;iBAC/E;aACF,EACD,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CACrF,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAC9B,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,6BAA6B,EAAE,EAAC,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import { routes } from "@lodestar/api";
2
+ import { ProtoBlock } from "@lodestar/fork-choice";
3
+ import { RootHex, Slot, gloas } from "@lodestar/types";
4
+ import { IBeaconChain } from "../../chain/index.js";
5
+ /** Return the counted bid payment in Gwei, saturated at uint64 max. */
6
+ export declare function getBuilderBidTotalGwei(bid: gloas.ExecutionPayloadBid, maxExecutionPayment: bigint): bigint;
7
+ /**
8
+ * Validate a bid received from a builder over the builder API in response to a bid request
9
+ * made during block production. Unlike gossip validation, the bid must match the requested
10
+ * slot and parent exactly, may carry a non-zero `executionPayment` which is counted at most at
11
+ * the entry's `maxExecutionPayment`, and is not subject to gossip anti-spam rules.
12
+ *
13
+ * Throws with a description of the failure, the caller drops the bid.
14
+ */
15
+ export declare function validateBuilderApiExecutionPayloadBid(chain: IBeaconChain, signedExecutionPayloadBid: gloas.SignedExecutionPayloadBid, request: {
16
+ slot: Slot;
17
+ parentBlock: ProtoBlock;
18
+ parentBlockHash: RootHex;
19
+ parentBlockRoot: RootHex;
20
+ entry: routes.validator.BuilderEntry;
21
+ }): Promise<void>;
22
+ //# sourceMappingURL=validateBid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateBid.d.ts","sourceRoot":"","sources":["../../../src/execution/builder/validateBid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAUjD,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAIlD,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE1G;AAED;;;;;;;GAOG;AACH,wBAAsB,qCAAqC,CACzD,KAAK,EAAE,YAAY,EACnB,yBAAyB,EAAE,KAAK,CAAC,yBAAyB,EAC1D,OAAO,EAAE;IACP,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,UAAU,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;CACtC,GACA,OAAO,CAAC,IAAI,CAAC,CA6Hf"}
@@ -0,0 +1,111 @@
1
+ import { MAX_EXECUTION_PAYMENT, PAYLOAD_BUILDER_VERSION } from "@lodestar/params";
2
+ import { computeEpochAtSlot, createSingleSignatureSetFromComponents, getExecutionPayloadBidSigningRoot, isActiveBuilder, isGasLimitTargetCompatible, isStatePostGloas, } from "@lodestar/state-transition";
3
+ import { bigIntMin, byteArrayEquals, prettyGweiToEth, toHex, toRootHex } from "@lodestar/utils";
4
+ import { RegenCaller } from "../../chain/regen/index.js";
5
+ import { getShufflingDependentRoot } from "../../util/dependentRoot.js";
6
+ /** Return the counted bid payment in Gwei, saturated at uint64 max. */
7
+ export function getBuilderBidTotalGwei(bid, maxExecutionPayment) {
8
+ return bigIntMin(MAX_EXECUTION_PAYMENT, BigInt(bid.value) + bigIntMin(bid.executionPayment, maxExecutionPayment));
9
+ }
10
+ /**
11
+ * Validate a bid received from a builder over the builder API in response to a bid request
12
+ * made during block production. Unlike gossip validation, the bid must match the requested
13
+ * slot and parent exactly, may carry a non-zero `executionPayment` which is counted at most at
14
+ * the entry's `maxExecutionPayment`, and is not subject to gossip anti-spam rules.
15
+ *
16
+ * Throws with a description of the failure, the caller drops the bid.
17
+ */
18
+ export async function validateBuilderApiExecutionPayloadBid(chain, signedExecutionPayloadBid, request) {
19
+ const bid = signedExecutionPayloadBid.message;
20
+ const { slot, parentBlock, parentBlockHash, parentBlockRoot, entry } = request;
21
+ if (bid.slot !== slot) {
22
+ throw Error(`Bid slot=${bid.slot} does not match requested slot=${slot}`);
23
+ }
24
+ const bidParentBlockHash = toRootHex(bid.parentBlockHash);
25
+ const bidParentBlockRoot = toRootHex(bid.parentBlockRoot);
26
+ if (bidParentBlockHash !== parentBlockHash || bidParentBlockRoot !== parentBlockRoot) {
27
+ throw Error(`Bid parent parentBlockHash=${bidParentBlockHash} parentBlockRoot=${bidParentBlockRoot} does not match ` +
28
+ `requested parentBlockHash=${parentBlockHash} parentBlockRoot=${parentBlockRoot}`);
29
+ }
30
+ const totalPayment = getBuilderBidTotalGwei(bid, entry.maxExecutionPayment);
31
+ if (totalPayment < entry.minBid) {
32
+ throw Error(`Bid total payment=${prettyGweiToEth(totalPayment)} ` +
33
+ `(value=${prettyGweiToEth(bid.value)} ` +
34
+ `executionPayment=${prettyGweiToEth(bid.executionPayment)}) ` +
35
+ `is below minBid=${prettyGweiToEth(entry.minBid)}`);
36
+ }
37
+ const state = await chain.regen
38
+ .getBlockSlotState(parentBlock, slot, { dontTransferCache: true }, RegenCaller.validateGossipExecutionPayloadBid)
39
+ .catch((e) => {
40
+ throw Error(`Unable to regenerate state to validate bid: ${e.message}`);
41
+ });
42
+ if (!isStatePostGloas(state)) {
43
+ throw Error(`Expected gloas+ state for execution payload bid validation, got fork=${state.forkName}`);
44
+ }
45
+ if (bid.builderIndex >= state.getBuildersLength()) {
46
+ throw Error(`Bid builderIndex=${bid.builderIndex} is out of bounds`);
47
+ }
48
+ const builder = state.getBuilder(bid.builderIndex);
49
+ if (!isActiveBuilder(builder, state.finalizedCheckpoint.epoch)) {
50
+ throw Error(`Bid builderIndex=${bid.builderIndex} is not an active builder`);
51
+ }
52
+ if (builder.version !== PAYLOAD_BUILDER_VERSION) {
53
+ throw Error(`Invalid builder version=${builder.version} expected=${PAYLOAD_BUILDER_VERSION}`);
54
+ }
55
+ // A bid not signed by one of the builder pubkeys the entry accepts bids from must not be accepted
56
+ if (entry.builderPubkeys.length > 0 &&
57
+ !entry.builderPubkeys.some((pubkey) => byteArrayEquals(pubkey, builder.pubkey))) {
58
+ throw Error(`Bid builder pubkey=${toHex(builder.pubkey)} is not in the entry's ` +
59
+ `builderPubkeys=${entry.builderPubkeys.map(toHex).join(",")}`);
60
+ }
61
+ const blobKzgCommitmentsLen = bid.blobKzgCommitments.length;
62
+ const maxBlobsPerBlock = chain.config.getMaxBlobsPerBlock(computeEpochAtSlot(bid.slot));
63
+ if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
64
+ throw Error(`Bid has too many KZG commitments len=${blobKzgCommitmentsLen} limit=${maxBlobsPerBlock}`);
65
+ }
66
+ // The coverage check only applies to the staked collateral payment, a pure execution
67
+ // layer payment bid has nothing to cover on-chain
68
+ if (bid.value > 0 && !state.canBuilderCoverBid(bid.builderIndex, bid.value)) {
69
+ throw Error(`Builder cannot cover bid value=${prettyGweiToEth(bid.value)} ` + `balance=${prettyGweiToEth(builder.balance)}`);
70
+ }
71
+ const randaoMix = state.getRandaoMix(computeEpochAtSlot(state.slot));
72
+ if (!byteArrayEquals(bid.prevRandao, randaoMix)) {
73
+ throw Error(`Invalid bid prevRandao=${toHex(bid.prevRandao)} expected=${toHex(randaoMix)}`);
74
+ }
75
+ // The builder must honor the proposer preferences it learned over gossip
76
+ const bidEpoch = computeEpochAtSlot(bid.slot);
77
+ const dependentRootHex = (() => {
78
+ try {
79
+ return getShufflingDependentRoot(chain.forkChoice, bidEpoch, computeEpochAtSlot(parentBlock.slot), parentBlock);
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ })();
85
+ if (dependentRootHex === null) {
86
+ throw Error(`Unable to resolve proposer preferences dependent root for bid slot=${bid.slot}`);
87
+ }
88
+ const proposerPreferences = chain.proposerPreferencesPool.get(bid.slot, dependentRootHex);
89
+ if (proposerPreferences === null) {
90
+ throw Error(`No proposer preferences found for bid slot=${bid.slot} dependentRoot=${dependentRootHex}`);
91
+ }
92
+ if (!byteArrayEquals(bid.feeRecipient, proposerPreferences.message.feeRecipient)) {
93
+ throw Error(`Bid feeRecipient=${toHex(bid.feeRecipient)} does not match ` +
94
+ `proposer preferences feeRecipient=${toHex(proposerPreferences.message.feeRecipient)}`);
95
+ }
96
+ const parentPayloadVariant = chain.forkChoice.getBlockHexAndBlockHash(bidParentBlockRoot, bidParentBlockHash);
97
+ if (parentPayloadVariant === null || parentPayloadVariant.executionPayloadBlockHash === null) {
98
+ throw Error(`Unable to resolve parent payload gas limit for bid parentBlockHash=${bidParentBlockHash}`);
99
+ }
100
+ const parentGasLimit = BigInt(parentPayloadVariant.executionPayloadGasLimit);
101
+ const targetGasLimit = proposerPreferences.message.targetGasLimit;
102
+ if (!isGasLimitTargetCompatible(parentGasLimit, bid.gasLimit, targetGasLimit)) {
103
+ throw Error(`Bid gasLimit=${bid.gasLimit} is not compatible with ` +
104
+ `parentGasLimit=${parentGasLimit} targetGasLimit=${targetGasLimit}`);
105
+ }
106
+ const signatureSet = createSingleSignatureSetFromComponents(builder.pubkey, getExecutionPayloadBidSigningRoot(chain.config, bid), signedExecutionPayloadBid.signature);
107
+ if (!(await chain.bls.verifySignatureSets([signatureSet]))) {
108
+ throw Error(`Invalid bid signature builderIndex=${bid.builderIndex}`);
109
+ }
110
+ }
111
+ //# sourceMappingURL=validateBid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateBid.js","sourceRoot":"","sources":["../../../src/execution/builder/validateBid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,qBAAqB,EAAE,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,sCAAsC,EACtC,iCAAiC,EACjC,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAEtE,uEAAuE;AACvE,MAAM,UAAU,sBAAsB,CAAC,GAA8B,EAAE,mBAA2B;IAChG,OAAO,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,gBAAgB,EAAE,mBAAmB,CA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C,0BAA0B,CAAC,cAAc,EAAE,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC;QAC9E,MAAM,KAAK,CACT,gBAAgB,GAAG,CAAC,QAAQ,0BAA0B;YACpD,kBAAkB,cAAc,mBAAmB,cAAc,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,sCAAsC,CACzD,OAAO,CAAC,MAAM,EACd,iCAAiC,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,EACpD,yBAAyB,CAAC,SAAS,CACpC,CAAC;IAEF,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,KAAK,CAAC,sCAAsC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -4,7 +4,7 @@ import { ArchiveStoreTask } from "../../chain/archiveStore/archiveStore.js";
4
4
  import { FrequencyStateArchiveStep } from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
5
5
  import { BlockInputSource } from "../../chain/blocks/blockInput/index.js";
6
6
  import { PayloadErrorCode } from "../../chain/blocks/importExecutionPayload.js";
7
- import { PayloadEnvelopeInputSource } from "../../chain/blocks/payloadEnvelopeInput/index.js";
7
+ import { PayloadEnvelopeInputPruneReason, PayloadEnvelopeInputSource } from "../../chain/blocks/payloadEnvelopeInput/index.js";
8
8
  import { JobQueueItemType } from "../../chain/bls/index.js";
9
9
  import { AttestationErrorCode, BlockErrorCode } from "../../chain/errors/index.js";
10
10
  import { type InvalidAttestationData, ScannedSlotsTerminationReason } from "../../chain/opPools/aggregatedAttestationPool.js";
@@ -18,7 +18,7 @@ import { ExecutionPayloadStatus } from "../../execution/index.js";
18
18
  import { GossipType } from "../../network/index.js";
19
19
  import { CannotAcceptWorkReason, ReprocessRejectReason } from "../../network/processor/index.js";
20
20
  import { BackfillSyncMethod } from "../../sync/backfill/backfill.js";
21
- import { PendingBlockType } from "../../sync/types.js";
21
+ import { DroppedItemReason, PendingBlockType } from "../../sync/types.js";
22
22
  import { PeerSyncType, RangeSyncType } from "../../sync/utils/remoteSyncType.js";
23
23
  import { AllocSource } from "../../util/bufferPool.js";
24
24
  import { DataColumnReconstructionCode } from "../../util/dataColumns.js";
@@ -26,6 +26,9 @@ import { DataColumnEngineResult } from "../../util/execution.js";
26
26
  import { LodestarMetadata } from "../options.js";
27
27
  import { RegistryMetricCreator } from "../utils/registryMetricCreator.js";
28
28
  export type LodestarMetrics = ReturnType<typeof createLodestarMetrics>;
29
+ type BlsJobOutcome = "valid" | "invalid" | "prepError" | "verifyError" | "workerError";
30
+ type BlsBufferFlushReason = "size" | "timeout";
31
+ type BlsVerificationCallOperation = "batch" | "single" | "fallback" | "same_message";
29
32
  /**
30
33
  * Extra Lodestar custom metrics
31
34
  */
@@ -50,7 +53,9 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
50
53
  topic: GossipType;
51
54
  }>;
52
55
  keyAge: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
53
- queueTime: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
56
+ queueTime: import("@lodestar/utils").Histogram<{
57
+ topic: GossipType;
58
+ }>;
54
59
  };
55
60
  networkProcessor: {
56
61
  gossipValidationAccept: import("@lodestar/utils").GaugeExtra<{
@@ -153,40 +158,56 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
153
158
  caller: RegenCaller;
154
159
  }>;
155
160
  bls: {
156
- aggregatedPubkeys: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
161
+ aggregatedPubkeys: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
162
+ pubkeyCacheSize: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
163
+ pubkeyCacheCapacity: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
157
164
  };
158
165
  blsThreadPool: {
159
- jobsWorkerTime: import("@lodestar/utils").GaugeExtra<{
166
+ jobsWorkerTime: import("@lodestar/utils").Counter<{
160
167
  workerId: number;
161
168
  }>;
162
- successJobsSignatureSetsCount: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
163
- errorAggregateSignatureSetsCount: import("@lodestar/utils").GaugeExtra<{
169
+ successJobsSignatureSetsCount: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
170
+ errorJobsSignatureSetsCount: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
171
+ jobWaitTime: import("@lodestar/utils").Histogram<{
164
172
  type: JobQueueItemType;
165
173
  }>;
166
- errorJobsSignatureSetsCount: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
167
- jobWaitTime: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
174
+ jobDuration: import("@lodestar/utils").Histogram<{
175
+ type: JobQueueItemType;
176
+ }>;
177
+ jobResults: import("@lodestar/utils").Counter<{
178
+ type: JobQueueItemType;
179
+ outcome: BlsJobOutcome;
180
+ }>;
168
181
  queueLength: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
182
+ bufferedQueueLength: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
169
183
  workersBusy: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
170
- totalJobsGroupsStarted: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
171
- totalJobsStarted: import("@lodestar/utils").GaugeExtra<{
184
+ totalJobsGroupsStarted: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
185
+ totalJobsStarted: import("@lodestar/utils").Counter<{
172
186
  type: JobQueueItemType;
173
187
  }>;
174
- totalSigSetsStarted: import("@lodestar/utils").GaugeExtra<{
188
+ totalSigSetsStarted: import("@lodestar/utils").Counter<{
175
189
  type: JobQueueItemType;
176
190
  }>;
177
- batchRetries: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
178
- batchSigsSuccess: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
179
- sameMessageRetryJobs: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
180
- sameMessageRetrySets: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
191
+ batchRetries: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
192
+ batchSigsSuccess: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
193
+ bufferFlushes: import("@lodestar/utils").Counter<{
194
+ reason: BlsBufferFlushReason;
195
+ }>;
196
+ bufferedSignatureSets: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
181
197
  latencyToWorker: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
182
198
  latencyFromWorker: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
183
199
  mainThreadDurationInThreadPool: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
184
200
  timePerSigSet: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
185
- totalSigSets: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
186
- prioritizedSigSets: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
187
- batchableSigSets: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
188
- aggregateWithRandomnessAsyncDuration: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
189
- pubkeysAggregationMainThreadDuration: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
201
+ workRequestPreparationDuration: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
202
+ verificationCallDuration: import("@lodestar/utils").Histogram<{
203
+ operation: BlsVerificationCallOperation;
204
+ }>;
205
+ verificationCallSignatureSets: import("@lodestar/utils").Counter<{
206
+ operation: BlsVerificationCallOperation;
207
+ }>;
208
+ totalSigSets: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
209
+ prioritizedSigSets: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
210
+ batchableSigSets: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
190
211
  };
191
212
  blsSingleThread: {
192
213
  singleThreadDuration: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
@@ -249,7 +270,12 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
249
270
  processedBlocksError: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
250
271
  downloadedBlocksSuccess: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
251
272
  downloadedBlocksError: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
252
- removedBlocks: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
273
+ removedBlocks: import("@lodestar/utils").GaugeExtra<{
274
+ reason: DroppedItemReason;
275
+ }>;
276
+ removedPayloads: import("@lodestar/utils").GaugeExtra<{
277
+ reason: DroppedItemReason;
278
+ }>;
253
279
  elapsedTimeTillReceived: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
254
280
  resolveAvailabilitySource: import("@lodestar/utils").GaugeExtra<{
255
281
  source: BlockInputSource;
@@ -360,6 +386,16 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
360
386
  error: PayloadErrorCode | "NOT_PAYLOAD_ERROR";
361
387
  }>;
362
388
  };
389
+ gossipExecutionPayloadBid: {
390
+ elapsedTimeTillReceived: import("@lodestar/utils").Histogram<{
391
+ source: OpSource;
392
+ }>;
393
+ };
394
+ gossipPayloadAttestationMessage: {
395
+ elapsedTimeTillReceived: import("@lodestar/utils").Histogram<{
396
+ source: OpSource;
397
+ }>;
398
+ };
363
399
  recoverBlobSidecars: {
364
400
  blobsReconstructed: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
365
401
  reconstructionTime: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
@@ -484,6 +520,9 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
484
520
  getAggregateCacheMisses: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
485
521
  };
486
522
  attesterSlashingPoolSize: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
523
+ deferredVoluntaryExitPool: {
524
+ size: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
525
+ };
487
526
  proposerSlashingPoolSize: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
488
527
  proposerSlashingsProduced: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
489
528
  voluntaryExitPoolSize: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
@@ -531,6 +570,7 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
531
570
  apiInsertOutcome: import("@lodestar/utils").Counter<{
532
571
  insertOutcome: InsertOutcome;
533
572
  }>;
573
+ apiValidationTime: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
534
574
  };
535
575
  };
536
576
  chain: {
@@ -566,6 +606,12 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
566
606
  epochSize: import("@lodestar/utils").GaugeExtra<{
567
607
  type: CacheItemType;
568
608
  }>;
609
+ persistentTierEpochs: import("@lodestar/utils").GaugeExtra<{
610
+ tier: number;
611
+ }>;
612
+ persistentTierStates: import("@lodestar/utils").GaugeExtra<{
613
+ tier: number;
614
+ }>;
569
615
  reads: import("@lodestar/utils").AvgMinMax<import("@lodestar/utils").NoLabels>;
570
616
  secondsSinceLastRead: import("@lodestar/utils").AvgMinMax<import("@lodestar/utils").NoLabels>;
571
617
  stateClonedCount: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
@@ -636,7 +682,12 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
636
682
  payloadEnvelopeInput: {
637
683
  count: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
638
684
  serializedObjectRefs: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
639
- created: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
685
+ created: import("@lodestar/utils").Counter<{
686
+ source: PayloadEnvelopeInputSource;
687
+ }>;
688
+ pruned: import("@lodestar/utils").Counter<{
689
+ reason: PayloadEnvelopeInputPruneReason;
690
+ }>;
640
691
  };
641
692
  };
642
693
  processFinalizedCheckpoint: {
@@ -690,6 +741,7 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
690
741
  }>;
691
742
  hits: import("@lodestar/utils").GaugeExtra<import("@lodestar/utils").NoLabels>;
692
743
  waste: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
744
+ predictedReorg: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
693
745
  duration: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
694
746
  };
695
747
  builderDepositPreVerify: {
@@ -809,6 +861,18 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
809
861
  baseUrl: string;
810
862
  }>;
811
863
  };
864
+ builderApi: {
865
+ bidRequests: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
866
+ bidRequestErrors: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
867
+ bidsReceived: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
868
+ bidsDiscarded: import("@lodestar/utils").Counter<import("@lodestar/utils").NoLabels>;
869
+ blockSubmissions: import("@lodestar/utils").Counter<{
870
+ status: "success" | "error";
871
+ }>;
872
+ preferencesForwarded: import("@lodestar/utils").Counter<{
873
+ status: "success" | "error";
874
+ }>;
875
+ };
812
876
  db: {
813
877
  dbReadReq: import("@lodestar/utils").GaugeExtra<{
814
878
  bucket: string;
@@ -831,4 +895,5 @@ export declare function createLodestarMetrics(register: RegistryMetricCreator, m
831
895
  pruneKeys: import("@lodestar/utils").Histogram<import("@lodestar/utils").NoLabels>;
832
896
  };
833
897
  };
898
+ export {};
834
899
  //# sourceMappingURL=lodestar.d.ts.map