@lodestar/beacon-node 1.51.0-dev.f8eff664d2 → 1.51.0-dev.f921fbf6b7

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 (632) 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/executionPayloadBid.d.ts +0 -15
  207. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  208. package/lib/chain/validation/executionPayloadBid.js +37 -158
  209. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  210. package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
  211. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  212. package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
  213. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  214. package/lib/chain/validation/inclusionList.d.ts +14 -0
  215. package/lib/chain/validation/inclusionList.d.ts.map +1 -0
  216. package/lib/chain/validation/inclusionList.js +150 -0
  217. package/lib/chain/validation/inclusionList.js.map +1 -0
  218. package/lib/chain/validation/index.d.ts +1 -0
  219. package/lib/chain/validation/index.d.ts.map +1 -1
  220. package/lib/chain/validation/index.js +1 -0
  221. package/lib/chain/validation/index.js.map +1 -1
  222. package/lib/chain/validatorMonitor.d.ts +1 -2
  223. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  224. package/lib/chain/validatorMonitor.js +0 -3
  225. package/lib/chain/validatorMonitor.js.map +1 -1
  226. package/lib/db/beacon.d.ts +7 -0
  227. package/lib/db/beacon.d.ts.map +1 -1
  228. package/lib/db/beacon.js +34 -0
  229. package/lib/db/beacon.js.map +1 -1
  230. package/lib/db/dataColumnStore.d.ts +1 -1
  231. package/lib/db/dataColumnStore.d.ts.map +1 -1
  232. package/lib/db/dataColumnStore.js +1 -4
  233. package/lib/db/dataColumnStore.js.map +1 -1
  234. package/lib/db/flatFileStore/flatFileStore.js +5 -5
  235. package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
  236. package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
  237. package/lib/db/flatFileStore/slotIndex.js +2 -2
  238. package/lib/db/flatFileStore/slotIndex.js.map +1 -1
  239. package/lib/db/interface.d.ts +1 -0
  240. package/lib/db/interface.d.ts.map +1 -1
  241. package/lib/db/repositories/blobSidecars.d.ts +0 -1
  242. package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
  243. package/lib/db/repositories/blobSidecars.js +0 -1
  244. package/lib/db/repositories/blobSidecars.js.map +1 -1
  245. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +6 -0
  246. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  247. package/lib/db/repositories/dataColumnSidecarArchive.js +19 -0
  248. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  249. package/lib/execution/builder/apiClient.d.ts +14 -8
  250. package/lib/execution/builder/apiClient.d.ts.map +1 -1
  251. package/lib/execution/builder/apiClient.js +12 -10
  252. package/lib/execution/builder/apiClient.js.map +1 -1
  253. package/lib/execution/builder/http.d.ts +2 -0
  254. package/lib/execution/builder/http.d.ts.map +1 -1
  255. package/lib/execution/builder/http.js +2 -0
  256. package/lib/execution/builder/http.js.map +1 -1
  257. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  258. package/lib/execution/builder/validateBid.js +14 -1
  259. package/lib/execution/builder/validateBid.js.map +1 -1
  260. package/lib/execution/engine/blobVersionedHashes.d.ts +1 -1
  261. package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -1
  262. package/lib/execution/engine/blobVersionedHashes.js.map +1 -1
  263. package/lib/execution/engine/disabled.d.ts +1 -0
  264. package/lib/execution/engine/disabled.d.ts.map +1 -1
  265. package/lib/execution/engine/disabled.js +3 -0
  266. package/lib/execution/engine/disabled.js.map +1 -1
  267. package/lib/execution/engine/http.d.ts +12 -8
  268. package/lib/execution/engine/http.d.ts.map +1 -1
  269. package/lib/execution/engine/http.js +35 -14
  270. package/lib/execution/engine/http.js.map +1 -1
  271. package/lib/execution/engine/index.d.ts +1 -1
  272. package/lib/execution/engine/index.d.ts.map +1 -1
  273. package/lib/execution/engine/index.js +1 -1
  274. package/lib/execution/engine/index.js.map +1 -1
  275. package/lib/execution/engine/interface.d.ts +29 -8
  276. package/lib/execution/engine/interface.d.ts.map +1 -1
  277. package/lib/execution/engine/interface.js.map +1 -1
  278. package/lib/execution/engine/jsonRpcTransport.d.ts +5 -6
  279. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  280. package/lib/execution/engine/jsonRpcTransport.js +34 -20
  281. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  282. package/lib/execution/engine/mock.d.ts +1 -1
  283. package/lib/execution/engine/mock.d.ts.map +1 -1
  284. package/lib/execution/engine/mock.js +31 -11
  285. package/lib/execution/engine/mock.js.map +1 -1
  286. package/lib/execution/engine/payloadIdCache.d.ts +5 -3
  287. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  288. package/lib/execution/engine/payloadIdCache.js +15 -4
  289. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  290. package/lib/execution/engine/restTransport.d.ts +4 -5
  291. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  292. package/lib/execution/engine/restTransport.js +4 -15
  293. package/lib/execution/engine/restTransport.js.map +1 -1
  294. package/lib/execution/engine/sszTypes.d.ts +38 -47
  295. package/lib/execution/engine/sszTypes.d.ts.map +1 -1
  296. package/lib/execution/engine/sszTypes.js +0 -5
  297. package/lib/execution/engine/sszTypes.js.map +1 -1
  298. package/lib/execution/engine/transport.d.ts +4 -14
  299. package/lib/execution/engine/transport.d.ts.map +1 -1
  300. package/lib/execution/engine/types.d.ts +25 -9
  301. package/lib/execution/engine/types.d.ts.map +1 -1
  302. package/lib/execution/engine/types.js +19 -14
  303. package/lib/execution/engine/types.js.map +1 -1
  304. package/lib/execution/engine/utils.d.ts.map +1 -1
  305. package/lib/execution/engine/utils.js +3 -2
  306. package/lib/execution/engine/utils.js.map +1 -1
  307. package/lib/index.d.ts +1 -0
  308. package/lib/index.d.ts.map +1 -1
  309. package/lib/index.js +2 -0
  310. package/lib/index.js.map +1 -1
  311. package/lib/metrics/metrics/beacon.d.ts +16 -9
  312. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  313. package/lib/metrics/metrics/beacon.js +35 -30
  314. package/lib/metrics/metrics/beacon.js.map +1 -1
  315. package/lib/metrics/metrics/lodestar.d.ts +42 -8
  316. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  317. package/lib/metrics/metrics/lodestar.js +104 -18
  318. package/lib/metrics/metrics/lodestar.js.map +1 -1
  319. package/lib/metrics/server/http.js +5 -5
  320. package/lib/metrics/server/http.js.map +1 -1
  321. package/lib/monitoring/service.js +1 -1
  322. package/lib/monitoring/service.js.map +1 -1
  323. package/lib/network/core/networkCore.d.ts +4 -1
  324. package/lib/network/core/networkCore.d.ts.map +1 -1
  325. package/lib/network/core/networkCore.js +7 -0
  326. package/lib/network/core/networkCore.js.map +1 -1
  327. package/lib/network/core/networkCoreWorker.js +2 -0
  328. package/lib/network/core/networkCoreWorker.js.map +1 -1
  329. package/lib/network/core/networkCoreWorkerHandler.d.ts +4 -1
  330. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  331. package/lib/network/core/networkCoreWorkerHandler.js +6 -0
  332. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  333. package/lib/network/core/types.d.ts +6 -1
  334. package/lib/network/core/types.d.ts.map +1 -1
  335. package/lib/network/gossip/gossipsub.d.ts +1 -0
  336. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  337. package/lib/network/gossip/gossipsub.js +10 -0
  338. package/lib/network/gossip/gossipsub.js.map +1 -1
  339. package/lib/network/gossip/interface.d.ts +8 -9
  340. package/lib/network/gossip/interface.d.ts.map +1 -1
  341. package/lib/network/gossip/interface.js +1 -1
  342. package/lib/network/gossip/interface.js.map +1 -1
  343. package/lib/network/gossip/topic.d.ts +13 -21
  344. package/lib/network/gossip/topic.d.ts.map +1 -1
  345. package/lib/network/gossip/topic.js +13 -24
  346. package/lib/network/gossip/topic.js.map +1 -1
  347. package/lib/network/interface.d.ts +5 -5
  348. package/lib/network/interface.d.ts.map +1 -1
  349. package/lib/network/libp2p/index.d.ts.map +1 -1
  350. package/lib/network/libp2p/index.js +5 -1
  351. package/lib/network/libp2p/index.js.map +1 -1
  352. package/lib/network/network.d.ts +9 -7
  353. package/lib/network/network.d.ts.map +1 -1
  354. package/lib/network/network.js +58 -35
  355. package/lib/network/network.js.map +1 -1
  356. package/lib/network/options.d.ts +2 -0
  357. package/lib/network/options.d.ts.map +1 -1
  358. package/lib/network/options.js +2 -0
  359. package/lib/network/options.js.map +1 -1
  360. package/lib/network/peers/peerManager.d.ts +2 -1
  361. package/lib/network/peers/peerManager.d.ts.map +1 -1
  362. package/lib/network/peers/peerManager.js +28 -1
  363. package/lib/network/peers/peerManager.js.map +1 -1
  364. package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
  365. package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
  366. package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
  367. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  368. package/lib/network/peers/utils/enrSubnetsDeserialize.d.ts.map +1 -1
  369. package/lib/network/peers/utils/enrSubnetsDeserialize.js +5 -2
  370. package/lib/network/peers/utils/enrSubnetsDeserialize.js.map +1 -1
  371. package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
  372. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  373. package/lib/network/peers/utils/prioritizePeers.js +8 -16
  374. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  375. package/lib/network/peers/utils/subnetMap.d.ts +5 -2
  376. package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
  377. package/lib/network/peers/utils/subnetMap.js +6 -3
  378. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  379. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  380. package/lib/network/processor/extractSlotRootFns.js +1 -8
  381. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  382. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  383. package/lib/network/processor/gossipHandlers.js +118 -149
  384. package/lib/network/processor/gossipHandlers.js.map +1 -1
  385. package/lib/network/processor/gossipQueues/index.js +6 -6
  386. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  387. package/lib/network/processor/gossipValidatorFn.js +5 -5
  388. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  389. package/lib/network/processor/index.d.ts +11 -0
  390. package/lib/network/processor/index.d.ts.map +1 -1
  391. package/lib/network/processor/index.js +66 -30
  392. package/lib/network/processor/index.js.map +1 -1
  393. package/lib/network/reqresp/ReqRespBeaconNode.js +6 -3
  394. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  395. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
  396. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  397. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +10 -0
  398. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +1 -0
  399. package/lib/network/reqresp/handlers/inclusionListsByIndices.js +30 -0
  400. package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +1 -0
  401. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  402. package/lib/network/reqresp/handlers/index.js +6 -12
  403. package/lib/network/reqresp/handlers/index.js.map +1 -1
  404. package/lib/network/reqresp/protocols.d.ts +1 -2
  405. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  406. package/lib/network/reqresp/protocols.js +5 -10
  407. package/lib/network/reqresp/protocols.js.map +1 -1
  408. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  409. package/lib/network/reqresp/rateLimit.js +5 -17
  410. package/lib/network/reqresp/rateLimit.js.map +1 -1
  411. package/lib/network/reqresp/types.d.ts +6 -9
  412. package/lib/network/reqresp/types.d.ts.map +1 -1
  413. package/lib/network/reqresp/types.js +4 -7
  414. package/lib/network/reqresp/types.js.map +1 -1
  415. package/lib/network/subnets/attnetsService.d.ts +35 -5
  416. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  417. package/lib/network/subnets/attnetsService.js +84 -6
  418. package/lib/network/subnets/attnetsService.js.map +1 -1
  419. package/lib/network/subnets/interface.d.ts +7 -0
  420. package/lib/network/subnets/interface.d.ts.map +1 -1
  421. package/lib/network/subnets/interface.js.map +1 -1
  422. package/lib/node/nodejs.d.ts +3 -1
  423. package/lib/node/nodejs.d.ts.map +1 -1
  424. package/lib/node/nodejs.js +47 -21
  425. package/lib/node/nodejs.js.map +1 -1
  426. package/lib/node/options.d.ts +3 -1
  427. package/lib/node/options.d.ts.map +1 -1
  428. package/lib/node/options.js +4 -2
  429. package/lib/node/options.js.map +1 -1
  430. package/lib/sync/interface.d.ts.map +1 -1
  431. package/lib/sync/interface.js.map +1 -1
  432. package/lib/sync/range/batch.d.ts +2 -3
  433. package/lib/sync/range/batch.d.ts.map +1 -1
  434. package/lib/sync/range/batch.js +9 -22
  435. package/lib/sync/range/batch.js.map +1 -1
  436. package/lib/sync/range/chain.d.ts.map +1 -1
  437. package/lib/sync/range/chain.js +2 -15
  438. package/lib/sync/range/chain.js.map +1 -1
  439. package/lib/sync/sync.d.ts +7 -0
  440. package/lib/sync/sync.d.ts.map +1 -1
  441. package/lib/sync/sync.js +61 -3
  442. package/lib/sync/sync.js.map +1 -1
  443. package/lib/sync/unknownBlock.d.ts.map +1 -1
  444. package/lib/sync/unknownBlock.js +43 -25
  445. package/lib/sync/unknownBlock.js.map +1 -1
  446. package/lib/sync/utils/downloadByRange.d.ts +6 -34
  447. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  448. package/lib/sync/utils/downloadByRange.js +24 -128
  449. package/lib/sync/utils/downloadByRange.js.map +1 -1
  450. package/lib/sync/utils/downloadByRoot.d.ts +2 -18
  451. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  452. package/lib/sync/utils/downloadByRoot.js +14 -99
  453. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  454. package/lib/util/blobs.d.ts +1 -7
  455. package/lib/util/blobs.d.ts.map +1 -1
  456. package/lib/util/blobs.js +0 -19
  457. package/lib/util/blobs.js.map +1 -1
  458. package/lib/util/execution.d.ts +3 -4
  459. package/lib/util/execution.d.ts.map +1 -1
  460. package/lib/util/execution.js +1 -73
  461. package/lib/util/execution.js.map +1 -1
  462. package/lib/util/file.d.ts.map +1 -1
  463. package/lib/util/file.js +8 -9
  464. package/lib/util/file.js.map +1 -1
  465. package/lib/util/queue/itemQueue.js +1 -1
  466. package/lib/util/queue/itemQueue.js.map +1 -1
  467. package/lib/util/sszBytes.d.ts +5 -1
  468. package/lib/util/sszBytes.d.ts.map +1 -1
  469. package/lib/util/sszBytes.js +36 -19
  470. package/lib/util/sszBytes.js.map +1 -1
  471. package/lib/util/types.d.ts +0 -5
  472. package/lib/util/types.d.ts.map +1 -1
  473. package/lib/util/types.js +1 -2
  474. package/lib/util/types.js.map +1 -1
  475. package/package.json +31 -32
  476. package/src/api/impl/api.ts +1 -1
  477. package/src/api/impl/beacon/blocks/index.ts +81 -126
  478. package/src/api/impl/beacon/index.ts +3 -1
  479. package/src/api/impl/beacon/pool/index.ts +31 -1
  480. package/src/api/impl/beacon/state/index.ts +10 -1
  481. package/src/api/impl/beacon/state/utils.ts +20 -10
  482. package/src/api/impl/debug/index.ts +4 -0
  483. package/src/api/impl/validator/index.ts +178 -39
  484. package/src/api/options.ts +3 -0
  485. package/src/chain/GetBlobsTracker.ts +82 -52
  486. package/src/chain/archiveStore/archiveStore.ts +1 -0
  487. package/src/chain/archiveStore/utils/archiveBlocks.ts +76 -130
  488. package/src/chain/blocks/blockInput/blockInput.ts +11 -343
  489. package/src/chain/blocks/blockInput/errors.ts +1 -2
  490. package/src/chain/blocks/blockInput/types.ts +2 -20
  491. package/src/chain/blocks/importBlock.ts +58 -77
  492. package/src/chain/blocks/importExecutionPayload.ts +123 -36
  493. package/src/chain/blocks/index.ts +11 -4
  494. package/src/chain/blocks/payloadEnvelopeProcessor.ts +35 -24
  495. package/src/chain/blocks/types.ts +8 -29
  496. package/src/chain/blocks/verifyBlock.ts +31 -16
  497. package/src/chain/blocks/verifyBlocksDataAvailability.ts +16 -2
  498. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -6
  499. package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
  500. package/src/chain/blocks/verifyBlocksSignatures.ts +10 -5
  501. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +14 -6
  502. package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
  503. package/src/chain/bls/interface.ts +2 -0
  504. package/src/chain/bls/multithread/index.ts +48 -24
  505. package/src/chain/bls/multithread/types.ts +1 -1
  506. package/src/chain/bls/multithread/worker.ts +1 -5
  507. package/src/chain/bls/singleThread.ts +1 -1
  508. package/src/chain/bls/utils.ts +1 -1
  509. package/src/chain/chain.ts +144 -42
  510. package/src/chain/emitter.ts +8 -8
  511. package/src/chain/errors/blockError.ts +1 -1
  512. package/src/chain/errors/executionPayloadBid.ts +12 -0
  513. package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
  514. package/src/chain/errors/inclusionList.ts +38 -0
  515. package/src/chain/errors/index.ts +1 -1
  516. package/src/chain/forkChoice/index.ts +11 -0
  517. package/src/chain/forkChoiceExecutionEngine.ts +183 -0
  518. package/src/chain/interface.ts +11 -6
  519. package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
  520. package/src/chain/opPools/attestationPool.ts +16 -4
  521. package/src/chain/opPools/inclusionListStore.ts +208 -0
  522. package/src/chain/opPools/index.ts +2 -0
  523. package/src/chain/opPools/payloadAttestationPool.ts +18 -7
  524. package/src/chain/opPools/singleAttestationPool.ts +287 -0
  525. package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
  526. package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
  527. package/src/chain/opPools/utils.ts +1 -1
  528. package/src/chain/options.ts +5 -4
  529. package/src/chain/produceBlock/produceBlockBody.ts +67 -22
  530. package/src/chain/proposerTracker.ts +94 -0
  531. package/src/chain/regen/interface.ts +2 -2
  532. package/src/chain/regen/queued.ts +6 -4
  533. package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
  534. package/src/chain/validation/executionPayloadBid.ts +54 -183
  535. package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
  536. package/src/chain/validation/inclusionList.ts +192 -0
  537. package/src/chain/validation/index.ts +1 -0
  538. package/src/chain/validatorMonitor.ts +0 -6
  539. package/src/db/beacon.ts +44 -0
  540. package/src/db/dataColumnStore.ts +2 -4
  541. package/src/db/flatFileStore/flatFileStore.ts +7 -7
  542. package/src/db/flatFileStore/slotIndex.ts +4 -3
  543. package/src/db/interface.ts +2 -0
  544. package/src/db/repositories/blobSidecars.ts +0 -1
  545. package/src/db/repositories/dataColumnSidecarArchive.ts +20 -0
  546. package/src/execution/builder/apiClient.ts +16 -13
  547. package/src/execution/builder/http.ts +4 -0
  548. package/src/execution/builder/validateBid.ts +23 -2
  549. package/src/execution/engine/blobVersionedHashes.ts +1 -1
  550. package/src/execution/engine/disabled.ts +4 -0
  551. package/src/execution/engine/http.ts +59 -47
  552. package/src/execution/engine/index.ts +1 -1
  553. package/src/execution/engine/interface.ts +46 -13
  554. package/src/execution/engine/jsonRpcTransport.ts +56 -31
  555. package/src/execution/engine/mock.ts +32 -14
  556. package/src/execution/engine/payloadIdCache.ts +24 -6
  557. package/src/execution/engine/restTransport.ts +18 -23
  558. package/src/execution/engine/sszTypes.ts +0 -9
  559. package/src/execution/engine/transport.ts +13 -17
  560. package/src/execution/engine/types.ts +44 -24
  561. package/src/execution/engine/utils.ts +4 -2
  562. package/src/index.ts +2 -0
  563. package/src/metrics/metrics/beacon.ts +37 -30
  564. package/src/metrics/metrics/lodestar.ts +106 -18
  565. package/src/metrics/server/http.ts +5 -5
  566. package/src/monitoring/service.ts +1 -1
  567. package/src/network/core/networkCore.ts +11 -1
  568. package/src/network/core/networkCoreWorker.ts +2 -0
  569. package/src/network/core/networkCoreWorkerHandler.ts +8 -1
  570. package/src/network/core/types.ts +6 -1
  571. package/src/network/gossip/gossipsub.ts +11 -0
  572. package/src/network/gossip/interface.ts +5 -5
  573. package/src/network/gossip/topic.ts +14 -25
  574. package/src/network/interface.ts +4 -5
  575. package/src/network/libp2p/index.ts +5 -1
  576. package/src/network/network.ts +66 -58
  577. package/src/network/options.ts +4 -0
  578. package/src/network/peers/peerManager.ts +28 -3
  579. package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
  580. package/src/network/peers/utils/enrSubnetsDeserialize.ts +5 -2
  581. package/src/network/peers/utils/prioritizePeers.ts +14 -22
  582. package/src/network/peers/utils/subnetMap.ts +6 -3
  583. package/src/network/processor/extractSlotRootFns.ts +0 -9
  584. package/src/network/processor/gossipHandlers.ts +150 -183
  585. package/src/network/processor/gossipQueues/index.ts +6 -6
  586. package/src/network/processor/gossipValidatorFn.ts +5 -5
  587. package/src/network/processor/index.ts +58 -28
  588. package/src/network/processor/types.ts +1 -1
  589. package/src/network/reqresp/ReqRespBeaconNode.ts +7 -7
  590. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
  591. package/src/network/reqresp/handlers/inclusionListsByIndices.ts +44 -0
  592. package/src/network/reqresp/handlers/index.ts +5 -17
  593. package/src/network/reqresp/protocols.ts +6 -12
  594. package/src/network/reqresp/rateLimit.ts +5 -17
  595. package/src/network/reqresp/types.ts +6 -13
  596. package/src/network/subnets/attnetsService.ts +94 -6
  597. package/src/network/subnets/interface.ts +7 -0
  598. package/src/node/nodejs.ts +58 -22
  599. package/src/node/options.ts +9 -6
  600. package/src/sync/interface.ts +1 -0
  601. package/src/sync/range/batch.ts +9 -21
  602. package/src/sync/range/chain.ts +2 -14
  603. package/src/sync/sync.ts +65 -4
  604. package/src/sync/unknownBlock.ts +48 -36
  605. package/src/sync/utils/downloadByRange.ts +31 -230
  606. package/src/sync/utils/downloadByRoot.ts +15 -142
  607. package/src/util/blobs.ts +0 -34
  608. package/src/util/execution.ts +8 -102
  609. package/src/util/file.ts +8 -9
  610. package/src/util/queue/itemQueue.ts +1 -1
  611. package/src/util/sszBytes.ts +42 -24
  612. package/src/util/types.ts +1 -8
  613. package/lib/chain/errors/blobSidecarError.d.ts +0 -108
  614. package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
  615. package/lib/chain/errors/blobSidecarError.js +0 -38
  616. package/lib/chain/errors/blobSidecarError.js.map +0 -1
  617. package/lib/chain/validation/blobSidecar.d.ts +0 -16
  618. package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
  619. package/lib/chain/validation/blobSidecar.js +0 -276
  620. package/lib/chain/validation/blobSidecar.js.map +0 -1
  621. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
  622. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
  623. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
  624. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
  625. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
  626. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
  627. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
  628. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
  629. package/src/chain/errors/blobSidecarError.ts +0 -70
  630. package/src/chain/validation/blobSidecar.ts +0 -357
  631. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
  632. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
