@lodestar/beacon-node 1.51.0-dev.fac22802f6 → 1.51.0-dev.fb216e169a

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 (479) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +19 -61
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +17 -0
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/validator/index.d.ts +6 -0
  8. package/lib/api/impl/validator/index.d.ts.map +1 -1
  9. package/lib/api/impl/validator/index.js +38 -25
  10. package/lib/api/impl/validator/index.js.map +1 -1
  11. package/lib/chain/GetBlobsTracker.d.ts +2 -2
  12. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  13. package/lib/chain/GetBlobsTracker.js +7 -31
  14. package/lib/chain/GetBlobsTracker.js.map +1 -1
  15. package/lib/chain/blocks/blockInput/blockInput.d.ts +11 -56
  16. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  17. package/lib/chain/blocks/blockInput/blockInput.js +5 -241
  18. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  19. package/lib/chain/blocks/blockInput/errors.d.ts +2 -4
  20. package/lib/chain/blocks/blockInput/errors.d.ts.map +1 -1
  21. package/lib/chain/blocks/blockInput/errors.js.map +1 -1
  22. package/lib/chain/blocks/blockInput/types.d.ts +2 -18
  23. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  24. package/lib/chain/blocks/blockInput/types.js +0 -1
  25. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  26. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  27. package/lib/chain/blocks/importBlock.js +36 -53
  28. package/lib/chain/blocks/importBlock.js.map +1 -1
  29. package/lib/chain/blocks/importExecutionPayload.d.ts +6 -10
  30. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  31. package/lib/chain/blocks/importExecutionPayload.js +26 -17
  32. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  33. package/lib/chain/blocks/index.d.ts.map +1 -1
  34. package/lib/chain/blocks/index.js +2 -2
  35. package/lib/chain/blocks/index.js.map +1 -1
  36. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +10 -7
  37. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  38. package/lib/chain/blocks/payloadEnvelopeProcessor.js +21 -16
  39. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  40. package/lib/chain/blocks/types.d.ts +4 -20
  41. package/lib/chain/blocks/types.d.ts.map +1 -1
  42. package/lib/chain/blocks/types.js +0 -24
  43. package/lib/chain/blocks/types.js.map +1 -1
  44. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  45. package/lib/chain/blocks/verifyBlock.js +17 -6
  46. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  47. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyBlocksDataAvailability.js +6 -1
  49. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  50. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
  51. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  52. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +7 -3
  53. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  54. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  55. package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
  56. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  57. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  58. package/lib/chain/blocks/verifyBlocksSignatures.js +10 -5
  59. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  60. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  61. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +1 -3
  62. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  63. package/lib/chain/blocks/writeBlockInputToDb.d.ts +0 -2
  64. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  65. package/lib/chain/blocks/writeBlockInputToDb.js +6 -24
  66. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  67. package/lib/chain/bls/interface.d.ts +2 -0
  68. package/lib/chain/bls/interface.d.ts.map +1 -1
  69. package/lib/chain/bls/multithread/index.d.ts +1 -1
  70. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  71. package/lib/chain/bls/multithread/index.js +45 -17
  72. package/lib/chain/bls/multithread/index.js.map +1 -1
  73. package/lib/chain/chain.d.ts +24 -3
  74. package/lib/chain/chain.d.ts.map +1 -1
  75. package/lib/chain/chain.js +120 -39
  76. package/lib/chain/chain.js.map +1 -1
  77. package/lib/chain/emitter.d.ts +7 -7
  78. package/lib/chain/emitter.d.ts.map +1 -1
  79. package/lib/chain/emitter.js +5 -5
  80. package/lib/chain/emitter.js.map +1 -1
  81. package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
  82. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  83. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  84. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  85. package/lib/chain/errors/index.d.ts +0 -1
  86. package/lib/chain/errors/index.d.ts.map +1 -1
  87. package/lib/chain/errors/index.js +0 -1
  88. package/lib/chain/errors/index.js.map +1 -1
  89. package/lib/chain/forkChoice/index.d.ts +11 -1
  90. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  91. package/lib/chain/forkChoice/index.js +11 -0
  92. package/lib/chain/forkChoice/index.js.map +1 -1
  93. package/lib/chain/forkChoiceExecutionEngine.d.ts +51 -0
  94. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
  95. package/lib/chain/forkChoiceExecutionEngine.js +117 -0
  96. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
  97. package/lib/chain/interface.d.ts +7 -4
  98. package/lib/chain/interface.d.ts.map +1 -1
  99. package/lib/chain/interface.js.map +1 -1
  100. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +17 -4
  101. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  102. package/lib/chain/opPools/aggregatedAttestationPool.js +198 -45
  103. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  104. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  105. package/lib/chain/opPools/attestationPool.js +14 -3
  106. package/lib/chain/opPools/attestationPool.js.map +1 -1
  107. package/lib/chain/opPools/index.d.ts +1 -0
  108. package/lib/chain/opPools/index.d.ts.map +1 -1
  109. package/lib/chain/opPools/index.js +1 -0
  110. package/lib/chain/opPools/index.js.map +1 -1
  111. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  112. package/lib/chain/opPools/payloadAttestationPool.js +16 -6
  113. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  114. package/lib/chain/opPools/singleAttestationPool.d.ts +77 -0
  115. package/lib/chain/opPools/singleAttestationPool.d.ts.map +1 -0
  116. package/lib/chain/opPools/singleAttestationPool.js +209 -0
  117. package/lib/chain/opPools/singleAttestationPool.js.map +1 -0
  118. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
  119. package/lib/chain/opPools/syncCommitteeMessagePool.js +8 -2
  120. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  121. package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
  122. package/lib/chain/opPools/syncContributionAndProofPool.js +10 -2
  123. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  124. package/lib/chain/options.d.ts +5 -2
  125. package/lib/chain/options.d.ts.map +1 -1
  126. package/lib/chain/options.js.map +1 -1
  127. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  128. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  129. package/lib/chain/produceBlock/produceBlockBody.js +3 -2
  130. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  131. package/lib/chain/proposerTracker.d.ts +31 -0
  132. package/lib/chain/proposerTracker.d.ts.map +1 -0
  133. package/lib/chain/proposerTracker.js +75 -0
  134. package/lib/chain/proposerTracker.js.map +1 -0
  135. package/lib/chain/regen/interface.d.ts +1 -1
  136. package/lib/chain/regen/interface.d.ts.map +1 -1
  137. package/lib/chain/regen/queued.d.ts +1 -1
  138. package/lib/chain/regen/queued.d.ts.map +1 -1
  139. package/lib/chain/regen/queued.js +5 -3
  140. package/lib/chain/regen/queued.js.map +1 -1
  141. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -14
  142. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  143. package/lib/chain/seenCache/seenGossipBlockInput.js +6 -65
  144. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  145. package/lib/chain/validation/executionPayloadBid.js +13 -13
  146. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  147. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  148. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  149. package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
  150. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  151. package/lib/chain/validatorMonitor.d.ts +1 -2
  152. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  153. package/lib/chain/validatorMonitor.js +0 -3
  154. package/lib/chain/validatorMonitor.js.map +1 -1
  155. package/lib/db/flatFileStore/flatFileStore.js +5 -5
  156. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  157. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  158. package/lib/db/flatFileStore/slotIndex.js +2 -2
  159. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  160. package/lib/db/repositories/blobSidecars.d.ts +0 -1
  161. package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
  162. package/lib/db/repositories/blobSidecars.js +0 -1
  163. package/lib/db/repositories/blobSidecars.js.map +1 -1
  164. package/lib/execution/builder/apiClient.d.ts +14 -8
  165. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  166. package/lib/execution/builder/apiClient.js +12 -10
  167. package/lib/execution/builder/apiClient.js.map +1 -1
  168. package/lib/execution/builder/http.d.ts +2 -0
  169. package/lib/execution/builder/http.d.ts.map +1 -1
  170. package/lib/execution/builder/http.js +2 -0
  171. package/lib/execution/builder/http.js.map +1 -1
  172. package/lib/execution/engine/http.d.ts +4 -6
  173. package/lib/execution/engine/http.d.ts.map +1 -1
  174. package/lib/execution/engine/http.js +8 -10
  175. package/lib/execution/engine/http.js.map +1 -1
  176. package/lib/execution/engine/interface.d.ts +17 -5
  177. package/lib/execution/engine/interface.d.ts.map +1 -1
  178. package/lib/execution/engine/interface.js.map +1 -1
  179. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -4
  180. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  181. package/lib/execution/engine/jsonRpcTransport.js +2 -12
  182. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  183. package/lib/execution/engine/mock.d.ts +0 -1
  184. package/lib/execution/engine/mock.d.ts.map +1 -1
  185. package/lib/execution/engine/mock.js +0 -4
  186. package/lib/execution/engine/mock.js.map +1 -1
  187. package/lib/execution/engine/restTransport.d.ts +2 -4
  188. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  189. package/lib/execution/engine/restTransport.js +1 -15
  190. package/lib/execution/engine/restTransport.js.map +1 -1
  191. package/lib/execution/engine/sszTypes.d.ts +0 -9
  192. package/lib/execution/engine/sszTypes.d.ts.map +1 -1
  193. package/lib/execution/engine/sszTypes.js +0 -5
  194. package/lib/execution/engine/sszTypes.js.map +1 -1
  195. package/lib/execution/engine/transport.d.ts +1 -14
  196. package/lib/execution/engine/transport.d.ts.map +1 -1
  197. package/lib/execution/engine/types.d.ts +0 -8
  198. package/lib/execution/engine/types.d.ts.map +1 -1
  199. package/lib/execution/engine/types.js +0 -8
  200. package/lib/execution/engine/types.js.map +1 -1
  201. package/lib/execution/engine/utils.d.ts.map +1 -1
  202. package/lib/execution/engine/utils.js +3 -2
  203. package/lib/execution/engine/utils.js.map +1 -1
  204. package/lib/index.d.ts +1 -1
  205. package/lib/index.d.ts.map +1 -1
  206. package/lib/index.js +1 -1
  207. package/lib/index.js.map +1 -1
  208. package/lib/metrics/metrics/beacon.d.ts +0 -9
  209. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  210. package/lib/metrics/metrics/beacon.js +0 -30
  211. package/lib/metrics/metrics/beacon.js.map +1 -1
  212. package/lib/metrics/metrics/lodestar.d.ts +27 -8
  213. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  214. package/lib/metrics/metrics/lodestar.js +74 -18
  215. package/lib/metrics/metrics/lodestar.js.map +1 -1
  216. package/lib/metrics/server/http.js +5 -5
  217. package/lib/metrics/server/http.js.map +1 -1
  218. package/lib/network/core/networkCore.d.ts +2 -1
  219. package/lib/network/core/networkCore.d.ts.map +1 -1
  220. package/lib/network/core/networkCore.js +4 -0
  221. package/lib/network/core/networkCore.js.map +1 -1
  222. package/lib/network/core/networkCoreWorker.js +1 -0
  223. package/lib/network/core/networkCoreWorker.js.map +1 -1
  224. package/lib/network/core/networkCoreWorkerHandler.d.ts +2 -1
  225. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  226. package/lib/network/core/networkCoreWorkerHandler.js +3 -0
  227. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  228. package/lib/network/core/types.d.ts +4 -1
  229. package/lib/network/core/types.d.ts.map +1 -1
  230. package/lib/network/gossip/gossipsub.d.ts +1 -0
  231. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  232. package/lib/network/gossip/gossipsub.js +10 -0
  233. package/lib/network/gossip/gossipsub.js.map +1 -1
  234. package/lib/network/gossip/interface.d.ts +1 -8
  235. package/lib/network/gossip/interface.d.ts.map +1 -1
  236. package/lib/network/gossip/interface.js +0 -1
  237. package/lib/network/gossip/interface.js.map +1 -1
  238. package/lib/network/gossip/topic.d.ts +0 -16
  239. package/lib/network/gossip/topic.d.ts.map +1 -1
  240. package/lib/network/gossip/topic.js +0 -23
  241. package/lib/network/gossip/topic.js.map +1 -1
  242. package/lib/network/interface.d.ts +2 -5
  243. package/lib/network/interface.d.ts.map +1 -1
  244. package/lib/network/libp2p/index.d.ts.map +1 -1
  245. package/lib/network/libp2p/index.js +5 -1
  246. package/lib/network/libp2p/index.js.map +1 -1
  247. package/lib/network/network.d.ts +6 -7
  248. package/lib/network/network.d.ts.map +1 -1
  249. package/lib/network/network.js +50 -37
  250. package/lib/network/network.js.map +1 -1
  251. package/lib/network/options.d.ts +2 -0
  252. package/lib/network/options.d.ts.map +1 -1
  253. package/lib/network/options.js +2 -0
  254. package/lib/network/options.js.map +1 -1
  255. package/lib/network/peers/peerManager.d.ts.map +1 -1
  256. package/lib/network/peers/peerManager.js +28 -1
  257. package/lib/network/peers/peerManager.js.map +1 -1
  258. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  259. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  260. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  261. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  262. package/lib/network/peers/utils/subnetMap.d.ts +5 -2
  263. package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
  264. package/lib/network/peers/utils/subnetMap.js +6 -3
  265. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  266. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  267. package/lib/network/processor/extractSlotRootFns.js +1 -8
  268. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  269. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  270. package/lib/network/processor/gossipHandlers.js +46 -126
  271. package/lib/network/processor/gossipHandlers.js.map +1 -1
  272. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  273. package/lib/network/processor/gossipQueues/index.js +0 -6
  274. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  275. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  276. package/lib/network/processor/gossipValidatorFn.js +1 -5
  277. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  278. package/lib/network/processor/index.d.ts +6 -0
  279. package/lib/network/processor/index.d.ts.map +1 -1
  280. package/lib/network/processor/index.js +29 -4
  281. package/lib/network/processor/index.js.map +1 -1
  282. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  283. package/lib/network/reqresp/ReqRespBeaconNode.js +0 -3
  284. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  285. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
  286. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  287. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  288. package/lib/network/reqresp/handlers/index.js +1 -12
  289. package/lib/network/reqresp/handlers/index.js.map +1 -1
  290. package/lib/network/reqresp/protocols.d.ts +0 -2
  291. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  292. package/lib/network/reqresp/protocols.js +0 -10
  293. package/lib/network/reqresp/protocols.js.map +1 -1
  294. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  295. package/lib/network/reqresp/rateLimit.js +1 -17
  296. package/lib/network/reqresp/rateLimit.js.map +1 -1
  297. package/lib/network/reqresp/types.d.ts +2 -8
  298. package/lib/network/reqresp/types.d.ts.map +1 -1
  299. package/lib/network/reqresp/types.js +1 -7
  300. package/lib/network/reqresp/types.js.map +1 -1
  301. package/lib/network/subnets/attnetsService.d.ts +35 -5
  302. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  303. package/lib/network/subnets/attnetsService.js +84 -6
  304. package/lib/network/subnets/attnetsService.js.map +1 -1
  305. package/lib/network/subnets/interface.d.ts +7 -0
  306. package/lib/network/subnets/interface.d.ts.map +1 -1
  307. package/lib/network/subnets/interface.js.map +1 -1
  308. package/lib/node/nodejs.d.ts +2 -0
  309. package/lib/node/nodejs.d.ts.map +1 -1
  310. package/lib/node/nodejs.js +37 -19
  311. package/lib/node/nodejs.js.map +1 -1
  312. package/lib/node/options.d.ts +3 -1
  313. package/lib/node/options.d.ts.map +1 -1
  314. package/lib/node/options.js +4 -2
  315. package/lib/node/options.js.map +1 -1
  316. package/lib/sync/range/batch.d.ts +2 -3
  317. package/lib/sync/range/batch.d.ts.map +1 -1
  318. package/lib/sync/range/batch.js +9 -22
  319. package/lib/sync/range/batch.js.map +1 -1
  320. package/lib/sync/range/chain.d.ts.map +1 -1
  321. package/lib/sync/range/chain.js +2 -15
  322. package/lib/sync/range/chain.js.map +1 -1
  323. package/lib/sync/sync.d.ts +8 -0
  324. package/lib/sync/sync.d.ts.map +1 -1
  325. package/lib/sync/sync.js +42 -22
  326. package/lib/sync/sync.js.map +1 -1
  327. package/lib/sync/unknownBlock.d.ts.map +1 -1
  328. package/lib/sync/unknownBlock.js +1 -7
  329. package/lib/sync/unknownBlock.js.map +1 -1
  330. package/lib/sync/utils/downloadByRange.d.ts +6 -34
  331. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  332. package/lib/sync/utils/downloadByRange.js +24 -128
  333. package/lib/sync/utils/downloadByRange.js.map +1 -1
  334. package/lib/sync/utils/downloadByRoot.d.ts +2 -18
  335. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  336. package/lib/sync/utils/downloadByRoot.js +14 -99
  337. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  338. package/lib/util/blobs.d.ts +1 -7
  339. package/lib/util/blobs.d.ts.map +1 -1
  340. package/lib/util/blobs.js +0 -19
  341. package/lib/util/blobs.js.map +1 -1
  342. package/lib/util/execution.d.ts +3 -4
  343. package/lib/util/execution.d.ts.map +1 -1
  344. package/lib/util/execution.js +1 -73
  345. package/lib/util/execution.js.map +1 -1
  346. package/lib/util/file.d.ts.map +1 -1
  347. package/lib/util/file.js +8 -9
  348. package/lib/util/file.js.map +1 -1
  349. package/lib/util/sszBytes.d.ts +5 -1
  350. package/lib/util/sszBytes.d.ts.map +1 -1
  351. package/lib/util/sszBytes.js +34 -17
  352. package/lib/util/sszBytes.js.map +1 -1
  353. package/lib/util/types.d.ts +0 -5
  354. package/lib/util/types.d.ts.map +1 -1
  355. package/lib/util/types.js +1 -2
  356. package/lib/util/types.js.map +1 -1
  357. package/package.json +16 -17
  358. package/src/api/impl/beacon/blocks/index.ts +24 -64
  359. package/src/api/impl/beacon/pool/index.ts +26 -0
  360. package/src/api/impl/validator/index.ts +43 -29
  361. package/src/chain/GetBlobsTracker.ts +10 -39
  362. package/src/chain/blocks/blockInput/blockInput.ts +11 -343
  363. package/src/chain/blocks/blockInput/errors.ts +1 -2
  364. package/src/chain/blocks/blockInput/types.ts +2 -20
  365. package/src/chain/blocks/importBlock.ts +56 -72
  366. package/src/chain/blocks/importExecutionPayload.ts +44 -33
  367. package/src/chain/blocks/index.ts +5 -2
  368. package/src/chain/blocks/payloadEnvelopeProcessor.ts +32 -21
  369. package/src/chain/blocks/types.ts +5 -31
  370. package/src/chain/blocks/verifyBlock.ts +30 -16
  371. package/src/chain/blocks/verifyBlocksDataAvailability.ts +6 -1
  372. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -6
  373. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  374. package/src/chain/blocks/verifyBlocksSignatures.ts +10 -5
  375. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +1 -3
  376. package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
  377. package/src/chain/bls/interface.ts +2 -0
  378. package/src/chain/bls/multithread/index.ts +43 -19
  379. package/src/chain/chain.ts +135 -37
  380. package/src/chain/emitter.ts +8 -8
  381. package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
  382. package/src/chain/errors/index.ts +0 -1
  383. package/src/chain/forkChoice/index.ts +11 -0
  384. package/src/chain/forkChoiceExecutionEngine.ts +183 -0
  385. package/src/chain/interface.ts +7 -3
  386. package/src/chain/opPools/aggregatedAttestationPool.ts +245 -42
  387. package/src/chain/opPools/attestationPool.ts +15 -3
  388. package/src/chain/opPools/index.ts +1 -0
  389. package/src/chain/opPools/payloadAttestationPool.ts +17 -6
  390. package/src/chain/opPools/singleAttestationPool.ts +287 -0
  391. package/src/chain/opPools/syncCommitteeMessagePool.ts +9 -2
  392. package/src/chain/opPools/syncContributionAndProofPool.ts +12 -2
  393. package/src/chain/options.ts +5 -2
  394. package/src/chain/produceBlock/produceBlockBody.ts +7 -3
  395. package/src/chain/proposerTracker.ts +94 -0
  396. package/src/chain/regen/interface.ts +1 -1
  397. package/src/chain/regen/queued.ts +6 -4
  398. package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
  399. package/src/chain/validation/executionPayloadBid.ts +14 -13
  400. package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
  401. package/src/chain/validatorMonitor.ts +0 -6
  402. package/src/db/flatFileStore/flatFileStore.ts +7 -7
  403. package/src/db/flatFileStore/slotIndex.ts +4 -3
  404. package/src/db/repositories/blobSidecars.ts +0 -1
  405. package/src/execution/builder/apiClient.ts +16 -13
  406. package/src/execution/builder/http.ts +4 -0
  407. package/src/execution/engine/http.ts +19 -42
  408. package/src/execution/engine/interface.ts +18 -9
  409. package/src/execution/engine/jsonRpcTransport.ts +10 -22
  410. package/src/execution/engine/mock.ts +0 -7
  411. package/src/execution/engine/restTransport.ts +3 -22
  412. package/src/execution/engine/sszTypes.ts +0 -9
  413. package/src/execution/engine/transport.ts +8 -17
  414. package/src/execution/engine/types.ts +0 -17
  415. package/src/execution/engine/utils.ts +4 -2
  416. package/src/index.ts +1 -1
  417. package/src/metrics/metrics/beacon.ts +0 -30
  418. package/src/metrics/metrics/lodestar.ts +75 -18
  419. package/src/metrics/server/http.ts +5 -5
  420. package/src/network/core/networkCore.ts +6 -1
  421. package/src/network/core/networkCoreWorker.ts +1 -0
  422. package/src/network/core/networkCoreWorkerHandler.ts +4 -1
  423. package/src/network/core/types.ts +4 -1
  424. package/src/network/gossip/gossipsub.ts +11 -0
  425. package/src/network/gossip/interface.ts +0 -5
  426. package/src/network/gossip/topic.ts +0 -25
  427. package/src/network/interface.ts +0 -5
  428. package/src/network/libp2p/index.ts +5 -1
  429. package/src/network/network.ts +50 -60
  430. package/src/network/options.ts +4 -0
  431. package/src/network/peers/peerManager.ts +27 -2
  432. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  433. package/src/network/peers/utils/subnetMap.ts +6 -3
  434. package/src/network/processor/extractSlotRootFns.ts +0 -9
  435. package/src/network/processor/gossipHandlers.ts +59 -159
  436. package/src/network/processor/gossipQueues/index.ts +0 -6
  437. package/src/network/processor/gossipValidatorFn.ts +0 -5
  438. package/src/network/processor/index.ts +25 -4
  439. package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
  440. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
  441. package/src/network/reqresp/handlers/index.ts +0 -17
  442. package/src/network/reqresp/protocols.ts +0 -12
  443. package/src/network/reqresp/rateLimit.ts +1 -17
  444. package/src/network/reqresp/types.ts +0 -13
  445. package/src/network/subnets/attnetsService.ts +94 -6
  446. package/src/network/subnets/interface.ts +7 -0
  447. package/src/node/nodejs.ts +34 -15
  448. package/src/node/options.ts +5 -1
  449. package/src/sync/range/batch.ts +9 -21
  450. package/src/sync/range/chain.ts +2 -14
  451. package/src/sync/sync.ts +43 -22
  452. package/src/sync/unknownBlock.ts +1 -8
  453. package/src/sync/utils/downloadByRange.ts +31 -230
  454. package/src/sync/utils/downloadByRoot.ts +15 -142
  455. package/src/util/blobs.ts +0 -34
  456. package/src/util/execution.ts +8 -102
  457. package/src/util/file.ts +8 -9
  458. package/src/util/sszBytes.ts +40 -22
  459. package/src/util/types.ts +1 -8
  460. package/lib/chain/errors/blobSidecarError.d.ts +0 -108
  461. package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
  462. package/lib/chain/errors/blobSidecarError.js +0 -38
  463. package/lib/chain/errors/blobSidecarError.js.map +0 -1
  464. package/lib/chain/validation/blobSidecar.d.ts +0 -16
  465. package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
  466. package/lib/chain/validation/blobSidecar.js +0 -276
  467. package/lib/chain/validation/blobSidecar.js.map +0 -1
  468. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
  469. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
  470. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
  471. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
  472. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
  473. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
  474. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
  475. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
  476. package/src/chain/errors/blobSidecarError.ts +0 -70
  477. package/src/chain/validation/blobSidecar.ts +0 -357
  478. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
  479. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
