@lodestar/beacon-node 1.40.0-dev.ba0be9204c → 1.40.0-dev.ba49cac4ae

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 (436) 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/debug/index.d.ts +1 -1
  5. package/lib/api/impl/debug/index.d.ts.map +1 -1
  6. package/lib/api/impl/debug/index.js +3 -6
  7. package/lib/api/impl/debug/index.js.map +1 -1
  8. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  9. package/lib/api/impl/lodestar/index.js +29 -2
  10. package/lib/api/impl/lodestar/index.js.map +1 -1
  11. package/lib/api/impl/validator/index.d.ts.map +1 -1
  12. package/lib/api/impl/validator/index.js +9 -8
  13. package/lib/api/impl/validator/index.js.map +1 -1
  14. package/lib/api/rest/base.d.ts.map +1 -1
  15. package/lib/api/rest/base.js +2 -2
  16. package/lib/api/rest/base.js.map +1 -1
  17. package/lib/chain/ColumnReconstructionTracker.d.ts +2 -0
  18. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  19. package/lib/chain/ColumnReconstructionTracker.js +7 -3
  20. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  21. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  22. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +2 -1
  23. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  24. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  25. package/lib/chain/archiveStore/utils/archiveBlocks.js +4 -0
  26. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  27. package/lib/chain/blocks/blockInput/blockInput.d.ts +30 -0
  28. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  29. package/lib/chain/blocks/blockInput/blockInput.js +44 -3
  30. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  31. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  32. package/lib/chain/blocks/importBlock.js +3 -7
  33. package/lib/chain/blocks/importBlock.js.map +1 -1
  34. package/lib/chain/blocks/index.d.ts.map +1 -1
  35. package/lib/chain/blocks/index.js +0 -14
  36. package/lib/chain/blocks/index.js.map +1 -1
  37. package/lib/chain/blocks/types.d.ts +0 -2
  38. package/lib/chain/blocks/types.d.ts.map +1 -1
  39. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  40. package/lib/chain/blocks/verifyBlock.js +1 -8
  41. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  42. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  43. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  44. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  45. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  46. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  47. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -2
  48. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  49. package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
  50. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  51. package/lib/chain/blocks/writeBlockInputToDb.js +28 -28
  52. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  53. package/lib/chain/bls/multithread/index.d.ts +3 -1
  54. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  55. package/lib/chain/bls/multithread/index.js +5 -3
  56. package/lib/chain/bls/multithread/index.js.map +1 -1
  57. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  58. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  59. package/lib/chain/bls/multithread/jobItem.js +2 -2
  60. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  61. package/lib/chain/bls/singleThread.d.ts +4 -2
  62. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  63. package/lib/chain/bls/singleThread.js +4 -2
  64. package/lib/chain/bls/singleThread.js.map +1 -1
  65. package/lib/chain/bls/utils.d.ts +2 -2
  66. package/lib/chain/bls/utils.d.ts.map +1 -1
  67. package/lib/chain/bls/utils.js +9 -6
  68. package/lib/chain/bls/utils.js.map +1 -1
  69. package/lib/chain/chain.d.ts +22 -5
  70. package/lib/chain/chain.d.ts.map +1 -1
  71. package/lib/chain/chain.js +197 -44
  72. package/lib/chain/chain.js.map +1 -1
  73. package/lib/chain/errors/attestationError.d.ts +14 -1
  74. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  75. package/lib/chain/errors/attestationError.js +8 -0
  76. package/lib/chain/errors/attestationError.js.map +1 -1
  77. package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
  78. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
  79. package/lib/chain/errors/executionPayloadBid.js +15 -0
  80. package/lib/chain/errors/executionPayloadBid.js.map +1 -0
  81. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  82. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
  83. package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
  84. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
  85. package/lib/chain/errors/index.d.ts +3 -0
  86. package/lib/chain/errors/index.d.ts.map +1 -1
  87. package/lib/chain/errors/index.js +3 -0
  88. package/lib/chain/errors/index.js.map +1 -1
  89. package/lib/chain/errors/payloadAttestation.d.ts +34 -0
  90. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
  91. package/lib/chain/errors/payloadAttestation.js +13 -0
  92. package/lib/chain/errors/payloadAttestation.js.map +1 -0
  93. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  94. package/lib/chain/forkChoice/index.js +18 -0
  95. package/lib/chain/forkChoice/index.js.map +1 -1
  96. package/lib/chain/initState.d.ts.map +1 -1
  97. package/lib/chain/initState.js +2 -2
  98. package/lib/chain/initState.js.map +1 -1
  99. package/lib/chain/interface.d.ts +21 -3
  100. package/lib/chain/interface.d.ts.map +1 -1
  101. package/lib/chain/interface.js.map +1 -1
  102. package/lib/chain/lightClient/index.d.ts.map +1 -1
  103. package/lib/chain/lightClient/index.js +1 -2
  104. package/lib/chain/lightClient/index.js.map +1 -1
  105. package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
  106. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
  107. package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
  108. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
  109. package/lib/chain/opPools/index.d.ts +2 -0
  110. package/lib/chain/opPools/index.d.ts.map +1 -1
  111. package/lib/chain/opPools/index.js +2 -0
  112. package/lib/chain/opPools/index.js.map +1 -1
  113. package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
  114. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
  115. package/lib/chain/opPools/payloadAttestationPool.js +109 -0
  116. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
  117. package/lib/chain/options.d.ts +0 -1
  118. package/lib/chain/options.d.ts.map +1 -1
  119. package/lib/chain/options.js +0 -1
  120. package/lib/chain/options.js.map +1 -1
  121. package/lib/chain/prepareNextSlot.js +6 -4
  122. package/lib/chain/prepareNextSlot.js.map +1 -1
  123. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  124. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  125. package/lib/chain/produceBlock/produceBlockBody.js +5 -3
  126. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  127. package/lib/chain/regen/interface.d.ts +4 -9
  128. package/lib/chain/regen/interface.d.ts.map +1 -1
  129. package/lib/chain/regen/interface.js +1 -1
  130. package/lib/chain/regen/interface.js.map +1 -1
  131. package/lib/chain/regen/queued.d.ts +2 -3
  132. package/lib/chain/regen/queued.d.ts.map +1 -1
  133. package/lib/chain/regen/queued.js +2 -16
  134. package/lib/chain/regen/queued.js.map +1 -1
  135. package/lib/chain/regen/regen.d.ts +5 -7
  136. package/lib/chain/regen/regen.d.ts.map +1 -1
  137. package/lib/chain/regen/regen.js +7 -17
  138. package/lib/chain/regen/regen.js.map +1 -1
  139. package/lib/chain/seenCache/index.d.ts +3 -1
  140. package/lib/chain/seenCache/index.d.ts.map +1 -1
  141. package/lib/chain/seenCache/index.js +3 -1
  142. package/lib/chain/seenCache/index.js.map +1 -1
  143. package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
  144. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  145. package/lib/chain/seenCache/seenAttesters.js +5 -0
  146. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  147. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
  148. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
  149. package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
  150. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
  151. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
  152. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
  153. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
  154. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
  155. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  156. package/lib/chain/seenCache/seenGossipBlockInput.js +3 -3
  157. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  158. package/lib/chain/stateCache/index.d.ts +0 -2
  159. package/lib/chain/stateCache/index.d.ts.map +1 -1
  160. package/lib/chain/stateCache/index.js +0 -2
  161. package/lib/chain/stateCache/index.js.map +1 -1
  162. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +2 -1
  163. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  164. package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -0
  165. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  166. package/lib/chain/validation/aggregateAndProof.js +35 -14
  167. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  168. package/lib/chain/validation/attestation.d.ts +2 -2
  169. package/lib/chain/validation/attestation.d.ts.map +1 -1
  170. package/lib/chain/validation/attestation.js +27 -8
  171. package/lib/chain/validation/attestation.js.map +1 -1
  172. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  173. package/lib/chain/validation/attesterSlashing.js +1 -1
  174. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  175. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  176. package/lib/chain/validation/blobSidecar.js +5 -5
  177. package/lib/chain/validation/blobSidecar.js.map +1 -1
  178. package/lib/chain/validation/block.d.ts.map +1 -1
  179. package/lib/chain/validation/block.js +6 -6
  180. package/lib/chain/validation/block.js.map +1 -1
  181. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  182. package/lib/chain/validation/dataColumnSidecar.js +5 -5
  183. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  184. package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
  185. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
  186. package/lib/chain/validation/executionPayloadBid.js +104 -0
  187. package/lib/chain/validation/executionPayloadBid.js.map +1 -0
  188. package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
  189. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
  190. package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
  191. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
  192. package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
  193. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
  194. package/lib/chain/validation/payloadAttestationMessage.js +72 -0
  195. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
  196. package/lib/chain/validation/proposerSlashing.js +1 -1
  197. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  198. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
  199. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  200. package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
  201. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  202. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  203. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  204. package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
  205. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  206. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
  207. package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
  208. package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
  209. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  210. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  211. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  212. package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
  213. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  214. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
  215. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  216. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  217. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  218. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  219. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  220. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  221. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  222. package/lib/chain/validation/syncCommittee.js +1 -1
  223. package/lib/chain/validation/syncCommittee.js.map +1 -1
  224. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  225. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
  226. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  227. package/lib/chain/validation/voluntaryExit.js +1 -1
  228. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  229. package/lib/chain/validatorMonitor.d.ts +2 -0
  230. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  231. package/lib/chain/validatorMonitor.js +49 -7
  232. package/lib/chain/validatorMonitor.js.map +1 -1
  233. package/lib/db/repositories/checkpointState.js +0 -1
  234. package/lib/db/repositories/checkpointState.js.map +1 -1
  235. package/lib/metrics/metrics/lodestar.d.ts +27 -0
  236. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  237. package/lib/metrics/metrics/lodestar.js +64 -0
  238. package/lib/metrics/metrics/lodestar.js.map +1 -1
  239. package/lib/network/core/networkCore.d.ts +3 -0
  240. package/lib/network/core/networkCore.d.ts.map +1 -1
  241. package/lib/network/core/networkCore.js +9 -0
  242. package/lib/network/core/networkCore.js.map +1 -1
  243. package/lib/network/core/networkCoreWorker.js +3 -0
  244. package/lib/network/core/networkCoreWorker.js.map +1 -1
  245. package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -0
  246. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  247. package/lib/network/core/networkCoreWorkerHandler.js +9 -0
  248. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  249. package/lib/network/core/types.d.ts +3 -0
  250. package/lib/network/core/types.d.ts.map +1 -1
  251. package/lib/network/gossip/gossipsub.d.ts +34 -0
  252. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  253. package/lib/network/gossip/gossipsub.js +123 -0
  254. package/lib/network/gossip/gossipsub.js.map +1 -1
  255. package/lib/network/gossip/interface.d.ts +20 -2
  256. package/lib/network/gossip/interface.d.ts.map +1 -1
  257. package/lib/network/gossip/interface.js +3 -0
  258. package/lib/network/gossip/interface.js.map +1 -1
  259. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  260. package/lib/network/gossip/scoringParameters.js +38 -2
  261. package/lib/network/gossip/scoringParameters.js.map +1 -1
  262. package/lib/network/gossip/topic.d.ts +77 -1
  263. package/lib/network/gossip/topic.d.ts.map +1 -1
  264. package/lib/network/gossip/topic.js +20 -0
  265. package/lib/network/gossip/topic.js.map +1 -1
  266. package/lib/network/network.d.ts +3 -0
  267. package/lib/network/network.d.ts.map +1 -1
  268. package/lib/network/network.js +9 -0
  269. package/lib/network/network.js.map +1 -1
  270. package/lib/network/options.d.ts +6 -0
  271. package/lib/network/options.d.ts.map +1 -1
  272. package/lib/network/options.js.map +1 -1
  273. package/lib/network/peers/peerManager.d.ts.map +1 -1
  274. package/lib/network/peers/peerManager.js +9 -0
  275. package/lib/network/peers/peerManager.js.map +1 -1
  276. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  277. package/lib/network/processor/gossipHandlers.js +35 -4
  278. package/lib/network/processor/gossipHandlers.js.map +1 -1
  279. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  280. package/lib/network/processor/gossipQueues/index.js +16 -0
  281. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  282. package/lib/network/processor/index.d.ts.map +1 -1
  283. package/lib/network/processor/index.js +3 -0
  284. package/lib/network/processor/index.js.map +1 -1
  285. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  286. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
  287. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  288. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
  289. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  290. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
  291. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  292. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
  293. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  294. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
  295. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  296. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  297. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
  298. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  299. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
  300. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
  301. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  302. package/lib/network/reqresp/handlers/index.js +2 -2
  303. package/lib/network/reqresp/handlers/index.js.map +1 -1
  304. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  305. package/lib/sync/backfill/backfill.js +3 -4
  306. package/lib/sync/backfill/backfill.js.map +1 -1
  307. package/lib/sync/backfill/verify.d.ts +1 -2
  308. package/lib/sync/backfill/verify.d.ts.map +1 -1
  309. package/lib/sync/backfill/verify.js +2 -2
  310. package/lib/sync/backfill/verify.js.map +1 -1
  311. package/lib/sync/range/chain.d.ts.map +1 -1
  312. package/lib/sync/range/chain.js +0 -1
  313. package/lib/sync/range/chain.js.map +1 -1
  314. package/lib/sync/range/range.d.ts.map +1 -1
  315. package/lib/sync/range/range.js +0 -3
  316. package/lib/sync/range/range.js.map +1 -1
  317. package/lib/sync/unknownBlock.d.ts.map +1 -1
  318. package/lib/sync/unknownBlock.js +0 -3
  319. package/lib/sync/unknownBlock.js.map +1 -1
  320. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  321. package/lib/sync/utils/downloadByRange.js +2 -2
  322. package/lib/sync/utils/downloadByRange.js.map +1 -1
  323. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  324. package/lib/sync/utils/downloadByRoot.js +1 -2
  325. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  326. package/package.json +16 -16
  327. package/src/api/impl/beacon/blocks/index.ts +39 -37
  328. package/src/api/impl/debug/index.ts +2 -6
  329. package/src/api/impl/lodestar/index.ts +35 -3
  330. package/src/api/impl/validator/index.ts +14 -12
  331. package/src/api/rest/base.ts +4 -4
  332. package/src/chain/ColumnReconstructionTracker.ts +8 -4
  333. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +2 -1
  334. package/src/chain/archiveStore/utils/archiveBlocks.ts +4 -0
  335. package/src/chain/blocks/blockInput/blockInput.ts +55 -4
  336. package/src/chain/blocks/importBlock.ts +3 -7
  337. package/src/chain/blocks/index.ts +0 -19
  338. package/src/chain/blocks/types.ts +0 -2
  339. package/src/chain/blocks/verifyBlock.ts +0 -9
  340. package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
  341. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -2
  342. package/src/chain/blocks/writeBlockInputToDb.ts +33 -30
  343. package/src/chain/bls/multithread/index.ts +7 -4
  344. package/src/chain/bls/multithread/jobItem.ts +7 -3
  345. package/src/chain/bls/singleThread.ts +5 -3
  346. package/src/chain/bls/utils.ts +15 -7
  347. package/src/chain/chain.ts +227 -56
  348. package/src/chain/errors/attestationError.ts +11 -1
  349. package/src/chain/errors/executionPayloadBid.ts +35 -0
  350. package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
  351. package/src/chain/errors/index.ts +3 -0
  352. package/src/chain/errors/payloadAttestation.ts +25 -0
  353. package/src/chain/forkChoice/index.ts +19 -0
  354. package/src/chain/initState.ts +2 -2
  355. package/src/chain/interface.ts +32 -1
  356. package/src/chain/lightClient/index.ts +1 -2
  357. package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
  358. package/src/chain/opPools/index.ts +2 -0
  359. package/src/chain/opPools/payloadAttestationPool.ts +157 -0
  360. package/src/chain/options.ts +0 -2
  361. package/src/chain/prepareNextSlot.ts +6 -6
  362. package/src/chain/produceBlock/produceBlockBody.ts +7 -5
  363. package/src/chain/regen/interface.ts +3 -13
  364. package/src/chain/regen/queued.ts +3 -24
  365. package/src/chain/regen/regen.ts +10 -25
  366. package/src/chain/seenCache/index.ts +3 -1
  367. package/src/chain/seenCache/seenAttesters.ts +5 -0
  368. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
  369. package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
  370. package/src/chain/seenCache/seenGossipBlockInput.ts +3 -3
  371. package/src/chain/stateCache/index.ts +0 -2
  372. package/src/chain/stateCache/persistentCheckpointsCache.ts +6 -2
  373. package/src/chain/validation/aggregateAndProof.ts +36 -14
  374. package/src/chain/validation/attestation.ts +33 -16
  375. package/src/chain/validation/attesterSlashing.ts +1 -6
  376. package/src/chain/validation/blobSidecar.ts +4 -9
  377. package/src/chain/validation/block.ts +6 -6
  378. package/src/chain/validation/dataColumnSidecar.ts +4 -9
  379. package/src/chain/validation/executionPayloadBid.ts +141 -0
  380. package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
  381. package/src/chain/validation/payloadAttestationMessage.ts +109 -0
  382. package/src/chain/validation/proposerSlashing.ts +1 -6
  383. package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
  384. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
  385. package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
  386. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
  387. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  388. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
  389. package/src/chain/validation/syncCommittee.ts +1 -1
  390. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
  391. package/src/chain/validation/voluntaryExit.ts +1 -1
  392. package/src/chain/validatorMonitor.ts +62 -8
  393. package/src/db/repositories/checkpointState.ts +1 -1
  394. package/src/metrics/metrics/lodestar.ts +65 -0
  395. package/src/network/core/networkCore.ts +12 -0
  396. package/src/network/core/networkCoreWorker.ts +3 -0
  397. package/src/network/core/networkCoreWorkerHandler.ts +9 -0
  398. package/src/network/core/types.ts +6 -0
  399. package/src/network/gossip/gossipsub.ts +147 -1
  400. package/src/network/gossip/interface.ts +17 -0
  401. package/src/network/gossip/scoringParameters.ts +44 -2
  402. package/src/network/gossip/topic.ts +21 -0
  403. package/src/network/network.ts +12 -0
  404. package/src/network/options.ts +6 -0
  405. package/src/network/peers/peerManager.ts +11 -0
  406. package/src/network/processor/gossipHandlers.ts +49 -4
  407. package/src/network/processor/gossipQueues/index.ts +16 -0
  408. package/src/network/processor/index.ts +3 -0
  409. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
  410. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
  411. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
  412. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
  413. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
  414. package/src/network/reqresp/handlers/index.ts +2 -2
  415. package/src/sync/backfill/backfill.ts +3 -4
  416. package/src/sync/backfill/verify.ts +2 -3
  417. package/src/sync/range/chain.ts +0 -1
  418. package/src/sync/range/range.ts +0 -3
  419. package/src/sync/unknownBlock.ts +0 -3
  420. package/src/sync/utils/downloadByRange.ts +2 -2
  421. package/src/sync/utils/downloadByRoot.ts +1 -2
  422. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +0 -54
  423. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +0 -1
  424. package/lib/chain/stateCache/blockStateCacheImpl.js +0 -130
  425. package/lib/chain/stateCache/blockStateCacheImpl.js.map +0 -1
  426. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +0 -60
  427. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +0 -1
  428. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +0 -156
  429. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +0 -1
  430. package/lib/util/bytes.d.ts +0 -3
  431. package/lib/util/bytes.d.ts.map +0 -1
  432. package/lib/util/bytes.js +0 -11
  433. package/lib/util/bytes.js.map +0 -1
  434. package/src/chain/stateCache/blockStateCacheImpl.ts +0 -149
  435. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +0 -192
  436. package/src/util/bytes.ts +0 -11
