@lodestar/beacon-node 1.51.0-dev.17f78227c7 → 1.51.0-dev.1b22218e60

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 (642) hide show
  1. package/lib/api/impl/api.js +1 -1
  2. package/lib/api/impl/api.js.map +1 -1
  3. package/lib/api/impl/beacon/blocks/index.d.ts +2 -1
  4. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/blocks/index.js +48 -95
  6. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  7. package/lib/api/impl/beacon/index.d.ts +2 -1
  8. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/index.js +2 -2
  10. package/lib/api/impl/beacon/index.js.map +1 -1
  11. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  12. package/lib/api/impl/beacon/pool/index.js +22 -2
  13. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  15. package/lib/api/impl/beacon/state/index.js +8 -2
  16. package/lib/api/impl/beacon/state/index.js.map +1 -1
  17. package/lib/api/impl/beacon/state/utils.d.ts +3 -2
  18. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  19. package/lib/api/impl/beacon/state/utils.js +17 -9
  20. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  21. package/lib/api/impl/debug/index.d.ts.map +1 -1
  22. package/lib/api/impl/debug/index.js +3 -0
  23. package/lib/api/impl/debug/index.js.map +1 -1
  24. package/lib/api/impl/validator/index.d.ts +6 -0
  25. package/lib/api/impl/validator/index.d.ts.map +1 -1
  26. package/lib/api/impl/validator/index.js +143 -35
  27. package/lib/api/impl/validator/index.js.map +1 -1
  28. package/lib/api/options.d.ts +2 -0
  29. package/lib/api/options.d.ts.map +1 -1
  30. package/lib/api/options.js +1 -0
  31. package/lib/api/options.js.map +1 -1
  32. package/lib/chain/GetBlobsTracker.d.ts +13 -2
  33. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  34. package/lib/chain/GetBlobsTracker.js +69 -35
  35. package/lib/chain/GetBlobsTracker.js.map +1 -1
  36. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  37. package/lib/chain/archiveStore/archiveStore.js +1 -0
  38. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  39. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +4 -0
  40. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  41. package/lib/chain/archiveStore/utils/archiveBlocks.js +61 -97
  42. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  43. package/lib/chain/blocks/blockInput/blockInput.d.ts +11 -56
  44. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  45. package/lib/chain/blocks/blockInput/blockInput.js +5 -241
  46. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  47. package/lib/chain/blocks/blockInput/errors.d.ts +2 -4
  48. package/lib/chain/blocks/blockInput/errors.d.ts.map +1 -1
  49. package/lib/chain/blocks/blockInput/errors.js.map +1 -1
  50. package/lib/chain/blocks/blockInput/types.d.ts +2 -18
  51. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  52. package/lib/chain/blocks/blockInput/types.js +0 -1
  53. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  54. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  55. package/lib/chain/blocks/importBlock.js +42 -57
  56. package/lib/chain/blocks/importBlock.js.map +1 -1
  57. package/lib/chain/blocks/importExecutionPayload.d.ts +10 -11
  58. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  59. package/lib/chain/blocks/importExecutionPayload.js +82 -20
  60. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  61. package/lib/chain/blocks/index.d.ts.map +1 -1
  62. package/lib/chain/blocks/index.js +4 -4
  63. package/lib/chain/blocks/index.js.map +1 -1
  64. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +12 -9
  65. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  66. package/lib/chain/blocks/payloadEnvelopeProcessor.js +24 -19
  67. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  68. package/lib/chain/blocks/types.d.ts +7 -19
  69. package/lib/chain/blocks/types.d.ts.map +1 -1
  70. package/lib/chain/blocks/types.js +5 -24
  71. package/lib/chain/blocks/types.js.map +1 -1
  72. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  73. package/lib/chain/blocks/verifyBlock.js +18 -7
  74. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  75. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  76. package/lib/chain/blocks/verifyBlocksDataAvailability.js +14 -2
  77. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  78. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
  79. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  80. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +7 -3
  81. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  82. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  83. package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
  84. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  85. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  86. package/lib/chain/blocks/verifyBlocksSignatures.js +10 -5
  87. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  88. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +3 -3
  89. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  90. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +11 -6
  91. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  92. package/lib/chain/blocks/writeBlockInputToDb.d.ts +0 -2
  93. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  94. package/lib/chain/blocks/writeBlockInputToDb.js +6 -24
  95. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  96. package/lib/chain/bls/interface.d.ts +2 -0
  97. package/lib/chain/bls/interface.d.ts.map +1 -1
  98. package/lib/chain/bls/multithread/index.d.ts +1 -1
  99. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  100. package/lib/chain/bls/multithread/index.js +50 -22
  101. package/lib/chain/bls/multithread/index.js.map +1 -1
  102. package/lib/chain/bls/multithread/types.d.ts +1 -1
  103. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  104. package/lib/chain/bls/multithread/worker.js +1 -1
  105. package/lib/chain/bls/multithread/worker.js.map +1 -1
  106. package/lib/chain/bls/singleThread.js +1 -1
  107. package/lib/chain/bls/singleThread.js.map +1 -1
  108. package/lib/chain/bls/utils.js +1 -1
  109. package/lib/chain/bls/utils.js.map +1 -1
  110. package/lib/chain/chain.d.ts +26 -4
  111. package/lib/chain/chain.d.ts.map +1 -1
  112. package/lib/chain/chain.js +127 -43
  113. package/lib/chain/chain.js.map +1 -1
  114. package/lib/chain/emitter.d.ts +7 -7
  115. package/lib/chain/emitter.d.ts.map +1 -1
  116. package/lib/chain/emitter.js +5 -5
  117. package/lib/chain/emitter.js.map +1 -1
  118. package/lib/chain/errors/blockError.d.ts +1 -1
  119. package/lib/chain/errors/blockError.d.ts.map +1 -1
  120. package/lib/chain/errors/blockError.js +1 -1
  121. package/lib/chain/errors/blockError.js.map +1 -1
  122. package/lib/chain/errors/executionPayloadBid.d.ts +11 -1
  123. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  124. package/lib/chain/errors/executionPayloadBid.js +2 -0
  125. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  126. package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
  127. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  128. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  129. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  130. package/lib/chain/errors/inclusionList.d.ts +60 -0
  131. package/lib/chain/errors/inclusionList.d.ts.map +1 -0
  132. package/lib/chain/errors/inclusionList.js +19 -0
  133. package/lib/chain/errors/inclusionList.js.map +1 -0
  134. package/lib/chain/errors/index.d.ts +1 -1
  135. package/lib/chain/errors/index.d.ts.map +1 -1
  136. package/lib/chain/errors/index.js +1 -1
  137. package/lib/chain/errors/index.js.map +1 -1
  138. package/lib/chain/forkChoice/index.d.ts +11 -1
  139. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  140. package/lib/chain/forkChoice/index.js +11 -0
  141. package/lib/chain/forkChoice/index.js.map +1 -1
  142. package/lib/chain/forkChoiceExecutionEngine.d.ts +51 -0
  143. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
  144. package/lib/chain/forkChoiceExecutionEngine.js +117 -0
  145. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
  146. package/lib/chain/interface.d.ts +10 -7
  147. package/lib/chain/interface.d.ts.map +1 -1
  148. package/lib/chain/interface.js.map +1 -1
  149. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +17 -4
  150. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  151. package/lib/chain/opPools/aggregatedAttestationPool.js +199 -46
  152. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  153. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  154. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  155. package/lib/chain/opPools/attestationPool.js +15 -4
  156. package/lib/chain/opPools/attestationPool.js.map +1 -1
  157. package/lib/chain/opPools/inclusionListStore.d.ts +63 -0
  158. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -0
  159. package/lib/chain/opPools/inclusionListStore.js +171 -0
  160. package/lib/chain/opPools/inclusionListStore.js.map +1 -0
  161. package/lib/chain/opPools/index.d.ts +2 -0
  162. package/lib/chain/opPools/index.d.ts.map +1 -1
  163. package/lib/chain/opPools/index.js +2 -0
  164. package/lib/chain/opPools/index.js.map +1 -1
  165. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  166. package/lib/chain/opPools/payloadAttestationPool.js +17 -7
  167. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  168. package/lib/chain/opPools/singleAttestationPool.d.ts +77 -0
  169. package/lib/chain/opPools/singleAttestationPool.d.ts.map +1 -0
  170. package/lib/chain/opPools/singleAttestationPool.js +209 -0
  171. package/lib/chain/opPools/singleAttestationPool.js.map +1 -0
  172. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
  173. package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
  174. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  175. package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
  176. package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
  177. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  178. package/lib/chain/opPools/utils.d.ts +1 -1
  179. package/lib/chain/opPools/utils.d.ts.map +1 -1
  180. package/lib/chain/opPools/utils.js +1 -1
  181. package/lib/chain/opPools/utils.js.map +1 -1
  182. package/lib/chain/options.d.ts +5 -3
  183. package/lib/chain/options.d.ts.map +1 -1
  184. package/lib/chain/options.js +0 -1
  185. package/lib/chain/options.js.map +1 -1
  186. package/lib/chain/produceBlock/produceBlockBody.d.ts +6 -3
  187. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  188. package/lib/chain/produceBlock/produceBlockBody.js +32 -11
  189. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  190. package/lib/chain/proposerTracker.d.ts +31 -0
  191. package/lib/chain/proposerTracker.d.ts.map +1 -0
  192. package/lib/chain/proposerTracker.js +75 -0
  193. package/lib/chain/proposerTracker.js.map +1 -0
  194. package/lib/chain/regen/interface.d.ts +2 -2
  195. package/lib/chain/regen/interface.d.ts.map +1 -1
  196. package/lib/chain/regen/interface.js +1 -1
  197. package/lib/chain/regen/interface.js.map +1 -1
  198. package/lib/chain/regen/queued.d.ts +1 -1
  199. package/lib/chain/regen/queued.d.ts.map +1 -1
  200. package/lib/chain/regen/queued.js +5 -3
  201. package/lib/chain/regen/queued.js.map +1 -1
  202. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -14
  203. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  204. package/lib/chain/seenCache/seenGossipBlockInput.js +6 -65
  205. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  206. package/lib/chain/validation/aggregateAndProof.js +1 -1
  207. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  208. package/lib/chain/validation/attestation.js +1 -1
  209. package/lib/chain/validation/attestation.js.map +1 -1
  210. package/lib/chain/validation/executionPayloadBid.d.ts +0 -15
  211. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  212. package/lib/chain/validation/executionPayloadBid.js +37 -158
  213. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  214. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  215. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  216. package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
  217. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  218. package/lib/chain/validation/inclusionList.d.ts +14 -0
  219. package/lib/chain/validation/inclusionList.d.ts.map +1 -0
  220. package/lib/chain/validation/inclusionList.js +150 -0
  221. package/lib/chain/validation/inclusionList.js.map +1 -0
  222. package/lib/chain/validation/index.d.ts +1 -0
  223. package/lib/chain/validation/index.d.ts.map +1 -1
  224. package/lib/chain/validation/index.js +1 -0
  225. package/lib/chain/validation/index.js.map +1 -1
  226. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  227. package/lib/chain/validation/syncCommittee.js +16 -10
  228. package/lib/chain/validation/syncCommittee.js.map +1 -1
  229. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  230. package/lib/chain/validation/syncCommitteeContributionAndProof.js +11 -0
  231. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  232. package/lib/chain/validatorMonitor.d.ts +1 -2
  233. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  234. package/lib/chain/validatorMonitor.js +0 -3
  235. package/lib/chain/validatorMonitor.js.map +1 -1
  236. package/lib/db/beacon.d.ts +7 -0
  237. package/lib/db/beacon.d.ts.map +1 -1
  238. package/lib/db/beacon.js +34 -0
  239. package/lib/db/beacon.js.map +1 -1
  240. package/lib/db/dataColumnStore.d.ts +1 -1
  241. package/lib/db/dataColumnStore.d.ts.map +1 -1
  242. package/lib/db/dataColumnStore.js +1 -4
  243. package/lib/db/dataColumnStore.js.map +1 -1
  244. package/lib/db/flatFileStore/flatFileStore.js +5 -5
  245. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  246. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  247. package/lib/db/flatFileStore/slotIndex.js +2 -2
  248. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  249. package/lib/db/interface.d.ts +1 -0
  250. package/lib/db/interface.d.ts.map +1 -1
  251. package/lib/db/repositories/blobSidecars.d.ts +0 -1
  252. package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
  253. package/lib/db/repositories/blobSidecars.js +0 -1
  254. package/lib/db/repositories/blobSidecars.js.map +1 -1
  255. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +6 -0
  256. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  257. package/lib/db/repositories/dataColumnSidecarArchive.js +19 -0
  258. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  259. package/lib/execution/builder/apiClient.d.ts +14 -8
  260. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  261. package/lib/execution/builder/apiClient.js +12 -10
  262. package/lib/execution/builder/apiClient.js.map +1 -1
  263. package/lib/execution/builder/http.d.ts +2 -0
  264. package/lib/execution/builder/http.d.ts.map +1 -1
  265. package/lib/execution/builder/http.js +2 -0
  266. package/lib/execution/builder/http.js.map +1 -1
  267. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  268. package/lib/execution/builder/validateBid.js +14 -1
  269. package/lib/execution/builder/validateBid.js.map +1 -1
  270. package/lib/execution/engine/blobVersionedHashes.d.ts +1 -1
  271. package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -1
  272. package/lib/execution/engine/blobVersionedHashes.js.map +1 -1
  273. package/lib/execution/engine/disabled.d.ts +1 -0
  274. package/lib/execution/engine/disabled.d.ts.map +1 -1
  275. package/lib/execution/engine/disabled.js +3 -0
  276. package/lib/execution/engine/disabled.js.map +1 -1
  277. package/lib/execution/engine/http.d.ts +12 -8
  278. package/lib/execution/engine/http.d.ts.map +1 -1
  279. package/lib/execution/engine/http.js +35 -14
  280. package/lib/execution/engine/http.js.map +1 -1
  281. package/lib/execution/engine/index.d.ts +1 -1
  282. package/lib/execution/engine/index.d.ts.map +1 -1
  283. package/lib/execution/engine/index.js +1 -1
  284. package/lib/execution/engine/index.js.map +1 -1
  285. package/lib/execution/engine/interface.d.ts +29 -8
  286. package/lib/execution/engine/interface.d.ts.map +1 -1
  287. package/lib/execution/engine/interface.js.map +1 -1
  288. package/lib/execution/engine/jsonRpcTransport.d.ts +5 -6
  289. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  290. package/lib/execution/engine/jsonRpcTransport.js +34 -20
  291. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  292. package/lib/execution/engine/mock.d.ts +1 -1
  293. package/lib/execution/engine/mock.d.ts.map +1 -1
  294. package/lib/execution/engine/mock.js +31 -11
  295. package/lib/execution/engine/mock.js.map +1 -1
  296. package/lib/execution/engine/payloadIdCache.d.ts +5 -3
  297. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  298. package/lib/execution/engine/payloadIdCache.js +15 -4
  299. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  300. package/lib/execution/engine/restTransport.d.ts +4 -5
  301. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  302. package/lib/execution/engine/restTransport.js +4 -15
  303. package/lib/execution/engine/restTransport.js.map +1 -1
  304. package/lib/execution/engine/sszTypes.d.ts +38 -47
  305. package/lib/execution/engine/sszTypes.d.ts.map +1 -1
  306. package/lib/execution/engine/sszTypes.js +0 -5
  307. package/lib/execution/engine/sszTypes.js.map +1 -1
  308. package/lib/execution/engine/transport.d.ts +4 -14
  309. package/lib/execution/engine/transport.d.ts.map +1 -1
  310. package/lib/execution/engine/types.d.ts +25 -9
  311. package/lib/execution/engine/types.d.ts.map +1 -1
  312. package/lib/execution/engine/types.js +19 -14
  313. package/lib/execution/engine/types.js.map +1 -1
  314. package/lib/execution/engine/utils.d.ts.map +1 -1
  315. package/lib/execution/engine/utils.js +3 -2
  316. package/lib/execution/engine/utils.js.map +1 -1
  317. package/lib/index.d.ts +1 -0
  318. package/lib/index.d.ts.map +1 -1
  319. package/lib/index.js +2 -0
  320. package/lib/index.js.map +1 -1
  321. package/lib/metrics/metrics/beacon.d.ts +16 -9
  322. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  323. package/lib/metrics/metrics/beacon.js +35 -30
  324. package/lib/metrics/metrics/beacon.js.map +1 -1
  325. package/lib/metrics/metrics/lodestar.d.ts +42 -8
  326. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  327. package/lib/metrics/metrics/lodestar.js +104 -18
  328. package/lib/metrics/metrics/lodestar.js.map +1 -1
  329. package/lib/metrics/server/http.js +5 -5
  330. package/lib/metrics/server/http.js.map +1 -1
  331. package/lib/monitoring/service.js +1 -1
  332. package/lib/monitoring/service.js.map +1 -1
  333. package/lib/network/core/networkCore.d.ts +4 -1
  334. package/lib/network/core/networkCore.d.ts.map +1 -1
  335. package/lib/network/core/networkCore.js +7 -0
  336. package/lib/network/core/networkCore.js.map +1 -1
  337. package/lib/network/core/networkCoreWorker.js +2 -0
  338. package/lib/network/core/networkCoreWorker.js.map +1 -1
  339. package/lib/network/core/networkCoreWorkerHandler.d.ts +4 -1
  340. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  341. package/lib/network/core/networkCoreWorkerHandler.js +6 -0
  342. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  343. package/lib/network/core/types.d.ts +6 -1
  344. package/lib/network/core/types.d.ts.map +1 -1
  345. package/lib/network/gossip/gossipsub.d.ts +1 -0
  346. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  347. package/lib/network/gossip/gossipsub.js +10 -0
  348. package/lib/network/gossip/gossipsub.js.map +1 -1
  349. package/lib/network/gossip/interface.d.ts +8 -9
  350. package/lib/network/gossip/interface.d.ts.map +1 -1
  351. package/lib/network/gossip/interface.js +1 -1
  352. package/lib/network/gossip/interface.js.map +1 -1
  353. package/lib/network/gossip/topic.d.ts +13 -21
  354. package/lib/network/gossip/topic.d.ts.map +1 -1
  355. package/lib/network/gossip/topic.js +13 -24
  356. package/lib/network/gossip/topic.js.map +1 -1
  357. package/lib/network/interface.d.ts +5 -5
  358. package/lib/network/interface.d.ts.map +1 -1
  359. package/lib/network/libp2p/index.d.ts.map +1 -1
  360. package/lib/network/libp2p/index.js +5 -1
  361. package/lib/network/libp2p/index.js.map +1 -1
  362. package/lib/network/network.d.ts +9 -7
  363. package/lib/network/network.d.ts.map +1 -1
  364. package/lib/network/network.js +58 -35
  365. package/lib/network/network.js.map +1 -1
  366. package/lib/network/options.d.ts +2 -0
  367. package/lib/network/options.d.ts.map +1 -1
  368. package/lib/network/options.js +2 -0
  369. package/lib/network/options.js.map +1 -1
  370. package/lib/network/peers/peerManager.d.ts +2 -1
  371. package/lib/network/peers/peerManager.d.ts.map +1 -1
  372. package/lib/network/peers/peerManager.js +28 -1
  373. package/lib/network/peers/peerManager.js.map +1 -1
  374. package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
  375. package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
  376. package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
  377. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  378. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  379. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  380. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  381. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  382. package/lib/network/peers/utils/subnetMap.d.ts +5 -2
  383. package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
  384. package/lib/network/peers/utils/subnetMap.js +6 -3
  385. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  386. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  387. package/lib/network/processor/extractSlotRootFns.js +1 -8
  388. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  389. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  390. package/lib/network/processor/gossipHandlers.js +118 -149
  391. package/lib/network/processor/gossipHandlers.js.map +1 -1
  392. package/lib/network/processor/gossipQueues/index.js +6 -6
  393. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  394. package/lib/network/processor/gossipValidatorFn.js +5 -5
  395. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  396. package/lib/network/processor/index.d.ts +6 -0
  397. package/lib/network/processor/index.d.ts.map +1 -1
  398. package/lib/network/processor/index.js +56 -29
  399. package/lib/network/processor/index.js.map +1 -1
  400. package/lib/network/reqresp/ReqRespBeaconNode.js +6 -3
  401. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  402. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
  403. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  404. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +10 -0
  405. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +1 -0
  406. package/lib/network/reqresp/handlers/inclusionListsByIndices.js +30 -0
  407. package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +1 -0
  408. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  409. package/lib/network/reqresp/handlers/index.js +6 -12
  410. package/lib/network/reqresp/handlers/index.js.map +1 -1
  411. package/lib/network/reqresp/protocols.d.ts +1 -2
  412. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  413. package/lib/network/reqresp/protocols.js +5 -10
  414. package/lib/network/reqresp/protocols.js.map +1 -1
  415. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  416. package/lib/network/reqresp/rateLimit.js +5 -17
  417. package/lib/network/reqresp/rateLimit.js.map +1 -1
  418. package/lib/network/reqresp/types.d.ts +6 -9
  419. package/lib/network/reqresp/types.d.ts.map +1 -1
  420. package/lib/network/reqresp/types.js +4 -7
  421. package/lib/network/reqresp/types.js.map +1 -1
  422. package/lib/network/subnets/attnetsService.d.ts +35 -5
  423. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  424. package/lib/network/subnets/attnetsService.js +84 -6
  425. package/lib/network/subnets/attnetsService.js.map +1 -1
  426. package/lib/network/subnets/interface.d.ts +7 -0
  427. package/lib/network/subnets/interface.d.ts.map +1 -1
  428. package/lib/network/subnets/interface.js.map +1 -1
  429. package/lib/node/nodejs.d.ts +3 -1
  430. package/lib/node/nodejs.d.ts.map +1 -1
  431. package/lib/node/nodejs.js +47 -21
  432. package/lib/node/nodejs.js.map +1 -1
  433. package/lib/node/options.d.ts +3 -1
  434. package/lib/node/options.d.ts.map +1 -1
  435. package/lib/node/options.js +4 -2
  436. package/lib/node/options.js.map +1 -1
  437. package/lib/sync/interface.d.ts.map +1 -1
  438. package/lib/sync/interface.js.map +1 -1
  439. package/lib/sync/range/batch.d.ts +2 -3
  440. package/lib/sync/range/batch.d.ts.map +1 -1
  441. package/lib/sync/range/batch.js +9 -22
  442. package/lib/sync/range/batch.js.map +1 -1
  443. package/lib/sync/range/chain.d.ts.map +1 -1
  444. package/lib/sync/range/chain.js +2 -15
  445. package/lib/sync/range/chain.js.map +1 -1
  446. package/lib/sync/sync.d.ts +15 -0
  447. package/lib/sync/sync.d.ts.map +1 -1
  448. package/lib/sync/sync.js +103 -25
  449. package/lib/sync/sync.js.map +1 -1
  450. package/lib/sync/unknownBlock.d.ts.map +1 -1
  451. package/lib/sync/unknownBlock.js +43 -25
  452. package/lib/sync/unknownBlock.js.map +1 -1
  453. package/lib/sync/utils/downloadByRange.d.ts +6 -34
  454. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  455. package/lib/sync/utils/downloadByRange.js +24 -128
  456. package/lib/sync/utils/downloadByRange.js.map +1 -1
  457. package/lib/sync/utils/downloadByRoot.d.ts +2 -18
  458. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  459. package/lib/sync/utils/downloadByRoot.js +14 -99
  460. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  461. package/lib/util/blobs.d.ts +1 -7
  462. package/lib/util/blobs.d.ts.map +1 -1
  463. package/lib/util/blobs.js +0 -19
  464. package/lib/util/blobs.js.map +1 -1
  465. package/lib/util/execution.d.ts +3 -4
  466. package/lib/util/execution.d.ts.map +1 -1
  467. package/lib/util/execution.js +1 -73
  468. package/lib/util/execution.js.map +1 -1
  469. package/lib/util/file.d.ts.map +1 -1
  470. package/lib/util/file.js +8 -9
  471. package/lib/util/file.js.map +1 -1
  472. package/lib/util/queue/itemQueue.js +1 -1
  473. package/lib/util/queue/itemQueue.js.map +1 -1
  474. package/lib/util/sszBytes.d.ts +5 -1
  475. package/lib/util/sszBytes.d.ts.map +1 -1
  476. package/lib/util/sszBytes.js +36 -19
  477. package/lib/util/sszBytes.js.map +1 -1
  478. package/lib/util/types.d.ts +0 -5
  479. package/lib/util/types.d.ts.map +1 -1
  480. package/lib/util/types.js +1 -2
  481. package/lib/util/types.js.map +1 -1
  482. package/package.json +31 -32
  483. package/src/api/impl/api.ts +1 -1
  484. package/src/api/impl/beacon/blocks/index.ts +81 -126
  485. package/src/api/impl/beacon/index.ts +3 -1
  486. package/src/api/impl/beacon/pool/index.ts +31 -1
  487. package/src/api/impl/beacon/state/index.ts +10 -1
  488. package/src/api/impl/beacon/state/utils.ts +20 -10
  489. package/src/api/impl/debug/index.ts +4 -0
  490. package/src/api/impl/validator/index.ts +178 -39
  491. package/src/api/options.ts +3 -0
  492. package/src/chain/GetBlobsTracker.ts +82 -52
  493. package/src/chain/archiveStore/archiveStore.ts +1 -0
  494. package/src/chain/archiveStore/utils/archiveBlocks.ts +76 -130
  495. package/src/chain/blocks/blockInput/blockInput.ts +11 -343
  496. package/src/chain/blocks/blockInput/errors.ts +1 -2
  497. package/src/chain/blocks/blockInput/types.ts +2 -20
  498. package/src/chain/blocks/importBlock.ts +58 -77
  499. package/src/chain/blocks/importExecutionPayload.ts +123 -36
  500. package/src/chain/blocks/index.ts +11 -4
  501. package/src/chain/blocks/payloadEnvelopeProcessor.ts +35 -24
  502. package/src/chain/blocks/types.ts +8 -29
  503. package/src/chain/blocks/verifyBlock.ts +31 -16
  504. package/src/chain/blocks/verifyBlocksDataAvailability.ts +16 -2
  505. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -6
  506. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  507. package/src/chain/blocks/verifyBlocksSignatures.ts +10 -5
  508. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +14 -6
  509. package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
  510. package/src/chain/bls/interface.ts +2 -0
  511. package/src/chain/bls/multithread/index.ts +48 -24
  512. package/src/chain/bls/multithread/types.ts +1 -1
  513. package/src/chain/bls/multithread/worker.ts +1 -5
  514. package/src/chain/bls/singleThread.ts +1 -1
  515. package/src/chain/bls/utils.ts +1 -1
  516. package/src/chain/chain.ts +144 -42
  517. package/src/chain/emitter.ts +8 -8
  518. package/src/chain/errors/blockError.ts +1 -1
  519. package/src/chain/errors/executionPayloadBid.ts +12 -0
  520. package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
  521. package/src/chain/errors/inclusionList.ts +38 -0
  522. package/src/chain/errors/index.ts +1 -1
  523. package/src/chain/forkChoice/index.ts +11 -0
  524. package/src/chain/forkChoiceExecutionEngine.ts +183 -0
  525. package/src/chain/interface.ts +11 -6
  526. package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
  527. package/src/chain/opPools/attestationPool.ts +16 -4
  528. package/src/chain/opPools/inclusionListStore.ts +208 -0
  529. package/src/chain/opPools/index.ts +2 -0
  530. package/src/chain/opPools/payloadAttestationPool.ts +18 -7
  531. package/src/chain/opPools/singleAttestationPool.ts +287 -0
  532. package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
  533. package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
  534. package/src/chain/opPools/utils.ts +1 -1
  535. package/src/chain/options.ts +5 -4
  536. package/src/chain/produceBlock/produceBlockBody.ts +67 -22
  537. package/src/chain/proposerTracker.ts +94 -0
  538. package/src/chain/regen/interface.ts +2 -2
  539. package/src/chain/regen/queued.ts +6 -4
  540. package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
  541. package/src/chain/validation/aggregateAndProof.ts +1 -1
  542. package/src/chain/validation/attestation.ts +1 -1
  543. package/src/chain/validation/executionPayloadBid.ts +54 -183
  544. package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
  545. package/src/chain/validation/inclusionList.ts +192 -0
  546. package/src/chain/validation/index.ts +1 -0
  547. package/src/chain/validation/syncCommittee.ts +31 -15
  548. package/src/chain/validation/syncCommitteeContributionAndProof.ts +13 -0
  549. package/src/chain/validatorMonitor.ts +0 -6
  550. package/src/db/beacon.ts +44 -0
  551. package/src/db/dataColumnStore.ts +2 -4
  552. package/src/db/flatFileStore/flatFileStore.ts +7 -7
  553. package/src/db/flatFileStore/slotIndex.ts +4 -3
  554. package/src/db/interface.ts +2 -0
  555. package/src/db/repositories/blobSidecars.ts +0 -1
  556. package/src/db/repositories/dataColumnSidecarArchive.ts +20 -0
  557. package/src/execution/builder/apiClient.ts +16 -13
  558. package/src/execution/builder/http.ts +4 -0
  559. package/src/execution/builder/validateBid.ts +23 -2
  560. package/src/execution/engine/blobVersionedHashes.ts +1 -1
  561. package/src/execution/engine/disabled.ts +4 -0
  562. package/src/execution/engine/http.ts +59 -47
  563. package/src/execution/engine/index.ts +1 -1
  564. package/src/execution/engine/interface.ts +46 -13
  565. package/src/execution/engine/jsonRpcTransport.ts +56 -31
  566. package/src/execution/engine/mock.ts +32 -14
  567. package/src/execution/engine/payloadIdCache.ts +24 -6
  568. package/src/execution/engine/restTransport.ts +18 -23
  569. package/src/execution/engine/sszTypes.ts +0 -9
  570. package/src/execution/engine/transport.ts +13 -17
  571. package/src/execution/engine/types.ts +44 -24
  572. package/src/execution/engine/utils.ts +4 -2
  573. package/src/index.ts +2 -0
  574. package/src/metrics/metrics/beacon.ts +37 -30
  575. package/src/metrics/metrics/lodestar.ts +106 -18
  576. package/src/metrics/server/http.ts +5 -5
  577. package/src/monitoring/service.ts +1 -1
  578. package/src/network/core/networkCore.ts +11 -1
  579. package/src/network/core/networkCoreWorker.ts +2 -0
  580. package/src/network/core/networkCoreWorkerHandler.ts +8 -1
  581. package/src/network/core/types.ts +6 -1
  582. package/src/network/gossip/gossipsub.ts +11 -0
  583. package/src/network/gossip/interface.ts +5 -5
  584. package/src/network/gossip/topic.ts +14 -25
  585. package/src/network/interface.ts +4 -5
  586. package/src/network/libp2p/index.ts +5 -1
  587. package/src/network/network.ts +66 -58
  588. package/src/network/options.ts +4 -0
  589. package/src/network/peers/peerManager.ts +28 -3
  590. package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
  591. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  592. package/src/network/peers/utils/subnetMap.ts +6 -3
  593. package/src/network/processor/extractSlotRootFns.ts +0 -9
  594. package/src/network/processor/gossipHandlers.ts +150 -183
  595. package/src/network/processor/gossipQueues/index.ts +6 -6
  596. package/src/network/processor/gossipValidatorFn.ts +5 -5
  597. package/src/network/processor/index.ts +48 -27
  598. package/src/network/processor/types.ts +1 -1
  599. package/src/network/reqresp/ReqRespBeaconNode.ts +7 -7
  600. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
  601. package/src/network/reqresp/handlers/inclusionListsByIndices.ts +44 -0
  602. package/src/network/reqresp/handlers/index.ts +5 -17
  603. package/src/network/reqresp/protocols.ts +6 -12
  604. package/src/network/reqresp/rateLimit.ts +5 -17
  605. package/src/network/reqresp/types.ts +6 -13
  606. package/src/network/subnets/attnetsService.ts +94 -6
  607. package/src/network/subnets/interface.ts +7 -0
  608. package/src/node/nodejs.ts +58 -22
  609. package/src/node/options.ts +9 -6
  610. package/src/sync/interface.ts +1 -0
  611. package/src/sync/range/batch.ts +9 -21
  612. package/src/sync/range/chain.ts +2 -14
  613. package/src/sync/sync.ts +108 -26
  614. package/src/sync/unknownBlock.ts +48 -36
  615. package/src/sync/utils/downloadByRange.ts +31 -230
  616. package/src/sync/utils/downloadByRoot.ts +15 -142
  617. package/src/util/blobs.ts +0 -34
  618. package/src/util/execution.ts +8 -102
  619. package/src/util/file.ts +8 -9
  620. package/src/util/queue/itemQueue.ts +1 -1
  621. package/src/util/sszBytes.ts +42 -24
  622. package/src/util/types.ts +1 -8
  623. package/lib/chain/errors/blobSidecarError.d.ts +0 -108
  624. package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
  625. package/lib/chain/errors/blobSidecarError.js +0 -38
  626. package/lib/chain/errors/blobSidecarError.js.map +0 -1
  627. package/lib/chain/validation/blobSidecar.d.ts +0 -16
  628. package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
  629. package/lib/chain/validation/blobSidecar.js +0 -276
  630. package/lib/chain/validation/blobSidecar.js.map +0 -1
  631. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
  632. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
  633. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
  634. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
  635. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
  636. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
  637. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
  638. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
  639. package/src/chain/errors/blobSidecarError.ts +0 -70
  640. package/src/chain/validation/blobSidecar.ts +0 -357
  641. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
  642. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
