@lodestar/beacon-node 1.47.0-dev.f591cb177e → 1.48.0-dev.67344272c0

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 (342) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +44 -12
  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 +21 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +2 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/events/index.d.ts.map +1 -1
  11. package/lib/api/impl/events/index.js +2 -0
  12. package/lib/api/impl/events/index.js.map +1 -1
  13. package/lib/api/impl/lodestar/index.js +1 -1
  14. package/lib/api/impl/lodestar/index.js.map +1 -1
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +237 -49
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/api/impl/validator/utils.js +1 -1
  19. package/lib/api/impl/validator/utils.js.map +1 -1
  20. package/lib/api/rest/base.d.ts.map +1 -1
  21. package/lib/api/rest/base.js +7 -0
  22. package/lib/api/rest/base.js.map +1 -1
  23. package/lib/chain/archiveStore/archiveStore.js +1 -1
  24. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  25. package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
  26. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  27. package/lib/chain/blocks/importExecutionPayload.js +11 -9
  28. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  29. package/lib/chain/blocks/index.d.ts.map +1 -1
  30. package/lib/chain/blocks/index.js +21 -13
  31. package/lib/chain/blocks/index.js.map +1 -1
  32. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
  33. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  34. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
  35. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  36. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
  37. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  38. package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
  39. package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
  40. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  41. package/lib/chain/blocks/verifyBlock.js +5 -2
  42. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  43. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  44. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
  45. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  46. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
  47. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  49. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  50. package/lib/chain/bls/index.d.ts +1 -1
  51. package/lib/chain/bls/index.d.ts.map +1 -1
  52. package/lib/chain/bls/interface.d.ts +5 -5
  53. package/lib/chain/bls/interface.d.ts.map +1 -1
  54. package/lib/chain/bls/multithread/index.d.ts +5 -11
  55. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  56. package/lib/chain/bls/multithread/index.js +116 -101
  57. package/lib/chain/bls/multithread/index.js.map +1 -1
  58. package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
  59. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  60. package/lib/chain/bls/multithread/jobItem.js +10 -65
  61. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  62. package/lib/chain/bls/multithread/types.d.ts +29 -8
  63. package/lib/chain/bls/multithread/types.d.ts.map +1 -1
  64. package/lib/chain/bls/multithread/types.js +12 -0
  65. package/lib/chain/bls/multithread/types.js.map +1 -1
  66. package/lib/chain/bls/multithread/utils.d.ts +4 -0
  67. package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
  68. package/lib/chain/bls/multithread/utils.js +10 -0
  69. package/lib/chain/bls/multithread/utils.js.map +1 -1
  70. package/lib/chain/bls/multithread/worker.js +49 -23
  71. package/lib/chain/bls/multithread/worker.js.map +1 -1
  72. package/lib/chain/bls/singleThread.d.ts +4 -10
  73. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  74. package/lib/chain/bls/singleThread.js +8 -45
  75. package/lib/chain/bls/singleThread.js.map +1 -1
  76. package/lib/chain/bls/utils.d.ts +4 -4
  77. package/lib/chain/bls/utils.d.ts.map +1 -1
  78. package/lib/chain/bls/utils.js +18 -19
  79. package/lib/chain/bls/utils.js.map +1 -1
  80. package/lib/chain/chain.d.ts +9 -4
  81. package/lib/chain/chain.d.ts.map +1 -1
  82. package/lib/chain/chain.js +22 -8
  83. package/lib/chain/chain.js.map +1 -1
  84. package/lib/chain/errors/blockError.d.ts +1 -0
  85. package/lib/chain/errors/blockError.d.ts.map +1 -1
  86. package/lib/chain/errors/blockError.js +6 -1
  87. package/lib/chain/errors/blockError.js.map +1 -1
  88. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  89. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  90. package/lib/chain/errors/executionPayloadBid.js +1 -0
  91. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  92. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  93. package/lib/chain/forkChoice/index.js +4 -0
  94. package/lib/chain/forkChoice/index.js.map +1 -1
  95. package/lib/chain/interface.d.ts +8 -4
  96. package/lib/chain/interface.d.ts.map +1 -1
  97. package/lib/chain/interface.js.map +1 -1
  98. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  99. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  100. package/lib/chain/opPools/attestationPool.d.ts +1 -1
  101. package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
  102. package/lib/chain/opPools/attestationPool.js +1 -1
  103. package/lib/chain/opPools/attestationPool.js.map +1 -1
  104. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
  105. package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
  106. package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
  107. package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
  108. package/lib/chain/opPools/executionPayloadBidPool.d.ts +7 -2
  109. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
  110. package/lib/chain/opPools/executionPayloadBidPool.js +4 -4
  111. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
  112. package/lib/chain/opPools/index.d.ts +2 -1
  113. package/lib/chain/opPools/index.d.ts.map +1 -1
  114. package/lib/chain/opPools/index.js +1 -0
  115. package/lib/chain/opPools/index.js.map +1 -1
  116. package/lib/chain/opPools/payloadAttestationPool.js +3 -3
  117. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  118. package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
  119. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  120. package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
  121. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  122. package/lib/chain/opPools/utils.d.ts +1 -1
  123. package/lib/chain/opPools/utils.d.ts.map +1 -1
  124. package/lib/chain/opPools/utils.js +1 -1
  125. package/lib/chain/opPools/utils.js.map +1 -1
  126. package/lib/chain/prepareNextSlot.d.ts +5 -0
  127. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  128. package/lib/chain/prepareNextSlot.js +47 -6
  129. package/lib/chain/prepareNextSlot.js.map +1 -1
  130. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  131. package/lib/chain/produceBlock/computeNewStateRoot.js +3 -25
  132. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  133. package/lib/chain/produceBlock/produceBlockBody.js +1 -1
  134. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  135. package/lib/chain/regen/interface.d.ts +5 -2
  136. package/lib/chain/regen/interface.d.ts.map +1 -1
  137. package/lib/chain/regen/interface.js +3 -0
  138. package/lib/chain/regen/interface.js.map +1 -1
  139. package/lib/chain/regen/queued.d.ts +2 -2
  140. package/lib/chain/regen/queued.d.ts.map +1 -1
  141. package/lib/chain/regen/queued.js +5 -5
  142. package/lib/chain/regen/queued.js.map +1 -1
  143. package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
  144. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  145. package/lib/chain/seenCache/seenAttesters.js +25 -4
  146. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  147. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
  148. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  149. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
  150. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  151. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
  152. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  153. package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
  154. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  155. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
  156. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  157. package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
  158. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  159. package/lib/chain/stateCache/types.d.ts +3 -3
  160. package/lib/chain/stateCache/types.d.ts.map +1 -1
  161. package/lib/chain/validation/attestation.d.ts.map +1 -1
  162. package/lib/chain/validation/attestation.js +1 -4
  163. package/lib/chain/validation/attestation.js.map +1 -1
  164. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  165. package/lib/chain/validation/attesterSlashing.js +1 -1
  166. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  167. package/lib/chain/validation/block.d.ts.map +1 -1
  168. package/lib/chain/validation/block.js +40 -10
  169. package/lib/chain/validation/block.js.map +1 -1
  170. package/lib/chain/validation/executionPayloadBid.d.ts +15 -3
  171. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  172. package/lib/chain/validation/executionPayloadBid.js +166 -12
  173. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  174. package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
  175. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  176. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  177. package/lib/chain/validation/payloadAttestationMessage.js +5 -14
  178. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  179. package/lib/chain/validation/proposerPreferences.js +2 -2
  180. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  181. package/lib/chain/validation/proposerSlashing.js +1 -1
  182. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  183. package/lib/chain/validation/voluntaryExit.d.ts +9 -1
  184. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  185. package/lib/chain/validation/voluntaryExit.js +46 -1
  186. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  187. package/lib/execution/builder/apiClient.d.ts +70 -0
  188. package/lib/execution/builder/apiClient.d.ts.map +1 -0
  189. package/lib/execution/builder/apiClient.js +202 -0
  190. package/lib/execution/builder/apiClient.js.map +1 -0
  191. package/lib/execution/builder/validateBid.d.ts +23 -0
  192. package/lib/execution/builder/validateBid.d.ts.map +1 -0
  193. package/lib/execution/builder/validateBid.js +119 -0
  194. package/lib/execution/builder/validateBid.js.map +1 -0
  195. package/lib/metrics/metrics/lodestar.d.ts +84 -23
  196. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  197. package/lib/metrics/metrics/lodestar.js +161 -55
  198. package/lib/metrics/metrics/lodestar.js.map +1 -1
  199. package/lib/network/gossip/topic.d.ts +13 -0
  200. package/lib/network/gossip/topic.d.ts.map +1 -1
  201. package/lib/network/gossip/topic.js +37 -0
  202. package/lib/network/gossip/topic.js.map +1 -1
  203. package/lib/network/network.d.ts.map +1 -1
  204. package/lib/network/network.js +23 -43
  205. package/lib/network/network.js.map +1 -1
  206. package/lib/network/processor/constants.d.ts +7 -0
  207. package/lib/network/processor/constants.d.ts.map +1 -0
  208. package/lib/network/processor/constants.js +7 -0
  209. package/lib/network/processor/constants.js.map +1 -0
  210. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  211. package/lib/network/processor/gossipHandlers.js +6 -2
  212. package/lib/network/processor/gossipHandlers.js.map +1 -1
  213. package/lib/network/processor/gossipQueues/indexed.d.ts.map +1 -1
  214. package/lib/network/processor/gossipQueues/indexed.js +0 -1
  215. package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
  216. package/lib/network/processor/index.d.ts +3 -0
  217. package/lib/network/processor/index.d.ts.map +1 -1
  218. package/lib/network/processor/index.js +52 -23
  219. package/lib/network/processor/index.js.map +1 -1
  220. package/lib/network/reqresp/score.d.ts.map +1 -1
  221. package/lib/network/reqresp/score.js +5 -11
  222. package/lib/network/reqresp/score.js.map +1 -1
  223. package/lib/network/util.d.ts +0 -1
  224. package/lib/network/util.d.ts.map +1 -1
  225. package/lib/network/util.js +0 -4
  226. package/lib/network/util.js.map +1 -1
  227. package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
  228. package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
  229. package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
  230. package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
  231. package/lib/node/nodejs.d.ts +2 -1
  232. package/lib/node/nodejs.d.ts.map +1 -1
  233. package/lib/node/nodejs.js +7 -0
  234. package/lib/node/nodejs.js.map +1 -1
  235. package/lib/sync/range/batch.d.ts +23 -5
  236. package/lib/sync/range/batch.d.ts.map +1 -1
  237. package/lib/sync/range/batch.js +61 -22
  238. package/lib/sync/range/batch.js.map +1 -1
  239. package/lib/sync/range/chain.d.ts +2 -1
  240. package/lib/sync/range/chain.d.ts.map +1 -1
  241. package/lib/sync/range/chain.js +32 -12
  242. package/lib/sync/range/chain.js.map +1 -1
  243. package/lib/sync/range/range.js +1 -1
  244. package/lib/sync/range/range.js.map +1 -1
  245. package/lib/sync/types.d.ts +32 -0
  246. package/lib/sync/types.d.ts.map +1 -1
  247. package/lib/sync/types.js +33 -0
  248. package/lib/sync/types.js.map +1 -1
  249. package/lib/sync/unknownBlock.d.ts +6 -2
  250. package/lib/sync/unknownBlock.d.ts.map +1 -1
  251. package/lib/sync/unknownBlock.js +143 -68
  252. package/lib/sync/unknownBlock.js.map +1 -1
  253. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  254. package/lib/sync/utils/downloadByRange.js +16 -11
  255. package/lib/sync/utils/downloadByRange.js.map +1 -1
  256. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  257. package/lib/sync/utils/downloadByRoot.js +3 -1
  258. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  259. package/package.json +35 -35
  260. package/src/api/impl/beacon/blocks/index.ts +51 -15
  261. package/src/api/impl/beacon/pool/index.ts +22 -2
  262. package/src/api/impl/beacon/state/utils.ts +2 -1
  263. package/src/api/impl/events/index.ts +3 -1
  264. package/src/api/impl/lodestar/index.ts +1 -1
  265. package/src/api/impl/validator/index.ts +290 -49
  266. package/src/api/impl/validator/utils.ts +1 -1
  267. package/src/api/rest/base.ts +7 -0
  268. package/src/chain/archiveStore/archiveStore.ts +1 -1
  269. package/src/chain/blocks/importExecutionPayload.ts +12 -11
  270. package/src/chain/blocks/index.ts +25 -13
  271. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
  272. package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
  273. package/src/chain/blocks/verifyBlock.ts +5 -2
  274. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
  275. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
  276. package/src/chain/bls/index.ts +1 -1
  277. package/src/chain/bls/interface.ts +7 -3
  278. package/src/chain/bls/multithread/index.ts +148 -120
  279. package/src/chain/bls/multithread/jobItem.ts +12 -82
  280. package/src/chain/bls/multithread/types.ts +33 -8
  281. package/src/chain/bls/multithread/utils.ts +11 -0
  282. package/src/chain/bls/multithread/worker.ts +85 -27
  283. package/src/chain/bls/singleThread.ts +11 -55
  284. package/src/chain/bls/utils.ts +23 -24
  285. package/src/chain/chain.ts +25 -7
  286. package/src/chain/errors/blockError.ts +8 -2
  287. package/src/chain/errors/executionPayloadBid.ts +6 -0
  288. package/src/chain/forkChoice/index.ts +4 -0
  289. package/src/chain/interface.ts +8 -3
  290. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  291. package/src/chain/opPools/attestationPool.ts +1 -1
  292. package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
  293. package/src/chain/opPools/executionPayloadBidPool.ts +13 -7
  294. package/src/chain/opPools/index.ts +2 -1
  295. package/src/chain/opPools/payloadAttestationPool.ts +3 -3
  296. package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
  297. package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
  298. package/src/chain/opPools/utils.ts +1 -1
  299. package/src/chain/prepareNextSlot.ts +49 -6
  300. package/src/chain/produceBlock/computeNewStateRoot.ts +3 -38
  301. package/src/chain/produceBlock/produceBlockBody.ts +1 -1
  302. package/src/chain/regen/interface.ts +5 -2
  303. package/src/chain/regen/queued.ts +5 -5
  304. package/src/chain/seenCache/seenAttesters.ts +31 -5
  305. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
  306. package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
  307. package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
  308. package/src/chain/stateCache/types.ts +3 -3
  309. package/src/chain/validation/attestation.ts +1 -7
  310. package/src/chain/validation/attesterSlashing.ts +1 -8
  311. package/src/chain/validation/block.ts +43 -10
  312. package/src/chain/validation/executionPayloadBid.ts +193 -14
  313. package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
  314. package/src/chain/validation/payloadAttestationMessage.ts +6 -17
  315. package/src/chain/validation/proposerPreferences.ts +3 -3
  316. package/src/chain/validation/proposerSlashing.ts +1 -1
  317. package/src/chain/validation/voluntaryExit.ts +59 -2
  318. package/src/execution/builder/apiClient.ts +264 -0
  319. package/src/execution/builder/validateBid.ts +181 -0
  320. package/src/metrics/metrics/lodestar.ts +176 -61
  321. package/src/network/gossip/topic.ts +38 -0
  322. package/src/network/network.ts +29 -54
  323. package/src/network/processor/constants.ts +6 -0
  324. package/src/network/processor/gossipHandlers.ts +6 -2
  325. package/src/network/processor/gossipQueues/indexed.ts +0 -1
  326. package/src/network/processor/index.ts +67 -30
  327. package/src/network/reqresp/score.ts +5 -11
  328. package/src/network/util.ts +0 -5
  329. package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
  330. package/src/node/nodejs.ts +10 -1
  331. package/src/sync/range/batch.ts +83 -28
  332. package/src/sync/range/chain.ts +35 -13
  333. package/src/sync/range/range.ts +1 -1
  334. package/src/sync/types.ts +33 -0
  335. package/src/sync/unknownBlock.ts +167 -73
  336. package/src/sync/utils/downloadByRange.ts +21 -12
  337. package/src/sync/utils/downloadByRoot.ts +3 -1
  338. package/lib/chain/bls/maybeBatch.d.ts +0 -12
  339. package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
  340. package/lib/chain/bls/maybeBatch.js +0 -35
  341. package/lib/chain/bls/maybeBatch.js.map +0 -1
  342. package/src/chain/bls/maybeBatch.ts +0 -45