@@ -69,6 +69,9 @@ function stringifyGossipTopicType(topic: GossipTopic): string {
69
69
  case GossipType.light_client_finality_update:
70
70
  case GossipType.light_client_optimistic_update:
71
71
  case GossipType.bls_to_execution_change:
72
+ case GossipType.execution_payload:
73
+ case GossipType.payload_attestation_message:
74
+ case GossipType.execution_payload_bid:
72
75
  return topic.type;
73
76
  case GossipType.beacon_attestation:
74
77
  case GossipType.sync_committee:
@@ -114,6 +117,12 @@ export function getGossipSSZType(topic: GossipTopic) {
114
117
  : ssz.altair.LightClientFinalityUpdate;
115
118
  case GossipType.bls_to_execution_change:
116
119
  return ssz.capella.SignedBLSToExecutionChange;
120
+ case GossipType.execution_payload:
121
+ return ssz.gloas.SignedExecutionPayloadEnvelope;
122
+ case GossipType.payload_attestation_message:
123
+ return ssz.gloas.PayloadAttestationMessage;
124
+ case GossipType.execution_payload_bid:
125
+ return ssz.gloas.SignedExecutionPayloadBid;
117
126
  }
118
127
  }
119
128
 
@@ -190,6 +199,9 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr:
190
199
  case GossipType.light_client_finality_update:
