@lodestar/beacon-node 1.23.0-dev.068fbae928 → 1.23.0-dev.07d1145194

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 (607) hide show
  1. package/lib/api/impl/api.js.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +27 -28
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/blocks/utils.d.ts +1 -1
  5. package/lib/api/impl/beacon/blocks/utils.js +2 -2
  6. package/lib/api/impl/beacon/blocks/utils.js.map +1 -1
  7. package/lib/api/impl/beacon/index.js +1 -1
  8. package/lib/api/impl/beacon/index.js.map +1 -1
  9. package/lib/api/impl/beacon/pool/index.js +5 -6
  10. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  11. package/lib/api/impl/beacon/state/index.d.ts +1 -1
  12. package/lib/api/impl/beacon/state/index.js +4 -10
  13. package/lib/api/impl/beacon/state/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/utils.d.ts +2 -2
  15. package/lib/api/impl/beacon/state/utils.js +23 -3
  16. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  17. package/lib/api/impl/config/constants.js +1 -2
  18. package/lib/api/impl/config/constants.js.map +1 -1
  19. package/lib/api/impl/config/index.js.map +1 -1
  20. package/lib/api/impl/debug/index.js +1 -1
  21. package/lib/api/impl/debug/index.js.map +1 -1
  22. package/lib/api/impl/events/index.js +1 -2
  23. package/lib/api/impl/events/index.js.map +1 -1
  24. package/lib/api/impl/lightclient/index.js +1 -1
  25. package/lib/api/impl/lightclient/index.js.map +1 -1
  26. package/lib/api/impl/lodestar/index.js +5 -5
  27. package/lib/api/impl/lodestar/index.js.map +1 -1
  28. package/lib/api/impl/node/index.d.ts +1 -1
  29. package/lib/api/impl/node/index.js +2 -4
  30. package/lib/api/impl/node/index.js.map +1 -1
  31. package/lib/api/impl/node/utils.js +1 -0
  32. package/lib/api/impl/node/utils.js.map +1 -1
  33. package/lib/api/impl/proof/index.d.ts +1 -1
  34. package/lib/api/impl/proof/index.js +2 -2
  35. package/lib/api/impl/proof/index.js.map +1 -1
  36. package/lib/api/impl/types.d.ts +2 -2
  37. package/lib/api/impl/validator/index.d.ts +32 -1
  38. package/lib/api/impl/validator/index.js +166 -98
  39. package/lib/api/impl/validator/index.js.map +1 -1
  40. package/lib/api/impl/validator/utils.d.ts +4 -3
  41. package/lib/api/impl/validator/utils.js +17 -9
  42. package/lib/api/impl/validator/utils.js.map +1 -1
  43. package/lib/api/options.js.map +1 -1
  44. package/lib/api/rest/activeSockets.js +1 -1
  45. package/lib/api/rest/activeSockets.js.map +1 -1
  46. package/lib/api/rest/base.d.ts +1 -1
  47. package/lib/api/rest/base.js +3 -3
  48. package/lib/api/rest/base.js.map +1 -1
  49. package/lib/api/rest/index.d.ts +2 -2
  50. package/lib/api/rest/index.js.map +1 -1
  51. package/lib/api/rest/swaggerUI.js +1 -4
  52. package/lib/api/rest/swaggerUI.js.map +1 -1
  53. package/lib/chain/archiver/archiveBlocks.d.ts +2 -2
  54. package/lib/chain/archiver/archiveBlocks.js +1 -1
  55. package/lib/chain/archiver/archiveBlocks.js.map +1 -1
  56. package/lib/chain/archiver/archiver.d.ts +40 -0
  57. package/lib/chain/archiver/archiver.js +117 -0
  58. package/lib/chain/archiver/archiver.js.map +1 -0
  59. package/lib/chain/archiver/index.d.ts +2 -54
  60. package/lib/chain/archiver/index.js +2 -104
  61. package/lib/chain/archiver/index.js.map +1 -1
  62. package/lib/chain/archiver/interface.d.ts +39 -0
  63. package/lib/chain/archiver/interface.js +8 -0
  64. package/lib/chain/archiver/interface.js.map +1 -0
  65. package/lib/chain/archiver/{archiveStates.d.ts → strategies/frequencyStateArchiveStrategy.d.ts} +17 -15
  66. package/lib/chain/archiver/{archiveStates.js → strategies/frequencyStateArchiveStrategy.js} +8 -6
  67. package/lib/chain/archiver/strategies/frequencyStateArchiveStrategy.js.map +1 -0
  68. package/lib/chain/balancesCache.d.ts +1 -1
  69. package/lib/chain/balancesCache.js +1 -1
  70. package/lib/chain/balancesCache.js.map +1 -1
  71. package/lib/chain/beaconProposerCache.d.ts +1 -1
  72. package/lib/chain/blocks/importBlock.js +9 -8
  73. package/lib/chain/blocks/importBlock.js.map +1 -1
  74. package/lib/chain/blocks/index.d.ts +2 -2
  75. package/lib/chain/blocks/index.js +4 -6
  76. package/lib/chain/blocks/index.js.map +1 -1
  77. package/lib/chain/blocks/types.d.ts +4 -4
  78. package/lib/chain/blocks/types.js +1 -1
  79. package/lib/chain/blocks/types.js.map +1 -1
  80. package/lib/chain/blocks/utils/checkpoint.js +1 -1
  81. package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
  82. package/lib/chain/blocks/verifyBlock.d.ts +2 -2
  83. package/lib/chain/blocks/verifyBlock.js +7 -7
  84. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  85. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +1 -1
  86. package/lib/chain/blocks/verifyBlocksDataAvailability.js +4 -4
  87. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  88. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +6 -6
  89. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -5
  90. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  91. package/lib/chain/blocks/verifyBlocksSanityChecks.js +5 -13
  92. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  93. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +1 -1
  94. package/lib/chain/blocks/verifyBlocksSignatures.js +1 -1
  95. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  96. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +2 -2
  97. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  98. package/lib/chain/blocks/writeBlockInputToDb.js +1 -1
  99. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  100. package/lib/chain/bls/multithread/index.d.ts +1 -1
  101. package/lib/chain/bls/multithread/index.js +10 -10
  102. package/lib/chain/bls/multithread/index.js.map +1 -1
  103. package/lib/chain/bls/multithread/jobItem.d.ts +3 -3
  104. package/lib/chain/bls/multithread/jobItem.js +4 -14
  105. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  106. package/lib/chain/bls/multithread/poolSize.js +1 -1
  107. package/lib/chain/bls/multithread/poolSize.js.map +1 -1
  108. package/lib/chain/bls/multithread/worker.js +2 -2
  109. package/lib/chain/bls/multithread/worker.js.map +1 -1
  110. package/lib/chain/chain.d.ts +25 -24
  111. package/lib/chain/chain.js +55 -59
  112. package/lib/chain/chain.js.map +1 -1
  113. package/lib/chain/emitter.d.ts +2 -2
  114. package/lib/chain/emitter.js +1 -1
  115. package/lib/chain/emitter.js.map +1 -1
  116. package/lib/chain/errors/attestationError.d.ts +1 -1
  117. package/lib/chain/errors/blobSidecarError.d.ts +1 -1
  118. package/lib/chain/errors/blockError.d.ts +1 -1
  119. package/lib/chain/errors/blockError.js.map +1 -1
  120. package/lib/chain/errors/syncCommitteeError.d.ts +1 -1
  121. package/lib/chain/forkChoice/index.d.ts +5 -1
  122. package/lib/chain/forkChoice/index.js +8 -3
  123. package/lib/chain/forkChoice/index.js.map +1 -1
  124. package/lib/chain/genesis/genesis.d.ts +3 -3
  125. package/lib/chain/genesis/genesis.js +4 -8
  126. package/lib/chain/genesis/genesis.js.map +1 -1
  127. package/lib/chain/genesis/interface.d.ts +1 -1
  128. package/lib/chain/historicalState/getHistoricalState.d.ts +1 -1
  129. package/lib/chain/historicalState/getHistoricalState.js.map +1 -1
  130. package/lib/chain/historicalState/index.js +1 -1
  131. package/lib/chain/historicalState/index.js.map +1 -1
  132. package/lib/chain/historicalState/worker.js +4 -4
  133. package/lib/chain/historicalState/worker.js.map +1 -1
  134. package/lib/chain/initState.d.ts +3 -3
  135. package/lib/chain/initState.js +1 -1
  136. package/lib/chain/initState.js.map +1 -1
  137. package/lib/chain/interface.d.ts +22 -21
  138. package/lib/chain/interface.js.map +1 -1
  139. package/lib/chain/lightClient/index.d.ts +2 -2
  140. package/lib/chain/lightClient/index.js +9 -11
  141. package/lib/chain/lightClient/index.js.map +1 -1
  142. package/lib/chain/lightClient/proofs.d.ts +1 -1
  143. package/lib/chain/lightClient/proofs.js +1 -1
  144. package/lib/chain/lightClient/proofs.js.map +1 -1
  145. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +3 -3
  146. package/lib/chain/opPools/aggregatedAttestationPool.js +38 -42
  147. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  148. package/lib/chain/opPools/attestationPool.d.ts +2 -2
  149. package/lib/chain/opPools/attestationPool.js +5 -7
  150. package/lib/chain/opPools/attestationPool.js.map +1 -1
  151. package/lib/chain/opPools/opPool.d.ts +2 -2
  152. package/lib/chain/opPools/opPool.js +4 -6
  153. package/lib/chain/opPools/opPool.js.map +1 -1
  154. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts +1 -1
  155. package/lib/chain/opPools/syncCommitteeMessagePool.js +4 -6
  156. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  157. package/lib/chain/opPools/syncContributionAndProofPool.d.ts +1 -1
  158. package/lib/chain/opPools/syncContributionAndProofPool.js +4 -6
  159. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  160. package/lib/chain/options.d.ts +3 -1
  161. package/lib/chain/options.js +4 -0
  162. package/lib/chain/options.js.map +1 -1
  163. package/lib/chain/prepareNextSlot.d.ts +1 -1
  164. package/lib/chain/prepareNextSlot.js +6 -5
  165. package/lib/chain/prepareNextSlot.js.map +1 -1
  166. package/lib/chain/produceBlock/produceBlockBody.d.ts +4 -4
  167. package/lib/chain/produceBlock/produceBlockBody.js +21 -20
  168. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  169. package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.d.ts +1 -1
  170. package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js +1 -1
  171. package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js.map +1 -1
  172. package/lib/chain/regen/errors.d.ts +1 -1
  173. package/lib/chain/regen/interface.d.ts +2 -2
  174. package/lib/chain/regen/queued.d.ts +3 -3
  175. package/lib/chain/regen/queued.js +2 -2
  176. package/lib/chain/regen/queued.js.map +1 -1
  177. package/lib/chain/regen/regen.d.ts +5 -5
  178. package/lib/chain/regen/regen.js +3 -3
  179. package/lib/chain/regen/regen.js.map +1 -1
  180. package/lib/chain/reprocess.d.ts +1 -1
  181. package/lib/chain/rewards/attestationsRewards.d.ts +3 -3
  182. package/lib/chain/rewards/attestationsRewards.js +1 -1
  183. package/lib/chain/rewards/attestationsRewards.js.map +1 -1
  184. package/lib/chain/rewards/blockRewards.d.ts +1 -1
  185. package/lib/chain/rewards/blockRewards.js +2 -4
  186. package/lib/chain/rewards/blockRewards.js.map +1 -1
  187. package/lib/chain/rewards/syncCommitteeRewards.d.ts +1 -1
  188. package/lib/chain/rewards/syncCommitteeRewards.js +1 -3
  189. package/lib/chain/rewards/syncCommitteeRewards.js.map +1 -1
  190. package/lib/chain/seenCache/seenAttestationData.d.ts +1 -1
  191. package/lib/chain/seenCache/seenCommittee.d.ts +1 -1
  192. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +2 -2
  193. package/lib/chain/seenCache/seenGossipBlockInput.js +23 -27
  194. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  195. package/lib/chain/shufflingCache.js +11 -11
  196. package/lib/chain/shufflingCache.js.map +1 -1
  197. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +2 -2
  198. package/lib/chain/stateCache/datastore/file.js.map +1 -1
  199. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +2 -2
  200. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +2 -2
  201. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
  202. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -5
  203. package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -3
  204. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  205. package/lib/chain/stateCache/types.d.ts +1 -1
  206. package/lib/chain/validation/aggregateAndProof.d.ts +2 -2
  207. package/lib/chain/validation/aggregateAndProof.js +2 -2
  208. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  209. package/lib/chain/validation/attestation.d.ts +5 -5
  210. package/lib/chain/validation/attestation.js +28 -34
  211. package/lib/chain/validation/attestation.js.map +1 -1
  212. package/lib/chain/validation/attesterSlashing.d.ts +1 -1
  213. package/lib/chain/validation/attesterSlashing.js +1 -1
  214. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  215. package/lib/chain/validation/blobSidecar.d.ts +1 -1
  216. package/lib/chain/validation/blobSidecar.js +5 -5
  217. package/lib/chain/validation/blobSidecar.js.map +1 -1
  218. package/lib/chain/validation/block.js +3 -3
  219. package/lib/chain/validation/block.js.map +1 -1
  220. package/lib/chain/validation/blsToExecutionChange.d.ts +1 -1
  221. package/lib/chain/validation/blsToExecutionChange.js +1 -1
  222. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  223. package/lib/chain/validation/lightClientFinalityUpdate.js +3 -3
  224. package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
  225. package/lib/chain/validation/lightClientOptimisticUpdate.js +3 -3
  226. package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
  227. package/lib/chain/validation/proposerSlashing.d.ts +1 -1
  228. package/lib/chain/validation/proposerSlashing.js +1 -1
  229. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  230. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -2
  231. package/lib/chain/validation/signatureSets/aggregateAndProof.js +1 -1
  232. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  233. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +1 -1
  234. package/lib/chain/validation/signatureSets/contributionAndProof.js +1 -1
  235. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  236. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -2
  237. package/lib/chain/validation/signatureSets/selectionProof.js +1 -1
  238. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  239. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +1 -1
  240. package/lib/chain/validation/signatureSets/syncCommittee.js +1 -1
  241. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  242. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -1
  243. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  244. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  245. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +1 -1
  246. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -1
  247. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  248. package/lib/chain/validation/syncCommittee.js +1 -1
  249. package/lib/chain/validation/syncCommittee.js.map +1 -1
  250. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts +1 -1
  251. package/lib/chain/validation/syncCommitteeContributionAndProof.js +2 -2
  252. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  253. package/lib/chain/validation/voluntaryExit.d.ts +1 -1
  254. package/lib/chain/validation/voluntaryExit.js +2 -2
  255. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  256. package/lib/db/beacon.d.ts +3 -3
  257. package/lib/db/beacon.js +2 -2
  258. package/lib/db/beacon.js.map +1 -1
  259. package/lib/db/buckets.js +3 -5
  260. package/lib/db/buckets.js.map +1 -1
  261. package/lib/db/interface.d.ts +2 -2
  262. package/lib/db/repositories/attesterSlashing.d.ts +1 -1
  263. package/lib/db/repositories/attesterSlashing.js +1 -1
  264. package/lib/db/repositories/attesterSlashing.js.map +1 -1
  265. package/lib/db/repositories/backfilledRanges.d.ts +2 -2
  266. package/lib/db/repositories/backfilledRanges.js +2 -3
  267. package/lib/db/repositories/backfilledRanges.js.map +1 -1
  268. package/lib/db/repositories/blobSidecars.d.ts +1 -1
  269. package/lib/db/repositories/blobSidecars.js.map +1 -1
  270. package/lib/db/repositories/blobSidecarsArchive.js.map +1 -1
  271. package/lib/db/repositories/blockArchive.d.ts +2 -2
  272. package/lib/db/repositories/blockArchive.js +3 -3
  273. package/lib/db/repositories/blockArchive.js.map +1 -1
  274. package/lib/db/repositories/blockArchiveIndex.d.ts +1 -1
  275. package/lib/db/repositories/blockArchiveIndex.js +1 -1
  276. package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
  277. package/lib/db/repositories/blsToExecutionChange.d.ts +1 -1
  278. package/lib/db/repositories/blsToExecutionChange.js.map +1 -1
  279. package/lib/db/repositories/checkpointState.js +1 -1
  280. package/lib/db/repositories/checkpointState.js.map +1 -1
  281. package/lib/db/repositories/depositDataRoot.d.ts +3 -3
  282. package/lib/db/repositories/depositDataRoot.js +3 -4
  283. package/lib/db/repositories/depositDataRoot.js.map +1 -1
  284. package/lib/db/repositories/depositEvent.d.ts +1 -1
  285. package/lib/db/repositories/depositEvent.js +1 -1
  286. package/lib/db/repositories/depositEvent.js.map +1 -1
  287. package/lib/db/repositories/eth1Data.d.ts +2 -2
  288. package/lib/db/repositories/eth1Data.js +2 -3
  289. package/lib/db/repositories/eth1Data.js.map +1 -1
  290. package/lib/db/repositories/lightclientBestUpdate.js.map +1 -1
  291. package/lib/db/repositories/lightclientCheckpointHeader.js +1 -1
  292. package/lib/db/repositories/lightclientCheckpointHeader.js.map +1 -1
  293. package/lib/db/repositories/proposerSlashing.d.ts +1 -1
  294. package/lib/db/repositories/proposerSlashing.js +1 -1
  295. package/lib/db/repositories/proposerSlashing.js.map +1 -1
  296. package/lib/db/repositories/stateArchive.d.ts +2 -2
  297. package/lib/db/repositories/stateArchive.js +2 -2
  298. package/lib/db/repositories/stateArchive.js.map +1 -1
  299. package/lib/db/repositories/stateArchiveIndex.js.map +1 -1
  300. package/lib/db/repositories/voluntaryExit.d.ts +1 -1
  301. package/lib/db/repositories/voluntaryExit.js +1 -1
  302. package/lib/db/repositories/voluntaryExit.js.map +1 -1
  303. package/lib/db/single/preGenesisState.js.map +1 -1
  304. package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts +1 -1
  305. package/lib/db/single/preGenesisStateLastProcessedBlock.js +1 -1
  306. package/lib/db/single/preGenesisStateLastProcessedBlock.js.map +1 -1
  307. package/lib/eth1/eth1DataCache.js +1 -1
  308. package/lib/eth1/eth1DataCache.js.map +1 -1
  309. package/lib/eth1/eth1DepositDataTracker.js +14 -18
  310. package/lib/eth1/eth1DepositDataTracker.js.map +1 -1
  311. package/lib/eth1/eth1DepositsCache.d.ts +2 -2
  312. package/lib/eth1/eth1DepositsCache.js +4 -4
  313. package/lib/eth1/eth1DepositsCache.js.map +1 -1
  314. package/lib/eth1/eth1MergeBlockTracker.d.ts +1 -1
  315. package/lib/eth1/eth1MergeBlockTracker.js +41 -51
  316. package/lib/eth1/eth1MergeBlockTracker.js.map +1 -1
  317. package/lib/eth1/index.d.ts +1 -1
  318. package/lib/eth1/index.js +4 -8
  319. package/lib/eth1/index.js.map +1 -1
  320. package/lib/eth1/interface.d.ts +1 -1
  321. package/lib/eth1/provider/eth1Provider.d.ts +2 -2
  322. package/lib/eth1/provider/eth1Provider.js +5 -5
  323. package/lib/eth1/provider/eth1Provider.js.map +1 -1
  324. package/lib/eth1/provider/jsonRpcHttpClient.d.ts +2 -2
  325. package/lib/eth1/provider/jsonRpcHttpClient.js +6 -12
  326. package/lib/eth1/provider/jsonRpcHttpClient.js.map +1 -1
  327. package/lib/eth1/provider/jwt.js +0 -1
  328. package/lib/eth1/provider/jwt.js.map +1 -1
  329. package/lib/eth1/provider/utils.js +2 -2
  330. package/lib/eth1/provider/utils.js.map +1 -1
  331. package/lib/eth1/stream.d.ts +1 -1
  332. package/lib/eth1/stream.js +1 -1
  333. package/lib/eth1/stream.js.map +1 -1
  334. package/lib/eth1/utils/deposits.d.ts +1 -1
  335. package/lib/eth1/utils/deposits.js +4 -4
  336. package/lib/eth1/utils/deposits.js.map +1 -1
  337. package/lib/eth1/utils/eth1Data.js.map +1 -1
  338. package/lib/eth1/utils/eth1Vote.d.ts +1 -1
  339. package/lib/eth1/utils/eth1Vote.js +3 -5
  340. package/lib/eth1/utils/eth1Vote.js.map +1 -1
  341. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js +1 -3
  342. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js.map +1 -1
  343. package/lib/execution/builder/http.d.ts +18 -3
  344. package/lib/execution/builder/http.js +33 -8
  345. package/lib/execution/builder/http.js.map +1 -1
  346. package/lib/execution/builder/index.js +1 -0
  347. package/lib/execution/builder/index.js.map +1 -1
  348. package/lib/execution/builder/interface.d.ts +3 -2
  349. package/lib/execution/engine/http.d.ts +5 -5
  350. package/lib/execution/engine/http.js +9 -13
  351. package/lib/execution/engine/http.js.map +1 -1
  352. package/lib/execution/engine/index.d.ts +2 -2
  353. package/lib/execution/engine/index.js +1 -0
  354. package/lib/execution/engine/index.js.map +1 -1
  355. package/lib/execution/engine/interface.d.ts +3 -3
  356. package/lib/execution/engine/interface.js.map +1 -1
  357. package/lib/execution/engine/mock.d.ts +2 -2
  358. package/lib/execution/engine/mock.js +12 -15
  359. package/lib/execution/engine/mock.js.map +1 -1
  360. package/lib/execution/engine/payloadIdCache.d.ts +1 -1
  361. package/lib/execution/engine/types.d.ts +18 -26
  362. package/lib/execution/engine/types.js +33 -54
  363. package/lib/execution/engine/types.js.map +1 -1
  364. package/lib/execution/engine/utils.d.ts +1 -1
  365. package/lib/execution/engine/utils.js +3 -3
  366. package/lib/execution/engine/utils.js.map +1 -1
  367. package/lib/metrics/metrics/beacon.d.ts +9 -4
  368. package/lib/metrics/metrics/beacon.js +13 -3
  369. package/lib/metrics/metrics/beacon.js.map +1 -1
  370. package/lib/metrics/metrics/lodestar.d.ts +3 -4
  371. package/lib/metrics/metrics/lodestar.js +0 -6
  372. package/lib/metrics/metrics/lodestar.js.map +1 -1
  373. package/lib/metrics/metrics.d.ts +3 -3
  374. package/lib/metrics/metrics.js +1 -1
  375. package/lib/metrics/metrics.js.map +1 -1
  376. package/lib/metrics/nodeJsMetrics.js +1 -1
  377. package/lib/metrics/nodeJsMetrics.js.map +1 -1
  378. package/lib/metrics/server/http.d.ts +1 -1
  379. package/lib/metrics/server/http.js +1 -1
  380. package/lib/metrics/server/http.js.map +1 -1
  381. package/lib/metrics/utils/avgMinMax.d.ts +1 -1
  382. package/lib/metrics/utils/gauge.d.ts +1 -1
  383. package/lib/metrics/utils/gauge.js.map +1 -1
  384. package/lib/metrics/utils/registryMetricCreator.d.ts +1 -1
  385. package/lib/metrics/utils/registryMetricCreator.js +1 -1
  386. package/lib/metrics/utils/registryMetricCreator.js.map +1 -1
  387. package/lib/metrics/validatorMonitor.d.ts +2 -2
  388. package/lib/metrics/validatorMonitor.js +39 -51
  389. package/lib/metrics/validatorMonitor.js.map +1 -1
  390. package/lib/monitoring/properties.js +2 -4
  391. package/lib/monitoring/properties.js.map +1 -1
  392. package/lib/monitoring/service.js +4 -6
  393. package/lib/monitoring/service.js.map +1 -1
  394. package/lib/monitoring/system.js +0 -1
  395. package/lib/monitoring/system.js.map +1 -1
  396. package/lib/network/core/metrics.js +0 -2
  397. package/lib/network/core/metrics.js.map +1 -1
  398. package/lib/network/core/networkCore.d.ts +14 -14
  399. package/lib/network/core/networkCore.js +18 -12
  400. package/lib/network/core/networkCore.js.map +1 -1
  401. package/lib/network/core/networkCoreWorker.js +2 -3
  402. package/lib/network/core/networkCoreWorker.js.map +1 -1
  403. package/lib/network/core/networkCoreWorkerHandler.js +1 -1
  404. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  405. package/lib/network/core/types.d.ts +2 -2
  406. package/lib/network/discv5/index.d.ts +3 -3
  407. package/lib/network/discv5/index.js +3 -3
  408. package/lib/network/discv5/index.js.map +1 -1
  409. package/lib/network/discv5/utils.js +1 -0
  410. package/lib/network/discv5/utils.js.map +1 -1
  411. package/lib/network/discv5/worker.js +8 -9
  412. package/lib/network/discv5/worker.js.map +1 -1
  413. package/lib/network/events.d.ts +3 -3
  414. package/lib/network/events.js +1 -1
  415. package/lib/network/events.js.map +1 -1
  416. package/lib/network/forks.d.ts +1 -1
  417. package/lib/network/forks.js +0 -1
  418. package/lib/network/forks.js.map +1 -1
  419. package/lib/network/gossip/encoding.d.ts +1 -1
  420. package/lib/network/gossip/encoding.js +4 -6
  421. package/lib/network/gossip/encoding.js.map +1 -1
  422. package/lib/network/gossip/gossipsub.d.ts +2 -2
  423. package/lib/network/gossip/gossipsub.js +11 -12
  424. package/lib/network/gossip/gossipsub.js.map +1 -1
  425. package/lib/network/gossip/interface.d.ts +6 -6
  426. package/lib/network/gossip/metrics.js +0 -1
  427. package/lib/network/gossip/metrics.js.map +1 -1
  428. package/lib/network/gossip/scoringParameters.js +1 -2
  429. package/lib/network/gossip/scoringParameters.js.map +1 -1
  430. package/lib/network/gossip/topic.d.ts +2 -2
  431. package/lib/network/gossip/topic.js +5 -6
  432. package/lib/network/gossip/topic.js.map +1 -1
  433. package/lib/network/interface.d.ts +6 -10
  434. package/lib/network/libp2p/index.d.ts +1 -1
  435. package/lib/network/libp2p/index.js +2 -2
  436. package/lib/network/libp2p/index.js.map +1 -1
  437. package/lib/network/metadata.d.ts +1 -1
  438. package/lib/network/metadata.js.map +1 -1
  439. package/lib/network/network.d.ts +10 -10
  440. package/lib/network/network.js +10 -10
  441. package/lib/network/network.js.map +1 -1
  442. package/lib/network/options.d.ts +1 -1
  443. package/lib/network/peers/datastore.d.ts +1 -1
  444. package/lib/network/peers/datastore.js +1 -2
  445. package/lib/network/peers/datastore.js.map +1 -1
  446. package/lib/network/peers/discover.d.ts +2 -2
  447. package/lib/network/peers/discover.js +11 -16
  448. package/lib/network/peers/discover.js.map +1 -1
  449. package/lib/network/peers/peerManager.d.ts +5 -5
  450. package/lib/network/peers/peerManager.js +14 -11
  451. package/lib/network/peers/peerManager.js.map +1 -1
  452. package/lib/network/peers/peersData.d.ts +1 -1
  453. package/lib/network/peers/utils/enrSubnetsDeserialize.js +1 -1
  454. package/lib/network/peers/utils/enrSubnetsDeserialize.js.map +1 -1
  455. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  456. package/lib/network/processor/extractSlotRootFns.js +1 -1
  457. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  458. package/lib/network/processor/gossipHandlers.d.ts +4 -4
  459. package/lib/network/processor/gossipHandlers.js +11 -12
  460. package/lib/network/processor/gossipHandlers.js.map +1 -1
  461. package/lib/network/processor/gossipQueues/index.js +3 -5
  462. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  463. package/lib/network/processor/gossipQueues/indexed.js +1 -3
  464. package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
  465. package/lib/network/processor/gossipQueues/linear.d.ts +1 -1
  466. package/lib/network/processor/gossipQueues/linear.js +5 -7
  467. package/lib/network/processor/gossipQueues/linear.js.map +1 -1
  468. package/lib/network/processor/gossipValidatorFn.d.ts +1 -1
  469. package/lib/network/processor/gossipValidatorFn.js +1 -1
  470. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  471. package/lib/network/processor/index.d.ts +4 -4
  472. package/lib/network/processor/index.js +8 -6
  473. package/lib/network/processor/index.js.map +1 -1
  474. package/lib/network/processor/types.d.ts +1 -1
  475. package/lib/network/reqresp/ReqRespBeaconNode.d.ts +2 -2
  476. package/lib/network/reqresp/ReqRespBeaconNode.js +2 -2
  477. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  478. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.d.ts +2 -2
  479. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.js +5 -5
  480. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.js.map +1 -1
  481. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.d.ts +1 -1
  482. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.js +1 -1
  483. package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.js.map +1 -1
  484. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +1 -1
  485. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  486. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +1 -1
  487. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +2 -2
  488. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  489. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +1 -1
  490. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  491. package/lib/network/reqresp/handlers/index.js +1 -1
  492. package/lib/network/reqresp/handlers/index.js.map +1 -1
  493. package/lib/network/reqresp/handlers/lightClientBootstrap.js +3 -5
  494. package/lib/network/reqresp/handlers/lightClientBootstrap.js.map +1 -1
  495. package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js +7 -9
  496. package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js.map +1 -1
  497. package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js +8 -10
  498. package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js.map +1 -1
  499. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts +1 -1
  500. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +3 -5
  501. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
  502. package/lib/network/reqresp/handlers/status.js +1 -1
  503. package/lib/network/reqresp/handlers/status.js.map +1 -1
  504. package/lib/network/reqresp/protocols.js +1 -2
  505. package/lib/network/reqresp/protocols.js.map +1 -1
  506. package/lib/network/reqresp/rateLimit.js +2 -2
  507. package/lib/network/reqresp/rateLimit.js.map +1 -1
  508. package/lib/network/reqresp/score.js +0 -1
  509. package/lib/network/reqresp/score.js.map +1 -1
  510. package/lib/network/reqresp/types.js +3 -7
  511. package/lib/network/reqresp/types.js.map +1 -1
  512. package/lib/network/reqresp/utils/collect.d.ts +1 -1
  513. package/lib/network/reqresp/utils/collect.js +1 -1
  514. package/lib/network/reqresp/utils/collect.js.map +1 -1
  515. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -2
  516. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  517. package/lib/network/subnets/attnetsService.d.ts +3 -3
  518. package/lib/network/subnets/attnetsService.js +3 -3
  519. package/lib/network/subnets/attnetsService.js.map +1 -1
  520. package/lib/network/subnets/interface.d.ts +1 -1
  521. package/lib/network/subnets/syncnetsService.d.ts +1 -1
  522. package/lib/network/subnets/syncnetsService.js +1 -1
  523. package/lib/network/subnets/syncnetsService.js.map +1 -1
  524. package/lib/network/util.js +1 -1
  525. package/lib/network/util.js.map +1 -1
  526. package/lib/node/nodejs.d.ts +7 -7
  527. package/lib/node/nodejs.js +9 -9
  528. package/lib/node/nodejs.js.map +1 -1
  529. package/lib/node/notifier.js +18 -28
  530. package/lib/node/notifier.js.map +1 -1
  531. package/lib/node/options.d.ts +3 -3
  532. package/lib/node/options.js +3 -3
  533. package/lib/node/options.js.map +1 -1
  534. package/lib/node/utils/interop/deposits.d.ts +1 -1
  535. package/lib/node/utils/interop/deposits.js +3 -3
  536. package/lib/node/utils/interop/deposits.js.map +1 -1
  537. package/lib/node/utils/interop/state.d.ts +1 -1
  538. package/lib/node/utils/interop/state.js +2 -2
  539. package/lib/node/utils/interop/state.js.map +1 -1
  540. package/lib/node/utils/state.js.map +1 -1
  541. package/lib/sync/backfill/backfill.d.ts +6 -6
  542. package/lib/sync/backfill/backfill.js +6 -4
  543. package/lib/sync/backfill/backfill.js.map +1 -1
  544. package/lib/sync/backfill/errors.d.ts +1 -1
  545. package/lib/sync/backfill/errors.js.map +1 -1
  546. package/lib/sync/backfill/verify.d.ts +2 -3
  547. package/lib/sync/backfill/verify.js +1 -1
  548. package/lib/sync/backfill/verify.js.map +1 -1
  549. package/lib/sync/interface.d.ts +5 -5
  550. package/lib/sync/range/batch.d.ts +2 -2
  551. package/lib/sync/range/batch.js +1 -1
  552. package/lib/sync/range/batch.js.map +1 -1
  553. package/lib/sync/range/chain.d.ts +1 -1
  554. package/lib/sync/range/chain.js +1 -1
  555. package/lib/sync/range/chain.js.map +1 -1
  556. package/lib/sync/range/range.d.ts +3 -3
  557. package/lib/sync/range/range.js +5 -9
  558. package/lib/sync/range/range.js.map +1 -1
  559. package/lib/sync/range/utils/batches.js +1 -3
  560. package/lib/sync/range/utils/batches.js.map +1 -1
  561. package/lib/sync/range/utils/hashBlocks.d.ts +1 -1
  562. package/lib/sync/sync.d.ts +1 -1
  563. package/lib/sync/sync.js +31 -30
  564. package/lib/sync/sync.js.map +1 -1
  565. package/lib/sync/unknownBlock.d.ts +1 -1
  566. package/lib/sync/unknownBlock.js +7 -11
  567. package/lib/sync/unknownBlock.js.map +1 -1
  568. package/lib/sync/utils/pendingBlocksTree.js +1 -1
  569. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  570. package/lib/sync/utils/remoteSyncType.d.ts +1 -1
  571. package/lib/sync/utils/remoteSyncType.js +25 -36
  572. package/lib/sync/utils/remoteSyncType.js.map +1 -1
  573. package/lib/util/asyncIterableToEvents.js +0 -2
  574. package/lib/util/asyncIterableToEvents.js.map +1 -1
  575. package/lib/util/binarySearch.js +1 -1
  576. package/lib/util/binarySearch.js.map +1 -1
  577. package/lib/util/bitArray.js +1 -2
  578. package/lib/util/bitArray.js.map +1 -1
  579. package/lib/util/blobs.d.ts +2 -2
  580. package/lib/util/blobs.js +2 -2
  581. package/lib/util/blobs.js.map +1 -1
  582. package/lib/util/clock.d.ts +2 -2
  583. package/lib/util/clock.js +1 -1
  584. package/lib/util/clock.js.map +1 -1
  585. package/lib/util/kzg.js +4 -5
  586. package/lib/util/kzg.js.map +1 -1
  587. package/lib/util/map.js +0 -1
  588. package/lib/util/map.js.map +1 -1
  589. package/lib/util/multifork.d.ts +1 -1
  590. package/lib/util/multifork.js.map +1 -1
  591. package/lib/util/peerId.js +1 -1
  592. package/lib/util/peerId.js.map +1 -1
  593. package/lib/util/profile.js +1 -1
  594. package/lib/util/profile.js.map +1 -1
  595. package/lib/util/queue/errors.d.ts +0 -1
  596. package/lib/util/queue/errors.js +0 -3
  597. package/lib/util/queue/errors.js.map +1 -1
  598. package/lib/util/queue/fnQueue.d.ts +1 -1
  599. package/lib/util/queue/fnQueue.js +1 -1
  600. package/lib/util/queue/fnQueue.js.map +1 -1
  601. package/lib/util/queue/itemQueue.d.ts +1 -1
  602. package/lib/util/queue/itemQueue.js +3 -3
  603. package/lib/util/queue/itemQueue.js.map +1 -1
  604. package/lib/util/sszBytes.d.ts +1 -1
  605. package/lib/util/sszBytes.js.map +1 -1
  606. package/package.json +18 -18
  607. package/lib/chain/archiver/archiveStates.js.map +0 -1