@@ -0,0 +1,208 @@
1
+ import {BitArray, SerializedList} from "@chainsafe/ssz";
2
+ import {BeaconConfig} from "@lodestar/config";
3
+ import {INCLUSION_LIST_COMMITTEE_SIZE} from "@lodestar/params";
4
+ import {RootHex, Slot, ValidatorIndex, bellatrix, heze, ssz} from "@lodestar/types";
5
+ import {MapDef, toHex, toRootHex} from "@lodestar/utils";
6
+
7
+ export enum InclusionListInsertOutcome {
8
+ /** Stored as a new entry. */
9
+ New = "New",
10
+ /** Slot is older than the prune horizon. */
11
+ Old = "Old",
12
+ /** Identical inclusion list already stored. */
13
+ Seen = "Seen",
14
+ /** New equivocation evidence: this validator already has a different inclusion list stored. */
15
+ Equivocating = "Equivocating",
16
+ /** Validator was already marked as an equivocator for this `(slot, dependent_root)`. */
17
+ SubsequentEquivocation = "SubsequentEquivocation",
18
+ }
19
+
20
+ type InclusionListEntry = {
21
+ signedInclusionList: heze.SignedInclusionList;
22
+ /** Positions of the validator in `get_inclusion_list_committee(state, slot)`, several when the committee cycles */
23
+ committeeIndices: number[];
24
+ /** Received before the inclusion list deadline of its slot. */
25
+ timely: boolean;
26
+ };
27
+
28
+ /**
29
+ * Spec `InclusionListStore`: inclusion lists keyed by `(slot, dependent_root)`, one per validator index.
30
+ * The committee position is recorded at insert time (gossip validation resolves it) so the bit-oriented
31
+ * reads need no shuffling lookup. Signed lists are kept so InclusionListsByIndices can serve them.
32
+ * A validator's first list stays stored and an equivocation marks the validator so reads skip it.
33
+ */
34
+ export class InclusionListStore {
35
+ /** slot -> dependent_root -> validator index -> entry */
36
+ private readonly inclusionLists = new MapDef<Slot, MapDef<RootHex, Map<ValidatorIndex, InclusionListEntry>>>(
37
+ () => new MapDef<RootHex, Map<ValidatorIndex, InclusionListEntry>>(() => new Map())
38
+ );
39
+ /** slot -> dependent_root -> equivocating validator indices */
40
+ private readonly equivocators = new MapDef<Slot, MapDef<RootHex, Set<ValidatorIndex>>>(
41
+ () => new MapDef<RootHex, Set<ValidatorIndex>>(() => new Set())
42
+ );
43
+ /** slot -> dependent_root -> validator index -> count, for the p2p "first or second message" rule */
44
+ private readonly seenCounts = new MapDef<Slot, MapDef<RootHex, Map<ValidatorIndex, number>>>(
45
+ () => new MapDef<RootHex, Map<ValidatorIndex, number>>(() => new Map())
46
+ );
47
+
48
+ private lowestPermissibleSlot = 0;
49
+
50
+ constructor(private readonly config: BeaconConfig) {}
51
+
52
+ get size(): number {
53
+ let count = 0;
54
+ for (const byDependentRoot of this.inclusionLists.values()) {
55
+ for (const entries of byDependentRoot.values()) {
56
+ count += entries.size;
57
+ }
58
+ }
59
+ return count;
60
+ }
61
+
62
+ /**
63
+ * Late lists are stored with `timely=false` rather than dropped: they still count toward the
64
+ * non-timely view used to validate another node's `inclusion_list_bits`.
65
+ */
66
+ process(
67
+ signedInclusionList: heze.SignedInclusionList,
68
+ committeeIndices: number[],
69
+ timely: boolean
70
+ ): InclusionListInsertOutcome {
71
+ const inclusionList = signedInclusionList.message;
72
+ const {slot, validatorIndex} = inclusionList;
73
+
74
+ if (slot < this.lowestPermissibleSlot) {
75
+ return InclusionListInsertOutcome.Old;
76
+ }
77
+
78
+ const dependentRoot = toRootHex(inclusionList.dependentRoot);
79
+ const stored = this.inclusionLists.getOrDefault(slot).getOrDefault(dependentRoot);
80
+
81
+ const entry = stored.get(validatorIndex);
82
+ if (entry !== undefined) {
83
+ if (ssz.heze.InclusionList.equals(entry.signedInclusionList.message, inclusionList)) {
84
+ return InclusionListInsertOutcome.Seen;
85
+ }
86
+ const equivocators = this.equivocators.getOrDefault(slot).getOrDefault(dependentRoot);
87
+ if (equivocators.has(validatorIndex)) {
88
+ return InclusionListInsertOutcome.SubsequentEquivocation;
89
+ }
90
+ equivocators.add(validatorIndex);
91
+ return InclusionListInsertOutcome.Equivocating;
92
+ }
93
+
94
+ stored.set(validatorIndex, {signedInclusionList, committeeIndices, timely});
95
+ return InclusionListInsertOutcome.New;
96
+ }
97
+
98
+ /** Count a valid message of `validatorIndex` for the first-or-second message gossip rule */
99
+ markSeen(slot: Slot, dependentRoot: RootHex, validatorIndex: ValidatorIndex): void {
100
+ const counts = this.seenCounts.getOrDefault(slot).getOrDefault(dependentRoot);
101
+ counts.set(validatorIndex, (counts.get(validatorIndex) ?? 0) + 1);
102
+ }
103
+
104
+ /** Gossip rule: at most two valid messages per validator for a `(slot, dependent_root)` */
105
+ seenTwice(slot: Slot, dependentRoot: RootHex, validatorIndex: ValidatorIndex): boolean {
106
+ return (this.seenCounts.get(slot)?.get(dependentRoot)?.get(validatorIndex) ?? 0) >= 2;
107
+ }
108
+
109
+ /** Deduplicated transactions from valid, non-equivocating inclusion lists at `(slot, dependentRoot)`. */
110
+ getInclusionListTransactions(slot: Slot, dependentRoot: RootHex, onlyTimely = true): bellatrix.Transactions {
111
+ const transactions: Uint8Array[] = [];
112
+ const seen = new Set<string>();
113
+
114
+ for (const {signedInclusionList} of this.getEligible(slot, dependentRoot, onlyTimely)) {
115
+ for (const transaction of signedInclusionList.message.transactions) {
116
+ const key = toHex(transaction);
117
+ if (!seen.has(key)) {
118
+ seen.add(key);
119
+ transactions.push(transaction);
120
+ }
121
+ }
122
+ }
123
+
124
+ return SerializedList.fromArray(transactions);
125
+ }
126
+
127
+ /** Bit `i` is set when committee member `i` submitted a valid, non-equivocating inclusion list */
128
+ getInclusionListBits(slot: Slot, dependentRoot: RootHex, onlyTimely = true): BitArray {
129
+ const bits = BitArray.fromBitLen(INCLUSION_LIST_COMMITTEE_SIZE);
130
+ for (const {committeeIndices} of this.getEligible(slot, dependentRoot, onlyTimely)) {
131
+ for (const committeeIndex of committeeIndices) {
132
+ bits.set(committeeIndex, true);
133
+ }
134
+ }
135
+ return bits;
136
+ }
137
+
138
+ /**
139
+ * True if `bits` has a bit set for every bit set in the local inclusion list bits.
140
+ *
141
+ * Intentionally deviates from the spec by only checking against timely lists, where the proposer would check
142
+ * against every list it observed (only_timely=False in
143
+ * https://github.com/ethereum/consensus-specs/blob/v1.7.0-beta.4/specs/heze/validator.md#signed-execution-payload-bid).
144
+ * A bid that passed gossip must stay eligible, otherwise a list released after the deadline voids every bid and
145
+ * a high early bid with empty bits crowds out the rest without ever paying.
146
+ */
147
+ isInclusionListBitsInclusive(slot: Slot, dependentRoot: RootHex, bits: BitArray): boolean {
148
+ for (const {committeeIndices} of this.getEligible(slot, dependentRoot, true)) {
149
+ if (committeeIndices.some((committeeIndex) => !bits.get(committeeIndex))) {
150
+ return false;
151
+ }
152
+ }
153
+ return true;
154
+ }
155
+
156
+ /** Inclusion lists for the given committee positions, to serve InclusionListsByIndices. */
157
+ getByIndices(slot: Slot, dependentRoot: RootHex, indices: BitArray): heze.SignedInclusionList[] {
158
+ const out: heze.SignedInclusionList[] = [];
159
+ for (const {signedInclusionList, committeeIndices} of this.getEligible(slot, dependentRoot, false)) {
160
+ if (committeeIndices.some((committeeIndex) => indices.get(committeeIndex))) {
161
+ out.push(signedInclusionList);
162
+ }
163
+ }
164
+ return out;
165
+ }
166
+
167
+ /** Lists are retained for MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS slots so InclusionListsByIndices can serve them */
168
+ prune(clockSlot: Slot): void {
169
+ const horizon = clockSlot - this.config.MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS;
170
+
171
+ for (const slot of this.inclusionLists.keys()) {
172
+ if (slot < horizon) {
173
+ this.inclusionLists.delete(slot);
174
+ }
175
+ }
176
+ for (const slot of this.equivocators.keys()) {
177
+ if (slot < horizon) {
178
+ this.equivocators.delete(slot);
179
+ }
180
+ }
181
+ for (const slot of this.seenCounts.keys()) {
182
+ if (slot < horizon) {
183
+ this.seenCounts.delete(slot);
184
+ }
185
+ }
186
+
187
+ this.lowestPermissibleSlot = Math.max(horizon, 0);
188
+ }
189
+
190
+ /** Entries at `(slot, dependentRoot)` from non-equivocating validators, timely when required. */
191
+ private *getEligible(slot: Slot, dependentRoot: RootHex, onlyTimely: boolean): Generator<InclusionListEntry> {
192
+ const stored = this.inclusionLists.get(slot)?.get(dependentRoot);
193
+ if (!stored || stored.size === 0) {
194
+ return;
195
+ }
196
+ const equivocators = this.equivocators.get(slot)?.get(dependentRoot);
197
+
198
+ for (const [validatorIndex, entry] of stored) {
199
+ if (equivocators?.has(validatorIndex)) {
200
+ continue;
201
+ }
202
+ if (onlyTimely && !entry.timely) {
203
+ continue;
204
+ }
205
+ yield entry;
206
+ }
207
+ }
208
+ }
@@ -2,8 +2,10 @@ export {AggregatedAttestationPool} from "./aggregatedAttestationPool.js";
2
2
  export {AttestationPool} from "./attestationPool.js";