191
200
  case GossipType.light_client_optimistic_update:
192
201
  case GossipType.bls_to_execution_change:
202
+ case GossipType.execution_payload:
203
+ case GossipType.payload_attestation_message:
204
+ case GossipType.execution_payload_bid:
193
205
  return {type: gossipTypeStr, boundary, encoding};
194
206
  }
195
207
 
@@ -240,6 +252,12 @@ export function getCoreTopicsAtFork(
240
252
  {type: GossipType.attester_slashing},
241
253
  ];
242
254
 
255
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
256
+ topics.push({type: GossipType.execution_payload});
257
+ topics.push({type: GossipType.payload_attestation_message});
258
+ topics.push({type: GossipType.execution_payload_bid});
259
+ }
260
+
243
261
  // After fulu also track data_column_sidecar_{index}
244
262
  if (ForkSeq[fork] >= ForkSeq.fulu) {
245
263
  topics.push(...getDataColumnSidecarTopics(networkConfig));
@@ -329,4 +347,7 @@ export const gossipTopicIgnoreDuplicatePublishError: Record<GossipType, boolean>
329
347
  [GossipType.light_client_finality_update]: false,
330
348
  [GossipType.light_client_optimistic_update]: false,
331
349
  [GossipType.bls_to_execution_change]: true,
350
+ [GossipType.execution_payload]: true,
351
+ [GossipType.payload_attestation_message]: true,
352
+ [GossipType.execution_payload_bid]: true,
332
353
  };
