@lodestar/beacon-node 1.41.0-dev.555261016d → 1.41.0-dev.6eb55025ce

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 (340) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +121 -3
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/index.js +8 -8
  5. package/lib/api/impl/beacon/state/index.js.map +1 -1
  6. package/lib/api/impl/beacon/state/utils.d.ts +3 -4
  7. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.js +5 -24
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +5 -2
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/lightclient/index.d.ts.map +1 -1
  14. package/lib/api/impl/lightclient/index.js +19 -2
  15. package/lib/api/impl/lightclient/index.js.map +1 -1
  16. package/lib/api/impl/node/index.d.ts +1 -1
  17. package/lib/api/impl/node/index.d.ts.map +1 -1
  18. package/lib/api/impl/node/index.js +18 -1
  19. package/lib/api/impl/node/index.js.map +1 -1
  20. package/lib/api/impl/node/utils.d.ts +1 -1
  21. package/lib/api/impl/node/utils.d.ts.map +1 -1
  22. package/lib/api/impl/node/utils.js.map +1 -1
  23. package/lib/api/impl/validator/index.d.ts.map +1 -1
  24. package/lib/api/impl/validator/index.js +104 -6
  25. package/lib/api/impl/validator/index.js.map +1 -1
  26. package/lib/chain/archiveStore/archiveStore.d.ts +1 -0
  27. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  28. package/lib/chain/archiveStore/archiveStore.js +9 -0
  29. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  30. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +5 -6
  31. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  32. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +9 -10
  33. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  34. package/lib/chain/archiveStore/historicalState/worker.js +3 -3
  35. package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
  36. package/lib/chain/archiveStore/utils/archivePayloads.d.ts +7 -0
  37. package/lib/chain/archiveStore/utils/archivePayloads.d.ts.map +1 -0
  38. package/lib/chain/archiveStore/utils/archivePayloads.js +10 -0
  39. package/lib/chain/archiveStore/utils/archivePayloads.js.map +1 -0
  40. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  41. package/lib/chain/blocks/importBlock.js +0 -2
  42. package/lib/chain/blocks/importBlock.js.map +1 -1
  43. package/lib/chain/blocks/index.d.ts.map +1 -1
  44. package/lib/chain/blocks/index.js +2 -1
  45. package/lib/chain/blocks/index.js.map +1 -1
  46. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  47. package/lib/chain/blocks/writeBlockInputToDb.js +3 -0
  48. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  49. package/lib/chain/bls/multithread/index.d.ts +3 -3
  50. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  51. package/lib/chain/bls/multithread/index.js +5 -5
  52. package/lib/chain/bls/multithread/index.js.map +1 -1
  53. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  54. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  55. package/lib/chain/bls/multithread/jobItem.js +2 -2
  56. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  57. package/lib/chain/bls/singleThread.d.ts +4 -4
  58. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  59. package/lib/chain/bls/singleThread.js +4 -4
  60. package/lib/chain/bls/singleThread.js.map +1 -1
  61. package/lib/chain/bls/utils.d.ts +2 -2
  62. package/lib/chain/bls/utils.d.ts.map +1 -1
  63. package/lib/chain/bls/utils.js +7 -4
  64. package/lib/chain/bls/utils.js.map +1 -1
  65. package/lib/chain/chain.d.ts +6 -9
  66. package/lib/chain/chain.d.ts.map +1 -1
  67. package/lib/chain/chain.js +32 -16
  68. package/lib/chain/chain.js.map +1 -1
  69. package/lib/chain/emitter.d.ts +2 -2
  70. package/lib/chain/emitter.d.ts.map +1 -1
  71. package/lib/chain/errors/blockError.d.ts +7 -1
  72. package/lib/chain/errors/blockError.d.ts.map +1 -1
  73. package/lib/chain/errors/blockError.js +2 -0
  74. package/lib/chain/errors/blockError.js.map +1 -1
  75. package/lib/chain/interface.d.ts +4 -6
  76. package/lib/chain/interface.d.ts.map +1 -1
  77. package/lib/chain/interface.js.map +1 -1
  78. package/lib/chain/lightClient/index.d.ts.map +1 -1
  79. package/lib/chain/lightClient/index.js +1 -1
  80. package/lib/chain/lightClient/index.js.map +1 -1
  81. package/lib/chain/options.d.ts.map +1 -1
  82. package/lib/chain/options.js.map +1 -1
  83. package/lib/chain/prepareNextSlot.js +3 -3
  84. package/lib/chain/prepareNextSlot.js.map +1 -1
  85. package/lib/chain/produceBlock/computeNewStateRoot.d.ts +10 -2
  86. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  87. package/lib/chain/produceBlock/computeNewStateRoot.js +24 -2
  88. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  89. package/lib/chain/produceBlock/produceBlockBody.d.ts +22 -7
  90. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  91. package/lib/chain/produceBlock/produceBlockBody.js +110 -10
  92. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  93. package/lib/chain/validation/attestation.d.ts.map +1 -1
  94. package/lib/chain/validation/attestation.js +4 -1
  95. package/lib/chain/validation/attestation.js.map +1 -1
  96. package/lib/chain/validation/attesterSlashing.js +1 -1
  97. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  98. package/lib/chain/validation/block.d.ts.map +1 -1
  99. package/lib/chain/validation/block.js +27 -3
  100. package/lib/chain/validation/block.js.map +1 -1
  101. package/lib/chain/validation/dataColumnSidecar.d.ts +2 -2
  102. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  103. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  104. package/lib/chain/validation/executionPayloadEnvelope.js +2 -1
  105. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  106. package/lib/chain/validation/payloadAttestationMessage.js +8 -1
  107. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  108. package/lib/chain/validation/proposerSlashing.js +1 -1
  109. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  110. package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
  111. package/lib/db/beacon.d.ts +3 -1
  112. package/lib/db/beacon.d.ts.map +1 -1
  113. package/lib/db/beacon.js +5 -1
  114. package/lib/db/beacon.js.map +1 -1
  115. package/lib/db/buckets.d.ts +3 -1
  116. package/lib/db/buckets.d.ts.map +1 -1
  117. package/lib/db/buckets.js +2 -0
  118. package/lib/db/buckets.js.map +1 -1
  119. package/lib/db/interface.d.ts +3 -1
  120. package/lib/db/interface.d.ts.map +1 -1
  121. package/lib/db/repositories/blockArchive.d.ts.map +1 -1
  122. package/lib/db/repositories/blockArchive.js +1 -2
  123. package/lib/db/repositories/blockArchive.js.map +1 -1
  124. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  125. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  126. package/lib/db/repositories/dataColumnSidecar.d.ts +5 -3
  127. package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
  128. package/lib/db/repositories/dataColumnSidecar.js +14 -1
  129. package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
  130. package/lib/db/repositories/dataColumnSidecarArchive.d.ts +5 -3
  131. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  132. package/lib/db/repositories/dataColumnSidecarArchive.js +14 -1
  133. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  134. package/lib/db/repositories/executionPayloadEnvelope.d.ts +19 -0
  135. package/lib/db/repositories/executionPayloadEnvelope.d.ts.map +1 -0
  136. package/lib/db/repositories/executionPayloadEnvelope.js +22 -0
  137. package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -0
  138. package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +18 -0
  139. package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -0
  140. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +28 -0
  141. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -0
  142. package/lib/db/repositories/index.d.ts +2 -0
  143. package/lib/db/repositories/index.d.ts.map +1 -1
  144. package/lib/db/repositories/index.js +2 -0
  145. package/lib/db/repositories/index.js.map +1 -1
  146. package/lib/execution/engine/http.d.ts +1 -0
  147. package/lib/execution/engine/http.d.ts.map +1 -1
  148. package/lib/execution/engine/http.js +3 -0
  149. package/lib/execution/engine/http.js.map +1 -1
  150. package/lib/execution/engine/interface.d.ts +3 -25
  151. package/lib/execution/engine/interface.d.ts.map +1 -1
  152. package/lib/execution/engine/interface.js +2 -20
  153. package/lib/execution/engine/interface.js.map +1 -1
  154. package/lib/metrics/metrics/beacon.d.ts +1 -0
  155. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  156. package/lib/metrics/metrics/beacon.js +5 -0
  157. package/lib/metrics/metrics/beacon.js.map +1 -1
  158. package/lib/metrics/metrics/lodestar.d.ts +8 -0
  159. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  160. package/lib/metrics/metrics/lodestar.js +14 -0
  161. package/lib/metrics/metrics/lodestar.js.map +1 -1
  162. package/lib/metrics/metrics.d.ts.map +1 -1
  163. package/lib/metrics/metrics.js +8 -3
  164. package/lib/metrics/metrics.js.map +1 -1
  165. package/lib/monitoring/service.d.ts +2 -2
  166. package/lib/monitoring/service.d.ts.map +1 -1
  167. package/lib/monitoring/service.js +3 -2
  168. package/lib/monitoring/service.js.map +1 -1
  169. package/lib/network/core/networkCore.d.ts +3 -3
  170. package/lib/network/core/networkCore.d.ts.map +1 -1
  171. package/lib/network/core/networkCore.js.map +1 -1
  172. package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -3
  173. package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
  174. package/lib/network/core/types.d.ts +2 -2
  175. package/lib/network/core/types.d.ts.map +1 -1
  176. package/lib/network/events.d.ts +2 -1
  177. package/lib/network/events.d.ts.map +1 -1
  178. package/lib/network/events.js.map +1 -1
  179. package/lib/network/gossip/encoding.d.ts +3 -3
  180. package/lib/network/gossip/encoding.d.ts.map +1 -1
  181. package/lib/network/gossip/encoding.js.map +1 -1
  182. package/lib/network/gossip/gossipsub.d.ts +13 -4
  183. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  184. package/lib/network/gossip/gossipsub.js +47 -20
  185. package/lib/network/gossip/gossipsub.js.map +1 -1
  186. package/lib/network/gossip/interface.d.ts +6 -6
  187. package/lib/network/gossip/interface.d.ts.map +1 -1
  188. package/lib/network/gossip/scoringParameters.d.ts +1 -1
  189. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  190. package/lib/network/gossip/scoringParameters.js +1 -1
  191. package/lib/network/gossip/scoringParameters.js.map +1 -1
  192. package/lib/network/gossip/topic.d.ts +114 -65
  193. package/lib/network/gossip/topic.d.ts.map +1 -1
  194. package/lib/network/gossip/topic.js +2 -2
  195. package/lib/network/gossip/topic.js.map +1 -1
  196. package/lib/network/interface.d.ts +6 -5
  197. package/lib/network/interface.d.ts.map +1 -1
  198. package/lib/network/libp2p/index.d.ts +1 -1
  199. package/lib/network/libp2p/index.d.ts.map +1 -1
  200. package/lib/network/libp2p/index.js +29 -9
  201. package/lib/network/libp2p/index.js.map +1 -1
  202. package/lib/network/network.d.ts +5 -4
  203. package/lib/network/network.d.ts.map +1 -1
  204. package/lib/network/network.js +10 -1
  205. package/lib/network/network.js.map +1 -1
  206. package/lib/network/options.d.ts.map +1 -1
  207. package/lib/network/options.js +3 -0
  208. package/lib/network/options.js.map +1 -1
  209. package/lib/network/peers/datastore.d.ts +7 -5
  210. package/lib/network/peers/datastore.d.ts.map +1 -1
  211. package/lib/network/peers/datastore.js +10 -10
  212. package/lib/network/peers/datastore.js.map +1 -1
  213. package/lib/network/peers/peerManager.d.ts +3 -0
  214. package/lib/network/peers/peerManager.d.ts.map +1 -1
  215. package/lib/network/peers/peerManager.js +103 -53
  216. package/lib/network/peers/peerManager.js.map +1 -1
  217. package/lib/network/peers/utils/prioritizePeers.d.ts +3 -3
  218. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  219. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  220. package/lib/network/processor/gossipHandlers.js +5 -1
  221. package/lib/network/processor/gossipHandlers.js.map +1 -1
  222. package/lib/network/processor/gossipValidatorFn.js +1 -1
  223. package/lib/network/processor/types.d.ts +1 -1
  224. package/lib/network/processor/types.d.ts.map +1 -1
  225. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
  226. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +7 -1
  227. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
  228. package/lib/network/reqresp/score.d.ts.map +1 -1
  229. package/lib/network/reqresp/score.js +0 -1
  230. package/lib/network/reqresp/score.js.map +1 -1
  231. package/lib/network/util.js +2 -2
  232. package/lib/network/util.js.map +1 -1
  233. package/lib/node/nodejs.d.ts +3 -5
  234. package/lib/node/nodejs.d.ts.map +1 -1
  235. package/lib/node/nodejs.js +6 -4
  236. package/lib/node/nodejs.js.map +1 -1
  237. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  238. package/lib/sync/utils/downloadByRange.js +3 -9
  239. package/lib/sync/utils/downloadByRange.js.map +1 -1
  240. package/lib/sync/utils/downloadByRoot.d.ts +1 -1
  241. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  242. package/lib/sync/utils/downloadByRoot.js +4 -4
  243. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  244. package/lib/util/blobs.d.ts +2 -2
  245. package/lib/util/blobs.d.ts.map +1 -1
  246. package/lib/util/blobs.js.map +1 -1
  247. package/lib/util/dataColumns.d.ts +15 -2
  248. package/lib/util/dataColumns.d.ts.map +1 -1
  249. package/lib/util/dataColumns.js +40 -5
  250. package/lib/util/dataColumns.js.map +1 -1
  251. package/lib/util/multifork.d.ts +8 -0
  252. package/lib/util/multifork.d.ts.map +1 -1
  253. package/lib/util/multifork.js +37 -0
  254. package/lib/util/multifork.js.map +1 -1
  255. package/lib/util/serializedCache.d.ts +5 -0
  256. package/lib/util/serializedCache.d.ts.map +1 -1
  257. package/lib/util/serializedCache.js +5 -0
  258. package/lib/util/serializedCache.js.map +1 -1
  259. package/package.json +38 -41
  260. package/src/api/impl/beacon/blocks/index.ts +145 -2
  261. package/src/api/impl/beacon/state/index.ts +8 -8
  262. package/src/api/impl/beacon/state/utils.ts +15 -29
  263. package/src/api/impl/debug/index.ts +8 -5
  264. package/src/api/impl/lightclient/index.ts +19 -2
  265. package/src/api/impl/node/index.ts +22 -1
  266. package/src/api/impl/node/utils.ts +3 -3
  267. package/src/api/impl/validator/index.ts +127 -5
  268. package/src/chain/archiveStore/archiveStore.ts +10 -0
  269. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -11
  270. package/src/chain/archiveStore/historicalState/worker.ts +3 -3
  271. package/src/chain/archiveStore/utils/archivePayloads.ts +15 -0
  272. package/src/chain/blocks/importBlock.ts +0 -3
  273. package/src/chain/blocks/index.ts +2 -1
  274. package/src/chain/blocks/writeBlockInputToDb.ts +3 -0
  275. package/src/chain/bls/multithread/index.ts +7 -7
  276. package/src/chain/bls/multithread/jobItem.ts +3 -3
  277. package/src/chain/bls/singleThread.ts +5 -5
  278. package/src/chain/bls/utils.ts +8 -5
  279. package/src/chain/chain.ts +51 -26
  280. package/src/chain/emitter.ts +2 -2
  281. package/src/chain/errors/blockError.ts +4 -1
  282. package/src/chain/interface.ts +4 -11
  283. package/src/chain/lightClient/index.ts +4 -1
  284. package/src/chain/options.ts +1 -0
  285. package/src/chain/prepareNextSlot.ts +5 -5
  286. package/src/chain/produceBlock/computeNewStateRoot.ts +35 -3
  287. package/src/chain/produceBlock/produceBlockBody.ts +163 -13
  288. package/src/chain/validation/attestation.ts +4 -1
  289. package/src/chain/validation/attesterSlashing.ts +1 -1
  290. package/src/chain/validation/block.ts +32 -4
  291. package/src/chain/validation/dataColumnSidecar.ts +2 -5
  292. package/src/chain/validation/executionPayloadEnvelope.ts +2 -1
  293. package/src/chain/validation/payloadAttestationMessage.ts +10 -2
  294. package/src/chain/validation/proposerSlashing.ts +1 -1
  295. package/src/chain/validation/syncCommitteeContributionAndProof.ts +1 -1
  296. package/src/db/beacon.ts +8 -0
  297. package/src/db/buckets.ts +3 -0
  298. package/src/db/interface.ts +5 -0
  299. package/src/db/repositories/blockArchive.ts +1 -2
  300. package/src/db/repositories/dataColumnSidecar.ts +18 -3
  301. package/src/db/repositories/dataColumnSidecarArchive.ts +18 -3
  302. package/src/db/repositories/executionPayloadEnvelope.ts +26 -0
  303. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +32 -0
  304. package/src/db/repositories/index.ts +2 -0
  305. package/src/execution/engine/http.ts +3 -0
  306. package/src/execution/engine/interface.ts +3 -27
  307. package/src/metrics/metrics/beacon.ts +5 -0
  308. package/src/metrics/metrics/lodestar.ts +14 -0
  309. package/src/metrics/metrics.ts +8 -3
  310. package/src/monitoring/service.ts +3 -2
  311. package/src/network/core/networkCore.ts +3 -3
  312. package/src/network/core/networkCoreWorkerHandler.ts +3 -3
  313. package/src/network/core/types.ts +2 -2
  314. package/src/network/events.ts +2 -1
  315. package/src/network/gossip/encoding.ts +3 -3
  316. package/src/network/gossip/gossipsub.ts +86 -25
  317. package/src/network/gossip/interface.ts +6 -6
  318. package/src/network/gossip/scoringParameters.ts +4 -4
  319. package/src/network/gossip/topic.ts +2 -1
  320. package/src/network/interface.ts +7 -4
  321. package/src/network/libp2p/index.ts +33 -10
  322. package/src/network/network.ts +24 -6
  323. package/src/network/options.ts +3 -0
  324. package/src/network/peers/datastore.ts +13 -10
  325. package/src/network/peers/peerManager.ts +118 -54
  326. package/src/network/peers/utils/prioritizePeers.ts +3 -3
  327. package/src/network/processor/gossipHandlers.ts +7 -1
  328. package/src/network/processor/gossipValidatorFn.ts +1 -1
  329. package/src/network/processor/types.ts +1 -1
  330. package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +6 -1
  331. package/src/network/reqresp/score.ts +0 -1
  332. package/src/network/util.ts +2 -2
  333. package/src/node/nodejs.ts +8 -9
  334. package/src/sync/utils/downloadByRange.ts +3 -15
  335. package/src/sync/utils/downloadByRoot.ts +5 -11
  336. package/src/util/blobs.ts +3 -3
  337. package/src/util/dataColumns.ts +54 -5
  338. package/src/util/multifork.ts +45 -0
  339. package/src/util/serializedCache.ts +5 -0
  340. package/src/util/workerEvents.ts +1 -1
