@lodestar/beacon-node 1.39.1 → 1.40.0-dev.059f489b0f

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 (509) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +23 -27
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/utils.d.ts +2 -7
  5. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  6. package/lib/api/impl/beacon/state/utils.js +0 -12
  7. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  8. package/lib/api/impl/config/constants.d.ts +3 -0
  9. package/lib/api/impl/config/constants.d.ts.map +1 -1
  10. package/lib/api/impl/config/constants.js +5 -1
  11. package/lib/api/impl/config/constants.js.map +1 -1
  12. package/lib/api/impl/debug/index.d.ts +1 -1
  13. package/lib/api/impl/debug/index.d.ts.map +1 -1
  14. package/lib/api/impl/debug/index.js +3 -6
  15. package/lib/api/impl/debug/index.js.map +1 -1
  16. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  17. package/lib/api/impl/lodestar/index.js +30 -3
  18. package/lib/api/impl/lodestar/index.js.map +1 -1
  19. package/lib/api/impl/proof/index.d.ts.map +1 -1
  20. package/lib/api/impl/proof/index.js +1 -2
  21. package/lib/api/impl/proof/index.js.map +1 -1
  22. package/lib/api/impl/validator/index.d.ts.map +1 -1
  23. package/lib/api/impl/validator/index.js +10 -11
  24. package/lib/api/impl/validator/index.js.map +1 -1
  25. package/lib/api/rest/base.d.ts.map +1 -1
  26. package/lib/api/rest/base.js +2 -2
  27. package/lib/api/rest/base.js.map +1 -1
  28. package/lib/chain/ColumnReconstructionTracker.d.ts +2 -0
  29. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  30. package/lib/chain/ColumnReconstructionTracker.js +7 -3
  31. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  32. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  33. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -4
  34. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  35. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  36. package/lib/chain/archiveStore/utils/archiveBlocks.js +23 -14
  37. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  38. package/lib/chain/blocks/blockInput/blockInput.d.ts +30 -0
  39. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  40. package/lib/chain/blocks/blockInput/blockInput.js +44 -3
  41. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  42. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  43. package/lib/chain/blocks/importBlock.js +15 -10
  44. package/lib/chain/blocks/importBlock.js.map +1 -1
  45. package/lib/chain/blocks/index.d.ts.map +1 -1
  46. package/lib/chain/blocks/index.js +0 -14
  47. package/lib/chain/blocks/index.js.map +1 -1
  48. package/lib/chain/blocks/types.d.ts +0 -2
  49. package/lib/chain/blocks/types.d.ts.map +1 -1
  50. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  51. package/lib/chain/blocks/verifyBlock.js +9 -9
  52. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  53. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  54. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  55. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  56. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  57. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  58. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +2 -2
  59. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  60. package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
  61. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  62. package/lib/chain/blocks/writeBlockInputToDb.js +28 -28
  63. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  64. package/lib/chain/bls/multithread/index.d.ts +3 -1
  65. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  66. package/lib/chain/bls/multithread/index.js +5 -3
  67. package/lib/chain/bls/multithread/index.js.map +1 -1
  68. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  69. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  70. package/lib/chain/bls/multithread/jobItem.js +2 -2
  71. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  72. package/lib/chain/bls/singleThread.d.ts +4 -2
  73. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  74. package/lib/chain/bls/singleThread.js +4 -2
  75. package/lib/chain/bls/singleThread.js.map +1 -1
  76. package/lib/chain/bls/utils.d.ts +2 -2
  77. package/lib/chain/bls/utils.d.ts.map +1 -1
  78. package/lib/chain/bls/utils.js +9 -6
  79. package/lib/chain/bls/utils.js.map +1 -1
  80. package/lib/chain/chain.d.ts +25 -7
  81. package/lib/chain/chain.d.ts.map +1 -1
  82. package/lib/chain/chain.js +213 -50
  83. package/lib/chain/chain.js.map +1 -1
  84. package/lib/chain/errors/attestationError.d.ts +14 -1
  85. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  86. package/lib/chain/errors/attestationError.js +8 -0
  87. package/lib/chain/errors/attestationError.js.map +1 -1
  88. package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
  89. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
  90. package/lib/chain/errors/executionPayloadBid.js +15 -0
  91. package/lib/chain/errors/executionPayloadBid.js.map +1 -0
  92. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  93. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
  94. package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
  95. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
  96. package/lib/chain/errors/index.d.ts +3 -0
  97. package/lib/chain/errors/index.d.ts.map +1 -1
  98. package/lib/chain/errors/index.js +3 -0
  99. package/lib/chain/errors/index.js.map +1 -1
  100. package/lib/chain/errors/payloadAttestation.d.ts +34 -0
  101. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
  102. package/lib/chain/errors/payloadAttestation.js +13 -0
  103. package/lib/chain/errors/payloadAttestation.js.map +1 -0
  104. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  105. package/lib/chain/forkChoice/index.js +18 -0
  106. package/lib/chain/forkChoice/index.js.map +1 -1
  107. package/lib/chain/initState.d.ts +1 -1
  108. package/lib/chain/initState.d.ts.map +1 -1
  109. package/lib/chain/initState.js +7 -5
  110. package/lib/chain/initState.js.map +1 -1
  111. package/lib/chain/interface.d.ts +23 -5
  112. package/lib/chain/interface.d.ts.map +1 -1
  113. package/lib/chain/interface.js.map +1 -1
  114. package/lib/chain/lightClient/index.d.ts.map +1 -1
  115. package/lib/chain/lightClient/index.js +1 -2
  116. package/lib/chain/lightClient/index.js.map +1 -1
  117. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  118. package/lib/chain/lightClient/proofs.js +0 -2
  119. package/lib/chain/lightClient/proofs.js.map +1 -1
  120. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +5 -9
  121. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  122. package/lib/chain/opPools/aggregatedAttestationPool.js +12 -141
  123. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  124. package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
  125. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
  126. package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
  127. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
  128. package/lib/chain/opPools/index.d.ts +2 -0
  129. package/lib/chain/opPools/index.d.ts.map +1 -1
  130. package/lib/chain/opPools/index.js +2 -0
  131. package/lib/chain/opPools/index.js.map +1 -1
  132. package/lib/chain/opPools/opPool.js +5 -8
  133. package/lib/chain/opPools/opPool.js.map +1 -1
  134. package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
  135. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
  136. package/lib/chain/opPools/payloadAttestationPool.js +109 -0
  137. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
  138. package/lib/chain/options.d.ts +0 -1
  139. package/lib/chain/options.d.ts.map +1 -1
  140. package/lib/chain/options.js +0 -1
  141. package/lib/chain/options.js.map +1 -1
  142. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  143. package/lib/chain/prepareNextSlot.js +9 -10
  144. package/lib/chain/prepareNextSlot.js.map +1 -1
  145. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  146. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  147. package/lib/chain/produceBlock/produceBlockBody.js +6 -4
  148. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  149. package/lib/chain/regen/interface.d.ts +5 -14
  150. package/lib/chain/regen/interface.d.ts.map +1 -1
  151. package/lib/chain/regen/interface.js +1 -1
  152. package/lib/chain/regen/interface.js.map +1 -1
  153. package/lib/chain/regen/queued.d.ts +6 -10
  154. package/lib/chain/regen/queued.d.ts.map +1 -1
  155. package/lib/chain/regen/queued.js +16 -40
  156. package/lib/chain/regen/queued.js.map +1 -1
  157. package/lib/chain/regen/regen.d.ts +6 -8
  158. package/lib/chain/regen/regen.d.ts.map +1 -1
  159. package/lib/chain/regen/regen.js +20 -34
  160. package/lib/chain/regen/regen.js.map +1 -1
  161. package/lib/chain/seenCache/index.d.ts +3 -1
  162. package/lib/chain/seenCache/index.d.ts.map +1 -1
  163. package/lib/chain/seenCache/index.js +3 -1
  164. package/lib/chain/seenCache/index.js.map +1 -1
  165. package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
  166. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  167. package/lib/chain/seenCache/seenAttesters.js +5 -0
  168. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  169. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
  170. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
  171. package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
  172. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
  173. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
  174. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
  175. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
  176. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
  177. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  178. package/lib/chain/seenCache/seenGossipBlockInput.js +3 -3
  179. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  180. package/lib/chain/shufflingCache.d.ts +16 -11
  181. package/lib/chain/shufflingCache.d.ts.map +1 -1
  182. package/lib/chain/shufflingCache.js +47 -41
  183. package/lib/chain/shufflingCache.js.map +1 -1
  184. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
  185. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  186. package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
  187. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  188. package/lib/chain/stateCache/index.d.ts +0 -2
  189. package/lib/chain/stateCache/index.d.ts.map +1 -1
  190. package/lib/chain/stateCache/index.js +0 -2
  191. package/lib/chain/stateCache/index.js.map +1 -1
  192. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +7 -7
  193. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  194. package/lib/chain/stateCache/persistentCheckpointsCache.js +20 -17
  195. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  196. package/lib/chain/stateCache/types.d.ts +5 -6
  197. package/lib/chain/stateCache/types.d.ts.map +1 -1
  198. package/lib/chain/stateCache/types.js.map +1 -1
  199. package/lib/chain/validation/aggregateAndProof.js +35 -14
  200. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  201. package/lib/chain/validation/attestation.d.ts +2 -2
  202. package/lib/chain/validation/attestation.d.ts.map +1 -1
  203. package/lib/chain/validation/attestation.js +28 -9
  204. package/lib/chain/validation/attestation.js.map +1 -1
  205. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  206. package/lib/chain/validation/attesterSlashing.js +2 -2
  207. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  208. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  209. package/lib/chain/validation/blobSidecar.js +5 -5
  210. package/lib/chain/validation/blobSidecar.js.map +1 -1
  211. package/lib/chain/validation/block.d.ts.map +1 -1
  212. package/lib/chain/validation/block.js +8 -6
  213. package/lib/chain/validation/block.js.map +1 -1
  214. package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
  215. package/lib/chain/validation/blsToExecutionChange.js +9 -2
  216. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  217. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  218. package/lib/chain/validation/dataColumnSidecar.js +5 -5
  219. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  220. package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
  221. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
  222. package/lib/chain/validation/executionPayloadBid.js +104 -0
  223. package/lib/chain/validation/executionPayloadBid.js.map +1 -0
  224. package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
  225. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
  226. package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
  227. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
  228. package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
  229. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
  230. package/lib/chain/validation/payloadAttestationMessage.js +72 -0
  231. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
  232. package/lib/chain/validation/proposerSlashing.js +3 -2
  233. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  234. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
  235. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  236. package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
  237. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  238. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  239. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  240. package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
  241. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  242. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
  243. package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
  244. package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
  245. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  246. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  247. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  248. package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
  249. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  250. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
  251. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  252. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  253. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  254. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  255. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  256. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  257. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  258. package/lib/chain/validation/syncCommittee.js +1 -1
  259. package/lib/chain/validation/syncCommittee.js.map +1 -1
  260. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  261. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
  262. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  263. package/lib/chain/validation/voluntaryExit.js +1 -1
  264. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  265. package/lib/chain/validatorMonitor.d.ts +2 -0
  266. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  267. package/lib/chain/validatorMonitor.js +49 -7
  268. package/lib/chain/validatorMonitor.js.map +1 -1
  269. package/lib/db/repositories/checkpointState.d.ts +2 -6
  270. package/lib/db/repositories/checkpointState.d.ts.map +1 -1
  271. package/lib/db/repositories/checkpointState.js +3 -16
  272. package/lib/db/repositories/checkpointState.js.map +1 -1
  273. package/lib/db/repositories/stateArchive.d.ts +9 -9
  274. package/lib/db/repositories/stateArchive.d.ts.map +1 -1
  275. package/lib/db/repositories/stateArchive.js +6 -21
  276. package/lib/db/repositories/stateArchive.js.map +1 -1
  277. package/lib/execution/engine/mock.d.ts +9 -6
  278. package/lib/execution/engine/mock.d.ts.map +1 -1
  279. package/lib/execution/engine/mock.js +34 -7
  280. package/lib/execution/engine/mock.js.map +1 -1
  281. package/lib/index.d.ts +1 -1
  282. package/lib/index.d.ts.map +1 -1
  283. package/lib/index.js +1 -1
  284. package/lib/index.js.map +1 -1
  285. package/lib/metrics/metrics/lodestar.d.ts +28 -6
  286. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  287. package/lib/metrics/metrics/lodestar.js +67 -17
  288. package/lib/metrics/metrics/lodestar.js.map +1 -1
  289. package/lib/network/core/networkCore.d.ts +3 -0
  290. package/lib/network/core/networkCore.d.ts.map +1 -1
  291. package/lib/network/core/networkCore.js +9 -0
  292. package/lib/network/core/networkCore.js.map +1 -1
  293. package/lib/network/core/networkCoreWorker.js +3 -0
  294. package/lib/network/core/networkCoreWorker.js.map +1 -1
  295. package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -0
  296. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  297. package/lib/network/core/networkCoreWorkerHandler.js +9 -0
  298. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  299. package/lib/network/core/types.d.ts +3 -0
  300. package/lib/network/core/types.d.ts.map +1 -1
  301. package/lib/network/gossip/gossipsub.d.ts +34 -0
  302. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  303. package/lib/network/gossip/gossipsub.js +123 -0
  304. package/lib/network/gossip/gossipsub.js.map +1 -1
  305. package/lib/network/gossip/interface.d.ts +20 -2
  306. package/lib/network/gossip/interface.d.ts.map +1 -1
  307. package/lib/network/gossip/interface.js +3 -0
  308. package/lib/network/gossip/interface.js.map +1 -1
  309. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  310. package/lib/network/gossip/scoringParameters.js +38 -2
  311. package/lib/network/gossip/scoringParameters.js.map +1 -1
  312. package/lib/network/gossip/topic.d.ts +77 -1
  313. package/lib/network/gossip/topic.d.ts.map +1 -1
  314. package/lib/network/gossip/topic.js +20 -0
  315. package/lib/network/gossip/topic.js.map +1 -1
  316. package/lib/network/network.d.ts +3 -0
  317. package/lib/network/network.d.ts.map +1 -1
  318. package/lib/network/network.js +9 -0
  319. package/lib/network/network.js.map +1 -1
  320. package/lib/network/options.d.ts +6 -0
  321. package/lib/network/options.d.ts.map +1 -1
  322. package/lib/network/options.js.map +1 -1
  323. package/lib/network/peers/peerManager.d.ts.map +1 -1
  324. package/lib/network/peers/peerManager.js +9 -0
  325. package/lib/network/peers/peerManager.js.map +1 -1
  326. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  327. package/lib/network/processor/gossipHandlers.js +35 -4
  328. package/lib/network/processor/gossipHandlers.js.map +1 -1
  329. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  330. package/lib/network/processor/gossipQueues/index.js +16 -0
  331. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  332. package/lib/network/processor/index.d.ts.map +1 -1
  333. package/lib/network/processor/index.js +3 -0
  334. package/lib/network/processor/index.js.map +1 -1
  335. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  336. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
  337. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  338. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
  339. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  340. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
  341. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  342. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
  343. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  344. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
  345. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  346. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  347. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
  348. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  349. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
  350. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
  351. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  352. package/lib/network/reqresp/handlers/index.js +2 -2
  353. package/lib/network/reqresp/handlers/index.js.map +1 -1
  354. package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
  355. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  356. package/lib/node/nodejs.d.ts.map +1 -1
  357. package/lib/node/nodejs.js +17 -2
  358. package/lib/node/nodejs.js.map +1 -1
  359. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  360. package/lib/sync/backfill/backfill.js +3 -4
  361. package/lib/sync/backfill/backfill.js.map +1 -1
  362. package/lib/sync/backfill/verify.d.ts +1 -2
  363. package/lib/sync/backfill/verify.d.ts.map +1 -1
  364. package/lib/sync/backfill/verify.js +2 -2
  365. package/lib/sync/backfill/verify.js.map +1 -1
  366. package/lib/sync/range/chain.d.ts.map +1 -1
  367. package/lib/sync/range/chain.js +0 -1
  368. package/lib/sync/range/chain.js.map +1 -1
  369. package/lib/sync/range/range.d.ts.map +1 -1
  370. package/lib/sync/range/range.js +0 -3
  371. package/lib/sync/range/range.js.map +1 -1
  372. package/lib/sync/unknownBlock.d.ts.map +1 -1
  373. package/lib/sync/unknownBlock.js +0 -3
  374. package/lib/sync/unknownBlock.js.map +1 -1
  375. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  376. package/lib/sync/utils/downloadByRange.js +2 -2
  377. package/lib/sync/utils/downloadByRange.js.map +1 -1
  378. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  379. package/lib/sync/utils/downloadByRoot.js +1 -2
  380. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  381. package/lib/util/sszBytes.js +1 -1
  382. package/lib/util/sszBytes.js.map +1 -1
  383. package/package.json +16 -16
  384. package/src/api/impl/beacon/blocks/index.ts +39 -37
  385. package/src/api/impl/beacon/state/utils.ts +2 -22
  386. package/src/api/impl/config/constants.ts +8 -0
  387. package/src/api/impl/debug/index.ts +2 -6
  388. package/src/api/impl/lodestar/index.ts +36 -4
  389. package/src/api/impl/proof/index.ts +1 -2
  390. package/src/api/impl/validator/index.ts +15 -15
  391. package/src/api/rest/base.ts +4 -4
  392. package/src/chain/ColumnReconstructionTracker.ts +8 -4
  393. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +7 -4
  394. package/src/chain/archiveStore/utils/archiveBlocks.ts +25 -14
  395. package/src/chain/blocks/blockInput/blockInput.ts +55 -4
  396. package/src/chain/blocks/importBlock.ts +16 -10
  397. package/src/chain/blocks/index.ts +0 -19
  398. package/src/chain/blocks/types.ts +0 -2
  399. package/src/chain/blocks/verifyBlock.ts +9 -12
  400. package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
  401. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +2 -2
  402. package/src/chain/blocks/writeBlockInputToDb.ts +33 -30
  403. package/src/chain/bls/multithread/index.ts +7 -4
  404. package/src/chain/bls/multithread/jobItem.ts +7 -3
  405. package/src/chain/bls/singleThread.ts +5 -3
  406. package/src/chain/bls/utils.ts +15 -7
  407. package/src/chain/chain.ts +247 -65
  408. package/src/chain/errors/attestationError.ts +11 -1
  409. package/src/chain/errors/executionPayloadBid.ts +35 -0
  410. package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
  411. package/src/chain/errors/index.ts +3 -0
  412. package/src/chain/errors/payloadAttestation.ts +25 -0
  413. package/src/chain/forkChoice/index.ts +19 -0
  414. package/src/chain/initState.ts +7 -5
  415. package/src/chain/interface.ts +34 -3
  416. package/src/chain/lightClient/index.ts +1 -2
  417. package/src/chain/lightClient/proofs.ts +0 -2
  418. package/src/chain/opPools/aggregatedAttestationPool.ts +19 -191
  419. package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
  420. package/src/chain/opPools/index.ts +2 -0
  421. package/src/chain/opPools/opPool.ts +5 -7
  422. package/src/chain/opPools/payloadAttestationPool.ts +157 -0
  423. package/src/chain/options.ts +0 -2
  424. package/src/chain/prepareNextSlot.ts +8 -12
  425. package/src/chain/produceBlock/produceBlockBody.ts +13 -6
  426. package/src/chain/regen/interface.ts +4 -18
  427. package/src/chain/regen/queued.ts +17 -57
  428. package/src/chain/regen/regen.ts +22 -43
  429. package/src/chain/seenCache/index.ts +3 -1
  430. package/src/chain/seenCache/seenAttesters.ts +5 -0
  431. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
  432. package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
  433. package/src/chain/seenCache/seenGossipBlockInput.ts +3 -3
  434. package/src/chain/shufflingCache.ts +67 -50
  435. package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
  436. package/src/chain/stateCache/index.ts +0 -2
  437. package/src/chain/stateCache/persistentCheckpointsCache.ts +23 -27
  438. package/src/chain/stateCache/types.ts +5 -10
  439. package/src/chain/validation/aggregateAndProof.ts +36 -14
  440. package/src/chain/validation/attestation.ts +36 -19
  441. package/src/chain/validation/attesterSlashing.ts +9 -7
  442. package/src/chain/validation/blobSidecar.ts +4 -9
  443. package/src/chain/validation/block.ts +9 -6
  444. package/src/chain/validation/blsToExecutionChange.ts +9 -7
  445. package/src/chain/validation/dataColumnSidecar.ts +4 -9
  446. package/src/chain/validation/executionPayloadBid.ts +141 -0
  447. package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
  448. package/src/chain/validation/payloadAttestationMessage.ts +109 -0
  449. package/src/chain/validation/proposerSlashing.ts +3 -7
  450. package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
  451. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
  452. package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
  453. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
  454. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  455. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
  456. package/src/chain/validation/syncCommittee.ts +1 -1
  457. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
  458. package/src/chain/validation/voluntaryExit.ts +1 -1
  459. package/src/chain/validatorMonitor.ts +62 -8
  460. package/src/db/repositories/checkpointState.ts +3 -19
  461. package/src/db/repositories/stateArchive.ts +13 -27
  462. package/src/execution/engine/mock.ts +40 -13
  463. package/src/index.ts +1 -1
  464. package/src/metrics/metrics/lodestar.ts +68 -17
  465. package/src/network/core/networkCore.ts +12 -0
  466. package/src/network/core/networkCoreWorker.ts +3 -0
  467. package/src/network/core/networkCoreWorkerHandler.ts +9 -0
  468. package/src/network/core/types.ts +6 -0
  469. package/src/network/gossip/gossipsub.ts +147 -1
  470. package/src/network/gossip/interface.ts +17 -0
  471. package/src/network/gossip/scoringParameters.ts +44 -2
  472. package/src/network/gossip/topic.ts +21 -0
  473. package/src/network/network.ts +12 -0
  474. package/src/network/options.ts +6 -0
  475. package/src/network/peers/peerManager.ts +11 -0
  476. package/src/network/processor/gossipHandlers.ts +49 -4
  477. package/src/network/processor/gossipQueues/index.ts +16 -0
  478. package/src/network/processor/index.ts +3 -0
  479. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
  480. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
  481. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
  482. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
  483. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
  484. package/src/network/reqresp/handlers/index.ts +2 -2
  485. package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
  486. package/src/node/nodejs.ts +18 -3
  487. package/src/sync/backfill/backfill.ts +3 -4
  488. package/src/sync/backfill/verify.ts +2 -3
  489. package/src/sync/range/chain.ts +0 -1
  490. package/src/sync/range/range.ts +0 -3
  491. package/src/sync/unknownBlock.ts +0 -3
  492. package/src/sync/utils/downloadByRange.ts +2 -2
  493. package/src/sync/utils/downloadByRoot.ts +1 -2
  494. package/src/util/sszBytes.ts +1 -1
  495. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +0 -55
  496. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +0 -1
  497. package/lib/chain/stateCache/blockStateCacheImpl.js +0 -130
  498. package/lib/chain/stateCache/blockStateCacheImpl.js.map +0 -1
  499. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +0 -61
  500. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +0 -1
  501. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +0 -157
  502. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +0 -1
  503. package/lib/util/bytes.d.ts +0 -3
  504. package/lib/util/bytes.d.ts.map +0 -1
  505. package/lib/util/bytes.js +0 -11
  506. package/lib/util/bytes.js.map +0 -1
  507. package/src/chain/stateCache/blockStateCacheImpl.ts +0 -150
  508. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +0 -198
  509. package/src/util/bytes.ts +0 -11