@@ -0,0 +1,287 @@
1
+ import {ATTESTATION_SUBNET_COUNT, ForkPostElectra} from "@lodestar/params";
2
+ import {EffectiveBalanceIncrements} from "@lodestar/state-transition";
3
+ import {BLSSignature, CommitteeIndex, RootHex, SingleAttestation, Slot, ValidatorIndex, phase0} from "@lodestar/types";
4
+ import {Metrics} from "../../metrics/metrics.js";
5
+ import {ProposerTracker} from "../proposerTracker.js";
6
+ import {InsertOutcome} from "./types.js";
7
+
8
+ type DataRootHex = string;
9
+
10
+ /** Position of a validator in its committee, i.e. its bit in `aggregationBits` */
11
+ type ValidatorCommitteeIndex = number;
12
+
13
+ /** `data` and `committeeIndex` are shared per data root and committee, only keep what packing reads */
14
+ type StoredSingle = {attesterIndex: ValidatorIndex; signature: BLSSignature};
15
+
16
+ type CommitteeSingles = {
17
+ /** Bit length of this committee's `aggregationBits` */
18
+ committeeSize: number;
19
+ singles: Map<ValidatorCommitteeIndex, StoredSingle>;
20
+ };
21
+
22
+ type DataRootSingles = {
23
+ /** Same for every single attestation under this data root */
24
+ data: phase0.AttestationData;
25
+ byCommittee: Map<CommitteeIndex, CommitteeSingles>;
26
+ };
27
+
28
+ /** Single attestations of not yet included committee members, signatures are not aggregated yet */
29
+ export type SinglesForCommittee = {
30
+ committeeSize: number;
31
+ singles: {validatorCommitteeIndex: ValidatorCommitteeIndex; single: StoredSingle}[];
32
+ newSeenEffectiveBalance: number;
33
+ newSeenAttesters: number;
34
+ };
35
+
36
+ /** Attesters of an attestation included in a block, `attestingIndices` is not sorted */
37
+ export type IncludedAttesters = {slot: Slot; attDataRootHex: DataRootHex; attestingIndices: ValidatorIndex[]};
38
+
39
+ /**
40
+ * Backstop only, single attestations included in a canonical block are deleted (see `onHead`) so the real retention is
41
+ * far lower. Sized for all subnets during the default 8 slots before a proposal (`slotsToSubscribeBeforeProposalDuty`)
42
+ * with no block at all and up to 1024 attesters per committee, i.e. ~2M active validators. Earlier slots of the
43
+ * collected window only add the few subnets the node subscribes to anyway. Beyond it, newer singles are dropped
44
+ */
45
+ const MAX_SINGLE_ATTESTATIONS_RETAINED = 8 * ATTESTATION_SUBNET_COUNT * 1024;
46
+
47
+ /**
48
+ * Single attestations to be packed into a block produced by this node, for votes that no aggregate covers.
49
+ * Callers only add to it for vote slots of an upcoming local proposal, see `ProposerTracker.shouldCollect()`.
50
+ * They are kept even if an aggregate covers them since proposers may not include that aggregate, until a canonical
51
+ * block includes them.
52
+ */
53
+ export class SingleAttestationPool {
54
+ private readonly singlesByCommitteeByDataRootBySlot = new Map<Slot, Map<DataRootHex, DataRootSingles>>();
55
+ private size = 0;
56
+ /** Attesters included by the head block, deleted once a child of it becomes head */
57
+ private pendingPrune: {blockRoot: RootHex; included: IncludedAttesters[]} | null = null;
58
+
59
+ constructor(metrics: Metrics | null = null) {
60
+ metrics?.opPool.singleAttestationPool.size.addCollect(() =>
61
+ metrics.opPool.singleAttestationPool.size.set(this.size)
62
+ );
63
+ }
64
+
65
+ /**
66
+ * @param validatorCommitteeIndex position of the attester in its committee, computed by gossip validation
67
+ */
68
+ add(
69
+ attestation: SingleAttestation<ForkPostElectra>,
70
+ attDataRootHex: DataRootHex,
71
+ validatorCommitteeIndex: ValidatorCommitteeIndex,
72
+ committeeSize: number
73
+ ): InsertOutcome {
74
+ if (this.size >= MAX_SINGLE_ATTESTATIONS_RETAINED) {
75
+ return InsertOutcome.ReachLimit;
76
+ }
77
+
78
+ const {data, committeeIndex, attesterIndex, signature} = attestation;
79
+ let singlesByCommitteeByDataRoot = this.singlesByCommitteeByDataRootBySlot.get(data.slot);
80
+ if (singlesByCommitteeByDataRoot === undefined) {
81
+ singlesByCommitteeByDataRoot = new Map();
82
+ this.singlesByCommitteeByDataRootBySlot.set(data.slot, singlesByCommitteeByDataRoot);
83
+ }
84
+
85
+ let dataRootSingles = singlesByCommitteeByDataRoot.get(attDataRootHex);
86
+ if (dataRootSingles === undefined) {
87
+ dataRootSingles = {data, byCommittee: new Map()};
88
+ singlesByCommitteeByDataRoot.set(attDataRootHex, dataRootSingles);
89
+ }
90
+
91
+ let committee = dataRootSingles.byCommittee.get(committeeIndex);
92
+ if (committee === undefined) {
93
+ committee = {committeeSize, singles: new Map()};
94
+ dataRootSingles.byCommittee.set(committeeIndex, committee);
95
+ }
96
+
97
+ if (committee.singles.has(validatorCommitteeIndex)) {
98
+ return InsertOutcome.AlreadyKnown;
99
+ }
100
+
101
+ committee.singles.set(validatorCommitteeIndex, {attesterIndex, signature});
102
+ this.size++;
103
+ return InsertOutcome.NewData;
104
+ }
105
+
106
+ /**
107
+ * Delete single attestations included by the parent of the new head. Not the ones of the head itself: a proposer
108
+ * boost reorg of a weak head must keep them, once a child of it is the head that reorg can no longer happen.
109
+ * @param included attesters of the attestations included in the new head block
110
+ * @returns number of deleted single attestations
111
+ */
112
+ onHead(blockRoot: RootHex, parentRoot: RootHex, included: IncludedAttesters[]): number {
113
+ if (this.singlesByCommitteeByDataRootBySlot.size === 0) {
114
+ this.pendingPrune = null;
115
+ return 0;
116
+ }
117
+
118
+ // a reorg or a parent imported while the pool was empty drops the pending block without deleting
119
+ const deleted = this.pendingPrune?.blockRoot === parentRoot ? this.deleteIncluded(this.pendingPrune.included) : 0;
120
+ this.pendingPrune = {blockRoot, included};
121
+ return deleted;
122
+ }
123
+
124
+ /** Drop vote slots that no upcoming local proposal can include */
125
+ prune(proposerTracker: ProposerTracker): void {
126
+ for (const [slot, singlesByCommitteeByDataRoot] of this.singlesByCommitteeByDataRootBySlot) {
127
+ if (proposerTracker.shouldCollect(slot)) {
128
+ continue;
129
+ }
130
+
131
+ for (const dataRootSingles of singlesByCommitteeByDataRoot.values()) {
132
+ for (const committee of dataRootSingles.byCommittee.values()) {
133
+ this.size -= committee.singles.size;
134
+ }
135
+ }
136
+ this.singlesByCommitteeByDataRootBySlot.delete(slot);
137
+ }
138
+
139
+ if (this.singlesByCommitteeByDataRootBySlot.size === 0) {
140
+ this.pendingPrune = null;
141
+ }
142
+ }
143
+
144
+ isEmpty(): boolean {
145
+ return this.singlesByCommitteeByDataRootBySlot.size === 0;
146
+ }
147
+
148
+ getStoredSlots(): Slot[] {
149
+ return Array.from(this.singlesByCommitteeByDataRootBySlot.keys());
150
+ }
151
+
152
+ getDataRoots(slot: Slot): Map<DataRootHex, phase0.AttestationData> {
153
+ const dataRoots = new Map<DataRootHex, phase0.AttestationData>();
154
+ for (const [attDataRootHex, dataRootSingles] of this.singlesByCommitteeByDataRootBySlot.get(slot) ?? []) {
155
+ dataRoots.set(attDataRootHex, dataRootSingles.data);
156
+ }
157
+ return dataRoots;
158
+ }
159
+
160
+ getCommitteeIndices(slot: Slot, attDataRootHex: DataRootHex): CommitteeIndex[] {
161
+ return Array.from(this.singlesByCommitteeByDataRootBySlot.get(slot)?.get(attDataRootHex)?.byCommittee.keys() ?? []);
162
+ }
163
+
164
+ /**
165
+ * Single attestations of a committee whose attesters are in `notSeenCommitteeMembers`, i.e. not on chain and not
166
+ * covered by the aggregates picked for the block. `notSeenCommitteeMembers` is only read.
167
+ * Returns at most `maxCount` single attestations with the highest effective balances, without removing them from the
168
+ * pool.
169
+ */
170
+ getUncovered(
171
+ slot: Slot,
172
+ attDataRootHex: DataRootHex,
173
+ committeeIndex: CommitteeIndex,
174
+ notSeenCommitteeMembers: ReadonlySet<ValidatorCommitteeIndex>,
175
+ effectiveBalanceIncrements: EffectiveBalanceIncrements,
176
+ maxCount: number
177
+ ): SinglesForCommittee | null {
178
+ const committee = this.singlesByCommitteeByDataRootBySlot
179
+ .get(slot)
180
+ ?.get(attDataRootHex)
181
+ ?.byCommittee.get(committeeIndex);
182
+ if (committee === undefined) {
183
+ return null;
184
+ }
185
+
186
+ const singles: SinglesForCommittee["singles"] = [];
187
+ // walk the smaller side, notSeenCommitteeMembers is usually tiny but close to the committee size if no aggregate
188
+ if (notSeenCommitteeMembers.size <= committee.singles.size) {
189
+ for (const validatorCommitteeIndex of notSeenCommitteeMembers) {
190
+ const single = committee.singles.get(validatorCommitteeIndex);
191
+ if (single !== undefined) {
192
+ singles.push({validatorCommitteeIndex, single});
193
+ }
194
+ }
195
+ } else {
196
+ for (const [validatorCommitteeIndex, single] of committee.singles) {
197
+ if (notSeenCommitteeMembers.has(validatorCommitteeIndex)) {
198
+ singles.push({validatorCommitteeIndex, single});
199
+ }
200
+ }
201
+ }
202
+ if (singles.length > maxCount) {
203
+ singles.sort(
204
+ (a, b) =>
205
+ effectiveBalanceIncrements[b.single.attesterIndex] - effectiveBalanceIncrements[a.single.attesterIndex]
206
+ );
207
+ singles.length = maxCount;
208
+ }
209
+ if (singles.length === 0) {
210
+ return null;
211
+ }
212
+
213
+ let newSeenEffectiveBalance = 0;
214
+ for (const {single} of singles) {
215
+ newSeenEffectiveBalance += effectiveBalanceIncrements[single.attesterIndex];
216
+ }
217
+ return {committeeSize: committee.committeeSize, singles, newSeenEffectiveBalance, newSeenAttesters: singles.length};
218
+ }
219
+
220
+ /**
221
+ * Delete single attestations whose votes are already on chain, they add nothing to a block built on top of it.
222
+ * @param includedAttestations one entry per attestation in the body of a canonical block (the parent of the new
223
+ * head): the attestation slot and data root, and the validators it covers. A single attestation is included if its
224
+ * attester is in `attestingIndices` of an entry with the same slot and data root.
225
+ * @returns number of deleted single attestations
226
+ */
227
+ private deleteIncluded(includedAttestations: IncludedAttesters[]): number {
228
+ // a block may include several attestations of the same data, merge their attesters per data root
229
+ const includedAttestersByDataRootBySlot = new Map<Slot, Map<DataRootHex, Set<ValidatorIndex>>>();
230
+ for (const {slot, attDataRootHex, attestingIndices} of includedAttestations) {
231
+ if (this.singlesByCommitteeByDataRootBySlot.get(slot)?.has(attDataRootHex) !== true) {
232
+ continue;
233
+ }
234
+ let includedAttestersByDataRoot = includedAttestersByDataRootBySlot.get(slot);
235
+ if (includedAttestersByDataRoot === undefined) {
236
+ includedAttestersByDataRoot = new Map();
237
+ includedAttestersByDataRootBySlot.set(slot, includedAttestersByDataRoot);
238
+ }
239
+ let includedAttesters = includedAttestersByDataRoot.get(attDataRootHex);
240
+ if (includedAttesters === undefined) {
241
+ includedAttesters = new Set();
242
+ includedAttestersByDataRoot.set(attDataRootHex, includedAttesters);
243
+ }
244
+ for (const attesterIndex of attestingIndices) {
245
+ includedAttesters.add(attesterIndex);
246
+ }
247
+ }
248
+
249
+ let deleted = 0;
250
+ for (const [slot, includedAttestersByDataRoot] of includedAttestersByDataRootBySlot) {
251
+ const singlesByCommitteeByDataRoot = this.singlesByCommitteeByDataRootBySlot.get(slot);
252
+ if (singlesByCommitteeByDataRoot === undefined) {
253
+ continue;
254
+ }
255
+
256
+ for (const [attDataRootHex, includedAttesters] of includedAttestersByDataRoot) {
257
+ const dataRootSingles = singlesByCommitteeByDataRoot.get(attDataRootHex);
258
+ if (dataRootSingles === undefined) {
259
+ continue;
260
+ }
261
+
262
+ for (const [committeeIndex, committee] of dataRootSingles.byCommittee) {
263
+ for (const [validatorCommitteeIndex, {attesterIndex}] of committee.singles) {
264
+ if (includedAttesters.has(attesterIndex)) {
265
+ committee.singles.delete(validatorCommitteeIndex);
266
+ deleted++;
267
+ }
268
+ }
269
+ if (committee.singles.size === 0) {
270
+ dataRootSingles.byCommittee.delete(committeeIndex);
271
+ }
272
+ }
273
+
274
+ if (dataRootSingles.byCommittee.size === 0) {
275
+ singlesByCommitteeByDataRoot.delete(attDataRootHex);
276
+ }
277
+ }
278
+
279
+ if (singlesByCommitteeByDataRoot.size === 0) {
280
+ this.singlesByCommitteeByDataRootBySlot.delete(slot);
281
+ }
282
+ }
283
+
284
+ this.size -= deleted;
285
+ return deleted;
286
+ }
287
+ }
@@ -2,8 +2,9 @@ import {BitArray} from "@chainsafe/ssz";
2
2
  import {ChainForkConfig} from "@lodestar/config";
