@lodestar/beacon-node 1.51.0 → 1.52.0-dev.03eb33e6f1

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 (677) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +99 -127
  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 +25 -3
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +1 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js +2 -1
  10. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  11. package/lib/api/impl/debug/index.d.ts.map +1 -1
  12. package/lib/api/impl/debug/index.js +6 -2
  13. package/lib/api/impl/debug/index.js.map +1 -1
  14. package/lib/api/impl/validator/index.d.ts +6 -0
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +55 -32
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
  19. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  20. package/lib/chain/ColumnReconstructionTracker.js +4 -0
  21. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  22. package/lib/chain/GetBlobsTracker.d.ts +13 -2
  23. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  24. package/lib/chain/GetBlobsTracker.js +69 -35
  25. package/lib/chain/GetBlobsTracker.js.map +1 -1
  26. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  27. package/lib/chain/archiveStore/archiveStore.js +4 -4
  28. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  29. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  30. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
  31. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  32. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +12 -0
  33. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  34. package/lib/chain/archiveStore/utils/archiveBlocks.js +17 -2
  35. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  36. package/lib/chain/archiveStore/utils/pruneHistory.d.ts +9 -2
  37. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  38. package/lib/chain/archiveStore/utils/pruneHistory.js +19 -7
  39. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  40. package/lib/chain/blocks/blockInput/blockInput.d.ts +11 -56
  41. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  42. package/lib/chain/blocks/blockInput/blockInput.js +8 -242
  43. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  44. package/lib/chain/blocks/blockInput/errors.d.ts +2 -4
  45. package/lib/chain/blocks/blockInput/errors.d.ts.map +1 -1
  46. package/lib/chain/blocks/blockInput/errors.js.map +1 -1
  47. package/lib/chain/blocks/blockInput/types.d.ts +2 -18
  48. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  49. package/lib/chain/blocks/blockInput/types.js +0 -1
  50. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  51. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  52. package/lib/chain/blocks/importBlock.js +36 -53
  53. package/lib/chain/blocks/importBlock.js.map +1 -1
  54. package/lib/chain/blocks/importExecutionPayload.d.ts +11 -12
  55. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  56. package/lib/chain/blocks/importExecutionPayload.js +56 -22
  57. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  58. package/lib/chain/blocks/index.d.ts.map +1 -1
  59. package/lib/chain/blocks/index.js +5 -19
  60. package/lib/chain/blocks/index.js.map +1 -1
  61. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +10 -7
  62. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  63. package/lib/chain/blocks/payloadEnvelopeProcessor.js +22 -17
  64. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  65. package/lib/chain/blocks/types.d.ts +4 -20
  66. package/lib/chain/blocks/types.d.ts.map +1 -1
  67. package/lib/chain/blocks/types.js +0 -24
  68. package/lib/chain/blocks/types.js.map +1 -1
  69. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  70. package/lib/chain/blocks/verifyBlock.js +29 -14
  71. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  72. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +2 -2
  73. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  74. package/lib/chain/blocks/verifyBlocksDataAvailability.js +17 -5
  75. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  76. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
  77. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  78. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +14 -8
  79. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  80. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  81. package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
  82. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  83. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  84. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  85. package/lib/chain/blocks/verifyBlocksSignatures.js +12 -6
  86. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  87. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +2 -2
  88. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  89. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +12 -7
  90. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  91. package/lib/chain/blocks/writeBlockInputToDb.d.ts +0 -2
  92. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  93. package/lib/chain/blocks/writeBlockInputToDb.js +6 -24
  94. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  95. package/lib/chain/bls/interface.d.ts +2 -0
  96. package/lib/chain/bls/interface.d.ts.map +1 -1
  97. package/lib/chain/bls/multithread/index.d.ts +1 -1
  98. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  99. package/lib/chain/bls/multithread/index.js +50 -22
  100. package/lib/chain/bls/multithread/index.js.map +1 -1
  101. package/lib/chain/bls/multithread/types.d.ts +1 -1
  102. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  103. package/lib/chain/bls/multithread/worker.js +1 -1
  104. package/lib/chain/bls/multithread/worker.js.map +1 -1
  105. package/lib/chain/bls/singleThread.js +1 -1
  106. package/lib/chain/bls/singleThread.js.map +1 -1
  107. package/lib/chain/bls/utils.js +2 -2
  108. package/lib/chain/bls/utils.js.map +1 -1
  109. package/lib/chain/chain.d.ts +31 -9
  110. package/lib/chain/chain.d.ts.map +1 -1
  111. package/lib/chain/chain.js +193 -64
  112. package/lib/chain/chain.js.map +1 -1
  113. package/lib/chain/emitter.d.ts +7 -7
  114. package/lib/chain/emitter.d.ts.map +1 -1
  115. package/lib/chain/emitter.js +5 -5
  116. package/lib/chain/emitter.js.map +1 -1
  117. package/lib/chain/errors/attestationError.d.ts +15 -1
  118. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  119. package/lib/chain/errors/attestationError.js +8 -0
  120. package/lib/chain/errors/attestationError.js.map +1 -1
  121. package/lib/chain/errors/blockError.d.ts +1 -1
  122. package/lib/chain/errors/blockError.d.ts.map +1 -1
  123. package/lib/chain/errors/blockError.js +1 -1
  124. package/lib/chain/errors/blockError.js.map +1 -1
  125. package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
  126. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  127. package/lib/chain/errors/executionPayloadBid.js +1 -1
  128. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  129. package/lib/chain/errors/executionPayloadEnvelope.d.ts +55 -0
  130. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  131. package/lib/chain/errors/executionPayloadEnvelope.js +8 -0
  132. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  133. package/lib/chain/errors/index.d.ts +0 -1
  134. package/lib/chain/errors/index.d.ts.map +1 -1
  135. package/lib/chain/errors/index.js +0 -1
  136. package/lib/chain/errors/index.js.map +1 -1
  137. package/lib/chain/forkChoice/index.d.ts +8 -1
  138. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  139. package/lib/chain/forkChoice/index.js +8 -0
  140. package/lib/chain/forkChoice/index.js.map +1 -1
  141. package/lib/chain/forkChoiceExecutionEngine.d.ts +53 -0
  142. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
  143. package/lib/chain/forkChoiceExecutionEngine.js +140 -0
  144. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
  145. package/lib/chain/interface.d.ts +10 -8
  146. package/lib/chain/interface.d.ts.map +1 -1
  147. package/lib/chain/interface.js.map +1 -1
  148. package/lib/chain/lightClient/index.d.ts +13 -6
  149. package/lib/chain/lightClient/index.d.ts.map +1 -1
  150. package/lib/chain/lightClient/index.js +95 -115
  151. package/lib/chain/lightClient/index.js.map +1 -1
  152. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +17 -4
  153. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  154. package/lib/chain/opPools/aggregatedAttestationPool.js +199 -46
  155. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  156. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  157. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  158. package/lib/chain/opPools/attestationPool.js +15 -4
  159. package/lib/chain/opPools/attestationPool.js.map +1 -1
  160. package/lib/chain/opPools/inclusionListStore.d.ts +4 -1
  161. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
  162. package/lib/chain/opPools/inclusionListStore.js +5 -2
  163. package/lib/chain/opPools/inclusionListStore.js.map +1 -1
  164. package/lib/chain/opPools/index.d.ts +1 -0
  165. package/lib/chain/opPools/index.d.ts.map +1 -1
  166. package/lib/chain/opPools/index.js +1 -0
  167. package/lib/chain/opPools/index.js.map +1 -1
  168. package/lib/chain/opPools/opPool.js +6 -6
  169. package/lib/chain/opPools/opPool.js.map +1 -1
  170. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  171. package/lib/chain/opPools/payloadAttestationPool.js +17 -7
  172. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  173. package/lib/chain/opPools/singleAttestationPool.d.ts +77 -0
  174. package/lib/chain/opPools/singleAttestationPool.d.ts.map +1 -0
  175. package/lib/chain/opPools/singleAttestationPool.js +209 -0
  176. package/lib/chain/opPools/singleAttestationPool.js.map +1 -0
  177. package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
  178. package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
  179. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  180. package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
  181. package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
  182. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  183. package/lib/chain/opPools/utils.d.ts +1 -1
  184. package/lib/chain/opPools/utils.d.ts.map +1 -1
  185. package/lib/chain/opPools/utils.js +1 -1
  186. package/lib/chain/opPools/utils.js.map +1 -1
  187. package/lib/chain/options.d.ts +5 -3
  188. package/lib/chain/options.d.ts.map +1 -1
  189. package/lib/chain/options.js +2 -3
  190. package/lib/chain/options.js.map +1 -1
  191. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  192. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  193. package/lib/chain/produceBlock/produceBlockBody.js +3 -2
  194. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  195. package/lib/chain/proposerTracker.d.ts +31 -0
  196. package/lib/chain/proposerTracker.d.ts.map +1 -0
  197. package/lib/chain/proposerTracker.js +75 -0
  198. package/lib/chain/proposerTracker.js.map +1 -0
  199. package/lib/chain/regen/interface.d.ts +1 -1
  200. package/lib/chain/regen/interface.d.ts.map +1 -1
  201. package/lib/chain/regen/queued.d.ts +1 -1
  202. package/lib/chain/regen/queued.d.ts.map +1 -1
  203. package/lib/chain/regen/queued.js +5 -3
  204. package/lib/chain/regen/queued.js.map +1 -1
  205. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  206. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  207. package/lib/chain/seenCache/seenAttesters.js +1 -1
  208. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  209. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  210. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  211. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  212. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  213. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  214. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  215. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  216. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  217. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -14
  218. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  219. package/lib/chain/seenCache/seenGossipBlockInput.js +6 -65
  220. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  221. package/lib/chain/shufflingCache.d.ts +5 -0
  222. package/lib/chain/shufflingCache.d.ts.map +1 -1
  223. package/lib/chain/shufflingCache.js +39 -1
  224. package/lib/chain/shufflingCache.js.map +1 -1
  225. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  226. package/lib/chain/validation/aggregateAndProof.js +38 -10
  227. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  228. package/lib/chain/validation/attestation.d.ts.map +1 -1
  229. package/lib/chain/validation/attestation.js +33 -17
  230. package/lib/chain/validation/attestation.js.map +1 -1
  231. package/lib/chain/validation/block.d.ts.map +1 -1
  232. package/lib/chain/validation/block.js +9 -1
  233. package/lib/chain/validation/block.js.map +1 -1
  234. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  235. package/lib/chain/validation/dataColumnSidecar.js +8 -1
  236. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  237. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  238. package/lib/chain/validation/executionPayloadBid.js +36 -46
  239. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  240. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  241. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  242. package/lib/chain/validation/executionPayloadEnvelope.js +132 -4
  243. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  244. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  245. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  246. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  247. package/lib/chain/validation/syncCommittee.js +16 -10
  248. package/lib/chain/validation/syncCommittee.js.map +1 -1
  249. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  250. package/lib/chain/validation/syncCommitteeContributionAndProof.js +11 -0
  251. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  252. package/lib/chain/validatorMonitor.d.ts +1 -2
  253. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  254. package/lib/chain/validatorMonitor.js +0 -3
  255. package/lib/chain/validatorMonitor.js.map +1 -1
  256. package/lib/db/dataColumnStore.d.ts +3 -2
  257. package/lib/db/dataColumnStore.d.ts.map +1 -1
  258. package/lib/db/dataColumnStore.js +3 -3
  259. package/lib/db/dataColumnStore.js.map +1 -1
  260. package/lib/db/flatFileStore/flatFileStore.d.ts +1 -1
  261. package/lib/db/flatFileStore/flatFileStore.d.ts.map +1 -1
  262. package/lib/db/flatFileStore/flatFileStore.js +10 -9
  263. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  264. package/lib/db/flatFileStore/interface.d.ts +2 -1
  265. package/lib/db/flatFileStore/interface.d.ts.map +1 -1
  266. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  267. package/lib/db/flatFileStore/slotIndex.js +2 -2
  268. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  269. package/lib/db/repositories/blobSidecars.d.ts +0 -1
  270. package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
  271. package/lib/db/repositories/blobSidecars.js +0 -1
  272. package/lib/db/repositories/blobSidecars.js.map +1 -1
  273. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +2 -1
  274. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  275. package/lib/db/repositories/dataColumnSidecarArchive.js +14 -4
  276. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  277. package/lib/execution/builder/apiClient.d.ts +14 -8
  278. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  279. package/lib/execution/builder/apiClient.js +12 -10
  280. package/lib/execution/builder/apiClient.js.map +1 -1
  281. package/lib/execution/builder/http.d.ts +2 -0
  282. package/lib/execution/builder/http.d.ts.map +1 -1
  283. package/lib/execution/builder/http.js +2 -0
  284. package/lib/execution/builder/http.js.map +1 -1
  285. package/lib/execution/engine/http.d.ts +4 -6
  286. package/lib/execution/engine/http.d.ts.map +1 -1
  287. package/lib/execution/engine/http.js +8 -10
  288. package/lib/execution/engine/http.js.map +1 -1
  289. package/lib/execution/engine/index.d.ts +1 -1
  290. package/lib/execution/engine/index.d.ts.map +1 -1
  291. package/lib/execution/engine/index.js +1 -1
  292. package/lib/execution/engine/index.js.map +1 -1
  293. package/lib/execution/engine/interface.d.ts +18 -6
  294. package/lib/execution/engine/interface.d.ts.map +1 -1
  295. package/lib/execution/engine/interface.js.map +1 -1
  296. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -4
  297. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  298. package/lib/execution/engine/jsonRpcTransport.js +2 -12
  299. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  300. package/lib/execution/engine/mock.d.ts +0 -1
  301. package/lib/execution/engine/mock.d.ts.map +1 -1
  302. package/lib/execution/engine/mock.js +0 -4
  303. package/lib/execution/engine/mock.js.map +1 -1
  304. package/lib/execution/engine/restTransport.d.ts +2 -4
  305. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  306. package/lib/execution/engine/restTransport.js +1 -15
  307. package/lib/execution/engine/restTransport.js.map +1 -1
  308. package/lib/execution/engine/sszTypes.d.ts +0 -9
  309. package/lib/execution/engine/sszTypes.d.ts.map +1 -1
  310. package/lib/execution/engine/sszTypes.js +0 -5
  311. package/lib/execution/engine/sszTypes.js.map +1 -1
  312. package/lib/execution/engine/transport.d.ts +1 -14
  313. package/lib/execution/engine/transport.d.ts.map +1 -1
  314. package/lib/execution/engine/types.d.ts +0 -8
  315. package/lib/execution/engine/types.d.ts.map +1 -1
  316. package/lib/execution/engine/types.js +2 -10
  317. package/lib/execution/engine/types.js.map +1 -1
  318. package/lib/execution/engine/utils.d.ts.map +1 -1
  319. package/lib/execution/engine/utils.js +3 -2
  320. package/lib/execution/engine/utils.js.map +1 -1
  321. package/lib/index.d.ts +1 -1
  322. package/lib/index.d.ts.map +1 -1
  323. package/lib/index.js +1 -1
  324. package/lib/index.js.map +1 -1
  325. package/lib/metrics/metrics/beacon.d.ts +4 -9
  326. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  327. package/lib/metrics/metrics/beacon.js +11 -32
  328. package/lib/metrics/metrics/beacon.js.map +1 -1
  329. package/lib/metrics/metrics/lodestar.d.ts +32 -8
  330. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  331. package/lib/metrics/metrics/lodestar.js +116 -46
  332. package/lib/metrics/metrics/lodestar.js.map +1 -1
  333. package/lib/metrics/server/http.js +5 -5
  334. package/lib/metrics/server/http.js.map +1 -1
  335. package/lib/monitoring/service.js +1 -1
  336. package/lib/monitoring/service.js.map +1 -1
  337. package/lib/network/core/networkCore.d.ts +4 -1
  338. package/lib/network/core/networkCore.d.ts.map +1 -1
  339. package/lib/network/core/networkCore.js +7 -0
  340. package/lib/network/core/networkCore.js.map +1 -1
  341. package/lib/network/core/networkCoreWorker.js +2 -0
  342. package/lib/network/core/networkCoreWorker.js.map +1 -1
  343. package/lib/network/core/networkCoreWorkerHandler.d.ts +4 -1
  344. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  345. package/lib/network/core/networkCoreWorkerHandler.js +6 -0
  346. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  347. package/lib/network/core/types.d.ts +6 -1
  348. package/lib/network/core/types.d.ts.map +1 -1
  349. package/lib/network/gossip/gossipsub.d.ts +1 -0
  350. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  351. package/lib/network/gossip/gossipsub.js +23 -6
  352. package/lib/network/gossip/gossipsub.js.map +1 -1
  353. package/lib/network/gossip/interface.d.ts +1 -8
  354. package/lib/network/gossip/interface.d.ts.map +1 -1
  355. package/lib/network/gossip/interface.js +0 -1
  356. package/lib/network/gossip/interface.js.map +1 -1
  357. package/lib/network/gossip/topic.d.ts +1 -23
  358. package/lib/network/gossip/topic.d.ts.map +1 -1
  359. package/lib/network/gossip/topic.js +0 -36
  360. package/lib/network/gossip/topic.js.map +1 -1
  361. package/lib/network/interface.d.ts +4 -5
  362. package/lib/network/interface.d.ts.map +1 -1
  363. package/lib/network/libp2p/index.d.ts.map +1 -1
  364. package/lib/network/libp2p/index.js +5 -1
  365. package/lib/network/libp2p/index.js.map +1 -1
  366. package/lib/network/network.d.ts +9 -7
  367. package/lib/network/network.d.ts.map +1 -1
  368. package/lib/network/network.js +73 -46
  369. package/lib/network/network.js.map +1 -1
  370. package/lib/network/options.d.ts +2 -0
  371. package/lib/network/options.d.ts.map +1 -1
  372. package/lib/network/options.js +2 -0
  373. package/lib/network/options.js.map +1 -1
  374. package/lib/network/peers/peerManager.d.ts +2 -1
  375. package/lib/network/peers/peerManager.d.ts.map +1 -1
  376. package/lib/network/peers/peerManager.js +28 -1
  377. package/lib/network/peers/peerManager.js.map +1 -1
  378. package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
  379. package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
  380. package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
  381. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  382. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  383. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  384. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  385. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  386. package/lib/network/peers/utils/subnetMap.d.ts +5 -2
  387. package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
  388. package/lib/network/peers/utils/subnetMap.js +6 -3
  389. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  390. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  391. package/lib/network/processor/extractSlotRootFns.js +1 -8
  392. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  393. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  394. package/lib/network/processor/gossipHandlers.js +72 -138
  395. package/lib/network/processor/gossipHandlers.js.map +1 -1
  396. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  397. package/lib/network/processor/gossipQueues/index.js +0 -6
  398. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  399. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  400. package/lib/network/processor/gossipValidatorFn.js +4 -5
  401. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  402. package/lib/network/processor/index.d.ts +6 -0
  403. package/lib/network/processor/index.d.ts.map +1 -1
  404. package/lib/network/processor/index.js +33 -6
  405. package/lib/network/processor/index.js.map +1 -1
  406. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  407. package/lib/network/reqresp/ReqRespBeaconNode.js +0 -3
  408. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  409. package/lib/network/reqresp/handlers/beaconBlocksByHead.js +1 -1
  410. package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -1
  411. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
  412. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  413. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  414. package/lib/network/reqresp/handlers/index.js +1 -12
  415. package/lib/network/reqresp/handlers/index.js.map +1 -1
  416. package/lib/network/reqresp/protocols.d.ts +0 -2
  417. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  418. package/lib/network/reqresp/protocols.js +0 -10
  419. package/lib/network/reqresp/protocols.js.map +1 -1
  420. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  421. package/lib/network/reqresp/rateLimit.js +1 -17
  422. package/lib/network/reqresp/rateLimit.js.map +1 -1
  423. package/lib/network/reqresp/types.d.ts +2 -8
  424. package/lib/network/reqresp/types.d.ts.map +1 -1
  425. package/lib/network/reqresp/types.js +1 -7
  426. package/lib/network/reqresp/types.js.map +1 -1
  427. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  428. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  429. package/lib/network/reqresp/utils/collect.js +9 -8
  430. package/lib/network/reqresp/utils/collect.js.map +1 -1
  431. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  432. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  433. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  434. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  435. package/lib/network/subnets/attnetsService.d.ts +35 -5
  436. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  437. package/lib/network/subnets/attnetsService.js +84 -6
  438. package/lib/network/subnets/attnetsService.js.map +1 -1
  439. package/lib/network/subnets/interface.d.ts +7 -0
  440. package/lib/network/subnets/interface.d.ts.map +1 -1
  441. package/lib/network/subnets/interface.js.map +1 -1
  442. package/lib/node/nodejs.d.ts +3 -1
  443. package/lib/node/nodejs.d.ts.map +1 -1
  444. package/lib/node/nodejs.js +38 -20
  445. package/lib/node/nodejs.js.map +1 -1
  446. package/lib/node/options.d.ts +3 -1
  447. package/lib/node/options.d.ts.map +1 -1
  448. package/lib/node/options.js +4 -2
  449. package/lib/node/options.js.map +1 -1
  450. package/lib/sync/interface.d.ts.map +1 -1
  451. package/lib/sync/interface.js.map +1 -1
  452. package/lib/sync/range/batch.d.ts +8 -3
  453. package/lib/sync/range/batch.d.ts.map +1 -1
  454. package/lib/sync/range/batch.js +26 -22
  455. package/lib/sync/range/batch.js.map +1 -1
  456. package/lib/sync/range/chain.d.ts.map +1 -1
  457. package/lib/sync/range/chain.js +10 -16
  458. package/lib/sync/range/chain.js.map +1 -1
  459. package/lib/sync/range/range.d.ts.map +1 -1
  460. package/lib/sync/range/range.js +43 -3
  461. package/lib/sync/range/range.js.map +1 -1
  462. package/lib/sync/sync.d.ts +15 -0
  463. package/lib/sync/sync.d.ts.map +1 -1
  464. package/lib/sync/sync.js +103 -25
  465. package/lib/sync/sync.js.map +1 -1
  466. package/lib/sync/types.d.ts +12 -1
  467. package/lib/sync/types.d.ts.map +1 -1
  468. package/lib/sync/types.js +2 -0
  469. package/lib/sync/types.js.map +1 -1
  470. package/lib/sync/unknownBlock.d.ts +28 -1
  471. package/lib/sync/unknownBlock.d.ts.map +1 -1
  472. package/lib/sync/unknownBlock.js +257 -31
  473. package/lib/sync/unknownBlock.js.map +1 -1
  474. package/lib/sync/utils/downloadByRange.d.ts +20 -35
  475. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  476. package/lib/sync/utils/downloadByRange.js +36 -130
  477. package/lib/sync/utils/downloadByRange.js.map +1 -1
  478. package/lib/sync/utils/downloadByRoot.d.ts +23 -17
  479. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  480. package/lib/sync/utils/downloadByRoot.js +57 -100
  481. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  482. package/lib/util/bitArray.d.ts +6 -6
  483. package/lib/util/bitArray.d.ts.map +1 -1
  484. package/lib/util/bitArray.js +25 -50
  485. package/lib/util/bitArray.js.map +1 -1
  486. package/lib/util/blobs.d.ts +1 -7
  487. package/lib/util/blobs.d.ts.map +1 -1
  488. package/lib/util/blobs.js +0 -19
  489. package/lib/util/blobs.js.map +1 -1
  490. package/lib/util/eventLoop.d.ts +5 -0
  491. package/lib/util/eventLoop.d.ts.map +1 -1
  492. package/lib/util/eventLoop.js +7 -0
  493. package/lib/util/eventLoop.js.map +1 -1
  494. package/lib/util/execution.d.ts +3 -4
  495. package/lib/util/execution.d.ts.map +1 -1
  496. package/lib/util/execution.js +1 -73
  497. package/lib/util/execution.js.map +1 -1
  498. package/lib/util/file.d.ts.map +1 -1
  499. package/lib/util/file.js +8 -9
  500. package/lib/util/file.js.map +1 -1
  501. package/lib/util/queue/itemQueue.js +1 -1
  502. package/lib/util/queue/itemQueue.js.map +1 -1
  503. package/lib/util/sszBytes.d.ts +5 -1
  504. package/lib/util/sszBytes.d.ts.map +1 -1
  505. package/lib/util/sszBytes.js +36 -19
  506. package/lib/util/sszBytes.js.map +1 -1
  507. package/lib/util/types.d.ts +0 -5
  508. package/lib/util/types.d.ts.map +1 -1
  509. package/lib/util/types.js +1 -2
  510. package/lib/util/types.js.map +1 -1
  511. package/package.json +27 -28
  512. package/src/api/impl/beacon/blocks/index.ts +133 -156
  513. package/src/api/impl/beacon/pool/index.ts +40 -8
  514. package/src/api/impl/beacon/state/utils.ts +3 -2
  515. package/src/api/impl/debug/index.ts +6 -2
  516. package/src/api/impl/validator/index.ts +62 -36
  517. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  518. package/src/chain/GetBlobsTracker.ts +82 -52
  519. package/src/chain/archiveStore/archiveStore.ts +6 -4
  520. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
  521. package/src/chain/archiveStore/utils/archiveBlocks.ts +21 -2
  522. package/src/chain/archiveStore/utils/pruneHistory.ts +24 -9
  523. package/src/chain/blocks/blockInput/blockInput.ts +15 -344
  524. package/src/chain/blocks/blockInput/errors.ts +1 -2
  525. package/src/chain/blocks/blockInput/types.ts +2 -20
  526. package/src/chain/blocks/importBlock.ts +56 -72
  527. package/src/chain/blocks/importExecutionPayload.ts +85 -38
  528. package/src/chain/blocks/index.ts +8 -33
  529. package/src/chain/blocks/payloadEnvelopeProcessor.ts +33 -22
  530. package/src/chain/blocks/types.ts +5 -31
  531. package/src/chain/blocks/verifyBlock.ts +47 -26
  532. package/src/chain/blocks/verifyBlocksDataAvailability.ts +20 -6
  533. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +16 -10
  534. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  535. package/src/chain/blocks/verifyBlocksSignatures.ts +13 -5
  536. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +16 -8
  537. package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
  538. package/src/chain/bls/interface.ts +2 -0
  539. package/src/chain/bls/multithread/index.ts +48 -24
  540. package/src/chain/bls/multithread/types.ts +1 -1
  541. package/src/chain/bls/multithread/worker.ts +1 -5
  542. package/src/chain/bls/singleThread.ts +1 -1
  543. package/src/chain/bls/utils.ts +2 -2
  544. package/src/chain/chain.ts +243 -81
  545. package/src/chain/emitter.ts +8 -8
  546. package/src/chain/errors/attestationError.ts +11 -1
  547. package/src/chain/errors/blockError.ts +1 -1
  548. package/src/chain/errors/executionPayloadBid.ts +3 -2
  549. package/src/chain/errors/executionPayloadEnvelope.ts +58 -0
  550. package/src/chain/errors/index.ts +0 -1
  551. package/src/chain/forkChoice/index.ts +8 -0
  552. package/src/chain/forkChoiceExecutionEngine.ts +216 -0
  553. package/src/chain/interface.ts +10 -7
  554. package/src/chain/lightClient/index.ts +108 -142
  555. package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
  556. package/src/chain/opPools/attestationPool.ts +16 -4
  557. package/src/chain/opPools/inclusionListStore.ts +5 -2
  558. package/src/chain/opPools/index.ts +1 -0
  559. package/src/chain/opPools/opPool.ts +6 -6
  560. package/src/chain/opPools/payloadAttestationPool.ts +18 -7
  561. package/src/chain/opPools/singleAttestationPool.ts +287 -0
  562. package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
  563. package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
  564. package/src/chain/opPools/utils.ts +1 -1
  565. package/src/chain/options.ts +7 -6
  566. package/src/chain/produceBlock/produceBlockBody.ts +7 -3
  567. package/src/chain/proposerTracker.ts +94 -0
  568. package/src/chain/regen/interface.ts +1 -1
  569. package/src/chain/regen/queued.ts +6 -4
  570. package/src/chain/seenCache/seenAttesters.ts +1 -1
  571. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  572. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  573. package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
  574. package/src/chain/shufflingCache.ts +40 -1
  575. package/src/chain/validation/aggregateAndProof.ts +44 -15
  576. package/src/chain/validation/attestation.ts +32 -21
  577. package/src/chain/validation/block.ts +9 -1
  578. package/src/chain/validation/dataColumnSidecar.ts +7 -1
  579. package/src/chain/validation/executionPayloadBid.ts +47 -48
  580. package/src/chain/validation/executionPayloadEnvelope.ts +155 -4
  581. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  582. package/src/chain/validation/syncCommittee.ts +31 -15
  583. package/src/chain/validation/syncCommitteeContributionAndProof.ts +13 -0
  584. package/src/chain/validatorMonitor.ts +0 -6
  585. package/src/db/dataColumnStore.ts +5 -4
  586. package/src/db/flatFileStore/flatFileStore.ts +12 -11
  587. package/src/db/flatFileStore/interface.ts +2 -1
  588. package/src/db/flatFileStore/slotIndex.ts +4 -3
  589. package/src/db/repositories/blobSidecars.ts +0 -1
  590. package/src/db/repositories/dataColumnSidecarArchive.ts +14 -4
  591. package/src/execution/builder/apiClient.ts +16 -13
  592. package/src/execution/builder/http.ts +4 -0
  593. package/src/execution/engine/http.ts +19 -42
  594. package/src/execution/engine/index.ts +1 -1
  595. package/src/execution/engine/interface.ts +19 -10
  596. package/src/execution/engine/jsonRpcTransport.ts +10 -22
  597. package/src/execution/engine/mock.ts +0 -7
  598. package/src/execution/engine/restTransport.ts +3 -22
  599. package/src/execution/engine/sszTypes.ts +0 -9
  600. package/src/execution/engine/transport.ts +8 -17
  601. package/src/execution/engine/types.ts +3 -18
  602. package/src/execution/engine/utils.ts +4 -2
  603. package/src/index.ts +1 -1
  604. package/src/metrics/metrics/beacon.ts +11 -32
  605. package/src/metrics/metrics/lodestar.ts +117 -46
  606. package/src/metrics/server/http.ts +5 -5
  607. package/src/monitoring/service.ts +1 -1
  608. package/src/network/core/networkCore.ts +11 -1
  609. package/src/network/core/networkCoreWorker.ts +2 -0
  610. package/src/network/core/networkCoreWorkerHandler.ts +8 -1
  611. package/src/network/core/types.ts +6 -1
  612. package/src/network/gossip/gossipsub.ts +24 -6
  613. package/src/network/gossip/interface.ts +0 -5
  614. package/src/network/gossip/topic.ts +1 -39
  615. package/src/network/interface.ts +2 -5
  616. package/src/network/libp2p/index.ts +5 -1
  617. package/src/network/network.ts +88 -69
  618. package/src/network/options.ts +4 -0
  619. package/src/network/peers/peerManager.ts +28 -3
  620. package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
  621. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  622. package/src/network/peers/utils/subnetMap.ts +6 -3
  623. package/src/network/processor/extractSlotRootFns.ts +0 -9
  624. package/src/network/processor/gossipHandlers.ts +91 -178
  625. package/src/network/processor/gossipQueues/index.ts +0 -6
  626. package/src/network/processor/gossipValidatorFn.ts +4 -5
  627. package/src/network/processor/index.ts +32 -6
  628. package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
  629. package/src/network/reqresp/handlers/beaconBlocksByHead.ts +1 -1
  630. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
  631. package/src/network/reqresp/handlers/index.ts +0 -17
  632. package/src/network/reqresp/protocols.ts +0 -12
  633. package/src/network/reqresp/rateLimit.ts +1 -17
  634. package/src/network/reqresp/types.ts +0 -13
  635. package/src/network/reqresp/utils/collect.ts +16 -8
  636. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  637. package/src/network/subnets/attnetsService.ts +94 -6
  638. package/src/network/subnets/interface.ts +7 -0
  639. package/src/node/nodejs.ts +40 -21
  640. package/src/node/options.ts +9 -6
  641. package/src/sync/interface.ts +1 -0
  642. package/src/sync/range/batch.ts +29 -21
  643. package/src/sync/range/chain.ts +10 -14
  644. package/src/sync/range/range.ts +56 -3
  645. package/src/sync/sync.ts +108 -26
  646. package/src/sync/types.ts +11 -0
  647. package/src/sync/unknownBlock.ts +296 -32
  648. package/src/sync/utils/downloadByRange.ts +60 -233
  649. package/src/sync/utils/downloadByRoot.ts +78 -139
  650. package/src/util/bitArray.ts +22 -43
  651. package/src/util/blobs.ts +0 -34
  652. package/src/util/eventLoop.ts +8 -0
  653. package/src/util/execution.ts +8 -102
  654. package/src/util/file.ts +8 -9
  655. package/src/util/queue/itemQueue.ts +1 -1
  656. package/src/util/sszBytes.ts +42 -24
  657. package/src/util/types.ts +1 -8
  658. package/lib/chain/errors/blobSidecarError.d.ts +0 -108
  659. package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
  660. package/lib/chain/errors/blobSidecarError.js +0 -38
  661. package/lib/chain/errors/blobSidecarError.js.map +0 -1
  662. package/lib/chain/validation/blobSidecar.d.ts +0 -16
  663. package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
  664. package/lib/chain/validation/blobSidecar.js +0 -276
  665. package/lib/chain/validation/blobSidecar.js.map +0 -1
  666. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
  667. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
  668. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
  669. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
  670. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
  671. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
  672. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
  673. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
  674. package/src/chain/errors/blobSidecarError.ts +0 -70
  675. package/src/chain/validation/blobSidecar.ts +0 -357
  676. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
  677. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