@@ -1,23 +1,26 @@
1
+ import { PubkeyIndexMap } from "@chainsafe/pubkey-index-map";
1
2
  import { routes } from "@lodestar/api";
2
- import { computeStartSlotAtEpoch, calculateCommitteeAssignments, proposerShufflingDecisionRoot, attesterShufflingDecisionRoot, getBlockRootAtSlot, computeEpochAtSlot, getCurrentSlot, beaconBlockToBlinded, } from "@lodestar/state-transition";
3
- import { GENESIS_SLOT, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SUBNET_SIZE, isForkBlobs, isForkExecution, ForkSeq, isForkPostElectra, } from "@lodestar/params";
3
+ import { DataAvailabilityStatus, ExecutionStatus } from "@lodestar/fork-choice";
4
+ import { ForkSeq, GENESIS_SLOT, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SUBNET_SIZE, isForkBlobs, isForkExecution, isForkPostElectra, } from "@lodestar/params";
5
+ import { attesterShufflingDecisionRoot, beaconBlockToBlinded, calculateCommitteeAssignments, computeEpochAtSlot, computeStartSlotAtEpoch, createCachedBeaconState, getBlockRootAtSlot, getCurrentSlot, loadState, proposerShufflingDecisionRoot, } from "@lodestar/state-transition";
6
+ import { ProducedBlockSource, getValidatorStatus, isBlindedBeaconBlock, isBlockContents, ssz, } from "@lodestar/types";
7
+ import { TimeoutError, formatWeiToEth, fromHex, prettyWeiToEth, resolveOrRacePromises, toHex, toRootHex, } from "@lodestar/utils";
4
8
  import { MAX_BUILDER_BOOST_FACTOR } from "@lodestar/validator";