3
3
  import {Signature, aggregateSignatures} from "@lodestar/native/blst";
4
4
  import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params";
5
+ import {G2_POINT_AT_INFINITY} from "@lodestar/state-transition";
5
6
  import {Root, Slot, SubcommitteeIndex, SubnetID, altair} from "@lodestar/types";
6
- import {MapDef, toRootHex} from "@lodestar/utils";
7
+ import {MapDef, byteArrayEquals, toRootHex} from "@lodestar/utils";
7
8
  import {IClock} from "../../util/clock.js";
8
9
  import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js";
9
10
  import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js";
@@ -110,10 +111,16 @@ export class SyncCommitteeMessagePool {
110
111
  return null;
111
112
  }
112
113
 
114
+ const signature = contribution.signature.toBytes();
115
+ // The point at infinity is not a valid contribution signature, do not serve such a contribution
116
+ if (byteArrayEquals(signature, G2_POINT_AT_INFINITY)) {
117
+ return null;
118
+ }
119
+
113
120
  return {
114
121
  ...contribution,
115
122
  aggregationBits: contribution.aggregationBits,
116
- signature: contribution.signature.toBytes(),
123
+ signature,
117
124
  };
118
125
  }
119
126
 
@@ -4,7 +4,7 @@ import {Signature, aggregateSignatures} from "@lodestar/native/blst";
4
4
  import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params";