@@ -16,33 +16,6 @@ import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction} fr
16
16
  import {IBeaconChain} from "../index.js";
17
17
  import {RegenCaller} from "../regen/index.js";
18
18
 
19
- /**
20
- * Relative increment over the current highest bid required to forward a bid, in basis points.
21
- * With 3%, laddering from 1 gwei to 1 ETH takes ~256 bids given the floor and cap below, see
22
- * https://github.com/ethereum/consensus-specs/pull/4792#issuecomment-3714553549.
23
- */
24
- const BID_INCREMENT_BPS = 300;
25
- /**
26
- * Minimum absolute increment (0.0001 ETH). Covers low bid values where the relative increment
27
- * is tiny and provides weak spam protection.
28
- */
29
- const BID_INCREMENT_FLOOR_GWEI = 100_000;
30
- /**
31
- * Maximum absolute increment (0.01 ETH). Bounds the barrier for legitimate competition on
32
- * high value blocks where the relative increment would suppress closely competing bids.
33
- */
34
- const BID_INCREMENT_CAP_GWEI = 10_000_000;
35
-
36
- /**
37
- * Return the minimum value a new bid must have to be forwarded given the current highest bid.
38
- * Division before multiplication to stay within safe integer range for max gwei values.
39
- */
40
- function getMinBidValue(currentHighestBid: number): number {
41
- const relativeIncrement = Math.floor(currentHighestBid / 10_000) * BID_INCREMENT_BPS;
42
- const increment = Math.min(Math.max(BID_INCREMENT_FLOOR_GWEI, relativeIncrement), BID_INCREMENT_CAP_GWEI);
43
- return currentHighestBid + increment;
44
- }
45
-
46
19
  /**
47
20
  * Check whether a bid builds on one of the paths compatible with the local head branch.
48
21
  *
@@ -165,17 +138,34 @@ async function validateExecutionPayloadBid(
165
138
  });
166
139
  }
167
140
 
168
- // [IGNORE] this is the first signed bid seen with a valid signature from the given builder for
169
- // the tuple `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
170
- // Entries are only added after signature verification, so known tuples can be dropped before
171
- // state regeneration and the other expensive validation steps.
172
- if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
141
+ // [IGNORE] The builder has not reached its bid limit, checked against the limit of its last valid bid.
142
+ // Bids for the same slot and parent root are validated against the same state, so bids past the
143
+ // limit can be dropped before state regeneration and the other expensive validation steps.
144
+ const seenBids = chain.seenExecutionPayloadBids.get(
145
+ bid.slot,
146
+ bid.builderIndex,
147
+ bidParentBlockHash,
148
+ bidParentBlockRoot
149
+ );
150
+ if (seenBids !== undefined && seenBids.count >= seenBids.limit) {
173
151
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
174
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
152
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
175
153
  builderIndex: bid.builderIndex,
176
154
  slot: bid.slot,
177
155
  parentBlockRoot: bidParentBlockRoot,
178
156
  parentBlockHash: bidParentBlockHash,
157
+ bidLimit: seenBids.limit,
158
+ });
159
+ }
160
+
161
+ // [IGNORE] this bid is the highest value bid seen for the tuple
162
+ // `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
163
+ const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, bidParentBlockHash, bidParentBlockRoot);
164
+ if (bestBid !== null && bid.value <= bestBid.signedBid.message.value) {
165
+ throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
166
+ code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
167
+ bidValue: bid.value,
168
+ currentHighestBid: bestBid.signedBid.message.value,
179
169
  });
180
170
  }
181
171
 
@@ -352,19 +342,24 @@ async function validateExecutionPayloadBid(
352
342
  });
353
343
  }
354
344
 
355
- // [IGNORE] this bid is the highest value bid seen for the tuple
356
- // `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
357
- // As a DoS prevention measure, the bid must also exceed the current highest bid by a minimum
358
- // increment, see https://github.com/ethereum/consensus-specs/pull/4831. This prevents spam
359
- // from builders submitting numerous bids with minimal value increments.
360
- const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, bidParentBlockHash, bidParentBlockRoot);
361
- if (bestBid !== null && bid.value < getMinBidValue(bestBid.signedBid.message.value)) {
345
+ // [IGNORE] The builder has not reached its bid limit for the tuple
346
+ // `(bid.slot, bid.parent_block_hash, bid.parent_block_root)` -- i.e. one bid per ETH of builder balance
347
+ // not owed in pending withdrawals, `get_builder_bid_limit(state, bid.builder_index)`.
348
+ const bidLimit = state.getBuilderBidLimit(bid.builderIndex);
349
+ if (
350
+ (chain.seenExecutionPayloadBids.get(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)?.count ??
351
+ 0) >= bidLimit
352
+ ) {
362
353
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
363
- code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
364
- bidValue: bid.value,
365
- currentHighestBid: bestBid.signedBid.message.value,
354
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
355
+ builderIndex: bid.builderIndex,
356
+ slot: bid.slot,
357
+ parentBlockRoot: bidParentBlockRoot,
358
+ parentBlockHash: bidParentBlockHash,
359
+ bidLimit,
366
360
  });
367
361
  }
362
+
368
363
  // [IGNORE] `bid.value` is less or equal than the builder's excess balance --
369
364
  // i.e. `can_builder_cover_bid(state, builder_index, amount)` returns `True`.
370
365
  if (!state.canBuilderCoverBid(bid.builderIndex, bid.value)) {
@@ -425,20 +420,24 @@ async function validateExecutionPayloadBid(
425
420
  });
426
421
  }
427
422
 
428
- // Repeat the seen check after the awaited signature verification to prevent concurrent bids
429
- // for the same builder and tuple from both passing validation.
430
- if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
423
+ // Repeat the bid limit check after the awaited signature verification to prevent concurrent bids
424
+ // for the same builder and tuple from all passing validation.
425
+ if (
426
+ (chain.seenExecutionPayloadBids.get(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)?.count ??
427
+ 0) >= bidLimit
428
+ ) {
431
429
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
432
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
430
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
433
431
  builderIndex: bid.builderIndex,
434
432
  slot: bid.slot,
435
433
  parentBlockRoot: bidParentBlockRoot,
436
434
  parentBlockHash: bidParentBlockHash,
435
+ bidLimit,
437
436
  });
438
437
  }
439
438
 
440
439
  // Valid
441
- chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot);
440
+ chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot, bidLimit);
442
441
 
443
442
  return {proposerIndex: proposerPreferences.message.validatorIndex};
444
443
  }
@@ -1,14 +1,21 @@
1
- import {PayloadStatus} from "@lodestar/fork-choice";
1
+ import {PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
2
2
  import {
3
3
  computeStartSlotAtEpoch,
4
+ computeTimeAtSlot,
4
5
  getExecutionPayloadEnvelopeSignatureSet,
5
6
  isStatePostGloas,
6
7
  } from "@lodestar/state-transition";
7
8
  import {gloas, ssz} from "@lodestar/types";
8
9
  import {byteArrayEquals, toRootHex} from "@lodestar/utils";
10
+ import {
11
+ getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized,
12
+ getSlotFromExecutionPayloadEnvelopeSerialized,
13
+ getTransactionCountFromExecutionPayloadEnvelopeSerialized,
14
+ } from "../../util/sszBytes.js";
9
15
  import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.js";
10
16
  import {IBeaconChain} from "../index.js";
11
17
  import {RegenCaller} from "../regen/index.js";
18
+ import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
12
19
 
13
20
  export async function validateApiExecutionPayloadEnvelope(
14
21
  chain: IBeaconChain,
@@ -24,6 +31,40 @@ export async function validateGossipExecutionPayloadEnvelope(
24
31
  return validateExecutionPayloadEnvelope(chain, executionPayloadEnvelope);
25
32
  }
26
33
 
34
+ /**
35
+ * Applies the transaction count check to the serialized envelope so that an oversized envelope is dropped
36
+ * before it is deserialized. Defers to validateGossipExecutionPayloadEnvelope if the data is malformed
37
+ * or the block is not known.
38
+ */
39
+ export function validateGossipExecutionPayloadEnvelopeSerialized(
40
+ chain: IBeaconChain,
41
+ serializedData: Uint8Array
42
+ ): void {
43
+ const blockRootHex = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(serializedData);
44
+ const slot = getSlotFromExecutionPayloadEnvelopeSerialized(serializedData);
45
+ const transactionCount = getTransactionCountFromExecutionPayloadEnvelopeSerialized(serializedData);
46
+ if (blockRootHex === null || slot === null || transactionCount === null) {
47
+ return;
48
+ }
49
+
50
+ const block = chain.forkChoice.getBlockHexDefaultStatus(blockRootHex);
51
+ const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockRootHex);
52
+ if (!block || !payloadInput) {
53
+ return;
54
+ }
55
+
56
+ const maxTransactionCount = getMaxTransactionCount(chain, block, payloadInput);
57
+ if (BigInt(transactionCount) > maxTransactionCount) {
58
+ throw new ExecutionPayloadEnvelopeError(GossipAction.IGNORE, {
59
+ code: ExecutionPayloadEnvelopeErrorCode.TOO_MANY_TRANSACTIONS,
60
+ slot,
61
+ root: blockRootHex,
62
+ transactionCount,
63
+ maxTransactionCount: Number(maxTransactionCount),
64
+ });
65
+ }
66
+ }
67
+
27
68
  async function validateExecutionPayloadEnvelope(
28
69
  chain: IBeaconChain,
29
70
  executionPayloadEnvelope: gloas.SignedExecutionPayloadEnvelope
@@ -89,6 +130,17 @@ async function validateExecutionPayloadEnvelope(
89
130
  });