@@ -1,5 +1,6 @@
1
- import {ForkName, isForkPostFulu} from "@lodestar/params";
2
- import {ForkDigest, Root, Slot, Status, fulu, ssz} from "@lodestar/types";
1
+ import {ForkName, GENESIS_EPOCH, isForkPostFulu} from "@lodestar/params";
2
+ import {computeEpochAtSlot} from "@lodestar/state-transition";
3
+ import {Epoch, ForkDigest, Root, Slot, Status, fulu, ssz} from "@lodestar/types";
3
4
  import {toHex, toRootHex} from "@lodestar/utils";
4
5
 
5
6
  // TODO: Why this value? (From Lighthouse)
@@ -9,6 +10,8 @@ export enum IrrelevantPeerCode {
9
10
  INCOMPATIBLE_FORKS = "IRRELEVANT_PEER_INCOMPATIBLE_FORKS",
10
11
  DIFFERENT_CLOCKS = "IRRELEVANT_PEER_DIFFERENT_CLOCKS",
11
12
  DIFFERENT_FINALIZED = "IRRELEVANT_PEER_DIFFERENT_FINALIZED",
13
+ FINALIZED_EPOCH_TOO_HIGH = "IRRELEVANT_PEER_FINALIZED_EPOCH_TOO_HIGH",
14
+ INVALID_FINALIZED_ROOT = "IRRELEVANT_PEER_INVALID_FINALIZED_ROOT",
12
15
  NO_EARLIEST_AVAILABLE_SLOT = "NO_EARLIEST_AVAILABLE_SLOT",
13
16
  }