5
5
  import {G2_POINT_AT_INFINITY} from "@lodestar/state-transition";
6
6
  import {Root, Slot, SubnetID, altair, ssz} from "@lodestar/types";
7
- import {Logger, MapDef, toRootHex} from "@lodestar/utils";
7
+ import {Logger, MapDef, byteArrayEquals, toRootHex} from "@lodestar/utils";
8
8
  import {Metrics} from "../../metrics/metrics.js";
9
9
  import {IClock} from "../../util/clock.js";
10
10
  import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js";
@@ -234,8 +234,18 @@ export function aggregate(
234
234
  }
235
235
 
236
236
  metrics?.opPool.syncContributionAndProofPool.getAggregateParticipants.set(participationCount);
237
+
238
+ const syncCommitteeSignature = aggregateSignatures(signatures).toBytes();
239
+ // The point at infinity is only a valid sync aggregate signature with empty participation bits
240
+ if (byteArrayEquals(syncCommitteeSignature, G2_POINT_AT_INFINITY)) {
241
+ return {
242
+ syncCommitteeBits: BitArray.fromBitLen(SYNC_COMMITTEE_SIZE),
243
+ syncCommitteeSignature,
244
+ };
245
+ }
246
+
237
247
  return {
238
248
  syncCommitteeBits,
239
- syncCommitteeSignature: aggregateSignatures(signatures).toBytes(),
249
+ syncCommitteeSignature,
240
250
  };