90
131
  }
91
132
 
133
+ // [REJECT] `envelope.parent_beacon_block_root == block.parent_root`
134
+ if (toRootHex(envelope.parentBeaconBlockRoot) !== block.parentRoot) {
135
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
136
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_BEACON_BLOCK_ROOT_MISMATCH,
137
+ slot: payload.slotNumber,
138
+ root: blockRootHex,
139
+ envelopeParentBeaconBlockRoot: toRootHex(envelope.parentBeaconBlockRoot),
140
+ blockParentRoot: block.parentRoot,
141
+ });
142
+ }
143
+
92
144
  // [REJECT] `envelope.builder_index == bid.builder_index`
93
145
  if (envelope.builderIndex !== payloadInput.getBuilderIndex()) {
94
146
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
@@ -100,6 +152,30 @@ async function validateExecutionPayloadEnvelope(
100
152
  });
101
153
  }
102
154
 
155
+ const bid = payloadInput.getBid();
156
+
157
+ // [REJECT] `payload.prev_randao == bid.prev_randao`
158
+ if (!byteArrayEquals(payload.prevRandao, bid.prevRandao)) {
159
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
160
+ code: ExecutionPayloadEnvelopeErrorCode.PREV_RANDAO_MISMATCH,
161
+ slot: payload.slotNumber,
162
+ root: blockRootHex,
163
+ envelopePrevRandao: toRootHex(payload.prevRandao),
164
+ bidPrevRandao: toRootHex(bid.prevRandao),
165
+ });
166
+ }
167
+
168
+ // [REJECT] `payload.gas_limit == bid.gas_limit`
169
+ if (BigInt(payload.gasLimit) !== bid.gasLimit) {
170
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
171
+ code: ExecutionPayloadEnvelopeErrorCode.GAS_LIMIT_MISMATCH,
172
+ slot: payload.slotNumber,
173
+ root: blockRootHex,
174
+ envelopeGasLimit: payload.gasLimit,
175
+ bidGasLimit: bid.gasLimit,
176
+ });
177
+ }
178
+
103
179
  // [REJECT] `payload.block_hash == bid.block_hash`