14
17
 
@@ -16,6 +19,8 @@ type IrrelevantPeerType =
16
19
  | {code: IrrelevantPeerCode.INCOMPATIBLE_FORKS; ours: ForkDigest; theirs: ForkDigest}
17
20
  | {code: IrrelevantPeerCode.DIFFERENT_CLOCKS; slotDiff: number}
18
21
  | {code: IrrelevantPeerCode.NO_EARLIEST_AVAILABLE_SLOT}
22
+ | {code: IrrelevantPeerCode.FINALIZED_EPOCH_TOO_HIGH; finalizedEpoch: Epoch; maxFinalizedEpoch: Epoch}
23
+ | {code: IrrelevantPeerCode.INVALID_FINALIZED_ROOT}
19
24
  | {code: IrrelevantPeerCode.DIFFERENT_FINALIZED; expectedRoot: Root; remoteRoot: Root};
20
25
 
21
26
  /**
@@ -45,29 +50,35 @@ export function assertPeerRelevance(
45
50
  return {code: IrrelevantPeerCode.DIFFERENT_CLOCKS, slotDiff};
46
51
  }
47
52
 
48
- // The remote's finalized epoch is less than or equal to ours, but the block root is
49
- // different to the one in our chain. Therefore, the node is on a different chain and we
50
- // should not communicate with them.
53
+ // A checkpoint can be finalized at the earliest at the start of epoch + 2
54
+ const maxFinalizedEpoch = Math.max(
55
+ GENESIS_EPOCH,
56
+ computeEpochAtSlot(Math.max(currentSlot, 0) + FUTURE_SLOT_TOLERANCE) - 2
57
+ );
58
+ if (remote.finalizedEpoch > maxFinalizedEpoch) {
59
+ return {
60
+ code: IrrelevantPeerCode.FINALIZED_EPOCH_TOO_HIGH,
61
+ finalizedEpoch: remote.finalizedEpoch,
62
+ maxFinalizedEpoch,
63
+ };
64
+ }
65
+
66
+ if (remote.finalizedEpoch > GENESIS_EPOCH && isZeroRoot(remote.finalizedRoot)) {
67
+ return {code: IrrelevantPeerCode.INVALID_FINALIZED_ROOT};
68
+ }
51
69
 
70
+ // The remote's finalized epoch is equal to ours, but the block root is different to the one in our chain.
71
+ // Therefore, the node is on a different chain and we should not communicate with them.
52
72
  if (
53
- remote.finalizedEpoch <= local.finalizedEpoch &&
54
- !isZeroRoot(remote.finalizedRoot) &&
55
- !isZeroRoot(local.finalizedRoot)
73
+ remote.finalizedEpoch === local.finalizedEpoch &&
74
+ !isZeroRoot(local.finalizedRoot) &&
75
+ !ssz.Root.equals(remote.finalizedRoot, local.finalizedRoot)
56
76
  ) {
57
- // NOTE: due to preferring to not access chain state here, we can't check the finalized root against our history.
58
- // The impact of not doing check is low: peers that are behind us we can't confirm they are in the same chain as us.
59
- // In the worst case they will attempt to sync from us, fail and disconnect. The ENR fork check should be sufficient
60
- // to differentiate most peers in normal network conditions.
61
- const remoteRoot = remote.finalizedRoot;
62
- const expectedRoot = remote.finalizedEpoch === local.finalizedEpoch ? local.finalizedRoot : null;
63
-
64
- if (expectedRoot !== null && !ssz.Root.equals(remoteRoot, expectedRoot)) {
65
- return {
66
- code: IrrelevantPeerCode.DIFFERENT_FINALIZED,
67
- expectedRoot: expectedRoot, // forkChoice returns Tree BranchNode which the logger prints as {}
68
- remoteRoot: remoteRoot,
69
- };
70
- }
77
+ return {
78
+ code: IrrelevantPeerCode.DIFFERENT_FINALIZED,
79
+ expectedRoot: local.finalizedRoot,
80
+ remoteRoot: remote.finalizedRoot,
81
+ };
71
82
  }
72
83
 
73
84
  if (isForkPostFulu(forkName) && (remote as fulu.Status).earliestAvailableSlot === undefined) {
@@ -76,7 +87,8 @@ export function assertPeerRelevance(
76
87
  };
77
88
  }
78
89
 
79
- // Note: Accept request status finalized checkpoint in the future, we do not know if it is a true finalized root
90
+ // Note: for a behind finalized checkpoint, we validate it more on the main thread against our history,
91
+ // see BeaconSync.verifyPastFinalizedCheckpoint
80
92
  return null;
81
93
  }
82
94
 
@@ -93,6 +105,10 @@ export function renderIrrelevantPeerType(type: IrrelevantPeerType): string {
93
105
  return `DIFFERENT_CLOCKS slotDiff: ${type.slotDiff}`;
94
106
  case IrrelevantPeerCode.DIFFERENT_FINALIZED:
95
107
  return `DIFFERENT_FINALIZED root: ${toRootHex(type.remoteRoot)} expected: ${toRootHex(type.expectedRoot)}`;
108
+ case IrrelevantPeerCode.FINALIZED_EPOCH_TOO_HIGH:
109
+ return `FINALIZED_EPOCH_TOO_HIGH finalizedEpoch: ${type.finalizedEpoch} max: ${type.maxFinalizedEpoch}`;
110
+ case IrrelevantPeerCode.INVALID_FINALIZED_ROOT:
111
+ return "INVALID_FINALIZED_ROOT zero root for a non-genesis finalized epoch";
96
112
  case IrrelevantPeerCode.NO_EARLIEST_AVAILABLE_SLOT:
97
113
  return "No earliestAvailableSlot announced via peer Status";
98
114
  }
@@ -17,10 +17,13 @@ export function deserializeEnrSubnets(bytes: Uint8Array, subnetCount: number): b
17
17
  return getUint8ByteToBitBooleanArray(bytes[0] ?? 0);
18
18
  }
19
19
 
20
- let boolsArr: boolean[] = [];
21
20
  const byteCount = Math.ceil(subnetCount / 8);
21
+ const boolsArr = new Array<boolean>(byteCount * 8);
22
22
  for (let i = 0; i < byteCount; i++) {
23
- boolsArr = boolsArr.concat(getUint8ByteToBitBooleanArray(bytes[i] ?? 0));
23
+ const bits = getUint8ByteToBitBooleanArray(bytes[i] ?? 0);
24
+ for (let j = 0; j < 8; j++) {
25
+ boolsArr[i * 8 + j] = bits[j];
26
+ }
24
27
  }
25
28
 
26
29
  return boolsArr;
@@ -49,6 +49,8 @@ const syncnetsZero = BitArray.fromBitLen(SYNC_COMMITTEE_SUBNET_COUNT);
49
49
 
50
50
  type SubnetDiscvQuery = {subnet: SubnetID; toSlot: number; maxPeersToDiscover: number};
51
51
 
52
+ export type RequestedSubnetWithPeerCount = RequestedSubnet & {peerCount: number};
53
+
52
54
  /**
53
55
  * A map of das custody group index to maxPeersToDiscover
54
56
  */