241
251
  }
@@ -43,8 +43,6 @@ export type IChainOptions = BlockProcessOpts &
43
43
  disableProposerSlashings?: boolean;
44
44
  /** Ensure blobs returned by the execution engine are valid */
45
45
  sanityCheckExecutionEngineBlobs?: boolean;
46
- /** Max number of produced blobs by local validators to cache */
47
- maxCachedBlobSidecars?: number;
48
46
  /** Max number of produced block roots (blinded or full) cached for broadcast validations */
49
47
  maxCachedProducedRoots?: number;
50
48
  initialCustodyGroupCount?: number;
@@ -90,6 +88,11 @@ export type PoolOpts = {
90
88
  * Only preaggregate attestation/sync committee message since clockSlot - preaggregateSlotDistance
91
89
  */
92
90
  preaggregateSlotDistance?: number;
91
+ /**
92
+ * Dev only: collect single attestations of every vote slot a block at the clock slot can include regardless of
93
+ * proposal duties, so that any produced block can pack them. Combine with `subscribeAllSubnets`
94
+ */
95
+ singleAttestationIgnoreProposalDuty?: boolean;
93
96
  };
94
97
 
95
98
  export type SeenCacheOpts = {
@@ -72,12 +72,13 @@ import {
72
72
  } from "@lodestar/utils";
73
73
  import {ZERO_HASH_HEX} from "../../constants/index.js";
74
74
  import {numToQuantity} from "../../execution/engine/utils.js";
75
- import {IExecutionBuilder, IExecutionEngine, PayloadAttributes, PayloadId} from "../../execution/index.js";
75
+ import {IExecutionBuilder, PayloadAttributes, PayloadId} from "../../execution/index.js";
76
76
  import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
77
77
  import {fromGraffitiBytes} from "../../util/graffiti.js";
78
78
  import {kzg} from "../../util/kzg.js";
79
79
  import {BeaconProposerCache} from "../beaconProposerCache.js";
80
80
  import type {BeaconChain} from "../chain.js";
81
+ import {ForkChoiceExecutionEngine} from "../forkChoiceExecutionEngine.js";
81
82
  import {CommonBlockBody} from "../interface.js";
82
83
  import {InclusionListStore, ProposerPreferencesPool} from "../opPools/index.js";
83
84
  import {validateBlobsAndKzgCommitments, validateCellsAndKzgCommitments} from "./validateBlobsAndKzgCommitments.js";
@@ -742,7 +743,7 @@ export async function produceBlockBody<T extends BlockType>(
742
743
  */
743
744
  export async function prepareExecutionPayload(
744
745
  chain: {
745
- executionEngine: IExecutionEngine;
746
+ executionEngine: ForkChoiceExecutionEngine;
746
747
  config: ChainForkConfig;
747
748
  forkChoice: IForkChoice;
748
749
  proposerPreferencesPool: ProposerPreferencesPool;
@@ -807,6 +808,7 @@ export async function prepareExecutionPayload(
807
808
 
808
809
  payloadId = await chain.executionEngine.notifyForkchoiceUpdate(
809
810
  fork,
811
+ toRootHex(parentBlockRoot),
810
812
  toRootHex(parentBlockHash),
811
813
  safeBlockHash,
812
814
  finalizedBlockHash,
@@ -1125,11 +1127,13 @@ export async function produceCommonBlockBody<T extends BlockType>(
1125
1127
  this.opPool.getSlashingsAndExits(currentState, blockType, this.metrics);
1126
1128
 
1127
1129
  const endAttestations = stepsMetrics?.startTimer();
1130
+ // TODO: extract to a separate BeaconChain method to coordinate the 2 op-pools
1128
1131
  const attestations = this.aggregatedAttestationPool.getAttestationsForBlock(
1129
1132
  fork,
1130
1133
  this.forkChoice,
1131
1134
  this.shufflingCache,
1132
- currentState
1135
+ currentState,
1136
+ this.singleAttestationPool
1133
1137
  );
1134
1138
  endAttestations?.({
1135
1139
  step: BlockProductionStep.attestations,
@@ -0,0 +1,94 @@
1
+ import {MIN_ATTESTATION_INCLUSION_DELAY} from "@lodestar/params";
2
+ import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
3
+ import {Slot} from "@lodestar/types";
4
+ import {Metrics} from "../metrics/metrics.js";
5
+
6
+ /**
7
+ * Track upcoming block proposals of validators connected to this node, and the vote slots those blocks can include,
8
+ * to only then insert single attestations into the SingleAttestationPool
9
+ */
10
+ export class ProposerTracker {
11
+ /** Local proposal slots that have not passed yet */
12
+ private readonly proposalSlots = new Set<Slot>();
13
+ /** Vote slots of tracked proposals, see `getFirstIncludableVoteSlot` */
14
+ private readonly collectableSlots = new Set<Slot>();
15
+ private clockSlot = 0;
16
+
17
+ /**
18
+ * @param ignoreProposalDuty dev only, collect every vote slot a block at the clock slot can include regardless of
19
+ * local proposals
20
+ */
21
+ constructor(
22
+ private readonly ignoreProposalDuty = false,
23
+ metrics: Metrics | null = null
24
+ ) {
25
+ metrics?.proposerTracker.proposalSlots.addCollect(() =>
26
+ metrics.proposerTracker.proposalSlots.set(this.proposalSlots.size)
27
+ );
28
+ metrics?.proposerTracker.collectableSlot.addCollect(() =>
29
+ metrics.proposerTracker.collectableSlot.set(this.shouldCollect(this.clockSlot) ? 1 : 0)
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Idempotent, a known proposal is ignored
35
+ * @returns true if the proposal was not tracked before
36
+ */
37
+ addProposal(proposalSlot: Slot): boolean {
38
+ if (this.proposalSlots.has(proposalSlot)) {
39
+ return false;
40
+ }
41
+
42
+ this.proposalSlots.add(proposalSlot);
43
+ for (
44
+ let voteSlot = getFirstIncludableVoteSlot(proposalSlot);
45
+ voteSlot <= proposalSlot - MIN_ATTESTATION_INCLUSION_DELAY;
46
+ voteSlot++
47
+ ) {
48
+ this.collectableSlots.add(voteSlot);
49
+ }
50
+ return true;
51
+ }
52
+
53
+ shouldCollect(attestationSlot: Slot): boolean {
54
+ if (this.ignoreProposalDuty) {
55
+ // to test block production without proposal duties
56
+ return attestationSlot >= getFirstIncludableVoteSlot(this.clockSlot);
57
+ }
58
+ return this.collectableSlots.has(attestationSlot);
59
+ }
60
+
61
+ /**
62
+ * Drop proposals that have passed. A proposal is kept during its own slot so that its single attestations stay
63
+ * available until the block is produced. Vote slots are dropped once no remaining proposal can include them.
64
+ */
65
+ prune(clockSlot: Slot): void {
66
+ this.clockSlot = clockSlot;
67
+ for (const proposalSlot of this.proposalSlots) {
68
+ if (proposalSlot < clockSlot) {
69
+ this.proposalSlots.delete(proposalSlot);
70
+ }
71
+ }
72
+
73
+ if (this.proposalSlots.size === 0) {
74
+ this.collectableSlots.clear();
75
+ return;
76
+ }
77
+
78
+ // Each remaining proposal covers its own vote slots, so a vote slot below the lowest one is covered by none
79
+ const lowestCollectableVoteSlot = getFirstIncludableVoteSlot(Math.min(...this.proposalSlots));
80
+ for (const voteSlot of this.collectableSlots) {
81
+ if (voteSlot < lowestCollectableVoteSlot) {
82
+ this.collectableSlots.delete(voteSlot);
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Since deneb (EIP-7045) a block includes attestations of its current and previous epoch, so the first vote slot it can
90
+ * include is the start of the previous epoch, 32 to 63 slots before it on mainnet
91
+ */
92
+ function getFirstIncludableVoteSlot(blockSlot: Slot): Slot {
93
+ return computeStartSlotAtEpoch(Math.max(computeEpochAtSlot(blockSlot) - 1, 0));
94
+ }
@@ -52,7 +52,7 @@ export interface IStateRegenerator extends IStateRegeneratorInternal {
52
52
  onCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void;
53
53
  processState(blockRootHex: RootHex, postState: IBeaconStateView): void;
54
54
  addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView): void;
55
- updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void;
55
+ updateHeadState(newHead: ProtoBlock, maybeHeadState?: IBeaconStateView): void;
56
56
  updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null;
57
57
  }
58
58
 
@@ -154,18 +154,20 @@ export class QueuedStateRegenerator implements IStateRegenerator {
154
154
  this.checkpointStateCache.add(cp, item);
155
155
  }
156
156
 
157
- updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void {
157
+ updateHeadState(newHead: ProtoBlock, maybeHeadState?: IBeaconStateView): void {
158
158
  const {stateRoot: newHeadStateRoot, blockRoot: newHeadBlockRoot, slot: newHeadSlot} = newHead;
159
- const maybeHeadStateRoot = toRootHex(maybeHeadState.hashTreeRoot());
159
+ const maybeHeadStateRoot = maybeHeadState ? toRootHex(maybeHeadState.hashTreeRoot()) : undefined;
160
160
  const logCtx = {
161
161
  newHeadSlot,
162
162
  newHeadBlockRoot,
163
163
  newHeadStateRoot,
164
- maybeHeadSlot: maybeHeadState.slot,
164
+ maybeHeadSlot: maybeHeadState?.slot,
165
165
  maybeHeadStateRoot,
166
166
  };
167
167
  const headState =
168
- newHeadStateRoot === maybeHeadStateRoot ? maybeHeadState : this.blockStateCache.get(newHeadStateRoot);
168
+ maybeHeadState && newHeadStateRoot === maybeHeadStateRoot
169
+ ? maybeHeadState
170
+ : this.blockStateCache.get(newHeadStateRoot);
169
171
 
170
172
  if (headState) {
171
173
  this.blockStateCache.setHeadState(headState);