104
180
  if (toRootHex(payload.blockHash) !== payloadInput.getBlockHashHex()) {
105
181
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
@@ -113,17 +189,31 @@ async function validateExecutionPayloadEnvelope(
113
189
 
114
190
  // [REJECT] `hash_tree_root(envelope.execution_requests) == bid.execution_requests_root`
115
191
  const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
116
- if (!byteArrayEquals(requestsRoot, payloadInput.getBid().executionRequestsRoot)) {
192
+ if (!byteArrayEquals(requestsRoot, bid.executionRequestsRoot)) {
117
193
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
118
194
  code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH,
119
195
  slot: payload.slotNumber,
120
196
  root: blockRootHex,
121
197
  envelopeRequestsRoot: toRootHex(requestsRoot),
122
- bidRequestsRoot: toRootHex(payloadInput.getBid().executionRequestsRoot),
198
+ bidRequestsRoot: toRootHex(bid.executionRequestsRoot),
199
+ });
200
+ }
201
+
202
+ // [IGNORE] The number of transactions is within the limit implied by the parent payload's gas limit
203
+ // TODO GLOAS: [REJECT] once https://github.com/ethereum/consensus-specs/pull/5802 is released,
204
+ // also in validateGossipExecutionPayloadEnvelopeSerialized
205
+ const maxTransactionCount = getMaxTransactionCount(chain, block, payloadInput);
206
+ if (BigInt(payload.transactions.length) > maxTransactionCount) {
207
+ throw new ExecutionPayloadEnvelopeError(GossipAction.IGNORE, {
208
+ code: ExecutionPayloadEnvelopeErrorCode.TOO_MANY_TRANSACTIONS,
209
+ slot: payload.slotNumber,
210
+ root: blockRootHex,
211
+ transactionCount: payload.transactions.length,
212
+ maxTransactionCount: Number(maxTransactionCount),
123
213
  });
124
214
  }
125
215
 
126
- // Get the block state to verify the builder's signature.
216
+ // Get the block state to verify the payload against it and the builder's signature.
127
217
  const blockState = await chain.regen
128
218
  .getState(block.stateRoot, RegenCaller.validateGossipPayloadEnvelope)
129
219
  .catch(() => {
@@ -137,6 +227,54 @@ async function validateExecutionPayloadEnvelope(
137
227
  throw new Error(`Expected gloas+ state for execution payload envelope validation, got fork=${blockState.forkName}`);
138
228
  }
139
229
 
230
+ // [REJECT] `payload.parent_hash == state.latest_block_hash`
231
+ if (!byteArrayEquals(payload.parentHash, blockState.latestBlockHash)) {
232
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
233
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_HASH_MISMATCH,
234
+ slot: payload.slotNumber,
235
+ root: blockRootHex,
236
+ envelopeParentHash: toRootHex(payload.parentHash),
237
+ latestBlockHash: toRootHex(blockState.latestBlockHash),
238
+ });
239
+ }
240
+
241
+ // [REJECT] `payload.timestamp == compute_time_at_slot(state.genesis_time, block.slot)`
242
+ const expectedTimestamp = computeTimeAtSlot(chain.config, block.slot, blockState.genesisTime);
243
+ if (payload.timestamp !== expectedTimestamp) {
244
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
245
+ code: ExecutionPayloadEnvelopeErrorCode.INCORRECT_TIMESTAMP,
246
+ slot: payload.slotNumber,
247
+ root: blockRootHex,
248
+ envelopeTimestamp: payload.timestamp,
249
+ expectedTimestamp,
250
+ });
251
+ }
252
+
253
+ // [REJECT] The payload contains no empty transactions
254
+ for (let i = 0; i < payload.transactions.length; i++) {
255
+ if (payload.transactions.getSize(i) === 0) {
256
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
257
+ code: ExecutionPayloadEnvelopeErrorCode.EMPTY_TRANSACTION,
258
+ slot: payload.slotNumber,
259
+ root: blockRootHex,
260
+ transactionIndex: i,
261
+ });
262
+ }
263
+ }
264
+
265
+ // [REJECT] `hash_tree_root(payload.withdrawals) == hash_tree_root(state.payload_expected_withdrawals)`
266
+ const withdrawalsRoot = ssz.gloas.Withdrawals.hashTreeRoot(payload.withdrawals);
267
+ const expectedWithdrawalsRoot = ssz.gloas.Withdrawals.hashTreeRoot(blockState.payloadExpectedWithdrawals);
268
+ if (!byteArrayEquals(withdrawalsRoot, expectedWithdrawalsRoot)) {
269
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
270
+ code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_MISMATCH,
271
+ slot: payload.slotNumber,
272
+ root: blockRootHex,
273
+ envelopeWithdrawalsRoot: toRootHex(withdrawalsRoot),
274
+ expectedWithdrawalsRoot: toRootHex(expectedWithdrawalsRoot),
275
+ });
276
+ }
277
+
140
278
  // [REJECT] `signed_execution_payload_envelope.signature` is valid as verified