3
3
  export {DeferredVoluntaryExitPool} from "./deferredVoluntaryExitPool.js";
4
4
  export {ExecutionPayloadBidPool, type PooledExecutionPayloadBid} from "./executionPayloadBidPool.js";
5
+ export {InclusionListInsertOutcome, InclusionListStore} from "./inclusionListStore.js";
5
6
  export {OpPool} from "./opPool.js";
6
7
  export {PayloadAttestationPool} from "./payloadAttestationPool.js";
7
8
  export {ProposerPreferencesPool} from "./proposerPreferencesPool.js";
9
+ export {SingleAttestationPool} from "./singleAttestationPool.js";
8
10
  export {SyncCommitteeMessagePool} from "./syncCommitteeMessagePool.js";
9
11
  export {SyncContributionAndProofPool} from "./syncContributionAndProofPool.js";
@@ -1,9 +1,10 @@
1
- import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
2
1
  import {BitArray} from "@chainsafe/ssz";
3
2
  import {ChainForkConfig} from "@lodestar/config";
3
+ import {Signature, aggregateSignatures} from "@lodestar/native/blst";
4
4
  import {MAX_COMMITTEES_PER_SLOT, MAX_PAYLOAD_ATTESTATIONS, PTC_SIZE} from "@lodestar/params";