@@ -145,8 +147,8 @@ export function prioritizePeers(
145
147
  samplingGroups: CustodyIndex[] | null;
146
148
  score: number;
147
149
  }[],
148
- activeAttnets: RequestedSubnet[],
149
- activeSyncnets: RequestedSubnet[],
150
+ activeAttnets: RequestedSubnetWithPeerCount[],
151
+ activeSyncnets: RequestedSubnetWithPeerCount[],
150
152
  samplingGroups: CustodyIndex[] | undefined,
151
153
  opts: PrioritizePeersOpts,
152
154
  config: ChainConfig,
@@ -231,8 +233,8 @@ export function prioritizePeers(
231
233
  */
232
234
  function requestSubnetPeers(
233
235
  connectedPeers: PeerInfo[],
234
- activeAttnets: RequestedSubnet[],
235
- activeSyncnets: RequestedSubnet[],
236
+ activeAttnets: RequestedSubnetWithPeerCount[],
237
+ activeSyncnets: RequestedSubnetWithPeerCount[],
236
238
  ourSamplingGroups: CustodyIndex[] | undefined,
237
239
  opts: PrioritizePeersOpts,
238
240
  config: ChainConfig,
@@ -252,54 +254,44 @@ function requestSubnetPeers(
252
254
 
253
255
  // attnets, do we need queries for more peers
254
256
  if (activeAttnets.length > 0) {
255
- /** Map of peers per subnet, peer may be in multiple arrays */
256
- const peersPerSubnet = new Map<number, number>();
257
-
258
257
  for (const peer of connectedPeers) {
259
258
  const trueBitIndices = peer.attnetsTrueBitIndices;
260
259
  let dutyCount = 0;
261
260
  for (const {subnet} of activeAttnets) {
262
261
  if (trueBitIndices.includes(subnet)) {
263
262
  dutyCount += 1;
264
- peersPerSubnet.set(subnet, 1 + (peersPerSubnet.get(subnet) ?? 0));
265
263
  }
266
264
  }
267
265
  dutiesByPeer.set(peer, dutyCount);
268
266
  }
269
267
 
270
- for (const {subnet, toSlot} of activeAttnets) {
271
- const peersInSubnet = peersPerSubnet.get(subnet) ?? 0;
272
- metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.attnets}, peersInSubnet);
273
- if (peersInSubnet < targetSubnetPeers) {
268
+ for (const {subnet, toSlot, peerCount} of activeAttnets) {
269
+ metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.attnets}, peerCount);
270
+ if (peerCount < targetSubnetPeers) {
274
271
  // We need more peers
275
- attnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peersInSubnet});
272
+ attnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peerCount});
276
273
  }