141
279
  // by `verify_execution_payload_envelope_signature`.
142
280
  const signatureSet = getExecutionPayloadEnvelopeSignatureSet(
@@ -154,3 +292,16 @@ async function validateExecutionPayloadEnvelope(
154
292
  });
155
293
  }
156
294
  }
295
+
296
+ /**
297
+ * The bid's gas limit is only tied to the parent payload by bid gossip, so the bound is the gas limit the
298
+ * EIP-1559 rule allows on top of the parent payload's. The bid is the only bound if that gas limit is unknown.
299
+ */
300
+ function getMaxTransactionCount(chain: IBeaconChain, block: ProtoBlock, payloadInput: PayloadEnvelopeInput): bigint {
301
+ const parentGasLimit = block.executionPayloadBlockHash === null ? 0n : BigInt(block.executionPayloadGasLimit);
302
+ const maxGasLimit =
303
+ parentGasLimit === 0n
304
+ ? payloadInput.getBid().gasLimit
305
+ : parentGasLimit + (parentGasLimit / 1024n > 1n ? parentGasLimit / 1024n : 1n) - 1n;
306
+ return maxGasLimit / BigInt(chain.config.MIN_TRANSACTION_GAS);
307
+ }
@@ -131,6 +131,16 @@ async function validatePayloadAttestationMessage(
131
131
  });