5
+ import {G2_POINT_AT_INFINITY} from "@lodestar/state-transition";
5
6
  import {RootHex, Slot, gloas} from "@lodestar/types";
6
- import {MapDef, toRootHex} from "@lodestar/utils";
7
+ import {MapDef, byteArrayEquals, toRootHex} from "@lodestar/utils";
7
8
  import {Metrics} from "../../metrics/metrics.js";
8
9
  import {IClock} from "../../util/clock.js";
9
10
  import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js";
@@ -112,11 +113,19 @@ export class PayloadAttestationPool {
112
113
  return [];
113
114
  }
114
115
 
115
- return Array.from(aggregateByDataRoot.values())
116
- .slice()
116
+ const payloadAttestations: gloas.PayloadAttestation[] = [];
117
+ for (const aggregate of aggregateByDataRoot.values()) {
118
+ const payloadAttestation = fastToPayloadAttestation(aggregate);
119
+ // The point at infinity is not a valid aggregate signature, exclude it from the block
120
+ if (byteArrayEquals(payloadAttestation.signature, G2_POINT_AT_INFINITY)) {
121
+ continue;
122
+ }
123
+ payloadAttestations.push(payloadAttestation);
124
+ }
125
+
126
+ return payloadAttestations
117
127
  .sort((a, b) => b.aggregationBits.getTrueBitIndexes().length - a.aggregationBits.getTrueBitIndexes().length)