5
- import { ssz, ProducedBlockSource, isBlindedBeaconBlock, isBlockContents, getValidatorStatus, } from "@lodestar/types";
6
- import { ExecutionStatus, DataAvailabilityStatus } from "@lodestar/fork-choice";
7
- import { fromHex, toHex, resolveOrRacePromises, prettyWeiToEth, toRootHex } from "@lodestar/utils";
8
9
  import { AttestationError, AttestationErrorCode, GossipAction, SyncCommitteeError, SyncCommitteeErrorCode, } from "../../../chain/errors/index.js";
10
+ import { ChainEvent } from "../../../chain/index.js";
11
+ import { SCHEDULER_LOOKAHEAD_FACTOR } from "../../../chain/prepareNextSlot.js";
12
+ import { RegenCaller } from "../../../chain/regen/index.js";
9
13
  import { validateApiAggregateAndProof } from "../../../chain/validation/index.js";
14
+ import { validateSyncCommitteeGossipContributionAndProof } from "../../../chain/validation/syncCommitteeContributionAndProof.js";
10
15
  import { ZERO_HASH } from "../../../constants/index.js";
16
+ import { NoBidReceived } from "../../../execution/builder/http.js";
17
+ import { validateGossipFnRetryUnknownRoot } from "../../../network/processor/gossipHandlers.js";
11
18
  import { SyncState } from "../../../sync/index.js";