132
132
  }
133
133
 
134
+ // Re-check after the await: concurrent messages from the same validator all pass the check above
135
+ if (chain.seenPayloadAttesters.isKnown(data.slot, validatorIndex)) {
136
+ throw new PayloadAttestationError(GossipAction.IGNORE, {
137
+ code: PayloadAttestationErrorCode.PAYLOAD_ATTESTATION_ALREADY_KNOWN,
138
+ validatorIndex,
139
+ slot: data.slot,
140
+ blockRoot: toRootHex(data.beaconBlockRoot),
141
+ });
142
+ }
143
+
134
144
  // Valid
135
145
  chain.seenPayloadAttesters.add(data.slot, validatorIndex);
136
146
 
@@ -1,7 +1,8 @@
1
1
  import {SYNC_COMMITTEE_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params";
2
2
  import {IBeaconStateView, isStatePostAltair} from "@lodestar/state-transition";
3
- import {SubnetID, altair} from "@lodestar/types";
3
+ import {RootHex, Slot, SubnetID, ValidatorIndex, altair} from "@lodestar/types";
4
4
  import {toRootHex} from "@lodestar/utils";
5
+ import {Metrics} from "../../metrics/metrics.js";
5
6
  import {GossipAction, SyncCommitteeError, SyncCommitteeErrorCode} from "../errors/index.js";
6
7
  import {IBeaconChain} from "../interface.js";
7
8
  import {getSyncCommitteeSignatureSet} from "./signatureSets/index.js";
@@ -32,6 +33,33 @@ export async function validateGossipSyncCommittee(
32
33
 
33
34
  // [IGNORE] There has been no other valid sync committee signature for the declared slot for the validator referenced
34
35
  // by sync_committee_signature.validator_index.
36
+ assertSyncCommitteeMessageNotKnown(chain, slot, subnet, validatorIndex, messageRoot, chain.metrics);
37
+
38
+ // [REJECT] The subnet_id is valid for the given validator, i.e. subnet_id in compute_subnets_for_sync_committee(state, sync_committee_signature.validator_index).
39
+ // Note this validation implies the validator is part of the broader current sync committee along with the correct subcommittee.
40
+ // > Checked in validateGossipSyncCommitteeExceptSig()
41
+
42
+ // [REJECT] The signature is valid for the message beacon_block_root for the validator referenced by validator_index.
43
+ await validateSyncCommitteeSigOnly(chain, headState, syncCommittee);
44
+
45
+ // Re-check after the await: concurrent messages from the same validator all pass the check above.
46
+ // Metrics were already counted by the first check.
47
+ assertSyncCommitteeMessageNotKnown(chain, slot, subnet, validatorIndex, messageRoot, null);
48
+
49
+ // Register this valid item as seen
50
+ chain.seenSyncCommitteeMessages.add(slot, subnet, validatorIndex, messageRoot);
51
+
52
+ return {indicesInSubcommittee};
53
+ }
54
+
55
+ function assertSyncCommitteeMessageNotKnown(
56
+ chain: IBeaconChain,
57
+ slot: Slot,
58
+ subnet: SubnetID,
59
+ validatorIndex: ValidatorIndex,
60
+ messageRoot: RootHex,
61
+ metrics: Metrics | null
62
+ ): void {
35
63
  const prevRoot = chain.seenSyncCommitteeMessages.get(slot, subnet, validatorIndex);
36
64
  if (prevRoot) {
37
65
  let shouldIgnore = false;
@@ -39,9 +67,9 @@ export async function validateGossipSyncCommittee(
39
67
  shouldIgnore = true;
40
68
  } else {
41
69
  const headRoot = chain.forkChoice.getHeadRoot();
42
- chain.metrics?.gossipSyncCommittee.equivocationCount.inc();
70
+ metrics?.gossipSyncCommittee.equivocationCount.inc();
43
71
  if (messageRoot === headRoot) {
44
- chain.metrics?.gossipSyncCommittee.equivocationToHeadCount.inc();
72
+ metrics?.gossipSyncCommittee.equivocationToHeadCount.inc();
45
73
  } else {
46
74
  shouldIgnore = true;
47
75
  }
@@ -57,18 +85,6 @@ export async function validateGossipSyncCommittee(
57
85
  });
58
86
  }
59
87
  }
60
-
61
- // [REJECT] The subnet_id is valid for the given validator, i.e. subnet_id in compute_subnets_for_sync_committee(state, sync_committee_signature.validator_index).
62
- // Note this validation implies the validator is part of the broader current sync committee along with the correct subcommittee.
63
- // > Checked in validateGossipSyncCommitteeExceptSig()
64
-
65
- // [REJECT] The signature is valid for the message beacon_block_root for the validator referenced by validator_index.
66
- await validateSyncCommitteeSigOnly(chain, headState, syncCommittee);
67
-
68
- // Register this valid item as seen
69
- chain.seenSyncCommitteeMessages.add(slot, subnet, validatorIndex, messageRoot);
70
-
71
- return {indicesInSubcommittee};
72
88
  }