118
- .slice(0, MAX_PAYLOAD_ATTESTATIONS)
119
- .map(fastToPayloadAttestation);
128
+ .slice(0, MAX_PAYLOAD_ATTESTATIONS);
120
129
  }
121
130
 
122
131
  getAll(slot?: Slot): gloas.PayloadAttestation[] {
@@ -139,9 +148,11 @@ export class PayloadAttestationPool {
139
148
  }
140
149
  }
141
150
 
151
+ // The point at infinity is not a valid aggregate signature, do not serve such an aggregate
142
152
  return aggregates
143
153
  .sort((a, b) => b.aggregationBits.getTrueBitIndexes().length - a.aggregationBits.getTrueBitIndexes().length)
144
- .map(fastToPayloadAttestation);
154
+ .map(fastToPayloadAttestation)
155
+ .filter((attestation) => !byteArrayEquals(attestation.signature, G2_POINT_AT_INFINITY));
145
156
  }
146
157
 
147
158
  prune(clockSlot: Slot): void {
@@ -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
+ }
@@ -1,9 +1,10 @@
1
- import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
2
1
  import {BitArray} from "@chainsafe/ssz";
3
2
  import {ChainForkConfig} from "@lodestar/config";
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
 
@@ -1,10 +1,10 @@
1
- import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
2
1
  import {BitArray} from "@chainsafe/ssz";