@@ -4,7 +4,10 @@ import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
4
4
  import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
5
5
  import {BlockInputSource} from "../../chain/blocks/blockInput/index.js";
6
6
  import {PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
7
- import {PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
7
+ import {
8
+ PayloadEnvelopeInputPruneReason,
9
+ PayloadEnvelopeInputSource,
10
+ } from "../../chain/blocks/payloadEnvelopeInput/index.js";
8
11
  import {JobQueueItemType} from "../../chain/bls/index.js";
9
12
  import {AttestationErrorCode, BlockErrorCode} from "../../chain/errors/index.js";
10
13
  import {
@@ -21,7 +24,7 @@ import {ExecutionPayloadStatus} from "../../execution/index.js";
21
24
  import {GossipType} from "../../network/index.js";
22
25
  import {CannotAcceptWorkReason, ReprocessRejectReason} from "../../network/processor/index.js";
23
26
  import {BackfillSyncMethod} from "../../sync/backfill/backfill.js";
24
- import {PendingBlockType} from "../../sync/types.js";
27
+ import {DroppedItemReason, PendingBlockType} from "../../sync/types.js";
25
28
  import {PeerSyncType, RangeSyncType} from "../../sync/utils/remoteSyncType.js";
26
29
  import {AllocSource} from "../../util/bufferPool.js";
27
30
  import {DataColumnReconstructionCode} from "../../util/dataColumns.js";
@@ -31,6 +34,10 @@ import {RegistryMetricCreator} from "../utils/registryMetricCreator.js";
31
34
 
32
35
  export type LodestarMetrics = ReturnType<typeof createLodestarMetrics>;
33
36
 
37
+ type BlsJobOutcome = "valid" | "invalid" | "prepError" | "verifyError" | "workerError";
38
+ type BlsBufferFlushReason = "size" | "timeout";
39
+ type BlsVerificationCallOperation = "batch" | "single" | "fallback" | "same_message";
40
+
34
41
  /**
35
42
  * Extra Lodestar custom metrics
36
43
  */
@@ -76,15 +83,15 @@ export function createLodestarMetrics(
76
83
  }),
77
84
  jobTime: register.histogram<{topic: GossipType}>({
78
85
  name: "lodestar_gossip_validation_queue_job_time_seconds",
79
- help: "Time to process gossip validation queue job in seconds",
86
+ help: "Time to process gossip validation queue job in seconds (accepted messages only)",
80
87
  labelNames: ["topic"],
81
- buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10],
88
+ buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2],
82
89
  }),