@@ -30,7 +30,7 @@ import {
30
30
  isDenebBlockContents,
31
31
  sszTypesFor,
32
32
  } from "@lodestar/types";
33
- import {fromAsync, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils";
33
+ import {fromHex, sleep, toHex, toRootHex} from "@lodestar/utils";
34
34
  import {BlockInputSource, isBlockInputBlobs, isBlockInputColumns} from "../../../../chain/blocks/blockInput/index.js";
35
35
  import {ImportBlockOpts} from "../../../../chain/blocks/types.js";
36
36
  import {verifyBlocksInEpoch} from "../../../../chain/blocks/verifyBlock.js";
@@ -133,21 +133,31 @@ export function getBeaconBlockApi({
133
133
 
134
134
  if (isBlockInputColumns(blockForImport)) {
135
135
  for (const dataColumnSidecar of dataColumnSidecars) {
136
- blockForImport.addColumn({
137
- blockRootHex: blockRoot,
138
- columnSidecar: dataColumnSidecar,
139
- source: BlockInputSource.api,
140
- seenTimestampSec,
141
- });
136
+ blockForImport.addColumn(
137
+ {
138
+ blockRootHex: blockRoot,
139
+ columnSidecar: dataColumnSidecar,
140
+ source: BlockInputSource.api,
141
+ seenTimestampSec,
142
+ },
143
+ // In multi-BN setups (DVT, fallback), the same block may be published to multiple nodes.
144
+ // Data columns may arrive via gossip from another node before the API publish completes,
145
+ // so we allow duplicates here instead of throwing an error.
146
+ {throwOnDuplicateAdd: false}
147
+ );
142
148
  }
143
149
  } else if (isBlockInputBlobs(blockForImport)) {
144
150
  for (const blobSidecar of blobSidecars) {
145
- blockForImport.addBlob({
146
- blockRootHex: blockRoot,
147
- blobSidecar,
148
- source: BlockInputSource.api,
149
- seenTimestampSec,
150
- });
151
+ blockForImport.addBlob(
152
+ {
153
+ blockRootHex: blockRoot,
154
+ blobSidecar,
155
+ source: BlockInputSource.api,
156
+ seenTimestampSec,
157
+ },
158
+ // Same as above for columns
159
+ {throwOnDuplicateAdd: false}
160
+ );
151
161
  }
152
162
  }
153
163
 
@@ -285,7 +295,7 @@ export function getBeaconBlockApi({
285
295
  () =>
286
296
  // there is no rush to persist block since we published it to gossip anyway
287
297
  chain
288
- .processBlock(blockForImport, {...opts, eagerPersistBlock: false})
298
+ .processBlock(blockForImport, opts)
289
299
  .catch((e) => {
290
300
  if (e instanceof BlockError && e.type.code === BlockErrorCode.PARENT_UNKNOWN) {
291
301
  chain.emitter.emit(ChainEvent.unknownParent, {
@@ -434,11 +444,13 @@ export function getBeaconBlockApi({
434
444
  const nonFinalizedBlocks = chain.forkChoice.getBlockSummariesByParentRoot(parentRoot);
435
445
  await Promise.all(
436
446
  nonFinalizedBlocks.map(async (summary) => {
437
- const block = await db.block.get(fromHex(summary.blockRoot));
438
- if (block) {
439
- const canonical = chain.forkChoice.getCanonicalBlockAtSlot(block.message.slot);
447
+ const blockResult = await chain.getBlockByRoot(summary.blockRoot);
448
+ if (blockResult) {
449
+ const canonical = chain.forkChoice.getCanonicalBlockAtSlot(blockResult.block.message.slot);
440
450
  if (canonical) {
441
- result.push(toBeaconHeaderResponse(config, block, canonical.blockRoot === summary.blockRoot));
451
+ result.push(
452
+ toBeaconHeaderResponse(config, blockResult.block, canonical.blockRoot === summary.blockRoot)
453
+ );
442
454
  if (isOptimisticBlock(canonical)) {
443
455
  executionOptimistic = true;
444
456
  }
@@ -492,9 +504,9 @@ export function getBeaconBlockApi({
492
504
  finalized = false;
493
505
 
494
506
  if (summary.blockRoot !== toRootHex(canonicalRoot)) {
495
- const block = await db.block.get(fromHex(summary.blockRoot));
496
- if (block) {
497
- result.push(toBeaconHeaderResponse(config, block));
507
+ const blockResult = await chain.getBlockByRoot(summary.blockRoot);
508
+ if (blockResult) {
509
+ result.push(toBeaconHeaderResponse(config, blockResult.block));
498
510
  }
499
511
  }
500
512
  })
@@ -626,6 +638,7 @@ export function getBeaconBlockApi({
626
638
  const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
627
639
  const fork = config.getForkName(block.message.slot);
628
640
  const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
641
+ const blockRootHex = toRootHex(blockRoot);
629
642
 
630
643
  let data: deneb.BlobSidecars;
631
644
 
@@ -642,10 +655,7 @@ export function getBeaconBlockApi({
642
655
  const blobCount = blobKzgCommitments.length;
643
656
 
644
657
  if (blobCount > 0) {
645
- let dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
646
- if (dataColumnSidecars.length === 0) {
647
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
648
- }
658
+ const dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, blockRootHex);
649
659
 
650
660
  if (dataColumnSidecars.length === 0) {
651
661
  throw new ApiError(
@@ -682,10 +692,7 @@ export function getBeaconBlockApi({
682
692
  data = [];
683
693
  }
684
694
  } else if (isForkPostDeneb(fork)) {
685
- let {blobSidecars} = (await db.blobSidecars.get(blockRoot)) ?? {};
686
- if (!blobSidecars) {
687
- ({blobSidecars} = (await db.blobSidecarsArchive.get(block.message.slot)) ?? {});
688
- }
695
+ const blobSidecars = await chain.getBlobSidecars(block.message.slot, blockRootHex);
689
696
 
690
697
  if (!blobSidecars) {
691
698
  throw new ApiError(
@@ -715,6 +722,7 @@ export function getBeaconBlockApi({
715
722
  const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
716
723
  const fork = config.getForkName(block.message.slot);
717
724
  const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
725
+ const blockRootHex = toRootHex(blockRoot);
718
726
 
719
727
  let blobs: deneb.Blobs;
720
728
 
@@ -731,10 +739,7 @@ export function getBeaconBlockApi({
731
739
  const blobCount = blobKzgCommitments.length;
732
740
 
733
741
  if (blobCount > 0) {
734
- let dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
735
- if (dataColumnSidecars.length === 0) {
736
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
737
- }
742
+ const dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, blockRootHex);
738
743
 
739
744
  if (dataColumnSidecars.length === 0) {
740
745
  throw new ApiError(
@@ -766,10 +771,7 @@ export function getBeaconBlockApi({
766
771
  blobs = [];
767
772
  }
768
773
  } else if (isForkPostDeneb(fork)) {
769
- let {blobSidecars} = (await db.blobSidecars.get(blockRoot)) ?? {};
770
- if (!blobSidecars) {
771
- ({blobSidecars} = (await db.blobSidecarsArchive.get(block.message.slot)) ?? {});
772
- }
774
+ const blobSidecars = await chain.getBlobSidecars(block.message.slot, blockRootHex);
773
775
 
774
776
  if (!blobSidecars) {
775
777
  throw new ApiError(
@@ -2,7 +2,7 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
2
2
  import {routes} from "@lodestar/api";
3
3
  import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
4
4
  import {GENESIS_SLOT} from "@lodestar/params";
5
- import {BeaconStateAllForks} from "@lodestar/state-transition";
5
+ import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition";
6
6
  import {BLSPubkey, Epoch, RootHex, Slot, ValidatorIndex, getValidatorStatus, phase0} from "@lodestar/types";
7
7
  import {fromHex} from "@lodestar/utils";
8
8
  import {IBeaconChain} from "../../../../chain/index.js";
@@ -41,30 +41,10 @@ export function resolveStateId(
41
41
  return blockSlot;
42
42
  }
43
43
 
44
- export async function getStateResponse(
45
- chain: IBeaconChain,
46
- inStateId: routes.beacon.StateId
47
- ): Promise<{state: BeaconStateAllForks; executionOptimistic: boolean; finalized: boolean}> {
48
- const stateId = resolveStateId(chain.forkChoice, inStateId);
49
-
50
- const res =
51
- typeof stateId === "string"
52
- ? await chain.getStateByStateRoot(stateId)
53
- : typeof stateId === "number"
54
- ? await chain.getStateBySlot(stateId)
55
- : chain.getStateByCheckpoint(stateId);
56
-
57
- if (!res) {
58
- throw new ApiError(404, `State not found for id '${inStateId}'`);
59
- }
60
-
61
- return res;
62
- }
63
-
64
44
  export async function getStateResponseWithRegen(
65
45
  chain: IBeaconChain,
66
46
  inStateId: routes.beacon.StateId
67
- ): Promise<{state: BeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean}> {
47
+ ): Promise<{state: CachedBeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean}> {
68
48
  const stateId = resolveStateId(chain.forkChoice, inStateId);
69
49
 
70
50
  const res =
@@ -5,6 +5,8 @@ import {
5
5
  BASE_REWARDS_PER_EPOCH,
6
6
  BLOB_TX_TYPE,
7
7
  BLS_WITHDRAWAL_PREFIX,
8
+ BUILDER_INDEX_FLAG,
9
+ BUILDER_INDEX_SELF_BUILD,
8
10
  BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
9
11
  BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
10
12
  BUILDER_WITHDRAWAL_PREFIX,
@@ -21,6 +23,7 @@ import {
21
23
  DOMAIN_BLS_TO_EXECUTION_CHANGE,
22
24
  DOMAIN_CONTRIBUTION_AND_PROOF,
23
25
  DOMAIN_DEPOSIT,
26
+ DOMAIN_PROPOSER_PREFERENCES,
24
27
  DOMAIN_PTC_ATTESTER,
25
28
  DOMAIN_RANDAO,
26
29
  DOMAIN_SELECTION_PROOF,
@@ -82,6 +85,7 @@ export const specConstants = {
82
85
  DOMAIN_APPLICATION_MASK,
83
86
  DOMAIN_APPLICATION_BUILDER,
84
87
  DOMAIN_BEACON_BUILDER,
88
+ DOMAIN_PROPOSER_PREFERENCES,
85
89
  DOMAIN_PTC_ATTESTER,
86
90
 
87
91
  // phase0/validator.md
@@ -128,6 +132,10 @@ export const specConstants = {
128
132
  DEPOSIT_REQUEST_TYPE: toHexByte(DEPOSIT_REQUEST_TYPE),
129
133
  WITHDRAWAL_REQUEST_TYPE: toHexByte(WITHDRAWAL_REQUEST_TYPE),
130
134
  CONSOLIDATION_REQUEST_TYPE: toHexByte(CONSOLIDATION_REQUEST_TYPE),
135
+
136
+ // gloas
137
+ BUILDER_INDEX_FLAG,
138
+ BUILDER_INDEX_SELF_BUILD,
131
139
  BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
132
140
  BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
133
141
  };
@@ -3,7 +3,7 @@ import {ApplicationMethods} from "@lodestar/api/server";
3
3
  import {ExecutionStatus} from "@lodestar/fork-choice";
4
4
  import {ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
5
5
  import {BeaconState, deneb, fulu, sszTypesFor} from "@lodestar/types";
6
- import {fromAsync, toRootHex} from "@lodestar/utils";
6
+ import {toRootHex} from "@lodestar/utils";
7
7
  import {isOptimisticBlock} from "../../../util/forkChoice.js";
8
8
  import {getStateSlotFromBytes} from "../../../util/multifork.js";
9
9
  import {getBlockResponse} from "../beacon/blocks/utils.js";
@@ -14,7 +14,6 @@ import {assertUniqueItems} from "../utils.js";
14
14
  export function getDebugApi({
15
15
  chain,
16
16
  config,
17
- db,
18
17
  }: Pick<ApiModules, "chain" | "config" | "db">): ApplicationMethods<routes.debug.Endpoints> {
19
18
  return {
20
19
  async getDebugChainHeadsV2() {
@@ -104,10 +103,7 @@ export function getDebugApi({
104
103
  : 0;
105
104
 
106
105
  if (isForkPostFulu(fork) && blobCount > 0) {
107
- dataColumnSidecars = await fromAsync(db.dataColumnSidecar.valuesStream(blockRoot));
108
- if (dataColumnSidecars.length === 0) {
109
- dataColumnSidecars = await fromAsync(db.dataColumnSidecarArchive.valuesStream(block.message.slot));
110
- }
106
+ dataColumnSidecars = await chain.getDataColumnSidecars(block.message.slot, toRootHex(blockRoot));
111
107
 
112
108
  if (dataColumnSidecars.length === 0) {
113
109
  throw Error(
@@ -154,6 +154,23 @@ export function getLodestarApi({
154
154
  await network.disconnectPeer(peerId);
155
155
  },
156
156
 
157
+ async addDirectPeer({peer}) {
158
+ const peerId = await network.addDirectPeer(peer);
159
+ if (peerId === null) {
160
+ throw new ApiError(400, `Failed to add direct peer: invalid peer address or ENR "${peer}"`);
161
+ }
162
+ return {data: {peerId}};
163
+ },
164
+
165
+ async removeDirectPeer({peerId}) {
166
+ const removed = await network.removeDirectPeer(peerId);
167
+ return {data: {removed}};
168
+ },
169
+
170
+ async getDirectPeers() {
171
+ return {data: await network.getDirectPeers()};
172
+ },
173
+
157
174
  async getPeers({state, direction}) {
158
175
  const peers = (await network.dumpPeers()).filter(
159
176
  (nodePeer) =>
@@ -198,7 +215,7 @@ export function getLodestarApi({
198
215
  const {state, executionOptimistic, finalized} = await getStateResponseWithRegen(chain, stateId);
199
216
 
200
217
  const stateView = (
201
- state instanceof Uint8Array ? loadState(config, chain.getHeadState(), state).state : state.clone()
218
+ state instanceof Uint8Array ? loadState(config, chain.getHeadState(), state).state : state
202
219
  ) as BeaconStateCapella;
203
220
 
204
221
  const fork = config.getForkName(stateView.slot);
@@ -238,6 +255,24 @@ export function getLodestarApi({
238
255
  },
239
256
  };
240
257
  },
258
+
259
+ async getMonitoredValidatorIndices() {
260
+ return {
261
+ data: chain.validatorMonitor?.getMonitoredValidatorIndices() ?? [],
262
+ };
263
+ },
264
+
265
+ async getCustodyInfo() {
266
+ const {custodyColumns, targetCustodyGroupCount} = chain.custodyConfig;
267
+
268
+ return {
269
+ data: {
270
+ earliestCustodiedSlot: chain.earliestAvailableSlot,
271
+ custodyGroupCount: targetCustodyGroupCount,
272
+ custodyColumns,
273
+ },
274
+ };
275
+ },
241
276
  };
242
277
  }
243
278
 
@@ -249,9 +284,6 @@ function regenRequestToJson(config: ChainForkConfig, regenRequest: RegenRequest)
249
284
  slot: regenRequest.args[1],
250
285
  };
251
286
 
252
- case "getCheckpointState":
253
- return ssz.phase0.Checkpoint.toJson(regenRequest.args[0]);
254
-
255
287
  case "getPreState": {
256
288
  const slot = regenRequest.args[0].slot;
257
289
  return {
@@ -27,8 +27,7 @@ export function getProofApi(
27
27
  const state =
28
28
  res.state instanceof Uint8Array ? loadState(config, chain.getHeadState(), res.state).state : res.state;
29
29
 
30
- // Commit any changes before computing the state root. In normal cases the state should have no changes here
31
- state.commit();
30
+ // there should be no state changes in beacon-node so no need to commit() here
32
31
  const stateNode = state.node;
33
32
 
34
33
  const proof = createProof(stateNode, {type: ProofType.compactMulti, descriptor});
@@ -1,7 +1,7 @@
1
1
  import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
2
2
  import {routes} from "@lodestar/api";
3
3
  import {ApplicationMethods} from "@lodestar/api/server";
4
- import {ExecutionStatus} from "@lodestar/fork-choice";
4
+ import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
5
5
  import {
6
6
  ForkName,
7
7
  ForkPostBellatrix,
@@ -67,10 +67,11 @@ import {
67
67
  SyncCommitteeError,
68
68
  SyncCommitteeErrorCode,
69
69
  } from "../../../chain/errors/index.js";
70
- import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js";
70
+ import {ChainEvent, CommonBlockBody} from "../../../chain/index.js";
71
71
  import {PREPARE_NEXT_SLOT_BPS} from "../../../chain/prepareNextSlot.js";
72
72
  import {BlockType, ProduceFullDeneb} from "../../../chain/produceBlock/index.js";
73
73
  import {RegenCaller} from "../../../chain/regen/index.js";
74
+ import {CheckpointHex} from "../../../chain/stateCache/types.js";
74
75
  import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
75
76
  import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js";
76
77
  import {ZERO_HASH} from "../../../constants/index.js";
@@ -413,10 +414,10 @@ export function getValidatorApi(
413
414
  // as of now fee recipient checks can not be performed because builder does not return bid recipient
414
415
  {
415
416
  commonBlockBodyPromise,
416
- parentBlockRoot,
417
+ parentBlock,
417
418
  }: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
418
419
  commonBlockBodyPromise: Promise<CommonBlockBody>;
419
- parentBlockRoot: Root;
420
+ parentBlock: ProtoBlock;
420
421
  }
421
422
  ): Promise<ProduceBlindedBlockRes> {
422
423
  const version = config.getForkName(slot);
@@ -447,7 +448,7 @@ export function getValidatorApi(
447
448
  timer = metrics?.blockProductionTime.startTimer();
448
449
  const {block, executionPayloadValue, consensusBlockValue} = await chain.produceBlindedBlock({
449
450
  slot,
450
- parentBlockRoot,
451
+ parentBlock,
451
452
  randaoReveal,
452
453
  graffiti,
453
454
  commonBlockBodyPromise,
@@ -482,10 +483,10 @@ export function getValidatorApi(
482
483
  feeRecipient,
483
484
  strictFeeRecipientCheck,
484
485
  commonBlockBodyPromise,
485
- parentBlockRoot,
486
+ parentBlock,
486
487
  }: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
487
488
  commonBlockBodyPromise: Promise<CommonBlockBody>;
488
- parentBlockRoot: Root;
489
+ parentBlock: ProtoBlock;
489
490
  }
490
491
  ): Promise<ProduceBlockContentsRes & {shouldOverrideBuilder?: boolean}> {
491
492
  const source = ProducedBlockSource.engine;
@@ -496,7 +497,7 @@ export function getValidatorApi(
496
497
  timer = metrics?.blockProductionTime.startTimer();
497
498
  const {block, executionPayloadValue, consensusBlockValue, shouldOverrideBuilder} = await chain.produceBlock({
498
499
  slot,
499
- parentBlockRoot,
500
+ parentBlock,
500
501
  randaoReveal,
501
502
  graffiti,
502
503
  feeRecipient,
@@ -569,7 +570,8 @@ export function getValidatorApi(
569
570
  notWhileSyncing();
570
571
  await waitForSlot(slot); // Must never request for a future slot > currentSlot
571
572
 
572
- const {blockRoot: parentBlockRootHex, slot: parentSlot} = chain.getProposerHead(slot);
573
+ const parentBlock = chain.getProposerHead(slot);
574
+ const {blockRoot: parentBlockRootHex, slot: parentSlot} = parentBlock;
573
575
  const parentBlockRoot = fromHex(parentBlockRootHex);
574
576
  notOnOutOfRangeData(parentBlockRoot);
575
577
  metrics?.blockProductionSlotDelta.set(slot - parentSlot);
@@ -638,7 +640,7 @@ export function getValidatorApi(
638
640
  // can't do fee recipient checks as builder bid doesn't return feeRecipient as of now
639
641
  strictFeeRecipientCheck: false,
640
642
  commonBlockBodyPromise,
641
- parentBlockRoot,
643
+ parentBlock,
642
644
  })
643
645
  : Promise.reject(new Error("Builder disabled"));
644
646
 
@@ -647,7 +649,7 @@ export function getValidatorApi(
647
649
  feeRecipient,
648
650
  strictFeeRecipientCheck,
649
651
  commonBlockBodyPromise,
650
- parentBlockRoot,
652
+ parentBlock,
651
653
  }).then((engineBlock) => {
652
654
  // Once the engine returns a block, in the event of either:
653
655
  // - suspected builder censorship
@@ -689,7 +691,7 @@ export function getValidatorApi(
689
691
  chain
690
692
  .produceCommonBlockBody({
691
693
  slot,
692
- parentBlockRoot,
694
+ parentBlock,
693
695
  randaoReveal,
694
696
  graffiti: graffitiBytes,
695
697
  })
@@ -1040,9 +1042,7 @@ export function getValidatorApi(
1040
1042
  const res = await getStateResponseWithRegen(chain, startSlot);
1041
1043
 
1042
1044
  const stateViewDU =
1043
- res.state instanceof Uint8Array
1044
- ? loadState(config, chain.getHeadState(), res.state).state
1045
- : res.state.clone();
1045
+ res.state instanceof Uint8Array ? loadState(config, chain.getHeadState(), res.state).state : res.state;
1046
1046
 
1047
1047
  state = createCachedBeaconState(
1048
1048
  stateViewDU,
@@ -1,6 +1,6 @@
1
1
  import bearerAuthPlugin from "@fastify/bearer-auth";
2
2
  import {fastifyCors} from "@fastify/cors";
3
- import {FastifyInstance, FastifyRequest, errorCodes, fastify} from "fastify";
3
+ import {FastifyError, FastifyInstance, FastifyRequest, errorCodes, fastify} from "fastify";
4
4
  import {parse as parseQueryString} from "qs";
5
5
  import {addSszContentTypeParser} from "@lodestar/api/server";
6
6
  import {ErrorAborted, Gauge, Histogram, Logger} from "@lodestar/utils";
@@ -91,10 +91,10 @@ export class RestApiServer {
91
91
  this.activeSockets = new HttpActiveSocketsTracker(server.server, metrics);
92
92
 
93
93
  // To parse our ApiError -> statusCode
94
- server.setErrorHandler((err, _req, res) => {
94
+ server.setErrorHandler<FastifyError | Error>((err, _req, res) => {
95
95
  const stacktraces = opts.stacktraces ? err.stack?.split("\n") : undefined;
96
- if (err.validation) {
97
- const {instancePath, message} = err.validation[0];
96
+ if ("validation" in err && err.validation) {
97
+ const {instancePath = "unknown", message} = err.validation?.[0] ?? {};
98
98
  const payload: ErrorResponse = {
99
99
  code: 400,
100
100
  message: `${instancePath.substring(instancePath.lastIndexOf("/") + 1)} ${message}`,
@@ -8,12 +8,12 @@ import {ChainEventEmitter} from "./emitter.js";
8
8
  /**
9
9
  * Minimum time to wait before attempting reconstruction
10
10
  */
11
- const RECONSTRUCTION_DELAY_MIN_MS = 800;
11
+ const RECONSTRUCTION_DELAY_MIN_BPS = 667;
12
12
 
13
13
  /**
14
14
  * Maximum time to wait before attempting reconstruction
15
15
  */
16
- const RECONSTRUCTION_DELAY_MAX_MS = 1200;
16
+ const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
17
17
 
18
18
  export type ColumnReconstructionTrackerInit = {
19
19
  logger: Logger;
@@ -41,11 +41,16 @@ export class ColumnReconstructionTracker {
41
41
  /** Track if a reconstruction attempt is in-flight */
42
42
  running = false;
43
43
 
44
+ private readonly minDelayMs: number;
45
+ private readonly maxDelayMs: number;
46
+
44
47
  constructor(init: ColumnReconstructionTrackerInit) {
45
48
  this.logger = init.logger;
46
49
  this.emitter = init.emitter;
47
50
  this.metrics = init.metrics;
48
51
  this.config = init.config;
52
+ this.minDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MIN_BPS);
53
+ this.maxDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MAX_BPS);
49
54
  }
50
55
 
51
56
  triggerColumnReconstruction(blockInput: BlockInputColumns): void {
@@ -61,8 +66,7 @@ export class ColumnReconstructionTracker {
61
66
  // just that it has been triggered for this block root.
62
67
  this.running = true;
63
68
  this.lastBlockRootHex = blockInput.blockRootHex;
64
- const delay =
65
- RECONSTRUCTION_DELAY_MIN_MS + Math.random() * (RECONSTRUCTION_DELAY_MAX_MS - RECONSTRUCTION_DELAY_MIN_MS);
69
+ const delay = this.minDelayMs + Math.random() * (this.maxDelayMs - this.minDelayMs);
66
70
  sleep(delay)
67
71
  .then(() => {
68
72
  const logCtx = {slot: blockInput.slot, root: blockInput.blockRootHex};
@@ -8,7 +8,9 @@ import {
8
8
  createCachedBeaconState,
9
9
  stateTransition,
10
10
  } from "@lodestar/state-transition";
11
+ import {byteArrayEquals} from "@lodestar/utils";
11
12
  import {IBeaconDb} from "../../../db/index.js";
13
+ import {getStateTypeFromBytes} from "../../../util/multifork.js";
12
14
  import {HistoricalStateRegenMetrics} from "./metrics.js";
13
15
  import {RegenErrorType} from "./types.js";
14
16
 
@@ -35,12 +37,13 @@ export async function getNearestState(
35
37
  db: IBeaconDb,
36
38
  pubkey2index: PubkeyIndexMap
37
39
  ): Promise<CachedBeaconStateAllForks> {
38
- const states = await db.stateArchive.values({limit: 1, lte: slot, reverse: true});
39
- if (!states.length) {
40
+ const stateBytesArr = await db.stateArchive.binaries({limit: 1, lte: slot, reverse: true});
41
+ if (!stateBytesArr.length) {
40
42
  throw new Error("No near state found in the database");
41
43
  }
42
44
 
43
- const state = states[0];
45
+ const stateBytes = stateBytesArr[0];
46
+ const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
44
47
  syncPubkeyCache(state, pubkey2index);
45
48
 
46
49
  return createCachedBeaconState(
@@ -96,7 +99,7 @@ export async function getHistoricalState(
96
99
  throw e;
97
100
  }
98
101
  blockCount++;
99
- if (Buffer.compare(state.hashTreeRoot(), block.message.stateRoot) !== 0) {
102
+ if (!byteArrayEquals(state.hashTreeRoot(), block.message.stateRoot)) {
100
103
  metrics?.regenErrorCount.inc({reason: RegenErrorType.invalidStateRoot});
101
104
  }
102
105
  }