73
89
 
74
90
  export async function validateApiSyncCommittee(
@@ -92,6 +92,19 @@ export async function validateSyncCommitteeGossipContributionAndProof(
92
92
  });
93
93
  }
94
94
 
95
+ // Re-check after the await: concurrent contributions from the same aggregator all pass the checks above
96
+ if (chain.seenContributionAndProof.isAggregatorKnown(slot, subcommitteeIndex, aggregatorIndex)) {
97
+ throw new SyncCommitteeError(GossipAction.IGNORE, {
98
+ code: SyncCommitteeErrorCode.SYNC_COMMITTEE_AGGREGATOR_ALREADY_KNOWN,
99
+ });
100
+ }
101
+
102
+ if (!skipValidationKnownParticipants && chain.seenContributionAndProof.participantsKnown(contribution)) {
103
+ throw new SyncCommitteeError(GossipAction.IGNORE, {
104
+ code: SyncCommitteeErrorCode.SYNC_COMMITTEE_PARTICIPANTS_ALREADY_KNOWN,
105
+ });
106
+ }
107
+
95
108
  // no need to add to seenSyncCommittteeContributionCache here, gossip handler will do that
96
109
  chain.seenContributionAndProof.add(contributionAndProof, syncCommitteeParticipantIndices.length);
97
110
 
@@ -21,7 +21,6 @@ import {
21
21
  SubnetID,
22
22
  ValidatorIndex,
23
23
  altair,
24
- deneb,
25
24
  gloas,
26
25
  } from "@lodestar/types";