277
274
  }
278
275
  }
279
276
 
280
277
  // syncnets, do we need queries for more peers
281
278
  if (activeSyncnets.length > 0) {
282
- /** Map of peers per subnet, peer may be in multiple arrays */
283
- const peersPerSubnet = new Map<number, number>();
284
-
285
279
  for (const peer of connectedPeers) {
286
280
  const trueBitIndices = peer.syncnetsTrueBitIndices;
287
281
  let dutyCount = dutiesByPeer.get(peer) ?? 0;
288
282
  for (const {subnet} of activeSyncnets) {
289
283
  if (trueBitIndices.includes(subnet)) {
290
284
  dutyCount += 1;
291
- peersPerSubnet.set(subnet, 1 + (peersPerSubnet.get(subnet) ?? 0));
292
285
  }
293
286
  }
294
287
  dutiesByPeer.set(peer, dutyCount);
295
288
  }
296
289
 
297
- for (const {subnet, toSlot} of activeSyncnets) {
298
- const peersInSubnet = peersPerSubnet.get(subnet) ?? 0;
299
- metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.syncnets}, peersInSubnet);
300
- if (peersInSubnet < targetSubnetPeers) {
290
+ for (const {subnet, toSlot, peerCount} of activeSyncnets) {
291
+ metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.syncnets}, peerCount);
292
+ if (peerCount < targetSubnetPeers) {
301
293
  // We need more peers
302
- syncnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peersInSubnet});
294
+ syncnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peerCount});
303
295
  }