@@ -128,6 +128,7 @@ const getClientVersionOpts: ReqOpts = {routeId: "getClientVersion"};
128
128
  */
129
129
  export class ExecutionEngineHttp implements IExecutionEngine {
130
130
  private logger: Logger;
131
+ private metrics: Metrics | null;
131
132
 
132
133
  // The default state is ONLINE, it will be updated to SYNCING once we receive the first payload
133
134
  // This assumption is better than the OFFLINE state, since we can't be sure if the EL is offline and being offline may trigger some notifications
@@ -167,6 +168,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
167
168
  metrics?.engineHttpProcessorQueue
168
169
  );
169
170
  this.logger = logger;
171
+ this.metrics = metrics ?? null;
170
172
 
171
173
  this.rpc.emitter.on(JsonRpcHttpClientEvent.ERROR, ({error}) => {
172
174
  this.updateEngineState(getExecutionEngineState({payloadError: error, oldState: this.state}));
@@ -369,6 +371,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
369
371
  } = await request;
370
372
 
371
373
  this.updateEngineState(getExecutionEngineState({payloadStatus: status, oldState: this.state}));
374
+ this.metrics?.engineNotifyForkchoiceUpdateResult.inc({result: status});
372
375
 
373
376
  switch (status) {
374
377
  case ExecutionPayloadStatus.VALID:
@@ -1,3 +1,4 @@
1
+ import {routes} from "@lodestar/api";
1
2
  import {
2
3
  CONSOLIDATION_REQUEST_TYPE,
3
4
  DEPOSIT_REQUEST_TYPE,
@@ -14,6 +15,8 @@ import {ExecutionPayloadBody} from "./types.js";
14
15
  import {DATA} from "./utils.js";
15
16
 
16
17
  export {PayloadIdCache, type PayloadId, type WithdrawalV1};
18
+ export type ClientVersion = routes.node.ClientVersion;
19
+ export const ClientCode = routes.node.ClientCode;
17
20
 
18
21
  export enum ExecutionPayloadStatus {
19
22
  /** given payload is valid */
@@ -45,26 +48,6 @@ export enum ExecutionEngineState {
45
48
  AUTH_FAILED = "AUTH_FAILED",
46
49
  }
47
50
 
48
- /**
49
- * Client code as defined in https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/identification.md#clientcode
50
- * ClientCode.XX is dedicated to other clients which do not have their own code
51
- */
52
- export enum ClientCode {
53
- BU = "BU", // besu
54
- EJ = "EJ", // ethereumJS
55
- EG = "EG", // erigon
56
- GE = "GE", // go-ethereum
57
- GR = "GR", // grandine
58
- LH = "LH", // lighthouse
59
- LS = "LS", // lodestar
60
- NM = "NM", // nethermind
61
- NB = "NB", // nimbus
62
- TK = "TK", // teku
63
- PM = "PM", // prysm
64
- RH = "RH", // reth
65
- XX = "XX", // unknown
66
- }
67
-
68
51
  export type ExecutionRequestType =
69
52
  | typeof DEPOSIT_REQUEST_TYPE
70
53
  | typeof WITHDRAWAL_REQUEST_TYPE
@@ -106,13 +89,6 @@ export type PayloadAttributes = {
106
89
  parentBeaconBlockRoot?: Uint8Array;
107
90
  };
108
91
 
109
- export type ClientVersion = {
110
- code: ClientCode;
111
- name: string;
112
- version: string;
113
- commit: string;
114
- };
115
-
116
92
  export type VersionedHashes = Uint8Array[];
117
93
 
118
94
  /**
@@ -144,6 +144,11 @@ export function createBeaconMetrics(register: RegistryMetricCreator) {
144
144
  help: "Time for preparing payload in advance",
145
145
  buckets: [0.1, 1, 3, 5, 10],
146
146
  }),
147
+ executionPayloadEnvelopeProcessingTime: register.histogram({
148
+ name: "beacon_block_payload_envelope_processing_seconds",
149
+ help: "Time to process execution payload envelope during block production",
150
+ buckets: [0.005, 0.01, 0.05, 0.1, 0.2, 0.5, 1],
151
+ }),
147
152
  payloadFetchedTime: register.histogram<{prepType: PayloadPreparationType}>({
148
153
  name: "beacon_block_payload_fetched_time",
149
154
  help: "Time to fetch the payload from EL",
@@ -827,6 +827,15 @@ export function createLodestarMetrics(
827
827
  help: "Total number of blobs retrieved from execution engine and published to gossip",
828
828
  }),
829
829
  },
830
+ // Gossip execution payload envelope
831
+ gossipExecutionPayloadEnvelope: {
832
+ elapsedTimeTillReceived: register.histogram<{source: OpSource}>({
833
+ name: "lodestar_gossip_execution_payload_envelope_elapsed_time_till_received",
834
+ help: "Time elapsed between slot time and the time execution payload envelope received",
835
+ labelNames: ["source"],
836
+ buckets: [0.5, 1, 2, 4, 6, 12],
837
+ }),
838
+ },
830
839
  recoverDataColumnSidecars: {
831
840
  recoverTime: register.histogram({
832
841
  name: "lodestar_recover_data_column_sidecar_recover_time_seconds",
@@ -919,6 +928,11 @@ export function createLodestarMetrics(
919
928
  help: "The total result of calling notifyNewPayload execution engine api",
920
929
  labelNames: ["result"],
921
930
  }),
931
+ engineNotifyForkchoiceUpdateResult: register.gauge<{result: ExecutionPayloadStatus}>({
932
+ name: "lodestar_execution_engine_notify_forkchoice_update_result_total",
933
+ help: "The total result of calling notifyForkchoiceUpdate execution engine api",
934
+ labelNames: ["result"],
935
+ }),
922
936
  backfillSync: {
923
937
  backfilledTillSlot: register.gauge({
924
938
  name: "lodestar_backfill_till_slot",
@@ -19,11 +19,16 @@ export function createMetrics(opts: MetricsOptions, genesisTime: number, externa
19
19
  const lodestar = createLodestarMetrics(register, opts.metadata, genesisTime);
20
20
  const stateTransition = getMetrics(register);
21
21
 
22
- process.on("unhandledRejection", (_error) => {
22
+ const onUnhandledRejection = (_error: unknown): void => {
23
23
  lodestar.unhandledPromiseRejections.inc();
24
- });
24
+ };
25
+ process.on("unhandledRejection", onUnhandledRejection);
25
26
 
26
- const close = collectNodeJSMetrics(register);
27
+ const nodeJsMetricsClose = collectNodeJSMetrics(register);
28
+ const close = (): void => {
29
+ process.removeListener("unhandledRejection", onUnhandledRejection);
30
+ nodeJsMetricsClose();
31
+ };
27
32
 
28
33
  // Merge external registries
29
34
  for (const externalRegister of externalRegistries) {
@@ -89,9 +89,9 @@ export class MonitoringService {
89
89
  }
90
90
 
91
91
  /**
92
- * Stop sending client stats
92
+ * Stop sending client stats and wait for any pending request to complete
93
93
  */
94
- close(): void {
94
+ async close(): Promise<void> {
95
95
  if (this.status === Status.Closed) return;
96
96
  this.status = Status.Closed;
97
97
 
@@ -103,6 +103,7 @@ export class MonitoringService {
103
103
  }
104
104
  if (this.pendingRequest) {
105
105
  this.fetchAbortController?.abort(FetchAbortReason.Close);
106
+ await this.pendingRequest;
106
107
  }
107
108
  }
108
109
 
@@ -1,8 +1,8 @@
1
- import {Connection, PrivateKey} from "@libp2p/interface";
1
+ import type {PeerScoreStatsDump} from "@libp2p/gossipsub/score";
2
+ import type {PublishOpts} from "@libp2p/gossipsub/types";
3
+ import type {Connection, PrivateKey} from "@libp2p/interface";
2
4
  import {peerIdFromPrivateKey} from "@libp2p/peer-id";
3
5
  import {multiaddr} from "@multiformats/multiaddr";
4
- import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score";
5
- import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types";
6
6
  import {routes} from "@lodestar/api";
7
7
  import {BeaconConfig, ForkBoundary} from "@lodestar/config";
8
8
  import type {LoggerNode} from "@lodestar/logger/node";
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
2
  import workerThreads from "node:worker_threads";
3
3
  import {privateKeyToProtobuf} from "@libp2p/crypto/keys";
4
- import {PrivateKey} from "@libp2p/interface";
5
- import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score";
6
- import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types";
4
+ import type {PeerScoreStatsDump} from "@libp2p/gossipsub/score";
5
+ import type {PublishOpts} from "@libp2p/gossipsub/types";
6
+ import type {PrivateKey} from "@libp2p/interface";
7
7
  import {ModuleThread, Thread, Worker, spawn} from "@chainsafe/threads";
8
8
  import {routes} from "@lodestar/api";
9
9
  import {BeaconConfig, chainConfigToJson} from "@lodestar/config";
@@ -1,5 +1,5 @@
1
- import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score";
2
- import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types";
1
+ import type {PeerScoreStatsDump} from "@libp2p/gossipsub/score";
2
+ import type {PublishOpts} from "@libp2p/gossipsub/types";
3
3
  import {routes} from "@lodestar/api";
4
4
  import {SpecJson} from "@lodestar/config";
5
5
  import {LoggerNodeOpts} from "@lodestar/logger/node";
@@ -1,5 +1,6 @@
1
1
  import {EventEmitter} from "node:events";
2
- import {PeerId, TopicValidatorResult} from "@libp2p/interface";
2
+ import type {TopicValidatorResult} from "@libp2p/gossipsub";
3
+ import type {PeerId} from "@libp2p/interface";
3
4
  import {CustodyIndex, Status} from "@lodestar/types";
4
5
  import {PeerIdStr} from "../util/peerId.js";
5
6
  import {StrictEventEmitterSingleArg} from "../util/strictEvents.js";
@@ -1,9 +1,9 @@
1
- import {Message} from "@libp2p/interface";
1
+ import type {Message} from "@libp2p/gossipsub";
2
+ import type {RPC} from "@libp2p/gossipsub/message";
3
+ import type {DataTransform} from "@libp2p/gossipsub/types";
2
4
  // snappyjs is better for compression for smaller payloads
3
5
  import xxhashFactory from "xxhash-wasm";
4
6
  import {digest} from "@chainsafe/as-sha256";
5
- import {RPC} from "@chainsafe/libp2p-gossipsub/message";
6
- import {DataTransform} from "@chainsafe/libp2p-gossipsub/types";
7
7
  import snappyWasm from "@chainsafe/snappy-wasm";
8
8
  import {ForkName} from "@lodestar/params";
9
9
  import {intToBytes} from "@lodestar/utils";
@@ -1,10 +1,18 @@
1
+ import {
2
+ type GossipSub,
3
+ type GossipSubEvents,
4
+ type PublishResult,
5
+ StrictNoSign,
6
+ type TopicValidatorResult,
7
+ gossipsub,
8
+ } from "@libp2p/gossipsub";
9
+ import type {MetricsRegister, TopicLabel, TopicStrToLabel} from "@libp2p/gossipsub/metrics";
10
+ import type {PeerScoreParams, PeerScoreStatsDump} from "@libp2p/gossipsub/score";
11
+ import type {AddrInfo, PublishOpts, TopicStr} from "@libp2p/gossipsub/types";
12
+ import type {PeerId} from "@libp2p/interface";
1
13
  import {peerIdFromString} from "@libp2p/peer-id";
2
14
  import {multiaddr} from "@multiformats/multiaddr";
3
15
  import {ENR} from "@chainsafe/enr";
4
- import {GossipSub, GossipsubEvents} from "@chainsafe/libp2p-gossipsub";
5
- import {MetricsRegister, TopicLabel, TopicStrToLabel} from "@chainsafe/libp2p-gossipsub/metrics";
6
- import {PeerScoreParams} from "@chainsafe/libp2p-gossipsub/score";
7
- import {AddrInfo, SignaturePolicy, TopicStr} from "@chainsafe/libp2p-gossipsub/types";
8
16
  import {routes} from "@lodestar/api";
9
17
  import {BeaconConfig, ForkBoundary} from "@lodestar/config";
10
18
  import {ATTESTATION_SUBNET_COUNT, SLOTS_PER_EPOCH, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params";
@@ -69,6 +77,24 @@ export type Eth2GossipsubOpts = {
69
77
 
70
78
  export type ForkBoundaryLabel = string;
71
79
 
80
+ // Many of the internal properties we need are not available on the public interface,
81
+ // so we create an extended type here to avoid excessive type assertions throughout the codebase.
82
+ // Mind that any updates to the gossipsub package may require updates to this type.
83
+ type GossipSubInternal = GossipSub & {
84
+ mesh: Map<string, Set<string>>;
85
+ peers: Map<string, PeerId>;
86
+ score: {score: (peerIdStr: string) => number};
87
+ direct: Set<string>;
88
+ topics: Map<string, Set<string>>;
89
+ start: () => Promise<void>;
90
+ stop: () => Promise<void>;
91
+ publish: (topic: TopicStr, data: Uint8Array, opts?: PublishOpts) => Promise<PublishResult>;
92
+ getMeshPeers: (topic: TopicStr) => string[];
93
+ dumpPeerScoreStats: () => PeerScoreStatsDump;
94
+ getScore: (peerIdStr: string) => number;
95
+ reportMessageValidationResult: (msgId: string, propagationSource: string, acceptance: TopicValidatorResult) => void;
96
+ };
97
+
72
98
  /**
73
99
  * Wrapper around js-libp2p-gossipsub with the following extensions:
74
100
  * - Eth2 message id
@@ -82,13 +108,14 @@ export type ForkBoundaryLabel = string;
82
108
  *
83
109
  * See https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#the-gossip-domain-gossipsub
84
110
  */
85
- export class Eth2Gossipsub extends GossipSub {
111
+ export class Eth2Gossipsub {
86
112
  readonly scoreParams: Partial<PeerScoreParams>;
87
113
  private readonly config: BeaconConfig;
88
114
  private readonly logger: Logger;
89
115
  private readonly peersData: PeersData;
90
116
  private readonly events: NetworkEventBus;
91
117
  private readonly libp2p: Libp2p;
118
+ private readonly gossipsub: GossipSubInternal;
92
119
 
93
120
  // Internal caches
94
121
  private readonly gossipTopicCache: GossipTopicCache;
@@ -103,9 +130,6 @@ export class Eth2Gossipsub extends GossipSub {
103
130
  let metrics: Eth2GossipsubMetrics | null = null;
104
131
  if (metricsRegister) {
105
132
  metrics = createEth2GossipsubMetrics(metricsRegister);
106
- metrics.gossipMesh.peersByType.addCollect(() =>
107
- this.onScrapeLodestarMetrics(metrics as Eth2GossipsubMetrics, networkConfig)
108
- );
109
133
  }
110
134
 
111
135
  // Parse direct peers from multiaddr strings to AddrInfo objects
@@ -113,8 +137,8 @@ export class Eth2Gossipsub extends GossipSub {
113
137
 
114
138
  // Gossipsub parameters defined here:
115
139
  // https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#the-gossip-domain-gossipsub
116
- super(modules.libp2p.services.components, {
117
- globalSignaturePolicy: SignaturePolicy.StrictNoSign,
140
+ const gossipsubInstance = gossipsub({
141
+ globalSignaturePolicy: StrictNoSign,
118
142
  allowPublishToZeroTopicPeers: allowPublishToZeroPeers,
119
143
  D: gossipsubD ?? GOSSIP_D,
120
144
  Dlo: gossipsubDLow ?? GOSSIP_D_LOW,
@@ -155,7 +179,12 @@ export class Eth2Gossipsub extends GossipSub {
155
179
  // This should be large enough to not send IDONTWANT for "small" messages
156
180
  // See https://github.com/ChainSafe/lodestar/pull/7077#issuecomment-2383679472
157
181
  idontwantMinDataSize: 16829,
158
- });
182
+ })(modules.libp2p.services.components) as GossipSubInternal;
183
+
184
+ if (metrics) {
185
+ metrics.gossipMesh.peersByType.addCollect(() => this.onScrapeLodestarMetrics(metrics, networkConfig));
186
+ }
187
+ this.gossipsub = gossipsubInstance;
159
188
  this.scoreParams = scoreParams;
160
189
  this.config = config;
161
190
  this.logger = logger;
@@ -164,7 +193,7 @@ export class Eth2Gossipsub extends GossipSub {
164
193
  this.libp2p = modules.libp2p;
165
194
  this.gossipTopicCache = gossipTopicCache;
166
195
 
167
- this.addEventListener("gossipsub:message", this.onGossipsubMessage.bind(this));
196
+ this.gossipsub.addEventListener("gossipsub:message", this.onGossipsubMessage.bind(this));
168
197
  this.events.on(NetworkEvent.gossipMessageValidationResult, this.onValidationResult.bind(this));
169
198
 
170
199
  // Having access to this data is CRUCIAL for debugging. While this is a massive log, it must not be deleted.
@@ -174,6 +203,38 @@ export class Eth2Gossipsub extends GossipSub {
174
203
  }
175
204
  }
176
205
 
206
+ async start(): Promise<void> {
207
+ await this.gossipsub.start();
208
+ }
209
+
210
+ async stop(): Promise<void> {
211
+ await this.gossipsub.stop();
212
+ }
213
+
214
+ get mesh(): Map<string, Set<string>> {
215
+ return this.gossipsub.mesh;
216
+ }
217
+
218
+ getTopics(): TopicStr[] {
219
+ return this.gossipsub.getTopics();
220
+ }
221
+
222
+ getMeshPeers(topic: TopicStr): string[] {
223
+ return this.gossipsub.getMeshPeers(topic);
224
+ }
225
+
226
+ publish(topic: TopicStr, data: Uint8Array, opts?: PublishOpts): Promise<PublishResult> {
227
+ return this.gossipsub.publish(topic, data, opts);
228
+ }
229
+
230
+ dumpPeerScoreStats(): PeerScoreStatsDump {
231
+ return this.gossipsub.dumpPeerScoreStats();
232
+ }
233
+
234
+ getScore(peerIdStr: string): number {
235
+ return this.gossipsub.getScore(peerIdStr);
236
+ }
237
+
177
238
  /**
178
239
  * Subscribe to a `GossipTopic`
179
240
  */
@@ -183,7 +244,7 @@ export class Eth2Gossipsub extends GossipSub {
183
244
  this.gossipTopicCache.setTopic(topicStr, topic);
184
245
 
185
246
  this.logger.verbose("Subscribe to gossipsub topic", {topic: topicStr});
186
- this.subscribe(topicStr);
247
+ this.gossipsub.subscribe(topicStr);
187
248
  }
188
249
 
189
250
  /**
@@ -192,15 +253,14 @@ export class Eth2Gossipsub extends GossipSub {
192
253
  unsubscribeTopic(topic: GossipTopic): void {
193
254
  const topicStr = stringifyGossipTopic(this.config, topic);
194
255
  this.logger.verbose("Unsubscribe to gossipsub topic", {topic: topicStr});
195
- this.unsubscribe(topicStr);
256
+ this.gossipsub.unsubscribe(topicStr);
196
257
  }
197
258
 
198
259
  private onScrapeLodestarMetrics(metrics: Eth2GossipsubMetrics, networkConfig: NetworkConfig): void {
199
- const mesh = this.mesh;
200
- // biome-ignore lint/complexity/useLiteralKeys: `topics` is a private attribute
201
- const topics = this["topics"] as Map<string, Set<string>>;
202
- const peers = this.peers;
203
- const score = this.score;
260
+ const mesh = this.gossipsub.mesh;
261
+ const topics = this.gossipsub.topics;
262
+ const peers = this.gossipsub.peers;
263
+ const score = this.gossipsub.score;
204
264
  const meshPeersByClient = new Map<string, number>();
205
265
  const meshPeerIdStrs = new Set<string>();
206
266
 
@@ -305,7 +365,7 @@ export class Eth2Gossipsub extends GossipSub {
305
365
  metrics.gossipPeer.score.set(gossipScores);
306
366
  }
307
367
 
308
- private onGossipsubMessage(event: GossipsubEvents["gossipsub:message"]): void {
368
+ private onGossipsubMessage(event: GossipSubEvents["gossipsub:message"]): void {
309
369
  const {propagationSource, msgId, msg} = event.detail;
310
370
 
311
371
  // Also validates that the topicStr is known
@@ -341,7 +401,7 @@ export class Eth2Gossipsub extends GossipSub {
341
401
  // Without this we'll have huge event loop lag
342
402
  // See https://github.com/ChainSafe/lodestar/issues/5604
343
403
  callInNextEventLoop(() => {
344
- this.reportMessageValidationResult(data.msgId, data.propagationSource, data.acceptance);
404
+ this.gossipsub.reportMessageValidationResult(data.msgId, data.propagationSource, data.acceptance);
345
405
  });
346
406
  }
347
407
 
@@ -379,7 +439,7 @@ export class Eth2Gossipsub extends GossipSub {
379
439
  }
380
440
 
381
441
  // Add to direct peers set only after addresses are stored
382
- this.direct.add(peerIdStr);
442
+ this.gossipsub.direct.add(peerIdStr);
383
443
 
384
444
  this.logger.info("Added direct peer via API", {peerId: peerIdStr});
385
445
  return peerIdStr;
@@ -389,7 +449,7 @@ export class Eth2Gossipsub extends GossipSub {
389
449
  * Remove a peer from direct peers.
390
450
  */
391
451
  removeDirectPeer(peerIdStr: string): boolean {
392
- const removed = this.direct.delete(peerIdStr);
452
+ const removed = this.gossipsub.direct.delete(peerIdStr);
393
453
  if (removed) {
394
454
  this.logger.info("Removed direct peer via API", {peerId: peerIdStr});
395
455
  }
@@ -400,7 +460,7 @@ export class Eth2Gossipsub extends GossipSub {
400
460
  * Get list of current direct peer IDs.
401
461
  */
402
462
  getDirectPeers(): string[] {
403
- return Array.from(this.direct);
463
+ return Array.from(this.gossipsub.direct);
404
464
  }
405
465
  }
406
466
 
@@ -498,7 +558,8 @@ export function parseDirectPeers(directPeerStrs: routes.lodestar.DirectPeer[], l
498
558
  try {
499
559
  const ma = multiaddr(peerStr);
500
560
 
501
- const peerIdStr = ma.getPeerId();
561
+ const peerIdComponent = ma.getComponents().findLast((component) => component.name === "p2p");
562
+ const peerIdStr = peerIdComponent?.value;
502
563
  if (!peerIdStr) {
503
564
  logger.warn("Direct peer multiaddr must contain /p2p/ component with peer ID", {multiaddr: peerStr});
504
565
  continue;
@@ -1,9 +1,10 @@
1
- import {Message, TopicValidatorResult} from "@libp2p/interface";
2
- import {Libp2p} from "libp2p";
3
- import {PeerIdStr} from "@chainsafe/libp2p-gossipsub/types";
1
+ import type {Message, TopicValidatorResult} from "@libp2p/gossipsub";
2
+ import type {PeerIdStr} from "@libp2p/gossipsub/types";
3
+ import type {Libp2p} from "libp2p";
4
4
  import {BeaconConfig, ForkBoundary} from "@lodestar/config";
5
5
  import {
6
6
  AttesterSlashing,
7
+ DataColumnSidecar,
7
8
  LightClientFinalityUpdate,
8
9
  LightClientOptimisticUpdate,
9
10
  SignedAggregateAndProof,
@@ -14,7 +15,6 @@ import {
14
15
  altair,
15
16
  capella,
16
17
  deneb,
17
- fulu,
18
18
  gloas,
19
19
  phase0,
20
20
  } from "@lodestar/types";
@@ -98,7 +98,7 @@ export type GossipTypeMap = {
98
98
  [GossipType.blob_sidecar]: deneb.BlobSidecar;
99
99
  [GossipType.beacon_aggregate_and_proof]: SignedAggregateAndProof;
100
100
  [GossipType.beacon_attestation]: SingleAttestation;
101
- [GossipType.data_column_sidecar]: fulu.DataColumnSidecar;
101
+ [GossipType.data_column_sidecar]: DataColumnSidecar;
102
102
  [GossipType.voluntary_exit]: phase0.SignedVoluntaryExit;
103
103
  [GossipType.proposer_slashing]: phase0.ProposerSlashing;
104
104
  [GossipType.attester_slashing]: AttesterSlashing;
@@ -117,7 +117,7 @@ export type GossipFnByType = {
117
117
  [GossipType.blob_sidecar]: (blobSidecar: deneb.BlobSidecar) => Promise<void> | void;
118
118
  [GossipType.beacon_aggregate_and_proof]: (aggregateAndProof: SignedAggregateAndProof) => Promise<void> | void;
119
119
  [GossipType.beacon_attestation]: (attestation: SingleAttestation) => Promise<void> | void;
120
- [GossipType.data_column_sidecar]: (dataColumnSidecar: fulu.DataColumnSidecar) => Promise<void> | void;
120
+ [GossipType.data_column_sidecar]: (dataColumnSidecar: DataColumnSidecar) => Promise<void> | void;
121
121
  [GossipType.voluntary_exit]: (voluntaryExit: phase0.SignedVoluntaryExit) => Promise<void> | void;
122
122
  [GossipType.proposer_slashing]: (proposerSlashing: phase0.ProposerSlashing) => Promise<void> | void;
123
123
  [GossipType.attester_slashing]: (attesterSlashing: AttesterSlashing) => Promise<void> | void;
@@ -1,9 +1,9 @@
1
1
  import {
2
- PeerScoreParams,
3
- PeerScoreThresholds,
4
- TopicScoreParams,
2
+ type PeerScoreParams,
3
+ type PeerScoreThresholds,
4
+ type TopicScoreParams,
5
5
  defaultTopicScoreParams,
6
- } from "@chainsafe/libp2p-gossipsub/score";
6
+ } from "@libp2p/gossipsub/score";
7
7
  import {BeaconConfig} from "@lodestar/config";
8
8
  import {ATTESTATION_SUBNET_COUNT, PTC_SIZE, SLOTS_PER_EPOCH, TARGET_AGGREGATORS_PER_COMMITTEE} from "@lodestar/params";
9
9
  import {computeCommitteeCount} from "@lodestar/state-transition";
@@ -6,6 +6,7 @@ import {
6
6
  SYNC_COMMITTEE_SUBNET_COUNT,
7
7
  isForkPostAltair,
8
8
  isForkPostElectra,
9
+ isForkPostFulu,
9
10
  } from "@lodestar/params";
10
11
  import {Attestation, SingleAttestation, ssz, sszTypesFor} from "@lodestar/types";
11
12
  import {GossipAction, GossipActionError, GossipErrorCode} from "../../chain/errors/gossipValidation.js";
@@ -92,7 +93,7 @@ export function getGossipSSZType(topic: GossipTopic) {
92
93
  case GossipType.blob_sidecar:
93
94
  return ssz.deneb.BlobSidecar;
94
95
  case GossipType.data_column_sidecar:
95
- return ssz.fulu.DataColumnSidecar;
96
+ return isForkPostFulu(fork) ? sszTypesFor(fork).DataColumnSidecar : ssz.fulu.DataColumnSidecar;
96
97
  case GossipType.beacon_aggregate_and_proof:
97
98
  return sszTypesFor(fork).SignedAggregateAndProof;
98
99
  case GossipType.beacon_attestation:
@@ -1,5 +1,5 @@
1
- import {Identify} from "@libp2p/identify";
2
- import {
1
+ import type {Identify} from "@libp2p/identify";
2
+ import type {
3
3
  ComponentLogger,
4
4
  ConnectionGater,
5
5
  ConnectionProtector,
@@ -16,9 +16,10 @@ import {
16
16
  } from "@libp2p/interface";
17
17
  import type {AddressManager, ConnectionManager, Registrar, TransportManager} from "@libp2p/interface-internal";
18
18
  import type {Datastore} from "interface-datastore";
19
- import {Libp2p as ILibp2p} from "libp2p";
19
+ import type {Libp2p as ILibp2p} from "libp2p";
20
20
  import {
21
21
  AttesterSlashing,
22
+ DataColumnSidecar,
22
23
  LightClientFinalityUpdate,
23
24
  LightClientOptimisticUpdate,
24
25
  SignedAggregateAndProof,
@@ -31,6 +32,7 @@ import {
31
32
  capella,
32
33
  deneb,
33
34
  fulu,
35
+ gloas,
34
36
  phase0,
35
37
  } from "@lodestar/types";
36
38
  import {BlockInputSource} from "../chain/blocks/blockInput/types.js";
@@ -86,7 +88,7 @@ export interface INetwork extends INetworkCorePublic {
86
88
  publishBlobSidecar(blobSidecar: deneb.BlobSidecar): Promise<number>;
87
89
  publishBeaconAggregateAndProof(aggregateAndProof: SignedAggregateAndProof): Promise<number>;
88
90
  publishBeaconAttestation(attestation: SingleAttestation, subnet: SubnetID): Promise<number>;
89
- publishDataColumnSidecar(dataColumnSideCar: fulu.DataColumnSidecar): Promise<number>;
91
+ publishDataColumnSidecar(dataColumnSideCar: DataColumnSidecar): Promise<number>;
90
92
  publishVoluntaryExit(voluntaryExit: phase0.SignedVoluntaryExit): Promise<number>;
91
93
  publishBlsToExecutionChange(blsToExecutionChange: capella.SignedBLSToExecutionChange): Promise<number>;
92
94
  publishProposerSlashing(proposerSlashing: phase0.ProposerSlashing): Promise<number>;
@@ -95,6 +97,7 @@ export interface INetwork extends INetworkCorePublic {
95
97
  publishContributionAndProof(contributionAndProof: altair.SignedContributionAndProof): Promise<number>;
96
98
  publishLightClientFinalityUpdate(update: LightClientFinalityUpdate): Promise<number>;
97
99
  publishLightClientOptimisticUpdate(update: LightClientOptimisticUpdate): Promise<number>;
100
+ publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number>;
98
101
 
99
102
  // Debug
100
103
  dumpGossipQueue(gossipType: GossipType): Promise<PendingGossipsubMessage[]>;
@@ -1,6 +1,6 @@
1
1
  import {bootstrap} from "@libp2p/bootstrap";
2
2
  import {identify} from "@libp2p/identify";
3
- import {PrivateKey} from "@libp2p/interface";
3
+ import type {PrivateKey} from "@libp2p/interface";
4
4
  import {mdns} from "@libp2p/mdns";
5
5
  import {mplex} from "@libp2p/mplex";
6
6
  import {prometheusMetrics} from "@libp2p/prometheus-metrics";
@@ -39,6 +39,7 @@ export async function createNodeJsLibp2p(
39
39
  nodeJsLibp2pOpts: NodeJsLibp2pOpts = {}
40
40
  ): Promise<Libp2p> {
41
41
  const localMultiaddrs = networkOpts.localMultiaddrs || defaultNetworkOptions.localMultiaddrs;
42
+ const disconnectThreshold = networkOpts.disconnectThreshold ?? defaultNetworkOptions.disconnectThreshold;
42
43
  const {peerStoreDir, disablePeerDiscovery} = nodeJsLibp2pOpts;
43
44
 
44
45
  let datastore: undefined | Eth2PeerDataStore = undefined;
@@ -72,8 +73,37 @@ export async function createNodeJsLibp2p(
72
73
  noiseCrypto.chaCha20Poly1305Encrypt = asCrypto.chaCha20Poly1305Encrypt;
73
74
  }
74
75
 
76
+ const libp2pMetrics = nodeJsLibp2pOpts.metrics
77
+ ? (components: LodestarComponents) => {
78
+ const metrics = prometheusMetrics({
79
+ collectDefaultMetrics: false,
80
+ preserveExistingMetrics: true,
81
+ registry: nodeJsLibp2pOpts.metricsRegistry,
82
+ })(components);
83
+
84
+ // Work around identify EOF race:
85
+ // `trackProtocolStream` attaches a `message` listener immediately after protocol
86
+ // negotiation. For `/ipfs/id/1.0.0`, identify() adds its own reader later and can
87
+ // miss the first response frame when metrics listener drains events first.
88
+ const originalTrackProtocolStream = metrics.trackProtocolStream.bind(metrics);
89
+ metrics.trackProtocolStream = ((stream) => {
90
+ if (stream.protocol === "/ipfs/id/1.0.0") {
91
+ return;
92
+ }
93
+ originalTrackProtocolStream(stream);
94
+ }) as typeof metrics.trackProtocolStream;
95
+
96
+ return metrics;
97
+ }
98
+ : undefined;
99
+
75
100
  return createLibp2p({
76
101
  privateKey,
102
+ nodeInfo: {
103
+ name: "lodestar",
104
+ version: networkOpts.version ?? "unknown",
105
+ userAgent: networkOpts.private ? "" : networkOpts.version ? `lodestar/${networkOpts.version}` : "lodestar",
106
+ },
77
107
  addresses: {
78
108
  listen: localMultiaddrs,
79
109
  announce: [],
@@ -93,15 +123,9 @@ export async function createNodeJsLibp2p(
93
123
  },
94
124
  }),
95
125
  ],
96
- streamMuxers: [mplex({maxInboundStreams: 256, disconnectThreshold: networkOpts.disconnectThreshold})],
126
+ streamMuxers: [mplex({disconnectThreshold})],
97
127
  peerDiscovery,
98
- metrics: nodeJsLibp2pOpts.metrics
99
- ? prometheusMetrics({
100
- collectDefaultMetrics: false,
101
- preserveExistingMetrics: true,
102
- registry: nodeJsLibp2pOpts.metricsRegistry,
103
- })
104
- : undefined,
128
+ metrics: libp2pMetrics,
105
129
  connectionManager: {
106
130
  // dialer config
107
131
  maxParallelDials: 100,
@@ -124,7 +148,6 @@ export async function createNodeJsLibp2p(
124
148
  datastore,
125
149
  services: {
126
150
  identify: identify({
127
- agentVersion: networkOpts.private ? "" : networkOpts.version ? `lodestar/${networkOpts.version}` : "lodestar",
128
151
  runOnConnectionOpen: false,
129
152
  }),
130
153
  // individual components are specified because the components object is a Proxy