3
2
  import {ChainForkConfig} from "@lodestar/config";
3
+ 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
  }
@@ -1,6 +1,6 @@
1
- import {Signature} from "@chainsafe/lodestar-z/blst";
2
1
  import {BeaconConfig} from "@lodestar/config";
3
2
  import {DbBatch, Id, Repository} from "@lodestar/db";
3
+ import {Signature} from "@lodestar/native/blst";
4
4
  import {BLS_WITHDRAWAL_PREFIX, DOMAIN_BEACON_ATTESTER, DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
5
5
  import {IBeaconStateView, computeStartSlotAtEpoch} from "@lodestar/state-transition";
6
6
  import {AttesterSlashing, Domain, Slot, capella, phase0} from "@lodestar/types";
@@ -43,12 +43,9 @@ 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;
51
- broadcastValidationStrictness?: string;
52
49
  minSameMessageSignatureSetsToBatch: number;
53
50
  archiveDateEpochs?: number;
54
51
  nHistoricalStatesFileDataStore?: boolean;
@@ -91,6 +88,11 @@ export type PoolOpts = {
91
88
  * Only preaggregate attestation/sync committee message since clockSlot - preaggregateSlotDistance
92
89
  */
93
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;
94
96
  };
95
97
 
96
98
  export type SeenCacheOpts = {
@@ -121,7 +123,6 @@ export const defaultChainOptions: IChainOptions = {
121
123
  // for attestation validation, having this value ensures we don't have to regen states most of the time
122
124
  maxSkipSlots: 32,
123
125
  disableProposerSlashings: false,
124
- broadcastValidationStrictness: "warn",
125
126
  // should be less than or equal to MIN_SIGNATURE_SETS_TO_BATCH_VERIFY
126
127
  // batching too much may block the I/O thread so if useWorker=false, suggest this value to be 32
127
128
  // since this batch attestation work is designed to work with useWorker=true, make this the lowest value