12
19
  import { isOptimisticBlock } from "../../../util/forkChoice.js";
13
20
  import { getDefaultGraffiti, toGraffitiBuffer } from "../../../util/graffiti.js";
14
- import { ApiError, NodeIsSyncing, OnlySupportedByDVT } from "../errors.js";
15
- import { validateSyncCommitteeGossipContributionAndProof } from "../../../chain/validation/syncCommitteeContributionAndProof.js";
16
- import { RegenCaller } from "../../../chain/regen/index.js";
17
- import { validateGossipFnRetryUnknownRoot } from "../../../network/processor/gossipHandlers.js";
18
- import { SCHEDULER_LOOKAHEAD_FACTOR } from "../../../chain/prepareNextSlot.js";
19
- import { ChainEvent } from "../../../chain/index.js";
20
21
  import { getLodestarClientVersion } from "../../../util/metadata.js";
22
+ import { getStateResponseWithRegen } from "../beacon/state/utils.js";
23
+ import { ApiError, NodeIsSyncing, OnlySupportedByDVT } from "../errors.js";
21
24
  import { computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProductionSource } from "./utils.js";
22
25
  /**
23
26
  * If the node is within this many epochs from the head, we declare it to be synced regardless of
@@ -34,7 +37,7 @@ import { computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProd
34
37
  */