@@ -641,6 +641,18 @@ export class Network implements INetwork {
641
641
  return this.core.disconnectPeer(peer);
642
642
  }
643
643
 
644
+ addDirectPeer(peer: routes.lodestar.DirectPeer): Promise<string | null> {
645
+ return this.core.addDirectPeer(peer);
646
+ }
647
+
648
+ removeDirectPeer(peerId: string): Promise<boolean> {
649
+ return this.core.removeDirectPeer(peerId);
650
+ }
651
+
652
+ getDirectPeers(): Promise<string[]> {
653
+ return this.core.getDirectPeers();
654
+ }
655
+
644
656
  dumpPeer(peerIdStr: string): Promise<routes.lodestar.LodestarNodePeer | undefined> {
645
657
  return this.core.dumpPeer(peerIdStr);
646
658
  }
@@ -15,6 +15,12 @@ export interface NetworkOptions
15
15
  Omit<Eth2GossipsubOpts, "disableLightClientServer"> {
16
16
  localMultiaddrs: string[];
17
17
  bootMultiaddrs?: string[];
18
+ /**
19
+ * Direct peers for GossipSub - these peers maintain permanent mesh connections without GRAFT/PRUNE.
20
+ * Format: multiaddr strings with peer ID, e.g., "/ip4/192.168.1.1/tcp/9000/p2p/16Uiu2HAmKLhW7..."
21
+ * Both peers must configure each other as direct peers for the feature to work properly.
22
+ */
23
+ directPeers?: string[];
18
24
  subscribeAllSubnets?: boolean;
19
25
  mdns?: boolean;
20
26
  connectToDiscv5Bootnodes?: boolean;
@@ -721,6 +721,17 @@ export class PeerManager {
721
721
  // NOTE: libp2p may emit two "peer:connect" events: One for inbound, one for outbound
722
722
  // If that happens, it's okay. Only the "outbound" connection triggers immediate action
723
723
  const now = Date.now();
724
+
725
+ // Ethereum uses secp256k1 for node IDs, reject peers with other key types
726
+ if (remotePeer.type !== "secp256k1") {
727
+ this.logger.debug("Peer does not have secp256k1 key, disconnecting", {
728
+ peer: remotePeerPrettyStr,
729
+ type: remotePeer.type,
730
+ });
731
+ void this.goodbyeAndDisconnect(remotePeer, GoodByeReasonCode.IRRELEVANT_NETWORK);
732
+ return;
733
+ }
734
+
724
735
  const nodeId = computeNodeId(remotePeer);
725
736
  const peerData: PeerData = {
726
737
  lastReceivedMsgUnixTsMs: direction === "outbound" ? 0 : now,
@@ -48,6 +48,8 @@ import {
48
48
  import {IBeaconChain} from "../../chain/interface.js";
49
49
  import {validateGossipBlobSidecar} from "../../chain/validation/blobSidecar.js";
50
50
  import {validateGossipDataColumnSidecar} from "../../chain/validation/dataColumnSidecar.js";
51
+ import {validateGossipExecutionPayloadBid} from "../../chain/validation/executionPayloadBid.js";
52
+ import {validateGossipExecutionPayloadEnvelope} from "../../chain/validation/executionPayloadEnvelope.js";
51
53
  import {
52
54
  AggregateAndProofValidationResult,
53
55
  GossipAttestation,
@@ -64,6 +66,7 @@ import {
64
66
  } from "../../chain/validation/index.js";
65
67
  import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js";
66
68
  import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js";
69
+ import {validateGossipPayloadAttestationMessage} from "../../chain/validation/payloadAttestationMessage.js";
67
70
  import {OpSource} from "../../chain/validatorMonitor.js";
68
71
  import {Metrics} from "../../metrics/index.js";
69
72
  import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
@@ -436,14 +439,11 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
436
439
  blsVerifyOnMainThread: true,
437
440
  // to track block process steps
438
441
  seenTimestampSec,
439
- // gossip block is validated, we want to process it asap
440
- eagerPersistBlock: true,
441
442
  })
442
443
  .then(() => {
443
444
  // Returns the delay between the start of `block.slot` and `current time`
444
445
  const delaySec = chain.clock.secFromSlot(slot);
445
446
  metrics?.gossipBlock.elapsedTimeTillProcessed.observe(delaySec);
446
- chain.seenBlockInputCache.prune(blockInput.blockRootHex);
447
447
  })
448
448
  .catch((e) => {
449
449
  // Adjust verbosity based on error type
@@ -579,7 +579,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
579
579
  break;
580
580
  }
581
581
 
582
- if (!blockInput.hasAllData()) {
582
+ if (!blockInput.hasComputedAllData()) {
583
583
  // immediately attempt fetch of data columns from execution engine
584
584
  chain.getBlobsTracker.triggerGetBlobs(blockInput);
585
585
  // if we've received at least half of the columns, trigger reconstruction of the rest
@@ -818,6 +818,51 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
818
818
 
819
819
  chain.emitter.emit(routes.events.EventType.blsToExecutionChange, blsToExecutionChange);
820
820
  },
821
+ [GossipType.execution_payload]: async ({
822
+ gossipData,
823
+ topic,
824
+ }: GossipHandlerParamGeneric<GossipType.execution_payload>) => {
825
+ const {serializedData} = gossipData;
826
+ const executionPayloadEnvelope = sszDeserialize(topic, serializedData);
827
+ await validateGossipExecutionPayloadEnvelope(chain, executionPayloadEnvelope);
828
+
829
+ // TODO GLOAS: Handle valid envelope. Need an import flow that calls `processExecutionPayloadEnvelope` and fork choice
830
+ },
831
+ [GossipType.payload_attestation_message]: async ({
832
+ gossipData,
833
+ topic,
834
+ }: GossipHandlerParamGeneric<GossipType.payload_attestation_message>) => {
835
+ const {serializedData} = gossipData;
836
+ const payloadAttestationMessage = sszDeserialize(topic, serializedData);
837
+ const validationResult = await validateGossipPayloadAttestationMessage(chain, payloadAttestationMessage);
838
+
839
+ try {
840
+ const insertOutcome = chain.payloadAttestationPool.add(
841
+ payloadAttestationMessage,
842
+ validationResult.attDataRootHex,
843
+ validationResult.validatorCommitteeIndex
844
+ );
845
+ metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
846
+ } catch (e) {
847
+ logger.error("Error adding to payloadAttestation pool", {}, e as Error);
848
+ }
849
+ },
850
+ [GossipType.execution_payload_bid]: async ({
851
+ gossipData,
852
+ topic,
853
+ }: GossipHandlerParamGeneric<GossipType.execution_payload_bid>) => {
854
+ const {serializedData} = gossipData;
855
+ const executionPayloadBid = sszDeserialize(topic, serializedData);
856
+ await validateGossipExecutionPayloadBid(chain, executionPayloadBid);
857
+
858
+ // Handle valid payload bid by storing in a bid pool
859
+ try {
860
+ const insertOutcome = chain.executionPayloadBidPool.add(executionPayloadBid.message);
861
+ metrics?.opPool.executionPayloadBidPool.gossipInsertOutcome.inc({insertOutcome});
862
+ } catch (e) {
863
+ logger.error("Error adding to executionPayloadBid pool", {}, e as Error);
864
+ }
865
+ },
821
866
  };
822
867
  }
823
868
 
@@ -67,6 +67,22 @@ const linearGossipQueueOpts: {
67
67
  type: QueueType.FIFO,
68
68
  dropOpts: {type: DropType.count, count: 1},
69
69
  },
70
+ [GossipType.execution_payload]: {
71
+ maxLength: 1024,
72
+ type: QueueType.FIFO,
73
+ dropOpts: {type: DropType.count, count: 1},
74
+ },
75
+ [GossipType.payload_attestation_message]: {
76
+ maxLength: 1024,
77
+ type: QueueType.FIFO,
78
+ dropOpts: {type: DropType.count, count: 1},
79
+ },
80
+ // TODO GLOAS: It is hard to predict how many bids are there. Put 1024 for max length for now
81
+ [GossipType.execution_payload_bid]: {
82
+ maxLength: 1024,
83
+ type: QueueType.FIFO,
84
+ dropOpts: {type: DropType.count, count: 1},
85
+ },
70
86
  };
71
87
 
72
88
  const indexedGossipQueueOpts: {
@@ -78,6 +78,9 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
78
78
  [GossipType.sync_committee]: {},
79
79
  [GossipType.light_client_finality_update]: {},
80
80
  [GossipType.light_client_optimistic_update]: {},
81
+ [GossipType.execution_payload]: {bypassQueue: true},
82
+ [GossipType.payload_attestation_message]: {},
83
+ [GossipType.execution_payload_bid]: {},
81
84
  };
82
85
  const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
83
86
 
@@ -4,7 +4,6 @@ import {GENESIS_SLOT, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
4
4
  import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
5
5
  import {computeEpochAtSlot} from "@lodestar/state-transition";
6
6
  import {deneb, phase0} from "@lodestar/types";
7
- import {fromHex} from "@lodestar/utils";
8
7
  import {IBeaconChain} from "../../../chain/index.js";
9
8
  import {IBeaconDb} from "../../../db/index.js";
10
9
  import {prettyPrintPeerId} from "../../util.ts";
@@ -22,7 +21,6 @@ export async function* onBeaconBlocksByRange(
22
21
  const endSlot = startSlot + count;
23
22
 
24
23
  const finalized = db.blockArchive;
25
- const unfinalized = db.block;
26
24
  // in the case of initializing from a non-finalized state, we don't have the finalized block so this api does not work
27
25
  // chain.forkChoice.getFinalizeBlock().slot
28
26
  const finalizedSlot = chain.forkChoice.getFinalizedCheckpointSlot();
@@ -65,7 +63,7 @@ export async function* onBeaconBlocksByRange(
65
63
  // re-org there's no need to abort the request
66
64
  // Spec: https://github.com/ethereum/consensus-specs/blob/a1e46d1ae47dd9d097725801575b46907c12a1f8/specs/eip4844/p2p-interface.md#blobssidecarsbyrange-v1
67
65
 
68
- const blockBytes = await unfinalized.getBinary(fromHex(block.blockRoot));
66
+ const blockBytes = await chain.getSerializedBlockByRoot(block.blockRoot);
69
67
  if (!blockBytes) {
70
68
  throw new ResponseError(
71
69
  RespStatus.SERVER_ERROR,
@@ -74,7 +72,7 @@ export async function* onBeaconBlocksByRange(
74
72
  }
75
73
 
76
74
  yield {
77
- data: blockBytes,
75
+ data: blockBytes.block,
78
76
  boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(block.slot)),
79
77
  };
80
78
  }
@@ -1,48 +1,21 @@
1
1
  import {ResponseOutgoing} from "@lodestar/reqresp";
2
2
  import {computeEpochAtSlot} from "@lodestar/state-transition";
3
- import {Slot} from "@lodestar/types";
4
3
  import {toRootHex} from "@lodestar/utils";
5
4
  import {IBeaconChain} from "../../../chain/index.js";
6
- import {IBeaconDb} from "../../../db/index.js";
7
- import {getSlotFromSignedBeaconBlockSerialized} from "../../../util/sszBytes.js";
8
5
  import {BeaconBlocksByRootRequest} from "../../../util/types.js";
9
6
 
10
7
  export async function* onBeaconBlocksByRoot(
11
8
  requestBody: BeaconBlocksByRootRequest,
12
- chain: IBeaconChain,
13
- db: IBeaconDb
9
+ chain: IBeaconChain
14
10
  ): AsyncIterable<ResponseOutgoing> {
15
11
  for (const blockRoot of requestBody) {
16
12
  const root = blockRoot;
17
- const summary = chain.forkChoice.getBlock(root);
18
- let blockBytes: Uint8Array | null = null;
19
-
20
- // finalized block has summary in forkchoice but it stays in blockArchive db
21
- if (summary) {
22
- blockBytes = await db.block.getBinary(root);
23
- }
24
-
25
- let slot: Slot | undefined = undefined;
26
- if (!blockBytes) {
27
- const blockEntry = await db.blockArchive.getBinaryEntryByRoot(root);
28
- if (blockEntry) {
29
- slot = blockEntry.key;
30
- blockBytes = blockEntry.value;
31
- }
32
- }
33
-
34
- if (blockBytes) {
35
- if (slot === undefined) {
36
- const slotFromBytes = getSlotFromSignedBeaconBlockSerialized(blockBytes);
37
- if (slotFromBytes === null) {
38
- throw Error(`Invalid block bytes for block root ${toRootHex(root)}`);
39
- }
40
- slot = slotFromBytes;
41
- }
13
+ const block = await chain.getSerializedBlockByRoot(toRootHex(root));
42
14
 
15
+ if (block) {
43
16
  yield {
44
- data: blockBytes,
45
- boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(slot)),
17
+ data: block.block,
18
+ boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(block.slot)),
46
19
  };
47
20
  }
48
21
  }
@@ -2,16 +2,13 @@ import {BLOB_SIDECAR_FIXED_SIZE} from "@lodestar/params";
2
2
  import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
3
3
  import {computeEpochAtSlot} from "@lodestar/state-transition";
4
4
  import {RootHex} from "@lodestar/types";
5
- import {fromHex, toRootHex} from "@lodestar/utils";
5
+ import {toRootHex} from "@lodestar/utils";
6
6
  import {IBeaconChain} from "../../../chain/index.js";
7
- import {IBeaconDb} from "../../../db/index.js";
8
- import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../../../db/repositories/blobSidecars.js";
9
7
  import {BlobSidecarsByRootRequest} from "../../../util/types.js";
10
8
 
11
9
  export async function* onBlobSidecarsByRoot(
12
10
  requestBody: BlobSidecarsByRootRequest,
13
- chain: IBeaconChain,
14
- db: IBeaconDb
11
+ chain: IBeaconChain
15
12
  ): AsyncIterable<ResponseOutgoing> {
16
13
  const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
17
14
 
@@ -34,14 +31,13 @@ export async function* onBlobSidecarsByRoot(
34
31
 
35
32
  // Check if we need to load sidecars for a new block root
36
33
  if (lastFetchedSideCars === null || lastFetchedSideCars.blockRoot !== blockRootHex) {
37
- const blobSideCarsBytesWrapped = await db.blobSidecars.getBinary(fromHex(block.blockRoot));
38
- if (!blobSideCarsBytesWrapped) {
34
+ const blobSidecarsBytes = await chain.getSerializedBlobSidecars(block.slot, blockRootHex);
35
+ if (!blobSidecarsBytes) {
39
36
  // Handle the same to onBeaconBlocksByRange
40
37
  throw new ResponseError(RespStatus.SERVER_ERROR, `No item for root ${block.blockRoot} slot ${block.slot}`);
41
38
  }
42
- const blobSideCarsBytes = blobSideCarsBytesWrapped.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
43
39
 
44
- lastFetchedSideCars = {blockRoot: blockRootHex, bytes: blobSideCarsBytes};
40
+ lastFetchedSideCars = {blockRoot: blockRootHex, bytes: blobSidecarsBytes};
45
41
  }
46
42
 
47
43
  const blobSidecarBytes = lastFetchedSideCars.bytes.slice(
@@ -38,7 +38,6 @@ export async function* onDataColumnSidecarsByRange(
38
38
  }
39
39
 
40
40
  const finalized = db.dataColumnSidecarArchive;
41
- const unfinalized = db.dataColumnSidecar;
42
41
  const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
43
42
 
44
43
  // Finalized range of columns
@@ -92,7 +91,11 @@ export async function* onDataColumnSidecarsByRange(
92
91
  // at the time of the start of the request. Spec is clear the chain of columns must be consistent, but on
93
92
  // re-org there's no need to abort the request
94
93
  // Spec: https://github.com/ethereum/consensus-specs/blob/ad36024441cf910d428d03f87f331fbbd2b3e5f1/specs/fulu/p2p-interface.md#L425-L429
95
- const dataColumnSidecars = await unfinalized.getManyBinary(fromHex(block.blockRoot), availableColumns);
94
+ const dataColumnSidecars = await chain.getSerializedDataColumnSidecars(
95
+ block.slot,
96
+ block.blockRoot,
97
+ availableColumns
98
+ );
96
99
 
97
100
  const unavailableColumnIndices: ColumnIndex[] = [];
98
101
  for (let i = 0; i < dataColumnSidecars.length; i++) {
@@ -61,11 +61,7 @@ export async function* onDataColumnSidecarsByRoot(
61
61
  continue;
62
62
  }
63
63
 
64
- const dataColumns = block
65
- ? // Non-finalized sidecars are stored by block root
66
- await db.dataColumnSidecar.getManyBinary(blockRoot, availableColumns)
67
- : // Finalized sidecars are archived and stored by slot
68
- await db.dataColumnSidecarArchive.getManyBinary(slot, availableColumns);
64
+ const dataColumns = await chain.getSerializedDataColumnSidecars(slot, blockRootHex, availableColumns);
69
65
 
70
66
  const unavailableColumnIndices: ColumnIndex[] = [];
71
67
  for (let i = 0; i < dataColumns.length; i++) {
@@ -42,12 +42,12 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
42
42
  [ReqRespMethod.BeaconBlocksByRoot]: (req) => {
43
43
  const fork = chain.config.getForkName(chain.clock.currentSlot);
44
44
  const body = BeaconBlocksByRootRequestType(fork, chain.config).deserialize(req.data);
45
- return onBeaconBlocksByRoot(body, chain, db);
45
+ return onBeaconBlocksByRoot(body, chain);
46
46
  },
47
47
  [ReqRespMethod.BlobSidecarsByRoot]: (req) => {
48
48
  const fork = chain.config.getForkName(chain.clock.currentSlot);
49
49
  const body = BlobSidecarsByRootRequestType(fork, chain.config).deserialize(req.data);
50
- return onBlobSidecarsByRoot(body, chain, db);
50
+ return onBlobSidecarsByRoot(body, chain);
51
51
  },
52
52
  [ReqRespMethod.BlobSidecarsByRange]: (req) => {
53
53
  const body = ssz.deneb.BlobSidecarsByRangeRequest.deserialize(req.data);
@@ -4,13 +4,12 @@ import {BeaconConfig, ChainForkConfig} from "@lodestar/config";
4
4
  import {SLOTS_PER_EPOCH} from "@lodestar/params";
5
5
  import {BeaconStateAllForks, blockToHeader, computeAnchorCheckpoint} from "@lodestar/state-transition";
6
6
  import {Root, SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
7
- import {ErrorAborted, Logger, sleep, toRootHex} from "@lodestar/utils";
7
+ import {ErrorAborted, Logger, byteArrayEquals, sleep, toRootHex} from "@lodestar/utils";
8
8
  import {IBeaconChain} from "../../chain/index.js";
9
9
  import {GENESIS_SLOT, ZERO_HASH} from "../../constants/index.js";
10
10
  import {IBeaconDb} from "../../db/index.js";
11
11
  import {Metrics} from "../../metrics/metrics.js";
12
12
  import {INetwork, NetworkEvent, NetworkEventData, PeerAction} from "../../network/index.js";
13
- import {byteArrayEquals} from "../../util/bytes.js";
14
13
  import {ItTrigger} from "../../util/itTrigger.js";
15
14
  import {PeerIdStr} from "../../util/peerId.js";
16
15
  import {shuffleOne} from "../../util/shuffle.js";
@@ -750,7 +749,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
750
749
 
751
750
  // GENESIS_SLOT doesn't has valid signature
752
751
  if (anchorBlock.message.slot === GENESIS_SLOT) return;
753
- await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, [anchorBlock]);
752
+ await verifyBlockProposerSignature(this.chain.config, this.chain.bls, [anchorBlock]);
754
753
 
755
754
  // We can write to the disk if this is ahead of prevFinalizedCheckpointBlock otherwise
756
755
  // we will need to go make checks on the top of sync loop before writing as it might
@@ -815,7 +814,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
815
814
 
816
815
  // If any of the block's proposer signature fail, we can't trust this peer at all
817
816
  if (verifiedBlocks.length > 0) {
818
- await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, verifiedBlocks);
817
+ await verifyBlockProposerSignature(this.chain.config, this.chain.bls, verifiedBlocks);
819
818
 
820
819
  // This is bad, like super bad. Abort the backfill
821
820
  if (!nextAnchor)
@@ -1,6 +1,6 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {GENESIS_SLOT} from "@lodestar/params";
3
- import {ISignatureSet, Index2PubkeyCache, getBlockProposerSignatureSet} from "@lodestar/state-transition";
3
+ import {ISignatureSet, getBlockProposerSignatureSet} from "@lodestar/state-transition";
4
4
  import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
5
5
  import {IBlsVerifier} from "../../chain/bls/index.js";
6
6
  import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js";
@@ -42,14 +42,13 @@ export function verifyBlockSequence(
42
42
 
43
43
  export async function verifyBlockProposerSignature(
44
44
  config: BeaconConfig,
45
- index2pubkey: Index2PubkeyCache,
46
45
  bls: IBlsVerifier,
47
46
  blocks: SignedBeaconBlock[]
48
47
  ): Promise<void> {
49
48
  if (blocks.length === 1 && blocks[0].message.slot === GENESIS_SLOT) return;
50
49
  const signatures = blocks.reduce((sigs: ISignatureSet[], block) => {
51
50
  // genesis block doesn't have valid signature
52
- if (block.message.slot !== GENESIS_SLOT) sigs.push(getBlockProposerSignatureSet(config, index2pubkey, block));
51
+ if (block.message.slot !== GENESIS_SLOT) sigs.push(getBlockProposerSignatureSet(config, block));
53
52
  return sigs;
54
53
  }, []);
55
54
 
@@ -585,7 +585,6 @@ export class SyncChain {
585
585
 
586
586
  if (!res.err) {
587
587
  batch.processingSuccess();
588
- this.pruneBlockInputs(batch.getBlocks());
589
588
 
590
589
  // If the processed batch is not empty, validate previous AwaitingValidation blocks.
591
590
  if (blocks.length > 0) {
@@ -188,9 +188,6 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
188
188
  // when this runs, syncing is the most important thing and gossip is not likely to run
189
189
  // so we can utilize worker threads to verify signatures
190
190
  blsVerifyOnMainThread: false,
191
- // we want to be safe to only persist blocks after verifying it to avoid any attacks that may cause our DB
192
- // to grow too much
193
- eagerPersistBlock: false,
194
191
  };
195
192
 
196
193
  if (this.opts?.disableProcessAsChainSegment) {
@@ -423,8 +423,6 @@ export class BlockInputSync {
423
423
  // see https://github.com/ChainSafe/lodestar/issues/5650
424
424
  ignoreIfFinalized: true,
425
425
  blsVerifyOnMainThread: true,
426
- // block is validated with correct root, we want to process it as soon as possible
427
- eagerPersistBlock: true,
428
426
  })
429
427
  );
430
428
 
@@ -434,7 +432,6 @@ export class BlockInputSync {
434
432
  if (!res.err) {
435
433
  // no need to update status to "processed", delete anyway
436
434
  this.pendingBlocks.delete(pendingBlock.blockInput.blockRootHex);
437
- this.chain.seenBlockInputCache.prune(pendingBlock.blockInput.blockRootHex);
438
435
 
439
436
  // Send child blocks to the processor
440
437
  for (const descendantBlock of getDescendantBlocks(pendingBlock.blockInput.blockRootHex, this.pendingBlocks)) {
@@ -8,7 +8,7 @@ import {
8
8
  isForkPostGloas,
9
9
  } from "@lodestar/params";
10
10
  import {SignedBeaconBlock, Slot, deneb, fulu, phase0} from "@lodestar/types";
11
- import {LodestarError, Logger, fromHex, prettyPrintIndices, toRootHex} from "@lodestar/utils";
11
+ import {LodestarError, Logger, byteArrayEquals, fromHex, prettyPrintIndices, toRootHex} from "@lodestar/utils";
12
12
  import {
13
13
  BlockInputSource,
14
14
  DAType,
@@ -475,7 +475,7 @@ export function validateBlockByRangeResponse(
475
475
  if (i < blocks.length - 1) {
476
476
  // compare the block root against the next block's parent root
477
477
  const parentRoot = blocks[i + 1].message.parentRoot;
478
- if (Buffer.compare(blockRoot, parentRoot) !== 0) {
478
+ if (!byteArrayEquals(blockRoot, parentRoot)) {
479
479
  throw new DownloadByRangeError(
480
480
  {
481
481
  code: DownloadByRangeErrorCode.PARENT_ROOT_MISMATCH,
@@ -9,7 +9,7 @@ import {
9
9
  isForkPostFulu,
10
10
  } from "@lodestar/params";
11
11
  import {BeaconBlockBody, BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
12
- import {LodestarError, fromHex, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
12
+ import {LodestarError, byteArrayEquals, fromHex, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
13
13
  import {isBlockInputBlobs, isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
14
14
  import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types.js";
15
15
  import {ChainEventEmitter} from "../../chain/emitter.js";
@@ -19,7 +19,6 @@ import {validateBlockDataColumnSidecars} from "../../chain/validation/dataColumn
19
19
  import {INetwork} from "../../network/interface.js";
20
20
  import {PeerSyncMeta} from "../../network/peers/peersData.js";
21
21
  import {prettyPrintPeerIdStr} from "../../network/util.js";
22
- import {byteArrayEquals} from "../../util/bytes.js";
23
22
  import {PeerIdStr} from "../../util/peerId.js";
24
23
  import {WarnResult} from "../../util/wrapError.js";
25
24
  import {
@@ -1,54 +0,0 @@
1
- import { routes } from "@lodestar/api";
2
- import { CachedBeaconStateAllForks } from "@lodestar/state-transition";
3
- import { Epoch, RootHex } from "@lodestar/types";
4
- import { Metrics } from "../../metrics/index.js";
5
- import { BlockStateCache } from "./types.js";
6
- /**
7
- * Old implementation of StateCache (used to call `StateContextCache`)
8
- * - Prune per checkpoint so number of states ranges from 96 to 128
9
- * - Keep a separate head state to make sure it is always available
10
- */
11
- export declare class BlockStateCacheImpl implements BlockStateCache {
12
- /**
13
- * Max number of states allowed in the cache
14
- */
15
- readonly maxStates: number;
16
- private readonly cache;
17
- /** Epoch -> Set<blockRoot> */
18
- private readonly epochIndex;
19
- private readonly metrics;
20
- /**
21
- * Strong reference to prevent head state from being pruned.
22
- * null if head state is being regen and not available at the moment.
23
- */
24
- private head;
25
- constructor({ maxStates, metrics }: {
26
- maxStates?: number;
27
- metrics?: Metrics | null;
28
- });
29
- get(rootHex: RootHex): CachedBeaconStateAllForks | null;
30
- add(item: CachedBeaconStateAllForks): void;
31
- setHeadState(item: CachedBeaconStateAllForks | null): void;
32
- /**
33
- * Get a seed state for state reload.
34
- * This is to conform to the api only as this cache is not used in n-historical state.
35
- * See ./fifoBlockStateCache.ts for implementation
36
- */
37
- getSeedState(): CachedBeaconStateAllForks;
38
- clear(): void;
39
- get size(): number;
40
- /**
41
- * TODO make this more robust.
42
- * Without more thought, this currently breaks our assumptions about recent state availablity
43
- */
44
- prune(headStateRootHex: RootHex): void;
45
- /**
46
- * Prune per finalized epoch.
47
- */
48
- deleteAllBeforeEpoch(finalizedEpoch: Epoch): void;
49
- /** ONLY FOR DEBUGGING PURPOSES. For lodestar debug API */
50
- dumpSummary(): routes.lodestar.StateCacheItem[];
51
- getStates(): IterableIterator<CachedBeaconStateAllForks>;
52
- private deleteAllEpochItems;
53
- }
54
- //# sourceMappingURL=blockStateCacheImpl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blockStateCacheImpl.d.ts","sourceRoot":"","sources":["../../../src/chain/stateCache/blockStateCacheImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAC,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAI3C;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgD;IACtE,8BAA8B;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiC;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2C;IACnE;;;OAGG;IACH,OAAO,CAAC,IAAI,CAAuE;gBAEvE,EAAC,SAAsB,EAAE,OAAO,EAAC,EAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAAC;IAS7F,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,yBAAyB,GAAG,IAAI;IAavD,GAAG,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI;IAgB1C,YAAY,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI;IAS1D;;;;OAIG;IACH,YAAY,IAAI,yBAAyB;IAIzC,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,KAAK,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI;IAgBtC;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,KAAK,GAAG,IAAI;IAQjD,0DAA0D;IAC1D,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;IAU/C,SAAS,IAAI,gBAAgB,CAAC,yBAAyB,CAAC;IAIxD,OAAO,CAAC,mBAAmB;CAM5B"}