@lodestar/beacon-node 1.22.0 → 1.23.0-dev.06b4c2d324

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