27
26
  import {
@@ -70,7 +69,6 @@ export type ValidatorMonitor = {
70
69
  balances?: number[]
71
70
  ): void;
72
71
  registerBeaconBlock(src: OpSource, delaySec: Seconds, block: BeaconBlock): void;
73
- registerBlobSidecar(src: OpSource, seenTimestampSec: Seconds, blob: deneb.BlobSidecar): void;
74
72
  registerExecutionPayloadEnvelope(
75
73
  src: OpSource,
76
74
  delaySec: Seconds,
@@ -434,10 +432,6 @@ export function createValidatorMonitor(
434
432
  }
435
433
  },
436
434
 
437
- registerBlobSidecar(_src, _seenTimestampSec, _blob) {
438
- //TODO: freetheblobs
439
- },
440
-
441
435
  registerExecutionPayloadEnvelope(_src, _delaySec, _envelope) {
442
436
  // TODO GLOAS: implement execution payload envelope monitoring
443
437
  },
@@ -22,7 +22,8 @@ export interface IDataColumnStore {
22
22
  getManyBinary(key: DataColumnKey, indices: ColumnIndex[]): Promise<(Uint8Array | undefined)[]>;
23
23
  putManyBinary(key: DataColumnKey, columns: IndexedDataColumnBytes[]): Promise<void>;
24
24
  deleteMany(keys: DataColumnKey[]): Promise<void>;
25
- pruneBefore(slot: Slot): Promise<Slot[]>;
25
+ /** Prunes the oldest slots before `slot`, at most `maxSlots` of them per backing store. Returns the pruned slots. */
26
+ pruneBefore(slot: Slot, maxSlots?: number): Promise<Slot[]>;
26
27
  }
27
28
 
28
29
  /**
@@ -84,9 +85,9 @@ export class LegacyDataColumnStore implements IDataColumnStore {
84
85
  await this.legacyHot.deleteMany(keys.map(({blockRoot}) => fromHex(blockRoot)));
85
86
  }
86
87
 
87
- async pruneBefore(slot: Slot): Promise<Slot[]> {
88
- const flatFileSlots = await this.flatFiles.pruneBefore(slot);
89
- const slots = await this.legacyArchive.pruneBefore(slot);
88
+ async pruneBefore(slot: Slot, maxSlots?: number): Promise<Slot[]> {
89
+ const flatFileSlots = await this.flatFiles.pruneBefore(slot, maxSlots);
90
+ const slots = await this.legacyArchive.pruneBefore(slot, maxSlots);
90
91
  return [...new Set([...flatFileSlots, ...slots])].sort((a, b) => a - b);
91
92
  }
92
93
  }
@@ -1,4 +1,4 @@
1
- import fs from "node:fs";
1
+ import {type FileHandle, open, readFile, rm} from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import {ChainForkConfig} from "@lodestar/config";
4
4
  import {ForkPostFulu} from "@lodestar/params";
@@ -161,25 +161,26 @@ export class FlatFileStore implements IFlatFileStore {
161
161
  }
162
162
  }
163
163
 
164
- async pruneBefore(minSlot: Slot): Promise<Slot[]> {
164
+ async pruneBefore(minSlot: Slot, maxSlots = Infinity): Promise<Slot[]> {
165
165
  return observeFlatFileStoreOperation(this.metrics, FlatFileStoreOperation.prune, async () => {
166
166
  this.minRetainedSlot = Math.max(this.minRetainedSlot, minSlot);
167
- const slotsToPrune = new Set(this.slotIndex.getBefore(this.minRetainedSlot));
167
+ const expiredSlots = new Set(this.slotIndex.getBefore(this.minRetainedSlot));
168
168
  for (const slot of this.mutationLocks.keys()) {
169
- if (slot < this.minRetainedSlot) slotsToPrune.add(slot);
169
+ if (slot < this.minRetainedSlot) expiredSlots.add(slot);
170
170
  }
171
+ const slotsToPrune = [...expiredSlots].sort((a, b) => a - b).slice(0, maxSlots);
171
172
 
172
173
  for (const slot of slotsToPrune) {
173
174
  const release = await this.acquireMutationLock(slot);
174
175
  try {
175
- await fs.promises.rm(path.join(this.dataColumnDir, padSlot(slot)), {recursive: true, force: true});
176
+ await rm(path.join(this.dataColumnDir, padSlot(slot)), {recursive: true, force: true});
176
177
  this.slotIndex.remove(slot);
177
178
  this.metrics?.prunedDirectories.inc();
178
179
  } finally {
179
180
  release();
180
181
  }
181
182
  }
182
- return [...slotsToPrune].sort((a, b) => a - b);
183
+ return slotsToPrune;
183
184
  });
184
185
  }
185
186
 
@@ -212,7 +213,7 @@ export class FlatFileStore implements IFlatFileStore {
212
213
 
213
214
  private async readFile(slot: Slot, rootHex: RootHex): Promise<Uint8Array | null> {
214
215
  try {
215
- return await fs.promises.readFile(this.filePath(slot, rootHex));
216
+ return await readFile(this.filePath(slot, rootHex));
216
217
  } catch (e) {
217
218
  if (!isFsNotFoundError(e)) throw e;
218
219
  return null;
@@ -224,9 +225,9 @@ export class FlatFileStore implements IFlatFileStore {
224
225
  rootHex: RootHex,
225
226
  indices: number[]
226
227
  ): Promise<(Uint8Array | undefined)[] | null> {
227
- let fd: fs.promises.FileHandle;
228
+ let fd: FileHandle;
228
229
  try {
229
- fd = await fs.promises.open(this.filePath(slot, rootHex), "r");
230
+ fd = await open(this.filePath(slot, rootHex), "r");
230
231
  } catch (e) {
231
232
  if (!isFsNotFoundError(e)) throw e;
232
233
  return null;
@@ -270,7 +271,7 @@ export class FlatFileStore implements IFlatFileStore {
270
271
  await observeFlatFileStoreOperation(this.metrics, FlatFileStoreOperation.delete, async () => {
271
272
  const release = await this.acquireMutationLock(slot);
272
273
  try {
273
- await fs.promises.rm(this.filePath(slot, rootHex), {force: true});
274
+ await rm(this.filePath(slot, rootHex), {force: true});
274
275
  } finally {
275
276
  release();
276
277
  }
@@ -294,7 +295,7 @@ function validateDcolHeader(header: DcolHeader, slot: Slot, rootHex: RootHex): v
294
295
  }
295
296
  }
296
297
 
297
- async function readExactly(fd: fs.promises.FileHandle, buffer: Uint8Array, position: number): Promise<void> {
298
+ async function readExactly(fd: FileHandle, buffer: Uint8Array, position: number): Promise<void> {
298
299
  let totalRead = 0;
299
300
  while (totalRead < buffer.length) {
300
301
  const {bytesRead} = await fd.read(buffer, totalRead, buffer.length - totalRead, position + totalRead);
@@ -17,5 +17,6 @@ export interface IFlatFileStore {
17
17
  putDataColumnsBinary(slot: Slot, blockRoot: RootHex, columns: {index: number; data: Uint8Array}[]): Promise<void>;
18
18
 
19
19
  deleteMany(items: {slot: Slot; blockRoot: RootHex}[]): Promise<void>;
20
- pruneBefore(slot: Slot): Promise<Slot[]>;
20
+ /** Prunes the oldest slots before `slot`, at most `maxSlots` of them. Returns the pruned slots. */
21
+ pruneBefore(slot: Slot, maxSlots?: number): Promise<Slot[]>;
21
22
  }
@@ -1,4 +1,5 @@
1
- import fs from "node:fs";
1
+ import type {Dirent} from "node:fs";
2
+ import {readdir} from "node:fs/promises";
2
3
  import {Slot} from "@lodestar/types";
3
4
  import {isFsNotFoundError} from "./errors.js";
4
5
  import {padSlot} from "./path.js";
@@ -33,9 +34,9 @@ export class SlotIndex {
33
34
 
34
35
  async rebuildFromDisk(columnsDir: string): Promise<SlotIndexRebuildStats> {
35
36
  this.slots.clear();
36
- let entries: fs.Dirent[];
37
+ let entries: Dirent[];
37
38
  try {
38
- entries = await fs.promises.readdir(columnsDir, {withFileTypes: true});
39
+ entries = await readdir(columnsDir, {withFileTypes: true});
39
40
  } catch (e) {
40
41
  if (!isFsNotFoundError(e)) throw e;
41
42
  return {slots: 0, ignoredEntries: 0};
@@ -14,7 +14,6 @@ export const blobSidecarsWrapperSsz = new ContainerType(
14
14
  );
15
15
 
16
16
  export type BlobSidecarsWrapper = ValueOf<typeof blobSidecarsWrapperSsz>;
17
- export const BLOB_SIDECARS_IN_WRAPPER_INDEX = 44;
18
17
 
19
18
  /**
20
19
  * blobSidecarsWrapper by block root (= hash_tree_root(SignedBeaconBlock.message))