304
296
  }
305
297
  }
@@ -66,11 +66,14 @@ export class SubnetMap {
66
66
  return subnets;
67
67
  }
68
68
 
69
- /** Return subnetIds with a `toSlot` less than `currentSlot`. Also deletes expired entries */
70
- getExpired(currentSlot: Slot): SubnetID[] {
69
+ /**
70
+ * Return subnetIds with a `toSlot` less than `currentSlot`. Also deletes expired entries
71
+ * @param keep expired subnets for which it returns true are neither returned nor deleted
72
+ */
73
+ getExpired(currentSlot: Slot, keep?: (subnet: SubnetID) => boolean): SubnetID[] {
71
74
  const subnetIds: SubnetID[] = [];
72
75
  for (const [subnet, toSlot] of this.subnets.entries()) {
73
- if (toSlot < currentSlot) {
76
+ if (toSlot < currentSlot && keep?.(subnet) !== true) {
74
77
  subnetIds.push(subnet);
75
78
  this.subnets.delete(subnet);
76
79
  }
@@ -6,7 +6,6 @@ import {
6
6
  getBlockRootFromPayloadAttestationMessageSerialized,
7
7
  getBlockRootFromSignedAggregateAndProofSerialized,
8
8
  getSlotFromBeaconAttestationSerialized,
9
- getSlotFromBlobSidecarSerialized,
10
9
  getSlotFromDataColumnSidecarSerialized,
11
10
  getSlotFromExecutionPayloadEnvelopeSerialized,
12
11
  getSlotFromPayloadAttestationMessageSerialized,
@@ -49,14 +48,6 @@ export function createExtractBlockSlotRootFns(): ExtractSlotRootFns {
49
48
  }
50
49
  return {slot};
51
50
  },
52
- [GossipType.blob_sidecar]: (data: Uint8Array): SlotOptionalRoot | null => {
53
- const slot = getSlotFromBlobSidecarSerialized(data);
54
-
55
- if (slot === null) {
56
- return null;
57
- }
58
- return {slot};
59
- },
60
51
  [GossipType.data_column_sidecar]: (data: Uint8Array, fork: ForkName): SlotOptionalRoot | null => {
61
52
  const slot = getSlotFromDataColumnSidecarSerialized(data, fork);
62
53