83
90
  jobWaitTime: register.histogram<{topic: GossipType}>({
84
91
  name: "lodestar_gossip_validation_queue_job_wait_time_seconds",
85
92
  help: "Time from job added to the queue to starting the job in seconds",
86
93
  labelNames: ["topic"],
87
- buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10],
94
+ buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2],
88
95
  }),
89
96
  concurrency: register.gauge<{topic: GossipType}>({
90
97
  name: "lodestar_gossip_validation_queue_concurrency",
@@ -97,9 +104,10 @@ export function createLodestarMetrics(
97
104
  help: "Age of the first item of each key in the indexed queues in seconds",
98
105
  buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 5],
99
106
  }),
100
- queueTime: register.histogram({
107
+ queueTime: register.histogram<{topic: GossipType}>({
101
108
  name: "lodestar_gossip_validation_queue_time_seconds",
102
109
  help: "Total time an item stays in queue until it is processed in seconds",
110
+ labelNames: ["topic"],
103
111
  buckets: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 5],
104
112
  }),
105
113
  },
@@ -396,86 +404,108 @@ export function createLodestarMetrics(
396
404
  // BLS verifier thread pool and queue
397
405
 
398
406
  bls: {
399
- aggregatedPubkeys: register.gauge({
407
+ aggregatedPubkeys: register.counter({
400
408
  name: "lodestar_bls_aggregated_pubkeys_total",
401
- help: "Total aggregated pubkeys for BLS validation",
409
+ help: "Total validator public keys used as inputs to aggregate signature sets",
410
+ }),
411
+ pubkeyCacheSize: register.gauge({
412
+ name: "lodestar_bls_pubkey_cache_size",
413
+ help: "Current number of validator public keys in the native cache",
414
+ }),
415
+ pubkeyCacheCapacity: register.gauge({
416
+ name: "lodestar_bls_pubkey_cache_capacity",
417
+ help: "Number of validator public keys the native cache can hold without growing",
402
418
  }),
403
419
  },
404
420
 
405
421
  blsThreadPool: {
406
- jobsWorkerTime: register.gauge<{workerId: number}>({
422
+ jobsWorkerTime: register.counter<{workerId: number}>({
407
423
  name: "lodestar_bls_thread_pool_time_seconds_sum",
408
- help: "Total time spent verifying signature sets measured on the worker",
424
+ help: "Cumulative wall time spent processing BLS dispatch groups by worker",
409
425
  labelNames: ["workerId"],
410
426
  }),
411
- successJobsSignatureSetsCount: register.gauge({
427
+ successJobsSignatureSetsCount: register.counter({
412
428
  name: "lodestar_bls_thread_pool_success_jobs_signature_sets_count",
413
- help: "Count of total verified signature sets",
429
+ help: "Count of signature sets completed without an operational error",
414
430
  }),
415
- errorAggregateSignatureSetsCount: register.gauge<{type: JobQueueItemType}>({
416
- name: "lodestar_bls_thread_pool_error_aggregate_signature_sets_count",
417
- help: "Count of error when aggregating pubkeys or signatures",
418
- labelNames: ["type"],
419
- }),
420
- errorJobsSignatureSetsCount: register.gauge({
431
+ errorJobsSignatureSetsCount: register.counter({
421
432
  name: "lodestar_bls_thread_pool_error_jobs_signature_sets_count",
422
- help: "Count of total error-ed signature sets",
433
+ help: "Count of signature sets that ended in an input, binding, or worker error",
423
434
  }),
424
- jobWaitTime: register.histogram({
435
+ jobWaitTime: register.histogram<{type: JobQueueItemType}>({
425
436
  name: "lodestar_bls_thread_pool_queue_job_wait_time_seconds",
426
- help: "Time from job added to the queue to starting the job in seconds",
427
- buckets: [0.01, 0.02, 0.1, 0.3, 0.5, 1],
437
+ help: "Time from adding a BLS job until it is selected for a worker dispatch group",
438
+ labelNames: ["type"],
439
+ buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2],
440
+ }),
441
+ jobDuration: register.histogram<{type: JobQueueItemType}>({
442
+ name: "lodestar_bls_thread_pool_job_duration_seconds",
443
+ help: "End-to-end duration of a BLS job from submission through completion",
444
+ labelNames: ["type"],
445
+ buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2],
446
+ }),
447
+ jobResults: register.counter<{type: JobQueueItemType; outcome: BlsJobOutcome}>({
448
+ name: "lodestar_bls_thread_pool_job_results_total",
449
+ help: "Count of completed BLS jobs by cryptographic or operational outcome",
450
+ labelNames: ["type", "outcome"],
428
451
  }),
429
452
  queueLength: register.gauge({
430
453
  name: "lodestar_bls_thread_pool_queue_length",
431
- help: "Count of total block processor queue length",
454
+ help: "Count of ready BLS jobs waiting for a worker",
455
+ }),
456
+ bufferedQueueLength: register.gauge({
457
+ name: "lodestar_bls_thread_pool_buffered_queue_length",
458
+ help: "Count of BLS jobs waiting in the intentional batching buffer",
432
459
  }),
433
460
  workersBusy: register.gauge({
434
461
  name: "lodestar_bls_thread_pool_workers_busy",
435
462
  help: "Count of current busy workers",
436
463
  }),
437
- totalJobsGroupsStarted: register.gauge({
464
+ totalJobsGroupsStarted: register.counter({
438
465
  name: "lodestar_bls_thread_pool_job_groups_started_total",
439
- help: "Count of total jobs groups started in bls thread pool, job groups include +1 jobs",
466
+ help: "Count of worker dispatch groups started by the BLS thread pool",
440
467
  }),
441
- totalJobsStarted: register.gauge<{type: JobQueueItemType}>({
468
+ totalJobsStarted: register.counter<{type: JobQueueItemType}>({
442
469
  name: "lodestar_bls_thread_pool_jobs_started_total",
443
- help: "Count of total jobs started in bls thread pool, jobs include +1 signature sets",
470
+ help: "Count of jobs started by the BLS thread pool",
444
471
  labelNames: ["type"],
445
472
  }),
446
- totalSigSetsStarted: register.gauge<{type: JobQueueItemType}>({
473
+ totalSigSetsStarted: register.counter<{type: JobQueueItemType}>({
447
474
  name: "lodestar_bls_thread_pool_sig_sets_started_total",
448
- help: "Count of total signature sets started in bls thread pool, sig sets include 1 pk, msg, sig",
475
+ help: "Count of signature sets started by the BLS thread pool",
449
476
  labelNames: ["type"],
450
477
  }),
451
478
  // Re-verifying a batch means doing double work. This number must be very low or it can be a waste of CPU resources
452
- batchRetries: register.gauge({
479
+ batchRetries: register.counter({
453
480
  name: "lodestar_bls_thread_pool_batch_retries_total",
454
- help: "Count of total batches that failed and had to be verified again.",
481
+ help: "Count of combined batches that failed and required per-job fallback",
455
482
  }),
456
483
  // To count how many sigs are being validated with the optimization of batching them
457
- batchSigsSuccess: register.gauge({
484
+ batchSigsSuccess: register.counter({
458
485
  name: "lodestar_bls_thread_pool_batch_sigs_success_total",
459
- help: "Count of total batches that failed and had to be verified again.",
486
+ help: "Count of signature sets accepted by combined batch verification without fallback",
460
487
  }),
461
- sameMessageRetryJobs: register.gauge({
462
- name: "lodestar_bls_thread_pool_same_message_jobs_retries_total",
463
- help: "Count of total same message jobs that failed and had to be verified again.",
488
+ bufferFlushes: register.counter<{reason: BlsBufferFlushReason}>({
489
+ name: "lodestar_bls_thread_pool_buffer_flushes_total",
490
+ help: "Count of batching-buffer flushes by trigger",
491
+ labelNames: ["reason"],
464
492
  }),
465
- sameMessageRetrySets: register.gauge({
466
- name: "lodestar_bls_thread_pool_same_message_sets_retries_total",
467
- help: "Count of total same message sets that failed and had to be verified again.",
493
+ bufferedSignatureSets: register.histogram({
494
+ name: "lodestar_bls_thread_pool_buffered_signature_sets",
495
+ help: "Count of signature sets included in each batching-buffer flush",
496
+ buckets: [1, 8, 16, 24, 28, 32, 36, 40, 44, 48, 64, 128],
468
497
  }),
469
498
  // To measure the time cost of main thread <-> worker message passing
470
499
  latencyToWorker: register.histogram({
471
500
  name: "lodestar_bls_thread_pool_latency_to_worker",
472
501
  help: "Time from sending the job to the worker and the worker receiving it",
473
- buckets: [0.001, 0.003, 0.01, 0.03, 0.1],
502
+ // The dashboard treats 20ms as slow; values above 100ms only need severe-stall classification.
503
+ buckets: [0.00025, 0.001, 0.005, 0.02, 0.1],
474
504
  }),
475
505
  latencyFromWorker: register.histogram({
476
506
  name: "lodestar_bls_thread_pool_latency_from_worker",
477
507
  help: "Time from the worker sending the result and the main thread receiving it",
478
- buckets: [0.001, 0.003, 0.01, 0.03, 0.1],
508
+ buckets: [0.00025, 0.001, 0.005, 0.02, 0.1],
479
509
  }),
480
510
  mainThreadDurationInThreadPool: register.histogram({
481
511
  name: "lodestar_bls_thread_pool_main_thread_time_seconds",
@@ -485,32 +515,40 @@ export function createLodestarMetrics(
485
515
  }),
486
516
  timePerSigSet: register.histogram({
487
517
  name: "lodestar_bls_worker_thread_time_per_sigset_seconds",
488
- help: "Time to verify each sigset with worker thread mode",
518
+ help: "Average BLS worker dispatch wall time per original signature set",
489
519
  // Time per sig ~0.9ms on good machines
490
- buckets: [0.5e-3, 0.75e-3, 1e-3, 1.5e-3, 2e-3, 5e-3],
491
- }),
492
- totalSigSets: register.gauge({
520
+ buckets: [0.5e-3, 0.75e-3, 1e-3, 1.5e-3, 2e-3, 5e-3, 10e-3, 20e-3, 50e-3, 100e-3],
521
+ }),
522
+ workRequestPreparationDuration: register.histogram({
523
+ name: "lodestar_bls_thread_pool_work_request_preparation_duration_seconds",
524
+ help: "Main-thread time spent converting one worker dispatch group to binding inputs",
525
+ // Normal requests take microseconds; the dashboard treats 1ms as a main-thread stall.
526
+ buckets: [0.000005, 0.000025, 0.0001, 0.0005, 0.001, 0.005, 0.025],
527
+ }),
528
+ verificationCallDuration: register.histogram<{operation: BlsVerificationCallOperation}>({
529
+ name: "lodestar_bls_thread_pool_verification_call_duration_seconds",
530
+ help: "Duration of one worker-side lodestar-z verification binding call, including input conversion",
531
+ labelNames: ["operation"],
532
+ // Verification ranges from sub-millisecond calls to large batches; above 500ms is uniformly severe.
533
+ buckets: [0.00025, 0.001, 0.005, 0.02, 0.1, 0.5],
534
+ }),
535
+ verificationCallSignatureSets: register.counter<{operation: BlsVerificationCallOperation}>({
536
+ name: "lodestar_bls_thread_pool_verification_call_signature_sets_total",
537
+ help: "Count of signature sets passed to worker-side lodestar-z verification binding calls",
538
+ labelNames: ["operation"],
539
+ }),
540
+ totalSigSets: register.counter({
493
541
  name: "lodestar_bls_thread_pool_sig_sets_total",
494
542
  help: "Count of total signature sets",
495
543
  }),
496
- prioritizedSigSets: register.gauge({
544
+ prioritizedSigSets: register.counter({
497
545
  name: "lodestar_bls_thread_pool_prioritized_sig_sets_total",
498
546
  help: "Count of total prioritized signature sets",
499
547
  }),
500
- batchableSigSets: register.gauge({
548
+ batchableSigSets: register.counter({
501
549
  name: "lodestar_bls_thread_pool_batchable_sig_sets_total",
502
550
  help: "Count of total batchable signature sets",
503
551
  }),
504
- aggregateWithRandomnessAsyncDuration: register.histogram({
505
- name: "lodestar_bls_thread_pool_aggregate_with_randomness_async_time_seconds",
506
- help: "Total time performing aggregateWithRandomness async",
507
- buckets: [0.001, 0.005, 0.01, 0.1, 0.3],
508
- }),
509
- pubkeysAggregationMainThreadDuration: register.histogram({
510
- name: "lodestar_bls_thread_pool_pubkeys_aggregation_main_thread_time_seconds",
511
- help: "Total time spent aggregating pubkeys on main thread",
512
- buckets: [0.001, 0.005, 0.01, 0.1],
513
- }),
514
552
  },
515
553
 
516
554
  // BLS time on single thread mode
@@ -643,9 +681,15 @@ export function createLodestarMetrics(
643
681
  name: "lodestar_sync_unknown_block_downloaded_blocks_error_total",
644
682
  help: "Total number of downloaded blocks errors in UnknownBlockSync",
645
683
  }),
646
- removedBlocks: register.gauge({
684
+ removedBlocks: register.gauge<{reason: DroppedItemReason}>({
647
685
  name: "lodestar_sync_unknown_block_removed_blocks_total",
648
- help: "Total number of removed bad blocks in UnknownBlockSync",
686
+ help: "Total pending blocks dropped from BlockInputSync without completing, by reason",
687
+ labelNames: ["reason"],
688
+ }),
689
+ removedPayloads: register.gauge<{reason: DroppedItemReason}>({
690
+ name: "lodestar_sync_unknown_block_removed_payloads_total",
691
+ help: "Total pending payloads dropped from BlockInputSync without completing, by reason",
692
+ labelNames: ["reason"],
649
693
  }),
650
694
  elapsedTimeTillReceived: register.histogram({
651
695
  name: "lodestar_sync_unknown_block_elapsed_time_till_received",
@@ -877,6 +921,12 @@ export function createLodestarMetrics(
877
921
  help: "Count of errors, by error type, while processing blocks",
878
922
  labelNames: ["error"],
879
923
  }),
924
+
925
+ preStateSource: register.counter<{source: "parentState" | "fallbackPreState" | "preState"}>({
926
+ name: "lodestar_gossip_block_validation_pre_state_source_total",
927
+ help: "Source of the pre-state used for gossip block validation",
928
+ labelNames: ["source"],
929
+ }),
880
930
  },
881
931
  gossipBlob: {
882
932
  recvToValidation: register.histogram({
@@ -1191,6 +1241,12 @@ export function createLodestarMetrics(
1191
1241
  name: "lodestar_oppool_attester_slashing_pool_size",
1192
1242
  help: "Current size of the AttesterSlashingPool",
1193
1243
  }),
1244
+ deferredVoluntaryExitPool: {
1245
+ size: register.gauge({
1246
+ name: "lodestar_oppool_deferred_voluntary_exit_pool_size",
1247
+ help: "Current size of the DeferredVoluntaryExitPool",
1248
+ }),
1249
+ },
1194
1250
  proposerSlashingPoolSize: register.gauge({
1195
1251
  name: "lodestar_oppool_proposer_slashing_pool_size",
1196
1252
  help: "Current size of the ProposerSlashingPool",
@@ -1301,6 +1357,11 @@ export function createLodestarMetrics(
1301
1357
  help: "Total number of InsertOutcome as a result of adding an execution payload bid from api to the pool",
1302
1358
  labelNames: ["insertOutcome"],
1303
1359
  }),
1360
+ apiValidationTime: register.histogram({
1361
+ name: "lodestar_api_execution_payload_bid_validation_time_seconds",
1362
+ help: "Time elapsed for signed execution payload bid validation - api path",
1363
+ buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.5],
1364
+ }),
1304
1365
  },
1305
1366
  },
1306
1367
 
@@ -1395,6 +1456,16 @@ export function createLodestarMetrics(
1395
1456
  help: "Checkpoint state cache size",
1396
1457
  labelNames: ["type"],
1397
1458
  }),
1459
+ persistentTierEpochs: register.gauge<{tier: number}>({
1460
+ name: "lodestar_cp_state_cache_persistent_tier_epochs",
1461
+ help: "Number of epoch keys retained in each on-disk checkpoint state retention tier",
1462
+ labelNames: ["tier"],
1463
+ }),
1464
+ persistentTierStates: register.gauge<{tier: number}>({
1465
+ name: "lodestar_cp_state_cache_persistent_tier_states",
1466
+ help: "Number of persisted checkpoint states retained in each on-disk retention tier",
1467
+ labelNames: ["tier"],
1468
+ }),
1398
1469
  reads: register.avgMinMax({
1399
1470
  name: "lodestar_cp_state_epoch_reads",
1400
1471
  help: "Avg min max of all state cache items total read count",
@@ -1609,9 +1680,15 @@ export function createLodestarMetrics(
1609
1680
  name: "lodestar_seen_payload_envelope_input_cache_serialized_object_refs",
1610
1681
  help: "Number of serialized-cache object refs retained by cached PayloadEnvelopeInputs",
1611
1682
  }),
1612
- created: register.counter({
1683
+ created: register.counter<{source: PayloadEnvelopeInputSource}>({
1613
1684
  name: "lodestar_seen_payload_envelope_input_cache_items_created_total",
1614
- help: "Number of PayloadEnvelopeInputs created",
1685
+ help: "Number of PayloadEnvelopeInputs created by source",
1686
+ labelNames: ["source"],
1687
+ }),
1688
+ pruned: register.counter<{reason: PayloadEnvelopeInputPruneReason}>({
1689
+ name: "lodestar_seen_payload_envelope_input_cache_items_pruned_total",
1690
+ help: "Number of PayloadEnvelopeInputs evicted by reason",
1691
+ labelNames: ["reason"],
1615
1692
  }),
1616
1693
  },
1617
1694
  },
@@ -1721,6 +1798,10 @@ export function createLodestarMetrics(
1721
1798
  name: "lodestar_precompute_next_epoch_transition_waste_total",
1722
1799
  help: "Total number of precomputing next epoch transition wasted",
1723
1800
  }),
1801
+ predictedReorg: register.counter({
1802
+ name: "lodestar_precompute_next_epoch_transition_predicted_reorg_total",
1803
+ help: "Predicted epoch-boundary reorgs where the strong parent was dialed instead of the weak head",
1804
+ }),
1724
1805
  duration: register.histogram({
1725
1806
  name: "lodestar_precompute_next_epoch_transition_duration_seconds",
1726
1807
  help: "Duration of precomputeNextEpochTransition, including epoch transition and hashTreeRoot",
@@ -1960,6 +2041,40 @@ export function createLodestarMetrics(
1960
2041
  }),
1961
2042
  },
1962
2043
 
2044
+ builderApi: {
2045
+ statusChecks: register.counter<{status: "success" | "error"}>({
2046
+ name: "lodestar_builder_api_status_checks_total",
2047
+ help: "Total count of status checks sent to external builders ahead of a proposal",
2048
+ labelNames: ["status"],
2049
+ }),
2050
+ bidRequests: register.counter({
2051
+ name: "lodestar_builder_api_bid_requests_total",
2052
+ help: "Total count of execution payload bid requests sent to external builders",
2053
+ }),
2054
+ bidRequestErrors: register.counter({
2055
+ name: "lodestar_builder_api_bid_request_errors_total",
2056
+ help: "Total count of failed execution payload bid requests to external builders",
2057
+ }),
2058
+ bidsReceived: register.counter({
2059
+ name: "lodestar_builder_api_bids_received_total",
2060
+ help: "Total count of execution payload bids received from external builders",
2061
+ }),
2062
+ bidsDiscarded: register.counter({
2063
+ name: "lodestar_builder_api_bids_discarded_total",
2064
+ help: "Total count of execution payload bids from external builders discarded due to failed validation",
2065
+ }),
2066
+ blockSubmissions: register.counter<{status: "success" | "error"}>({
2067
+ name: "lodestar_builder_api_block_submissions_total",
2068
+ help: "Total count of signed beacon blocks submitted to external builders",
2069
+ labelNames: ["status"],
2070
+ }),
2071
+ preferencesForwarded: register.counter<{status: "success" | "error"}>({
2072
+ name: "lodestar_builder_api_preferences_forwarded_total",
2073
+ help: "Total count of builder preferences forwarded to external builders",
2074
+ labelNames: ["status"],
2075
+ }),
2076
+ },
2077
+
1963
2078
  db: {
1964
2079
  dbReadReq: register.gauge<{bucket: string}>({
1965
2080
  name: "lodestar_db_read_req_total",
@@ -414,3 +414,41 @@ export const gossipTopicIgnoreDuplicatePublishError: Record<GossipType, boolean>
414
414
  [GossipType.execution_payload_bid]: true,
415
415
  [GossipType.proposer_preferences]: true,
416
416
  };
417
+
418
+ /**
419
+ * Whether a publish that reached zero subscribed peers is an acceptable outcome for a topic.
420
+ *
421
+ * Publishing to a topic with no subscribed peers throws `PublishError.NoPeersSubscribedToTopic`, which
422
+ * propagates to the caller and, for messages submitted through the beacon API, is surfaced to the
423
+ * validator client. That is the right default: a message that reached nobody is a failed broadcast, and a
424
+ * VC configured with several beacon nodes can fall back to another one.
425
+ *
426
+ * Only topics that have a concrete reason to tolerate it opt out here, ie. are set to `true`, and the
427
+ * reason is named on the entry. Everything else is `false` and keeps raising. Note this is applied per
428
+ * publish, a topic set to `false` still honors the global `--network.allowPublishToZeroPeers` flag.
429
+ */
430
+ export const gossipTopicAllowPublishToZeroPeers: Record<GossipType, boolean> = {
431
+ [GossipType.beacon_block]: false,
432
+ [GossipType.blob_sidecar]: false,
433
+ // data_column_sidecar: we ensure having all topic peers via prioritizePeers(). Even with 0 peers on the
434
+ // topic the overall publish can still succeed, because a supernode rebuilds and publishes the missing
435
+ // columns for us, so track sent peers as 0 instead of raising
436
+ [GossipType.data_column_sidecar]: true,
437
+ [GossipType.beacon_aggregate_and_proof]: false,
438
+ [GossipType.beacon_attestation]: false,
439
+ [GossipType.voluntary_exit]: false,
440
+ [GossipType.proposer_slashing]: false,
441
+ [GossipType.attester_slashing]: false,
442
+ [GossipType.sync_committee_contribution_and_proof]: false,
443
+ [GossipType.sync_committee]: false,
444
+ // light_client_finality_update and light_client_optimistic_update: non-mandatory route on most of the
445
+ // network as of Oct 2022, there may be no peer subscribed to the topic at all. Reason carried over from
446
+ // the handlers in network.ts, which used to swallow the error instead
447
+ [GossipType.light_client_finality_update]: true,
448
+ [GossipType.light_client_optimistic_update]: true,
449
+ [GossipType.bls_to_execution_change]: false,
450
+ [GossipType.execution_payload]: false,
451
+ [GossipType.payload_attestation_message]: false,
452
+ [GossipType.execution_payload_bid]: false,
453
+ [GossipType.proposer_preferences]: false,
454
+ };
@@ -49,7 +49,12 @@ import {INetworkCore, NetworkCore, WorkerNetworkCore} from "./core/index.js";
49
49
  import {INetworkEventBus, NetworkEvent, NetworkEventBus, NetworkEventData} from "./events.js";
50
50
  import {getActiveForkBoundaries} from "./forks.js";
51
51
  import {GossipHandlers, GossipTopicMap, GossipType, GossipTypeMap} from "./gossip/index.js";
52
- import {getGossipSSZType, gossipTopicIgnoreDuplicatePublishError, stringifyGossipTopic} from "./gossip/topic.js";
52
+ import {
53
+ getGossipSSZType,
54
+ gossipTopicAllowPublishToZeroPeers,
55
+ gossipTopicIgnoreDuplicatePublishError,
56
+ stringifyGossipTopic,
57
+ } from "./gossip/topic.js";
53
58
  import {INetwork} from "./interface.js";
54
59
  import {NetworkOptions} from "./options.js";
55
60
  import {PeerAction, PeerScoreStats} from "./peers/index.js";
@@ -65,7 +70,7 @@ import {
65
70
  } from "./reqresp/utils/collect.js";
66
71
  import {collectSequentialBlocksInRange} from "./reqresp/utils/collectSequentialBlocksInRange.js";
67
72
  import {CommitteeSubscription} from "./subnets/index.js";
68
- import {isPublishDuplicateError, isPublishToZeroPeersError, prettyPrintPeerIdStr} from "./util.js";
73
+ import {isPublishDuplicateError, prettyPrintPeerIdStr} from "./util.js";
69
74
 
70
75
  type NetworkModules = {
71
76
  opts: NetworkOptions;
@@ -352,9 +357,7 @@ export class Network implements INetwork {
352
357
  const epoch = computeEpochAtSlot(signedBlock.message.slot);
353
358
  const boundary = this.config.getForkBoundaryAtEpoch(epoch);
354
359
 
355
- return this.publishGossip<GossipType.beacon_block>({type: GossipType.beacon_block, boundary}, signedBlock, {
356
- ignoreDuplicatePublishError: true,
357
- });
360
+ return this.publishGossip<GossipType.beacon_block>({type: GossipType.beacon_block, boundary}, signedBlock);
358
361
  }
359
362
 
360
363
  async publishBlobSidecar(blobSidecar: deneb.BlobSidecar): Promise<number> {
@@ -363,9 +366,7 @@ export class Network implements INetwork {
363
366
 
364
367
  const subnet = blobSidecar.index;
365
368
 
366
- return this.publishGossip<GossipType.blob_sidecar>({type: GossipType.blob_sidecar, boundary, subnet}, blobSidecar, {
367
- ignoreDuplicatePublishError: true,
368
- });
369
+ return this.publishGossip<GossipType.blob_sidecar>({type: GossipType.blob_sidecar, boundary, subnet}, blobSidecar);
369
370
  }
370
371
 
371
372
  async publishDataColumnSidecar(
@@ -381,14 +382,7 @@ export class Network implements INetwork {
381
382
  try {
382
383
  const sentPeers = await this.publishGossip<GossipType.data_column_sidecar>(
383
384
  {type: GossipType.data_column_sidecar, boundary, subnet},
384
- dataColumnSidecar,
385
- {
386
- // we ensure having all topic peers via prioritizePeers() function
387
- // in the worse case, if there is 0 peer on the topic, the overall publish operation could be still a success
388
- // because supernode will rebuild and publish missing data column sidecars for us
389
- // hence we want to track sent peers as 0 instead of an error
390
- allowPublishToZeroTopicPeers: true,
391
- }
385
+ dataColumnSidecar
392
386
  );
393
387
  return {sentPeers, alreadyPublished: false};
394
388
  } catch (e) {
@@ -405,8 +399,7 @@ export class Network implements INetwork {
405
399
 
406
400
  return this.publishGossip<GossipType.beacon_aggregate_and_proof>(
407
401
  {type: GossipType.beacon_aggregate_and_proof, boundary},
408
- aggregateAndProof,
409
- {ignoreDuplicatePublishError: true}
402
+ aggregateAndProof
410
403
  );
411
404
  }
412
405
 
@@ -416,8 +409,7 @@ export class Network implements INetwork {
416
409
 
417
410
  return this.publishGossip<GossipType.beacon_attestation>(
418
411
  {type: GossipType.beacon_attestation, boundary, subnet},
419
- attestation,
420
- {ignoreDuplicatePublishError: true}
412
+ attestation
421
413
  );
422
414
  }
423
415
 
@@ -425,9 +417,7 @@ export class Network implements INetwork {
425
417
  const epoch = voluntaryExit.message.epoch;
426
418
  const boundary = this.config.getForkBoundaryAtEpoch(epoch);
427
419
 
428
- return this.publishGossip<GossipType.voluntary_exit>({type: GossipType.voluntary_exit, boundary}, voluntaryExit, {
429
- ignoreDuplicatePublishError: true,
430
- });
420
+ return this.publishGossip<GossipType.voluntary_exit>({type: GossipType.voluntary_exit, boundary}, voluntaryExit);
431
421
  }
432
422
 
433
423
  async publishBlsToExecutionChange(blsToExecutionChange: capella.SignedBLSToExecutionChange): Promise<number> {
@@ -438,8 +428,7 @@ export class Network implements INetwork {
438
428
  if (fork >= ForkSeq.capella) {
439
429
  const publishPromise = this.publishGossip<GossipType.bls_to_execution_change>(
440
430
  {type: GossipType.bls_to_execution_change, boundary},
441
- blsToExecutionChange,
442
- {ignoreDuplicatePublishError: true}
431
+ blsToExecutionChange
443
432
  );
444
433
  publishChanges.push(publishPromise);
445
434
  }
@@ -457,8 +446,7 @@ export class Network implements INetwork {
457
446
 
458
447
  return this.publishGossip<GossipType.proposer_slashing>(
459
448
  {type: GossipType.proposer_slashing, boundary},
460
- proposerSlashing,
461
- {ignoreDuplicatePublishError: true}
449
+ proposerSlashing
462
450
  );
463
451
  }
464
452
 
@@ -478,10 +466,7 @@ export class Network implements INetwork {
478
466
 
479
467
  return this.publishGossip<GossipType.sync_committee>(
480
468
  {type: GossipType.sync_committee, boundary, subnet},
481
- signature,
482
- {
483
- ignoreDuplicatePublishError: true,
484
- }
469
+ signature
485
470
  );
486
471
  }
487
472
 
@@ -491,8 +476,7 @@ export class Network implements INetwork {
491
476
 
492
477
  return this.publishGossip<GossipType.sync_committee_contribution_and_proof>(
493
478
  {type: GossipType.sync_committee_contribution_and_proof, boundary},
494
- contributionAndProof,
495
- {ignoreDuplicatePublishError: true}
479
+ contributionAndProof
496
480
  );
497
481
  }
498
482
 
@@ -522,8 +506,7 @@ export class Network implements INetwork {
522
506
 
523
507
  return this.publishGossip<GossipType.execution_payload>(
524
508
  {type: GossipType.execution_payload, boundary},
525
- signedEnvelope,
526
- {ignoreDuplicatePublishError: true}
509
+ signedEnvelope
527
510
  );
528
511
  }
529
512
 
@@ -534,7 +517,7 @@ export class Network implements INetwork {
534
517
  return this.publishGossip<GossipType.execution_payload_bid>(
535
518
  {type: GossipType.execution_payload_bid, boundary},
536
519
  signedBid,
537
- {ignoreDuplicatePublishError: true}
520
+ {floodPublish: true}
538
521
  );
539
522
  }
540
523
 
@@ -544,8 +527,7 @@ export class Network implements INetwork {
544
527
 
545
528
  return this.publishGossip<GossipType.payload_attestation_message>(
546
529
  {type: GossipType.payload_attestation_message, boundary},
547
- payloadAttestationMessage,
548
- {ignoreDuplicatePublishError: true}
530
+ payloadAttestationMessage
549
531
  );
550
532
  }
551
533
 
@@ -555,24 +537,25 @@ export class Network implements INetwork {
555
537
 
556
538
  return this.publishGossip<GossipType.proposer_preferences>(
557
539
  {type: GossipType.proposer_preferences, boundary},
558
- signedProposerPreferences,
559
- {ignoreDuplicatePublishError: true}
540
+ signedProposerPreferences
560
541
  );
561
542
  }
562
543
 
563
544
  private async publishGossip<K extends GossipType>(
564
545
  topic: GossipTopicMap[K],
565
546
  object: GossipTypeMap[K],
566
- opts?: PublishOpts | undefined
547
+ opts?: PublishOpts
567
548
  ): Promise<number> {
568
549
  const topicStr = stringifyGossipTopic(this.config, topic);
569
550
  const sszType = getGossipSSZType(topic);
570
551
  const messageData = (sszType.serialize as (object: GossipTypeMap[GossipType]) => Uint8Array)(object);
571
- opts = {
572
- ...opts,
552
+ const publishOpts: PublishOpts = {
573
553
  ignoreDuplicatePublishError: gossipTopicIgnoreDuplicatePublishError[topic.type],
554
+ // Leave undefined unless the topic opts out, so `--network.allowPublishToZeroPeers` still applies
555
+ allowPublishToZeroTopicPeers: gossipTopicAllowPublishToZeroPeers[topic.type] ? true : undefined,
556
+ ...opts,
574
557
  };
575
- const sentPeers = await this.core.publishGossip(topicStr, messageData, opts);
558
+ const sentPeers = await this.core.publishGossip(topicStr, messageData, publishOpts);
576
559
 
577
560
  this.logger.verbose("Publish to topic", {topic: topicStr, sentPeers, currentSlot: this.clock.currentSlot});
578
561
  return sentPeers;
@@ -813,11 +796,7 @@ export class Network implements INetwork {
813
796
  await this.waitForSyncMessageCutoff(finalityUpdate.signatureSlot);
814
797
  await this.publishLightClientFinalityUpdate(finalityUpdate);
815
798
  } catch (e) {
816
- // Non-mandatory route on most of network as of Oct 2022. May not have found any peers on topic yet
817
- // Remove once https://github.com/ChainSafe/js-libp2p-gossipsub/issues/367
818
- if (!isPublishToZeroPeersError(e as Error)) {
819
- this.logger.debug("Error on BeaconGossipHandler.onLightclientFinalityUpdate", {}, e as Error);
820
- }
799
+ this.logger.debug("Error on BeaconGossipHandler.onLightclientFinalityUpdate", {}, e as Error);
821
800
  }
822
801
  };
823
802
 
@@ -830,11 +809,7 @@ export class Network implements INetwork {
830
809
  await this.waitForSyncMessageCutoff(optimisticUpdate.signatureSlot);
831
810
  await this.publishLightClientOptimisticUpdate(optimisticUpdate);
832
811
  } catch (e) {
833
- // Non-mandatory route on most of network as of Oct 2022. May not have found any peers on topic yet
834
- // Remove once https://github.com/ChainSafe/js-libp2p-gossipsub/issues/367
835
- if (!isPublishToZeroPeersError(e as Error)) {
836
- this.logger.debug("Error on BeaconGossipHandler.onLightclientOptimisticUpdate", {}, e as Error);
837
- }
812
+ this.logger.debug("Error on BeaconGossipHandler.onLightclientOptimisticUpdate", {}, e as Error);
838
813
  }
839
814
  };
840
815