35
38
  export const SYNC_TOLERANCE_EPOCHS = 1;
36
39
  /**
37
- * Cutoff time to wait for execution and builder block production apis to resolve
40
+ * Cutoff time to wait from start of the slot for execution and builder block production apis to resolve
38
41
  * Post this time, race execution and builder to pick whatever resolves first
39
42
  *
40
43
  * Empirically the builder block resolves in ~1.5+ seconds, and execution should resolve <1 sec.
@@ -44,6 +47,31 @@ export const SYNC_TOLERANCE_EPOCHS = 1;
44
47
  const BLOCK_PRODUCTION_RACE_CUTOFF_MS = 2_000;
45
48
  /** Overall timeout for execution and block production apis */
46
49
  const BLOCK_PRODUCTION_RACE_TIMEOUT_MS = 12_000;
50
+ /**
51
+ * Engine block selection reasons tracked in metrics
52
+ */
53
+ export var EngineBlockSelectionReason;
54
+ (function (EngineBlockSelectionReason) {
55
+ EngineBlockSelectionReason["BuilderDisabled"] = "builder_disabled";
56
+ EngineBlockSelectionReason["BuilderError"] = "builder_error";
57
+ EngineBlockSelectionReason["BuilderTimeout"] = "builder_timeout";
58
+ EngineBlockSelectionReason["BuilderPending"] = "builder_pending";
59
+ EngineBlockSelectionReason["BuilderNoBid"] = "builder_no_bid";
60
+ EngineBlockSelectionReason["BuilderCensorship"] = "builder_censorship";
61
+ EngineBlockSelectionReason["BlockValue"] = "block_value";
62
+ EngineBlockSelectionReason["EnginePreferred"] = "engine_preferred";
63
+ })(EngineBlockSelectionReason || (EngineBlockSelectionReason = {}));
64
+ /**
65
+ * Builder block selection reasons tracked in metrics
66
+ */
67
+ export var BuilderBlockSelectionReason;
68
+ (function (BuilderBlockSelectionReason) {
69
+ BuilderBlockSelectionReason["EngineDisabled"] = "engine_disabled";
70
+ BuilderBlockSelectionReason["EngineError"] = "engine_error";
71
+ BuilderBlockSelectionReason["EnginePending"] = "engine_pending";
72
+ BuilderBlockSelectionReason["BlockValue"] = "block_value";
73
+ BuilderBlockSelectionReason["BuilderPreferred"] = "builder_preferred";
74
+ })(BuilderBlockSelectionReason || (BuilderBlockSelectionReason = {}));
47
75
  /**
48
76
  * Server implementation for handling validator duties.
49
77
  * See `@lodestar/validator/src/api` for the client implementation).
@@ -89,7 +117,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
89
117
  if (msToSlot > MAX_API_CLOCK_DISPARITY_MS) {
90
118
  throw Error(`Requested slot ${slot} is in the future`);
91
119
  }
92
- else if (msToSlot > 0) {
120
+ if (msToSlot > 0) {
93
121
  await chain.clock.waitForSlot(slot);
94
122
  }
95
123
  // else, clock already in slot or slot is in the past
@@ -128,20 +156,18 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
128
156
  blockTotalValue: prettyWeiToEth(totalValue),
129
157
  };
130
158
  }
131
- else if (source === ProducedBlockSource.builder) {
159
+ if (source === ProducedBlockSource.builder) {
132
160
  return {
133
161
  builderExecutionPayloadValue: prettyWeiToEth(executionValue),
134
162
  builderConsensusBlockValue: prettyWeiToEth(consensusValue),
135
163
  builderBlockTotalValue: prettyWeiToEth(totalValue),
136
164
  };
137
165
  }
138
- else {
139
- return {
140
- engineExecutionPayloadValue: prettyWeiToEth(executionValue),
141
- engineConsensusBlockValue: prettyWeiToEth(consensusValue),
142
- engineBlockTotalValue: prettyWeiToEth(totalValue),
143
- };
144
- }
166
+ return {
167
+ engineExecutionPayloadValue: prettyWeiToEth(executionValue),
168
+ engineConsensusBlockValue: prettyWeiToEth(consensusValue),
169
+ engineBlockTotalValue: prettyWeiToEth(totalValue),
170
+ };
145
171
  }
146
172
  /**
147
173
  * This function is called 1s before next epoch, usually at that time PrepareNextSlotScheduler finishes
@@ -203,9 +229,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
203
229
  if (currentSlot - headSlot > SYNC_TOLERANCE_EPOCHS * SLOTS_PER_EPOCH) {
204
230
  throw new NodeIsSyncing(`headSlot ${headSlot} currentSlot ${currentSlot}`);
205
231
  }
206
- else {
207
- return;
208
- }
232
+ return;
209
233
  }
210
234
  case SyncState.Synced:
211
235
  return;
@@ -268,10 +292,6 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
268
292
  if (skipHeadChecksAndUpdate !== true) {
269
293
  notWhileSyncing();
270
294
  await waitForSlot(slot); // Must never request for a future slot > currentSlot
271
- // Process the queued attestations in the forkchoice for correct head estimation
272
- // forkChoice.updateTime() might have already been called by the onSlot clock
273
- // handler, in which case this should just return.
274
- chain.forkChoice.updateTime(slot);
275
295
  parentBlockRoot = fromHex(chain.getProposerHead(slot).blockRoot);
276
296
  }
277
297
  else {
@@ -290,6 +310,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
290
310
  });
291
311
  metrics?.blockProductionSuccess.inc({ source });
292
312
  metrics?.blockProductionNumAggregated.observe({ source }, block.body.attestations.length);
313
+ metrics?.blockProductionExecutionPayloadValue.observe({ source }, Number(formatWeiToEth(executionPayloadValue)));
293
314
  logger.verbose("Produced blinded block", {
294
315
  slot,
295
316
  executionPayloadValue,
@@ -313,10 +334,6 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
313
334
  if (skipHeadChecksAndUpdate !== true) {
314
335
  notWhileSyncing();
315
336
  await waitForSlot(slot); // Must never request for a future slot > currentSlot
316
- // Process the queued attestations in the forkchoice for correct head estimation
317
- // forkChoice.updateTime() might have already been called by the onSlot clock
318
- // handler, in which case this should just return.
319
- chain.forkChoice.updateTime(slot);
320
337
  parentBlockRoot = fromHex(chain.getProposerHead(slot).blockRoot);
321
338
  }
322
339
  else {
@@ -343,6 +360,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
343
360
  }
344
361
  metrics?.blockProductionSuccess.inc({ source });
345
362
  metrics?.blockProductionNumAggregated.observe({ source }, block.body.attestations.length);
363
+ metrics?.blockProductionExecutionPayloadValue.observe({ source }, Number(formatWeiToEth(executionPayloadValue)));
346
364
  logger.verbose("Produced execution block", {
347
365
  slot,
348
366
  executionPayloadValue,
@@ -366,9 +384,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
366
384
  shouldOverrideBuilder,
367
385
  };
368
386
  }
369
- else {
370
- return { data: block, version, executionPayloadValue, consensusBlockValue, shouldOverrideBuilder };
371
- }
387
+ return { data: block, version, executionPayloadValue, consensusBlockValue, shouldOverrideBuilder };
372
388
  }
373
389
  finally {
374
390
  if (timer)
@@ -380,10 +396,6 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
380
396
  _skipRandaoVerification, builderBoostFactor, { feeRecipient, builderSelection, strictFeeRecipientCheck } = {}) {
381
397
  notWhileSyncing();
382
398
  await waitForSlot(slot); // Must never request for a future slot > currentSlot
383
- // Process the queued attestations in the forkchoice for correct head estimation
384
- // forkChoice.updateTime() might have already been called by the onSlot clock
385
- // handler, in which case this should just return.
386
- chain.forkChoice.updateTime(slot);
387
399
  const parentBlockRoot = fromHex(chain.getProposerHead(slot).blockRoot);
388
400
  notOnOutOfRangeData(parentBlockRoot);
389
401
  const fork = config.getForkName(slot);
@@ -428,9 +440,11 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
428
440
  graffiti: toGraffitiBuffer(graffiti ?? getDefaultGraffiti(getLodestarClientVersion(opts), chain.executionEngine.clientVersion, opts)),
429
441
  });
430
442
  logger.debug("Produced common block body", loggerContext);
443
+ // Calculate cutoff time based on start of the slot
444
+ const cutoffMs = Math.max(0, BLOCK_PRODUCTION_RACE_CUTOFF_MS - Math.round(chain.clock.secFromSlot(slot) * 1000));
431
445
  logger.verbose("Block production race (builder vs execution) starting", {
432
446
  ...loggerContext,
433
- cutoffMs: BLOCK_PRODUCTION_RACE_CUTOFF_MS,
447
+ cutoffMs,
434
448
  timeoutMs: BLOCK_PRODUCTION_RACE_TIMEOUT_MS,
435
449
  });
436
450
  // use abort controller to stop waiting for both block sources
@@ -469,7 +483,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
469
483
  })
470
484
  : Promise.reject(new Error("Engine disabled"));
471
485
  const [builder, engine] = await resolveOrRacePromises([builderPromise, enginePromise], {
472
- resolveTimeoutMs: BLOCK_PRODUCTION_RACE_CUTOFF_MS,
486
+ resolveTimeoutMs: cutoffMs,
473
487
  raceTimeoutMs: BLOCK_PRODUCTION_RACE_TIMEOUT_MS,
474
488
  signal: controller.signal,
475
489
  });
@@ -483,10 +497,18 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
483
497
  }, engine.reason);
484
498
  }
485
499
  if (builder.status === "rejected" && isBuilderEnabled) {
486
- logger.warn("Builder failed to produce the block", {
487
- ...loggerContext,
488
- durationMs: builder.durationMs,
489
- }, builder.reason);
500
+ if (builder.reason instanceof NoBidReceived) {
501
+ logger.info("Builder did not provide a bid", {
502
+ ...loggerContext,
503
+ durationMs: builder.durationMs,
504
+ });
505
+ }
506
+ else {
507
+ logger.warn("Builder failed to produce the block", {
508
+ ...loggerContext,
509
+ durationMs: builder.durationMs,
510
+ }, builder.reason);
511
+ }
490
512
  }
491
513
  if (builder.status === "rejected" && engine.status === "rejected") {
492
514
  throw Error(`${isBuilderEnabled && isEngineEnabled ? "Builder and engine both" : isBuilderEnabled ? "Builder" : "Engine"} failed to produce the block`);
@@ -499,6 +521,10 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
499
521
  shouldOverrideBuilder: engine.value.shouldOverrideBuilder,
500
522
  ...getBlockValueLogInfo(engine.value),
501
523
  });
524
+ metrics?.blockProductionSelectionResults.inc({
525
+ source: ProducedBlockSource.engine,
526
+ reason: EngineBlockSelectionReason.BuilderCensorship,
527
+ });
502
528
  return { ...engine.value, executionPayloadBlinded: false, executionPayloadSource: ProducedBlockSource.engine };
503
529
  }
504
530
  if (builder.status === "fulfilled" && engine.status !== "fulfilled") {
@@ -507,6 +533,14 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
507
533
  durationMs: builder.durationMs,
508
534
  ...getBlockValueLogInfo(builder.value),
509
535
  });
536
+ metrics?.blockProductionSelectionResults.inc({
537
+ source: ProducedBlockSource.builder,
538
+ reason: isEngineEnabled === false
539
+ ? BuilderBlockSelectionReason.EngineDisabled
540
+ : engine.status === "pending"
541
+ ? BuilderBlockSelectionReason.EnginePending
542
+ : BuilderBlockSelectionReason.EngineError,
543
+ });
510
544
  return { ...builder.value, executionPayloadBlinded: true, executionPayloadSource: ProducedBlockSource.builder };
511
545
  }
512
546
  if (engine.status === "fulfilled" && builder.status !== "fulfilled") {
@@ -515,15 +549,29 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
515
549
  durationMs: engine.durationMs,
516
550
  ...getBlockValueLogInfo(engine.value),
517
551
  });
552
+ metrics?.blockProductionSelectionResults.inc({
553
+ source: ProducedBlockSource.engine,
554
+ reason: isBuilderEnabled === false
555
+ ? EngineBlockSelectionReason.BuilderDisabled
556
+ : builder.status === "pending"
557
+ ? EngineBlockSelectionReason.BuilderPending
558
+ : builder.reason instanceof NoBidReceived
559
+ ? EngineBlockSelectionReason.BuilderNoBid
560
+ : builder.reason instanceof TimeoutError
561
+ ? EngineBlockSelectionReason.BuilderTimeout
562
+ : EngineBlockSelectionReason.BuilderError,
563
+ });
518
564
  return { ...engine.value, executionPayloadBlinded: false, executionPayloadSource: ProducedBlockSource.engine };
519
565
  }
520
566
  if (engine.status === "fulfilled" && builder.status === "fulfilled") {
521
- const executionPayloadSource = selectBlockProductionSource({
567
+ const result = selectBlockProductionSource({
522
568
  builderBlockValue: builder.value.executionPayloadValue + builder.value.consensusBlockValue,
523
569
  engineBlockValue: engine.value.executionPayloadValue + engine.value.consensusBlockValue,
524
570
  builderBoostFactor,
525
571
  builderSelection,
526
572
  });
573
+ const executionPayloadSource = result.source;
574
+ metrics?.blockProductionSelectionResults.inc(result);
527
575
  logger.info(`Selected ${executionPayloadSource} block`, {
528
576
  ...loggerContext,
529
577
  engineDurationMs: engine.durationMs,
@@ -538,13 +586,11 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
538
586
  executionPayloadSource,
539
587
  };
540
588
  }
541
- else {
542
- return {
543
- ...builder.value,
544
- executionPayloadBlinded: true,
545
- executionPayloadSource,
546
- };
547
- }
589
+ return {
590
+ ...builder.value,
591
+ executionPayloadBlinded: true,
592
+ executionPayloadSource,
593
+ };
548
594
  }
549
595
  throw Error("Unreachable error occurred during the builder and execution block production");
550
596
  }
@@ -559,27 +605,21 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
559
605
  if (meta.executionPayloadBlinded) {
560
606
  return { data, meta };
561
607
  }
562
- else {
563
- if (isBlockContents(data)) {
564
- const { block } = data;
565
- const blindedBlock = beaconBlockToBlinded(config, block);
566
- return {
567
- data: blindedBlock,
568
- meta: { ...meta, executionPayloadBlinded: true },
569
- };
570
- }
571
- else {
572
- const blindedBlock = beaconBlockToBlinded(config, data);
573
- return {
574
- data: blindedBlock,
575
- meta: { ...meta, executionPayloadBlinded: true },
576
- };
577
- }
608
+ if (isBlockContents(data)) {
609
+ const { block } = data;
610
+ const blindedBlock = beaconBlockToBlinded(config, block);
611
+ return {
612
+ data: blindedBlock,
613
+ meta: { ...meta, executionPayloadBlinded: true },
614
+ };
578
615
  }
616
+ const blindedBlock = beaconBlockToBlinded(config, data);
617
+ return {
618
+ data: blindedBlock,
619
+ meta: { ...meta, executionPayloadBlinded: true },
620
+ };
579
621
  }
580
- else {
581
- return { data, meta };
582
- }
622
+ return { data, meta };
583
623
  },
584
624
  async produceBlindedBlock({ slot, randaoReveal, graffiti }) {
585
625
  const { data, version } = await produceEngineOrBuilderBlock(slot, randaoReveal, graffiti);
@@ -591,13 +631,11 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
591
631
  const blindedBlock = beaconBlockToBlinded(config, block);
592
632
  return { data: blindedBlock, meta: { version } };
593
633
  }
594
- else if (isBlindedBeaconBlock(data)) {
634
+ if (isBlindedBeaconBlock(data)) {
595
635
  return { data, meta: { version } };
596
636
  }
597
- else {
598
- const blindedBlock = beaconBlockToBlinded(config, data);
599
- return { data: blindedBlock, meta: { version } };
600
- }
637
+ const blindedBlock = beaconBlockToBlinded(config, data);
638
+ return { data: blindedBlock, meta: { version } };
601
639
  },
602
640
  async produceAttestationData({ committeeIndex, slot }) {
603
641
  notWhileSyncing();
@@ -673,14 +711,15 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
673
711
  },
674
712
  async getProposerDuties({ epoch }) {
675
713
  notWhileSyncing();
676
- // Early check that epoch is within [current_epoch, current_epoch + 1], or allow for pre-genesis
714
+ // Early check that epoch is no more than current_epoch + 1, or allow for pre-genesis
677
715
  const currentEpoch = currentEpochWithDisparity();
678
716
  const nextEpoch = currentEpoch + 1;
679
- if (currentEpoch >= 0 && epoch !== currentEpoch && epoch !== nextEpoch) {
680
- throw Error(`Requested epoch ${epoch} must equal current ${currentEpoch} or next epoch ${nextEpoch}`);
717
+ if (currentEpoch >= 0 && epoch > nextEpoch) {
718
+ throw new ApiError(400, `Requested epoch ${epoch} must not be more than one epoch in the future`);
681
719
  }
682
720
  const head = chain.forkChoice.getHead();
683
721
  let state = undefined;
722
+ const startSlot = computeStartSlotAtEpoch(epoch);
684
723
  const slotMs = config.SECONDS_PER_SLOT * 1000;
685
724
  const prepareNextSlotLookAheadMs = slotMs / SCHEDULER_LOOKAHEAD_FACTOR;
686
725
  const toNextEpochMs = msToNextEpoch();
@@ -698,28 +737,59 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
698
737
  }
699
738
  }
700
739
  if (!state) {
701
- state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.getDuties);
740
+ if (epoch >= currentEpoch - 1) {
741
+ // Cached beacon state stores proposers for previous, current and next epoch. The
742
+ // requested epoch is within that range, we can use the head state at current epoch
743
+ state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.getDuties);
744
+ }
745
+ else {
746
+ const res = await getStateResponseWithRegen(chain, startSlot);
747
+ const stateViewDU = res.state instanceof Uint8Array
748
+ ? loadState(config, chain.getHeadState(), res.state).state
749
+ : res.state.clone();
750
+ state = createCachedBeaconState(stateViewDU, {
751
+ config: chain.config,
752
+ // Not required to compute proposers
753
+ pubkey2index: new PubkeyIndexMap(),
754
+ index2pubkey: [],
755
+ }, { skipSyncPubkeys: true, skipSyncCommitteeCache: true });
756
+ if (state.epochCtx.epoch !== epoch) {
757
+ throw Error(`Loaded state epoch ${state.epochCtx.epoch} does not match requested epoch ${epoch}`);
758
+ }
759
+ }
702
760
  }
703
761
  const stateEpoch = state.epochCtx.epoch;
704
762
  let indexes = [];
705
- if (epoch === stateEpoch) {
706
- indexes = state.epochCtx.getBeaconProposers();
707
- }
708
- else if (epoch === stateEpoch + 1) {
709
- // Requesting duties for next epoch is allow since they can be predicted with high probabilities.
710
- // @see `epochCtx.getBeaconProposersNextEpoch` JSDocs for rationale.
711
- indexes = state.epochCtx.getBeaconProposersNextEpoch();
712
- }
713
- else {
714
- // Should never happen, epoch is checked to be in bounds above
715
- throw Error(`Proposer duties for epoch ${epoch} not supported, current epoch ${stateEpoch}`);
763
+ switch (epoch) {
764
+ case stateEpoch:
765
+ indexes = state.epochCtx.getBeaconProposers();
766
+ break;
767
+ case stateEpoch + 1:
768
+ // make sure shuffling is calculated and ready for next call to calculate nextProposers
769
+ await chain.shufflingCache.get(state.epochCtx.nextEpoch, state.epochCtx.nextDecisionRoot);
770
+ // Requesting duties for next epoch is allowed since they can be predicted with high probabilities.
771
+ // @see `epochCtx.getBeaconProposersNextEpoch` JSDocs for rationale.
772
+ indexes = state.epochCtx.getBeaconProposersNextEpoch();
773
+ break;
774
+ case stateEpoch - 1: {
775
+ const indexesPrevEpoch = state.epochCtx.getBeaconProposersPrevEpoch();
776
+ if (indexesPrevEpoch === null) {
777
+ // Should not happen as previous proposer duties should be initialized for head state
778
+ // and if we load state from `Uint8Array` it will always be the state of requested epoch
779
+ throw Error(`Proposer duties for previous epoch ${epoch} not yet initialized`);
780
+ }
781
+ indexes = indexesPrevEpoch;
782
+ break;
783
+ }
784
+ default:
785
+ // Should never happen, epoch is checked to be in bounds above
786
+ throw Error(`Proposer duties for epoch ${epoch} not supported, current epoch ${stateEpoch}`);
716
787
  }
717
788
  // NOTE: this is the fastest way of getting compressed pubkeys.
718
789
  // See benchmark -> packages/lodestar/test/perf/api/impl/validator/attester.test.ts
719
790
  // After dropping the flat caches attached to the CachedBeaconState it's no longer available.
720
791
  // TODO: Add a flag to just send 0x00 as pubkeys since the Lodestar validator does not need them.
721
792
  const pubkeys = getPubkeysForIndices(state.validators, indexes);
722
- const startSlot = computeStartSlotAtEpoch(epoch);
723
793
  const duties = [];
724
794
  for (let i = 0; i < SLOTS_PER_EPOCH; i++) {
725
795
  duties.push({ slot: startSlot + i, validatorIndex: indexes[i], pubkey: pubkeys[i] });
@@ -872,7 +942,6 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
872
942
  await Promise.all(signedAggregateAndProofs.map(async (signedAggregateAndProof, i) => {
873
943
  try {
874
944
  // TODO: Validate in batch
875
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
876
945
  const validateFn = () => validateApiAggregateAndProof(fork, chain, signedAggregateAndProof);
877
946
  const { slot, beaconBlockRoot } = signedAggregateAndProof.message.aggregate.data;
878
947
  // when a validator is configured with multiple beacon node urls, this attestation may come from another beacon node
@@ -902,7 +971,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
902
971
  if (errors.length > 1) {
903
972
  throw Error("Multiple errors on publishAggregateAndProofs\n" + errors.map((e) => e.message).join("\n"));
904
973
  }
905
- else if (errors.length === 1) {
974
+ if (errors.length === 1) {
906
975
  throw errors[0];
907
976
  }
908
977
  },
@@ -944,7 +1013,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
944
1013
  if (errors.length > 1) {
945
1014
  throw Error("Multiple errors on publishContributionAndProofs\n" + errors.map((e) => e.message).join("\n"));
946
1015
  }
947
- else if (errors.length === 1) {
1016
+ if (errors.length === 1) {
948
1017
  throw errors[0];
949
1018
  }
950
1019
  },
@@ -1039,8 +1108,7 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
1039
1108
  return false;
1040
1109
  const validator = headState.validators.getReadonly(validatorIndex);
1041
1110
  const status = getValidatorStatus(validator, currentEpoch);
1042
- return (status === "active" ||
1043
- status === "active_exiting" ||
1111
+ return (status === "active_exiting" ||
1044
1112
  status === "active_ongoing" ||
1045
1113
  status === "active_slashed" ||
1046
1114
  status === "pending_initialized" ||