@lodestar/beacon-node 1.39.1 → 1.40.0-dev.193b2e2047

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 (434) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +8 -18
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/utils.d.ts +2 -7
  5. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  6. package/lib/api/impl/beacon/state/utils.js +0 -12
  7. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  8. package/lib/api/impl/config/constants.d.ts +3 -0
  9. package/lib/api/impl/config/constants.d.ts.map +1 -1
  10. package/lib/api/impl/config/constants.js +5 -1
  11. package/lib/api/impl/config/constants.js.map +1 -1
  12. package/lib/api/impl/debug/index.d.ts +1 -1
  13. package/lib/api/impl/debug/index.d.ts.map +1 -1
  14. package/lib/api/impl/debug/index.js +3 -6
  15. package/lib/api/impl/debug/index.js.map +1 -1
  16. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  17. package/lib/api/impl/lodestar/index.js +6 -3
  18. package/lib/api/impl/lodestar/index.js.map +1 -1
  19. package/lib/api/impl/proof/index.d.ts.map +1 -1
  20. package/lib/api/impl/proof/index.js +1 -2
  21. package/lib/api/impl/proof/index.js.map +1 -1
  22. package/lib/api/impl/validator/index.d.ts.map +1 -1
  23. package/lib/api/impl/validator/index.js +10 -11
  24. package/lib/api/impl/validator/index.js.map +1 -1
  25. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  26. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -3
  27. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  28. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  29. package/lib/chain/archiveStore/utils/archiveBlocks.js +23 -14
  30. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  31. package/lib/chain/blocks/blockInput/blockInput.d.ts +2 -0
  32. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  33. package/lib/chain/blocks/blockInput/blockInput.js +6 -0
  34. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  35. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  36. package/lib/chain/blocks/importBlock.js +14 -9
  37. package/lib/chain/blocks/importBlock.js.map +1 -1
  38. package/lib/chain/blocks/index.d.ts.map +1 -1
  39. package/lib/chain/blocks/index.js +0 -14
  40. package/lib/chain/blocks/index.js.map +1 -1
  41. package/lib/chain/blocks/types.d.ts +0 -2
  42. package/lib/chain/blocks/types.d.ts.map +1 -1
  43. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  44. package/lib/chain/blocks/verifyBlock.js +9 -9
  45. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  46. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  47. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  49. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  50. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  51. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
  52. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  53. package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
  54. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  55. package/lib/chain/blocks/writeBlockInputToDb.js +20 -28
  56. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  57. package/lib/chain/bls/multithread/index.d.ts +3 -1
  58. package/lib/chain/bls/multithread/index.d.ts.map +1 -1
  59. package/lib/chain/bls/multithread/index.js +5 -3
  60. package/lib/chain/bls/multithread/index.js.map +1 -1
  61. package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
  62. package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
  63. package/lib/chain/bls/multithread/jobItem.js +2 -2
  64. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  65. package/lib/chain/bls/singleThread.d.ts +4 -2
  66. package/lib/chain/bls/singleThread.d.ts.map +1 -1
  67. package/lib/chain/bls/singleThread.js +4 -2
  68. package/lib/chain/bls/singleThread.js.map +1 -1
  69. package/lib/chain/bls/utils.d.ts +2 -2
  70. package/lib/chain/bls/utils.d.ts.map +1 -1
  71. package/lib/chain/bls/utils.js +9 -6
  72. package/lib/chain/bls/utils.js.map +1 -1
  73. package/lib/chain/chain.d.ts +24 -6
  74. package/lib/chain/chain.d.ts.map +1 -1
  75. package/lib/chain/chain.js +196 -21
  76. package/lib/chain/chain.js.map +1 -1
  77. package/lib/chain/errors/attestationError.d.ts +14 -1
  78. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  79. package/lib/chain/errors/attestationError.js +8 -0
  80. package/lib/chain/errors/attestationError.js.map +1 -1
  81. package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
  82. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
  83. package/lib/chain/errors/executionPayloadBid.js +15 -0
  84. package/lib/chain/errors/executionPayloadBid.js.map +1 -0
  85. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  86. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
  87. package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
  88. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
  89. package/lib/chain/errors/index.d.ts +3 -0
  90. package/lib/chain/errors/index.d.ts.map +1 -1
  91. package/lib/chain/errors/index.js +3 -0
  92. package/lib/chain/errors/index.js.map +1 -1
  93. package/lib/chain/errors/payloadAttestation.d.ts +34 -0
  94. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
  95. package/lib/chain/errors/payloadAttestation.js +13 -0
  96. package/lib/chain/errors/payloadAttestation.js.map +1 -0
  97. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  98. package/lib/chain/forkChoice/index.js +18 -0
  99. package/lib/chain/forkChoice/index.js.map +1 -1
  100. package/lib/chain/initState.d.ts +1 -1
  101. package/lib/chain/initState.d.ts.map +1 -1
  102. package/lib/chain/initState.js +5 -3
  103. package/lib/chain/initState.js.map +1 -1
  104. package/lib/chain/interface.d.ts +23 -5
  105. package/lib/chain/interface.d.ts.map +1 -1
  106. package/lib/chain/interface.js.map +1 -1
  107. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  108. package/lib/chain/lightClient/proofs.js +0 -2
  109. package/lib/chain/lightClient/proofs.js.map +1 -1
  110. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +5 -9
  111. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  112. package/lib/chain/opPools/aggregatedAttestationPool.js +12 -141
  113. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  114. package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
  115. package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
  116. package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
  117. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
  118. package/lib/chain/opPools/index.d.ts +2 -0
  119. package/lib/chain/opPools/index.d.ts.map +1 -1
  120. package/lib/chain/opPools/index.js +2 -0
  121. package/lib/chain/opPools/index.js.map +1 -1
  122. package/lib/chain/opPools/opPool.js +5 -8
  123. package/lib/chain/opPools/opPool.js.map +1 -1
  124. package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
  125. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
  126. package/lib/chain/opPools/payloadAttestationPool.js +109 -0
  127. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
  128. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  129. package/lib/chain/prepareNextSlot.js +9 -10
  130. package/lib/chain/prepareNextSlot.js.map +1 -1
  131. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
  132. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  133. package/lib/chain/produceBlock/produceBlockBody.js +6 -4
  134. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  135. package/lib/chain/regen/interface.d.ts +4 -13
  136. package/lib/chain/regen/interface.d.ts.map +1 -1
  137. package/lib/chain/regen/interface.js +1 -1
  138. package/lib/chain/regen/interface.js.map +1 -1
  139. package/lib/chain/regen/queued.d.ts +5 -9
  140. package/lib/chain/regen/queued.d.ts.map +1 -1
  141. package/lib/chain/regen/queued.js +16 -40
  142. package/lib/chain/regen/queued.js.map +1 -1
  143. package/lib/chain/regen/regen.d.ts +4 -8
  144. package/lib/chain/regen/regen.d.ts.map +1 -1
  145. package/lib/chain/regen/regen.js +16 -33
  146. package/lib/chain/regen/regen.js.map +1 -1
  147. package/lib/chain/seenCache/index.d.ts +3 -1
  148. package/lib/chain/seenCache/index.d.ts.map +1 -1
  149. package/lib/chain/seenCache/index.js +3 -1
  150. package/lib/chain/seenCache/index.js.map +1 -1
  151. package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
  152. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  153. package/lib/chain/seenCache/seenAttesters.js +5 -0
  154. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  155. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
  156. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
  157. package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
  158. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
  159. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
  160. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
  161. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
  162. package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
  163. package/lib/chain/shufflingCache.d.ts +16 -11
  164. package/lib/chain/shufflingCache.d.ts.map +1 -1
  165. package/lib/chain/shufflingCache.js +47 -41
  166. package/lib/chain/shufflingCache.js.map +1 -1
  167. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
  168. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
  169. package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
  170. package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
  171. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
  172. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  173. package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
  174. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  175. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
  176. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
  177. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
  178. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
  179. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -6
  180. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  181. package/lib/chain/stateCache/persistentCheckpointsCache.js +17 -17
  182. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  183. package/lib/chain/stateCache/types.d.ts +5 -6
  184. package/lib/chain/stateCache/types.d.ts.map +1 -1
  185. package/lib/chain/stateCache/types.js.map +1 -1
  186. package/lib/chain/validation/aggregateAndProof.js +35 -14
  187. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  188. package/lib/chain/validation/attestation.d.ts +2 -2
  189. package/lib/chain/validation/attestation.d.ts.map +1 -1
  190. package/lib/chain/validation/attestation.js +28 -9
  191. package/lib/chain/validation/attestation.js.map +1 -1
  192. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  193. package/lib/chain/validation/attesterSlashing.js +2 -2
  194. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  195. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  196. package/lib/chain/validation/blobSidecar.js +3 -3
  197. package/lib/chain/validation/blobSidecar.js.map +1 -1
  198. package/lib/chain/validation/block.d.ts.map +1 -1
  199. package/lib/chain/validation/block.js +7 -4
  200. package/lib/chain/validation/block.js.map +1 -1
  201. package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
  202. package/lib/chain/validation/blsToExecutionChange.js +9 -2
  203. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  204. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  205. package/lib/chain/validation/dataColumnSidecar.js +3 -3
  206. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  207. package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
  208. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
  209. package/lib/chain/validation/executionPayloadBid.js +104 -0
  210. package/lib/chain/validation/executionPayloadBid.js.map +1 -0
  211. package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
  212. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
  213. package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
  214. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
  215. package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
  216. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
  217. package/lib/chain/validation/payloadAttestationMessage.js +72 -0
  218. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
  219. package/lib/chain/validation/proposerSlashing.js +3 -2
  220. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  221. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
  222. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  223. package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
  224. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  225. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  226. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  227. package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
  228. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  229. package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
  230. package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
  231. package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
  232. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  233. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  234. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  235. package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
  236. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  237. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
  238. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  239. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  240. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  241. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  242. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  243. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  244. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  245. package/lib/chain/validation/syncCommittee.js +1 -1
  246. package/lib/chain/validation/syncCommittee.js.map +1 -1
  247. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  248. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
  249. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  250. package/lib/chain/validation/voluntaryExit.js +1 -1
  251. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  252. package/lib/chain/validatorMonitor.d.ts +2 -0
  253. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  254. package/lib/chain/validatorMonitor.js +42 -3
  255. package/lib/chain/validatorMonitor.js.map +1 -1
  256. package/lib/db/repositories/checkpointState.d.ts +2 -6
  257. package/lib/db/repositories/checkpointState.d.ts.map +1 -1
  258. package/lib/db/repositories/checkpointState.js +3 -16
  259. package/lib/db/repositories/checkpointState.js.map +1 -1
  260. package/lib/db/repositories/stateArchive.d.ts +9 -9
  261. package/lib/db/repositories/stateArchive.d.ts.map +1 -1
  262. package/lib/db/repositories/stateArchive.js +6 -21
  263. package/lib/db/repositories/stateArchive.js.map +1 -1
  264. package/lib/execution/engine/mock.d.ts +9 -6
  265. package/lib/execution/engine/mock.d.ts.map +1 -1
  266. package/lib/execution/engine/mock.js +34 -7
  267. package/lib/execution/engine/mock.js.map +1 -1
  268. package/lib/index.d.ts +1 -1
  269. package/lib/index.d.ts.map +1 -1
  270. package/lib/index.js +1 -1
  271. package/lib/index.js.map +1 -1
  272. package/lib/metrics/metrics/lodestar.d.ts +28 -6
  273. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  274. package/lib/metrics/metrics/lodestar.js +67 -17
  275. package/lib/metrics/metrics/lodestar.js.map +1 -1
  276. package/lib/network/gossip/interface.d.ts +20 -2
  277. package/lib/network/gossip/interface.d.ts.map +1 -1
  278. package/lib/network/gossip/interface.js +3 -0
  279. package/lib/network/gossip/interface.js.map +1 -1
  280. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  281. package/lib/network/gossip/scoringParameters.js +38 -2
  282. package/lib/network/gossip/scoringParameters.js.map +1 -1
  283. package/lib/network/gossip/topic.d.ts +77 -1
  284. package/lib/network/gossip/topic.d.ts.map +1 -1
  285. package/lib/network/gossip/topic.js +20 -0
  286. package/lib/network/gossip/topic.js.map +1 -1
  287. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  288. package/lib/network/processor/gossipHandlers.js +34 -3
  289. package/lib/network/processor/gossipHandlers.js.map +1 -1
  290. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  291. package/lib/network/processor/gossipQueues/index.js +16 -0
  292. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  293. package/lib/network/processor/index.d.ts.map +1 -1
  294. package/lib/network/processor/index.js +3 -0
  295. package/lib/network/processor/index.js.map +1 -1
  296. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  297. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
  298. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  299. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
  300. package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
  301. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
  302. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  303. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
  304. package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
  305. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
  306. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  307. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  308. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
  309. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  310. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
  311. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
  312. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  313. package/lib/network/reqresp/handlers/index.js +2 -2
  314. package/lib/network/reqresp/handlers/index.js.map +1 -1
  315. package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
  316. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  317. package/lib/node/nodejs.d.ts.map +1 -1
  318. package/lib/node/nodejs.js +17 -2
  319. package/lib/node/nodejs.js.map +1 -1
  320. package/lib/sync/backfill/backfill.js +2 -2
  321. package/lib/sync/backfill/backfill.js.map +1 -1
  322. package/lib/sync/backfill/verify.d.ts +1 -2
  323. package/lib/sync/backfill/verify.d.ts.map +1 -1
  324. package/lib/sync/backfill/verify.js +2 -2
  325. package/lib/sync/backfill/verify.js.map +1 -1
  326. package/lib/sync/range/chain.d.ts.map +1 -1
  327. package/lib/sync/range/chain.js +0 -1
  328. package/lib/sync/range/chain.js.map +1 -1
  329. package/lib/sync/range/range.d.ts.map +1 -1
  330. package/lib/sync/range/range.js +0 -3
  331. package/lib/sync/range/range.js.map +1 -1
  332. package/lib/sync/unknownBlock.d.ts.map +1 -1
  333. package/lib/sync/unknownBlock.js +0 -3
  334. package/lib/sync/unknownBlock.js.map +1 -1
  335. package/lib/util/sszBytes.js +1 -1
  336. package/lib/util/sszBytes.js.map +1 -1
  337. package/package.json +15 -15
  338. package/src/api/impl/beacon/blocks/index.ts +8 -18
  339. package/src/api/impl/beacon/state/utils.ts +2 -22
  340. package/src/api/impl/config/constants.ts +8 -0
  341. package/src/api/impl/debug/index.ts +2 -6
  342. package/src/api/impl/lodestar/index.ts +7 -4
  343. package/src/api/impl/proof/index.ts +1 -2
  344. package/src/api/impl/validator/index.ts +13 -14
  345. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -3
  346. package/src/chain/archiveStore/utils/archiveBlocks.ts +25 -14
  347. package/src/chain/blocks/blockInput/blockInput.ts +8 -0
  348. package/src/chain/blocks/importBlock.ts +15 -9
  349. package/src/chain/blocks/index.ts +0 -19
  350. package/src/chain/blocks/types.ts +0 -2
  351. package/src/chain/blocks/verifyBlock.ts +9 -12
  352. package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
  353. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
  354. package/src/chain/blocks/writeBlockInputToDb.ts +24 -30
  355. package/src/chain/bls/multithread/index.ts +7 -4
  356. package/src/chain/bls/multithread/jobItem.ts +7 -3
  357. package/src/chain/bls/singleThread.ts +5 -3
  358. package/src/chain/bls/utils.ts +15 -7
  359. package/src/chain/chain.ts +225 -32
  360. package/src/chain/errors/attestationError.ts +11 -1
  361. package/src/chain/errors/executionPayloadBid.ts +35 -0
  362. package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
  363. package/src/chain/errors/index.ts +3 -0
  364. package/src/chain/errors/payloadAttestation.ts +25 -0
  365. package/src/chain/forkChoice/index.ts +19 -0
  366. package/src/chain/initState.ts +5 -3
  367. package/src/chain/interface.ts +34 -3
  368. package/src/chain/lightClient/proofs.ts +0 -2
  369. package/src/chain/opPools/aggregatedAttestationPool.ts +19 -191
  370. package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
  371. package/src/chain/opPools/index.ts +2 -0
  372. package/src/chain/opPools/opPool.ts +5 -7
  373. package/src/chain/opPools/payloadAttestationPool.ts +157 -0
  374. package/src/chain/prepareNextSlot.ts +8 -12
  375. package/src/chain/produceBlock/produceBlockBody.ts +13 -6
  376. package/src/chain/regen/interface.ts +3 -17
  377. package/src/chain/regen/queued.ts +17 -56
  378. package/src/chain/regen/regen.ts +16 -42
  379. package/src/chain/seenCache/index.ts +3 -1
  380. package/src/chain/seenCache/seenAttesters.ts +5 -0
  381. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
  382. package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
  383. package/src/chain/shufflingCache.ts +67 -50
  384. package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
  385. package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
  386. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
  387. package/src/chain/stateCache/persistentCheckpointsCache.ts +17 -25
  388. package/src/chain/stateCache/types.ts +5 -10
  389. package/src/chain/validation/aggregateAndProof.ts +36 -14
  390. package/src/chain/validation/attestation.ts +36 -19
  391. package/src/chain/validation/attesterSlashing.ts +9 -7
  392. package/src/chain/validation/blobSidecar.ts +2 -7
  393. package/src/chain/validation/block.ts +8 -4
  394. package/src/chain/validation/blsToExecutionChange.ts +9 -7
  395. package/src/chain/validation/dataColumnSidecar.ts +2 -7
  396. package/src/chain/validation/executionPayloadBid.ts +141 -0
  397. package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
  398. package/src/chain/validation/payloadAttestationMessage.ts +109 -0
  399. package/src/chain/validation/proposerSlashing.ts +3 -7
  400. package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
  401. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
  402. package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
  403. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
  404. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
  405. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
  406. package/src/chain/validation/syncCommittee.ts +1 -1
  407. package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
  408. package/src/chain/validation/voluntaryExit.ts +1 -1
  409. package/src/chain/validatorMonitor.ts +52 -3
  410. package/src/db/repositories/checkpointState.ts +3 -19
  411. package/src/db/repositories/stateArchive.ts +13 -27
  412. package/src/execution/engine/mock.ts +40 -13
  413. package/src/index.ts +1 -1
  414. package/src/metrics/metrics/lodestar.ts +68 -17
  415. package/src/network/gossip/interface.ts +17 -0
  416. package/src/network/gossip/scoringParameters.ts +44 -2
  417. package/src/network/gossip/topic.ts +21 -0
  418. package/src/network/processor/gossipHandlers.ts +48 -3
  419. package/src/network/processor/gossipQueues/index.ts +16 -0
  420. package/src/network/processor/index.ts +3 -0
  421. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
  422. package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
  423. package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
  424. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
  425. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
  426. package/src/network/reqresp/handlers/index.ts +2 -2
  427. package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
  428. package/src/node/nodejs.ts +18 -3
  429. package/src/sync/backfill/backfill.ts +2 -2
  430. package/src/sync/backfill/verify.ts +2 -3
  431. package/src/sync/range/chain.ts +0 -1
  432. package/src/sync/range/range.ts +0 -3
  433. package/src/sync/unknownBlock.ts +0 -3
  434. package/src/util/sszBytes.ts +1 -1
@@ -1,39 +1,25 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
- import {Db, Repository} from "@lodestar/db";
3
- import {BeaconStateAllForks} from "@lodestar/state-transition";
4
- import {Epoch, Root, RootHex, Slot, ssz} from "@lodestar/types";
2
+ import {BinaryRepository, Db} from "@lodestar/db";
3
+ import {Root, RootHex, Slot} from "@lodestar/types";
5
4
  import {bytesToInt, toHex} from "@lodestar/utils";
6
- import {getStateTypeFromBytes} from "../../util/multifork.js";
7
5
  import {Bucket, getBucketNameByValue} from "../buckets.js";
8
6
  import {getRootIndex, getRootIndexKey, storeRootIndex} from "./stateArchiveIndex.js";
9
7
 
10
- export class StateArchiveRepository extends Repository<Slot, BeaconStateAllForks> {
8
+ export type BeaconStateArchive = {
9
+ serialize(): Uint8Array;
10
+ hashTreeRoot(): Root;
11
+ };
12
+
13
+ export class StateArchiveRepository extends BinaryRepository<Slot> {
11
14
  constructor(config: ChainForkConfig, db: Db) {
12
- // Pick some type but won't be used. Casted to any because no type can match `BeaconStateAllForks`
13
- // biome-ignore lint/suspicious/noExplicitAny: We need to use `any` type here
14
- const type = ssz.phase0.BeaconState as any;
15
15
  const bucket = Bucket.allForks_stateArchive;
16
- super(config, db, bucket, type, getBucketNameByValue(bucket));
17
- }
18
-
19
- // Overrides for multi-fork
20
-
21
- encodeValue(value: BeaconStateAllForks): Uint8Array {
22
- return value.serialize();
23
- }
24
-
25
- decodeValue(data: Uint8Array): BeaconStateAllForks {
26
- return getStateTypeFromBytes(this.config, data).deserializeToViewDU(data);
16
+ super(config, db, bucket, getBucketNameByValue(bucket));
27
17
  }
28
18
 
29
19
  // Handle key as slot
30
20
 
31
- async put(key: Slot, value: BeaconStateAllForks): Promise<void> {
32
- await Promise.all([super.put(key, value), storeRootIndex(this.db, key, value.hashTreeRoot())]);
33
- }
34
-
35
- getId(state: BeaconStateAllForks): Epoch {
36
- return state.slot;
21
+ async put(key: Slot, value: BeaconStateArchive): Promise<void> {
22
+ await Promise.all([super.putBinary(key, value.serialize()), storeRootIndex(this.db, key, value.hashTreeRoot())]);
37
23
  }
38
24
 
39
25
  decodeKey(data: Uint8Array): number {
@@ -42,10 +28,10 @@ export class StateArchiveRepository extends Repository<Slot, BeaconStateAllForks
42
28
 
43
29
  // Index Root -> Slot
44
30
 
45
- async getByRoot(stateRoot: Root): Promise<BeaconStateAllForks | null> {
31
+ async getBinaryByRoot(stateRoot: Root): Promise<Uint8Array | null> {
46
32
  const slot = await this.getSlotByRoot(stateRoot);
47
33
  if (slot !== null && Number.isInteger(slot)) {
48
- return this.get(slot);
34
+ return this.getBinary(slot);
49
35
  }
50
36
  return null;
51
37
  }
@@ -1,4 +1,5 @@
1
1
  import crypto from "node:crypto";
2
+ import {ChainConfig} from "@lodestar/config";
2
3
  import {
3
4
  BLOB_TX_TYPE,
4
5
  BYTES_PER_FIELD_ELEMENT,
@@ -7,7 +8,9 @@ import {
7
8
  ForkPostBellatrix,
8
9
  ForkPostCapella,
9
10
  ForkSeq,
11
+ SLOTS_PER_EPOCH,
10
12
  } from "@lodestar/params";
13
+ import {computeTimeAtSlot} from "@lodestar/state-transition";
11
14
  import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
12
15
  import {fromHex, toRootHex} from "@lodestar/utils";
13
16
  import {ZERO_HASH_HEX} from "../../constants/index.js";
@@ -34,14 +37,11 @@ const INTEROP_GAS_LIMIT = 30e6;
34
37
  const PRUNE_PAYLOAD_ID_AFTER_MS = 5000;
35
38
 
36
39
  export type ExecutionEngineMockOpts = {
37
- genesisBlockHash: string;
40
+ genesisBlockHash?: string;
38
41
  eth1BlockHash?: string;
39
42
  onlyPredefinedResponses?: boolean;
40
- capellaForkTimestamp?: number;
41
- denebForkTimestamp?: number;
42
- electraForkTimestamp?: number;
43
- fuluForkTimestamp?: number;
44
- gloasForkTimestamp?: number;
43
+ genesisTime?: number;
44
+ config?: ChainConfig;
45
45
  };
46
46
 
47
47
  type ExecutionBlock = {
@@ -74,17 +74,21 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
74
74
  /** Preparing payloads to be retrieved via engine_getPayloadV1 */
75
75
  private readonly preparingPayloads = new Map<number, PreparedPayload>();
76
76
  private readonly payloadsForDeletion = new Map<number, number>();
77
-
78
77
  private readonly predefinedPayloadStatuses = new Map<RootHex, PayloadStatus>();
79
78
 
80
79
  private payloadId = 0;
80
+ private capellaForkTimestamp: number;
81
+ private denebForkTimestamp: number;
82
+ private electraForkTimestamp: number;
83
+ private fuluForkTimestamp: number;
84
+ private gloasForkTimestamp: number;
81
85
 
82
86
  readonly handlers: {
83
87
  [K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
84
88
  };
85
89
 
86
90
  constructor(private readonly opts: ExecutionEngineMockOpts) {
87
- this.validBlocks.set(opts.genesisBlockHash, {
91
+ this.validBlocks.set(opts.genesisBlockHash ?? ZERO_HASH_HEX, {
88
92
  parentHash: ZERO_HASH_HEX,
89
93
  blockHash: ZERO_HASH_HEX,
90
94
  timestamp: 0,
@@ -100,6 +104,29 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
100
104
  blockNumber: 1,
101
105
  });
102
106
 
107
+ const {config} = opts;
108
+
109
+ this.capellaForkTimestamp =
110
+ opts.genesisTime && config
111
+ ? computeTimeAtSlot(config, config.CAPELLA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
112
+ : Infinity;
113
+ this.denebForkTimestamp =
114
+ opts.genesisTime && config
115
+ ? computeTimeAtSlot(config, config.DENEB_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
116
+ : Infinity;
117
+ this.electraForkTimestamp =
118
+ opts.genesisTime && config
119
+ ? computeTimeAtSlot(config, config.ELECTRA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
120
+ : Infinity;
121
+ this.fuluForkTimestamp =
122
+ opts.genesisTime && config
123
+ ? computeTimeAtSlot(config, config.FULU_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
124
+ : Infinity;
125
+ this.gloasForkTimestamp =
126
+ opts.genesisTime && config
127
+ ? computeTimeAtSlot(config, config.GLOAS_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
128
+ : Infinity;
129
+
103
130
  this.handlers = {
104
131
  engine_newPayloadV1: this.notifyNewPayload.bind(this),
105
132
  engine_newPayloadV2: this.notifyNewPayload.bind(this),
@@ -448,11 +475,11 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
448
475
  }
449
476
 
450
477
  private timestampToFork(timestamp: number): ForkPostBellatrix {
451
- if (timestamp >= (this.opts.gloasForkTimestamp ?? Infinity)) return ForkName.gloas;
452
- if (timestamp >= (this.opts.fuluForkTimestamp ?? Infinity)) return ForkName.fulu;
453
- if (timestamp >= (this.opts.electraForkTimestamp ?? Infinity)) return ForkName.electra;
454
- if (timestamp >= (this.opts.denebForkTimestamp ?? Infinity)) return ForkName.deneb;
455
- if (timestamp >= (this.opts.capellaForkTimestamp ?? Infinity)) return ForkName.capella;
478
+ if (timestamp >= this.gloasForkTimestamp) return ForkName.gloas;
479
+ if (timestamp >= this.fuluForkTimestamp) return ForkName.fulu;
480
+ if (timestamp >= this.electraForkTimestamp) return ForkName.electra;
481
+ if (timestamp >= this.denebForkTimestamp) return ForkName.deneb;
482
+ if (timestamp >= this.capellaForkTimestamp) return ForkName.capella;
456
483
  return ForkName.bellatrix;
457
484
  }
458
485
  }
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  export type {RestApiServerMetrics, RestApiServerModules, RestApiServerOpts} from "./api/rest/base.js";
4
4
  export {RestApiServer} from "./api/rest/base.js";
5
- export {checkAndPersistAnchorState, initStateFromDb} from "./chain/index.js";
5
+ export {checkAndPersistAnchorState} from "./chain/index.js";
6
6
  export {DbCPStateDatastore} from "./chain/stateCache/datastore/db.js";
7
7
  export {FileCPStateDatastore} from "./chain/stateCache/datastore/file.js";
8
8
  export {BeaconDb, type IBeaconDb} from "./db/index.js";
@@ -212,6 +212,31 @@ export function createLodestarMetrics(
212
212
  }),
213
213
  },
214
214
 
215
+ unfinalizedBlockWritesQueue: {
216
+ length: register.gauge({
217
+ name: "lodestar_unfinalized_block_writes_queue_length",
218
+ help: "Count of total unfinalized block writes queue length",
219
+ }),
220
+ droppedJobs: register.gauge({
221
+ name: "lodestar_unfinalized_block_writes_queue_dropped_jobs_total",
222
+ help: "Count of total unfinalized block writes queue dropped jobs",
223
+ }),
224
+ jobTime: register.histogram({
225
+ name: "lodestar_unfinalized_block_writes_queue_job_time_seconds",
226
+ help: "Time to process unfinalized block writes queue job in seconds",
227
+ buckets: [0.01, 0.1, 1, 4, 12],
228
+ }),
229
+ jobWaitTime: register.histogram({
230
+ name: "lodestar_unfinalized_block_writes_queue_job_wait_time_seconds",
231
+ help: "Time from job added to the unfinalized block writes queue to starting in seconds",
232
+ buckets: [0.01, 0.1, 1, 4, 12],
233
+ }),
234
+ concurrency: register.gauge({
235
+ name: "lodestar_unfinalized_block_writes_queue_concurrency",
236
+ help: "Current concurrency of unfinalized block writes queue",
237
+ }),
238
+ },
239
+
215
240
  engineHttpProcessorQueue: {
216
241
  length: register.gauge({
217
242
  name: "lodestar_engine_http_processor_queue_length",
@@ -1116,6 +1141,46 @@ export function createLodestarMetrics(
1116
1141
  help: "Total number of empty returns in SyncContributionAndProofPool.getAggregate(slot, root)",
1117
1142
  }),
1118
1143
  },
1144
+ payloadAttestationPool: {
1145
+ size: register.gauge({
1146
+ name: "lodestar_oppool_payload_attestation_pool_size",
1147
+ help: "Current size of the PayloadAttestationPool = total payload attestations unique by data and slot",
1148
+ }),
1149
+ payloadAttDataPerSlot: register.gauge({
1150
+ name: "lodestar_oppool_payload_attestation_pool_payload_attestation_data_per_slot_total",
1151
+ help: "Total number of payload attestation data per slot in PayloadAttestationPool",
1152
+ }),
1153
+ gossipInsertOutcome: register.counter<{insertOutcome: InsertOutcome}>({
1154
+ name: "lodestar_oppool_payload_attestation_pool_gossip_insert_outcome_total",
1155
+ help: "Total number of InsertOutcome as a result of adding a payload attestation message from gossip to the pool",
1156
+ labelNames: ["insertOutcome"],
1157
+ }),
1158
+ apiInsertOutcome: register.counter<{insertOutcome: InsertOutcome}>({
1159
+ name: "lodestar_oppool_payload_attestation_pool_api_insert_outcome_total",
1160
+ help: "Total number of InsertOutcome as a result of adding a payload attestation message from api to the pool",
1161
+ labelNames: ["insertOutcome"],
1162
+ }),
1163
+ getPayloadAttestationsCacheMisses: register.counter({
1164
+ name: "lodestar_oppool_payload_attestation_pool_get_payload_attestations_cache_misses_total",
1165
+ help: "Total number of getPayloadAttestationsForBlock calls with no aggregate for slot and payload attestation data root",
1166
+ }),
1167
+ },
1168
+ executionPayloadBidPool: {
1169
+ size: register.gauge({
1170
+ name: "lodestar_oppool_execution_payload_bid_pool_size",
1171
+ help: "Current size of the ExecutionPayloadBidPool = total number of bids",
1172
+ }),
1173
+ gossipInsertOutcome: register.counter<{insertOutcome: InsertOutcome}>({
1174
+ name: "lodestar_oppool_execution_payload_bid_pool_gossip_insert_outcome_total",
1175
+ help: "Total number of InsertOutcome as a result of adding an execution payload bid from gossip to the pool",
1176
+ labelNames: ["insertOutcome"],
1177
+ }),
1178
+ apiInsertOutcome: register.counter<{insertOutcome: InsertOutcome}>({
1179
+ name: "lodestar_oppool_execution_payload_bid_pool_api_insert_outcome_total",
1180
+ help: "Total number of InsertOutcome as a result of adding an execution payload bid from api to the pool",
1181
+ labelNames: ["insertOutcome"],
1182
+ }),
1183
+ },
1119
1184
  },
1120
1185
 
1121
1186
  chain: {
@@ -1308,33 +1373,19 @@ export function createLodestarMetrics(
1308
1373
  name: "lodestar_shuffling_cache_miss_count",
1309
1374
  help: "Count of shuffling cache miss",
1310
1375
  }),
1311
- shufflingBuiltMultipleTimes: register.gauge({
1312
- name: "lodestar_shuffling_cache_recalculated_shuffling_count",
1313
- help: "Count of shuffling that were build multiple times",
1314
- }),
1315
- shufflingPromiseNotResolvedAndThrownAway: register.gauge({
1316
- name: "lodestar_shuffling_cache_promise_not_resolved_and_thrown_away_count",
1317
- help: "Count of shuffling cache promises that were discarded and the shuffling was built synchronously",
1376
+ shufflingSetMultipleTimes: register.gauge({
1377
+ name: "lodestar_shuffling_cache_set_multiple_times_count",
1378
+ help: "Count of shuffling that were set multiple times",
1318
1379
  }),
1319
1380
  shufflingPromiseNotResolved: register.gauge({
1320
1381
  name: "lodestar_shuffling_cache_promise_not_resolved_count",
1321
1382
  help: "Count of shuffling cache promises that were requested before the promise was resolved",
1322
1383
  }),
1323
- nextShufflingNotOnEpochCache: register.gauge({
1324
- name: "lodestar_shuffling_cache_next_shuffling_not_on_epoch_cache",
1325
- help: "The next shuffling was not on the epoch cache before the epoch transition",
1326
- }),
1327
1384
  shufflingPromiseResolutionTime: register.histogram({
1328
1385
  name: "lodestar_shuffling_cache_promise_resolution_time_seconds",
1329
1386
  help: "Time from promise insertion until promise resolution when shuffling was ready in seconds",
1330
1387
  buckets: [0.5, 1, 1.5, 2],
1331
1388
  }),
1332
- shufflingCalculationTime: register.histogram<{source: "build" | "getSync"}>({
1333
- name: "lodestar_shuffling_cache_shuffling_calculation_time_seconds",
1334
- help: "Run time of shuffling calculation",
1335
- buckets: [0.5, 0.75, 1, 1.25, 1.5],
1336
- labelNames: ["source"],
1337
- }),
1338
1389
  },
1339
1390
 
1340
1391
  seenCache: {
@@ -15,6 +15,7 @@ import {
15
15
  capella,
16
16
  deneb,
17
17
  fulu,
18
+ gloas,
18
19
  phase0,
19
20
  } from "@lodestar/types";
20
21
  import {Logger} from "@lodestar/utils";
@@ -37,6 +38,9 @@ export enum GossipType {
37
38
  light_client_finality_update = "light_client_finality_update",
38
39
  light_client_optimistic_update = "light_client_optimistic_update",
39
40
  bls_to_execution_change = "bls_to_execution_change",
41
+ execution_payload = "execution_payload",
42
+ payload_attestation_message = "payload_attestation_message",
43
+ execution_payload_bid = "execution_payload_bid",
40
44
  }
41
45
 
42
46
  export type SequentialGossipType = Exclude<GossipType, GossipType.beacon_attestation>;
@@ -71,6 +75,9 @@ export type GossipTopicTypeMap = {
71
75
  [GossipType.light_client_finality_update]: {type: GossipType.light_client_finality_update};
72
76
  [GossipType.light_client_optimistic_update]: {type: GossipType.light_client_optimistic_update};
73
77
  [GossipType.bls_to_execution_change]: {type: GossipType.bls_to_execution_change};
78
+ [GossipType.execution_payload]: {type: GossipType.execution_payload};
79
+ [GossipType.payload_attestation_message]: {type: GossipType.payload_attestation_message};
80
+ [GossipType.execution_payload_bid]: {type: GossipType.execution_payload_bid};
74
81
  };
75
82
 
76
83
  export type GossipTopicMap = {
@@ -100,6 +107,9 @@ export type GossipTypeMap = {
100
107
  [GossipType.light_client_finality_update]: LightClientFinalityUpdate;
101
108
  [GossipType.light_client_optimistic_update]: LightClientOptimisticUpdate;
102
109
  [GossipType.bls_to_execution_change]: capella.SignedBLSToExecutionChange;
110
+ [GossipType.execution_payload]: gloas.SignedExecutionPayloadEnvelope;
111
+ [GossipType.payload_attestation_message]: gloas.PayloadAttestationMessage;
112
+ [GossipType.execution_payload_bid]: gloas.SignedExecutionPayloadBid;
103
113
  };
104
114
 
105
115
  export type GossipFnByType = {
@@ -124,6 +134,13 @@ export type GossipFnByType = {
124
134
  [GossipType.bls_to_execution_change]: (
125
135
  blsToExecutionChange: capella.SignedBLSToExecutionChange
126
136
  ) => Promise<void> | void;
137
+ [GossipType.execution_payload]: (
138
+ executionPayloadEnvelope: gloas.SignedExecutionPayloadEnvelope
139
+ ) => Promise<void> | void;
140
+ [GossipType.payload_attestation_message]: (
141
+ payloadAttestationMessage: gloas.PayloadAttestationMessage
142
+ ) => Promise<void> | void;
143
+ [GossipType.execution_payload_bid]: (executionPayloadBid: gloas.SignedExecutionPayloadBid) => Promise<void> | void;
127
144
  };
128
145
 
129
146
  export type GossipFn = GossipFnByType[keyof GossipFnByType];
@@ -5,7 +5,7 @@ import {
5
5
  defaultTopicScoreParams,
6
6
  } from "@chainsafe/libp2p-gossipsub/score";
7
7
  import {BeaconConfig} from "@lodestar/config";
8
- import {ATTESTATION_SUBNET_COUNT, SLOTS_PER_EPOCH, TARGET_AGGREGATORS_PER_COMMITTEE} from "@lodestar/params";
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";
10
10
  import {getActiveForkBoundaries} from "../forks.js";
11
11
  import {Eth2Context} from "./gossipsub.js";
@@ -24,6 +24,9 @@ const VOLUNTARY_EXIT_WEIGHT = 0.05;
24
24
  const PROPOSER_SLASHING_WEIGHT = 0.05;
25
25
  const ATTESTER_SLASHING_WEIGHT = 0.05;
26
26
  const BLS_TO_EXECUTION_CHANGE_WEIGHT = 0.05;
27
+ const EXECUTION_PAYLOAD_WEIGHT = 0.5;
28
+ const PAYLOAD_ATTESTATION_WEIGHT = 0.05;
29
+ const EXECUTION_PAYLOAD_BID_WEIGHT = 0.05;
27
30
 
28
31
  const beaconAttestationSubnetWeight = 1 / ATTESTATION_SUBNET_COUNT;
29
32
  const maxPositiveScore =
@@ -34,7 +37,10 @@ const maxPositiveScore =
34
37
  VOLUNTARY_EXIT_WEIGHT +
35
38
  PROPOSER_SLASHING_WEIGHT +
36
39
  ATTESTER_SLASHING_WEIGHT +
37
- BLS_TO_EXECUTION_CHANGE_WEIGHT);
40
+ BLS_TO_EXECUTION_CHANGE_WEIGHT +
41
+ EXECUTION_PAYLOAD_WEIGHT +
42
+ PAYLOAD_ATTESTATION_WEIGHT +
43
+ EXECUTION_PAYLOAD_BID_WEIGHT);
38
44
 
39
45
  /**
40
46
  * The following params is implemented by Lighthouse at
@@ -172,6 +178,26 @@ function getAllTopicsScoreParams(
172
178
  expectedMessageRate: 1 / 5 / SLOTS_PER_EPOCH,
173
179
  firstMessageDecayTime: epochDurationMs * 100,
174
180
  });
181
+ topicsParams[
182
+ stringifyGossipTopic(config, {
183
+ type: GossipType.payload_attestation_message,
184
+ boundary,
185
+ })
186
+ ] = getTopicScoreParams(config, precomputedParams, {
187
+ topicWeight: PAYLOAD_ATTESTATION_WEIGHT,
188
+ expectedMessageRate: PTC_SIZE,
189
+ firstMessageDecayTime: epochDurationMs * 100,
190
+ });
191
+ topicsParams[
192
+ stringifyGossipTopic(config, {
193
+ type: GossipType.execution_payload_bid,
194
+ boundary,
195
+ })
196
+ ] = getTopicScoreParams(config, precomputedParams, {
197
+ topicWeight: EXECUTION_PAYLOAD_BID_WEIGHT,
198
+ expectedMessageRate: 1024, // TODO GLOAS: Need an estimate for this
199
+ firstMessageDecayTime: epochDurationMs * 100,
200
+ });
175
201
 
176
202
  // other topics
177
203
  topicsParams[
@@ -190,6 +216,22 @@ function getAllTopicsScoreParams(
190
216
  currentSlot: eth2Context.currentSlot,
191
217
  },
192
218
  });
219
+ topicsParams[
220
+ stringifyGossipTopic(config, {
221
+ type: GossipType.execution_payload,
222
+ boundary,
223
+ })
224
+ ] = getTopicScoreParams(config, precomputedParams, {
225
+ topicWeight: EXECUTION_PAYLOAD_WEIGHT,
226
+ expectedMessageRate: 1,
227
+ firstMessageDecayTime: epochDurationMs * 20,
228
+ meshMessageInfo: {
229
+ decaySlots: SLOTS_PER_EPOCH * 5,
230
+ capFactor: 3,
231
+ activationWindow: epochDurationMs,
232
+ currentSlot: eth2Context.currentSlot,
233
+ },
234
+ });
193
235
 
194
236
  const activeValidatorCount = eth2Context.activeValidatorCount;
195
237
  const {aggregatorsPerslot, committeesPerSlot} = expectedAggregatorCountPerSlot(activeValidatorCount);
@@ -69,6 +69,9 @@ function stringifyGossipTopicType(topic: GossipTopic): string {
69
69
  case GossipType.light_client_finality_update:
70
70
  case GossipType.light_client_optimistic_update:
71
71
  case GossipType.bls_to_execution_change:
72
+ case GossipType.execution_payload:
73
+ case GossipType.payload_attestation_message:
74
+ case GossipType.execution_payload_bid:
72
75
  return topic.type;
73
76
  case GossipType.beacon_attestation:
74
77
  case GossipType.sync_committee:
@@ -114,6 +117,12 @@ export function getGossipSSZType(topic: GossipTopic) {
114
117
  : ssz.altair.LightClientFinalityUpdate;
115
118
  case GossipType.bls_to_execution_change:
116
119
  return ssz.capella.SignedBLSToExecutionChange;
120
+ case GossipType.execution_payload:
121
+ return ssz.gloas.SignedExecutionPayloadEnvelope;
122
+ case GossipType.payload_attestation_message:
123
+ return ssz.gloas.PayloadAttestationMessage;
124
+ case GossipType.execution_payload_bid:
125
+ return ssz.gloas.SignedExecutionPayloadBid;
117
126
  }
118
127
  }
119
128
 
@@ -190,6 +199,9 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr:
190
199
  case GossipType.light_client_finality_update:
191
200
  case GossipType.light_client_optimistic_update:
192
201
  case GossipType.bls_to_execution_change:
202
+ case GossipType.execution_payload:
203
+ case GossipType.payload_attestation_message:
204
+ case GossipType.execution_payload_bid:
193
205
  return {type: gossipTypeStr, boundary, encoding};
194
206
  }
195
207
 
@@ -240,6 +252,12 @@ export function getCoreTopicsAtFork(
240
252
  {type: GossipType.attester_slashing},
241
253
  ];
242
254
 
255
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
256
+ topics.push({type: GossipType.execution_payload});
257
+ topics.push({type: GossipType.payload_attestation_message});
258
+ topics.push({type: GossipType.execution_payload_bid});
259
+ }
260
+
243
261
  // After fulu also track data_column_sidecar_{index}
244
262
  if (ForkSeq[fork] >= ForkSeq.fulu) {
245
263
  topics.push(...getDataColumnSidecarTopics(networkConfig));
@@ -329,4 +347,7 @@ export const gossipTopicIgnoreDuplicatePublishError: Record<GossipType, boolean>
329
347
  [GossipType.light_client_finality_update]: false,
330
348
  [GossipType.light_client_optimistic_update]: false,
331
349
  [GossipType.bls_to_execution_change]: true,
350
+ [GossipType.execution_payload]: true,
351
+ [GossipType.payload_attestation_message]: true,
352
+ [GossipType.execution_payload_bid]: true,
332
353
  };
@@ -48,6 +48,8 @@ import {
48
48
  import {IBeaconChain} from "../../chain/interface.js";
49
49
  import {validateGossipBlobSidecar} from "../../chain/validation/blobSidecar.js";
50
50
  import {validateGossipDataColumnSidecar} from "../../chain/validation/dataColumnSidecar.js";
51
+ import {validateGossipExecutionPayloadBid} from "../../chain/validation/executionPayloadBid.js";
52
+ import {validateGossipExecutionPayloadEnvelope} from "../../chain/validation/executionPayloadEnvelope.js";
51
53
  import {
52
54
  AggregateAndProofValidationResult,
53
55
  GossipAttestation,
@@ -64,6 +66,7 @@ import {
64
66
  } from "../../chain/validation/index.js";
65
67
  import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js";
66
68
  import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js";
69
+ import {validateGossipPayloadAttestationMessage} from "../../chain/validation/payloadAttestationMessage.js";
67
70
  import {OpSource} from "../../chain/validatorMonitor.js";
68
71
  import {Metrics} from "../../metrics/index.js";
69
72
  import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
@@ -436,14 +439,11 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
436
439
  blsVerifyOnMainThread: true,
437
440
  // to track block process steps
438
441
  seenTimestampSec,
439
- // gossip block is validated, we want to process it asap
440
- eagerPersistBlock: true,
441
442
  })
442
443
  .then(() => {
443
444
  // Returns the delay between the start of `block.slot` and `current time`
444
445
  const delaySec = chain.clock.secFromSlot(slot);
445
446
  metrics?.gossipBlock.elapsedTimeTillProcessed.observe(delaySec);
446
- chain.seenBlockInputCache.prune(blockInput.blockRootHex);
447
447
  })
448
448
  .catch((e) => {
449
449
  // Adjust verbosity based on error type
@@ -818,6 +818,51 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
818
818
 
819
819
  chain.emitter.emit(routes.events.EventType.blsToExecutionChange, blsToExecutionChange);
820
820
  },
821
+ [GossipType.execution_payload]: async ({
822
+ gossipData,
823
+ topic,
824
+ }: GossipHandlerParamGeneric<GossipType.execution_payload>) => {
825
+ const {serializedData} = gossipData;
826
+ const executionPayloadEnvelope = sszDeserialize(topic, serializedData);
827
+ await validateGossipExecutionPayloadEnvelope(chain, executionPayloadEnvelope);
828
+
829
+ // TODO GLOAS: Handle valid envelope. Need an import flow that calls `processExecutionPayloadEnvelope` and fork choice
830
+ },
831
+ [GossipType.payload_attestation_message]: async ({
832
+ gossipData,
833
+ topic,
834
+ }: GossipHandlerParamGeneric<GossipType.payload_attestation_message>) => {
835
+ const {serializedData} = gossipData;
836
+ const payloadAttestationMessage = sszDeserialize(topic, serializedData);
837
+ const validationResult = await validateGossipPayloadAttestationMessage(chain, payloadAttestationMessage);
838
+
839
+ try {
840
+ const insertOutcome = chain.payloadAttestationPool.add(
841
+ payloadAttestationMessage,
842
+ validationResult.attDataRootHex,
843
+ validationResult.validatorCommitteeIndex
844
+ );
845
+ metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
846
+ } catch (e) {
847
+ logger.error("Error adding to payloadAttestation pool", {}, e as Error);
848
+ }
849
+ },
850
+ [GossipType.execution_payload_bid]: async ({
851
+ gossipData,
852
+ topic,
853
+ }: GossipHandlerParamGeneric<GossipType.execution_payload_bid>) => {
854
+ const {serializedData} = gossipData;
855
+ const executionPayloadBid = sszDeserialize(topic, serializedData);
856
+ await validateGossipExecutionPayloadBid(chain, executionPayloadBid);
857
+
858
+ // Handle valid payload bid by storing in a bid pool
859
+ try {
860
+ const insertOutcome = chain.executionPayloadBidPool.add(executionPayloadBid.message);
861
+ metrics?.opPool.executionPayloadBidPool.gossipInsertOutcome.inc({insertOutcome});
862
+ } catch (e) {
863
+ logger.error("Error adding to executionPayloadBid pool", {}, e as Error);
864
+ }
865
+ },
821
866
  };
822
867
  }
823
868
 
@@ -67,6 +67,22 @@ const linearGossipQueueOpts: {
67
67
  type: QueueType.FIFO,
68
68
  dropOpts: {type: DropType.count, count: 1},
69
69
  },
70
+ [GossipType.execution_payload]: {
71
+ maxLength: 1024,
72
+ type: QueueType.FIFO,
73
+ dropOpts: {type: DropType.count, count: 1},
74
+ },
75
+ [GossipType.payload_attestation_message]: {
76
+ maxLength: 1024,
77
+ type: QueueType.FIFO,
78
+ dropOpts: {type: DropType.count, count: 1},
79
+ },
80
+ // TODO GLOAS: It is hard to predict how many bids are there. Put 1024 for max length for now
81
+ [GossipType.execution_payload_bid]: {
82
+ maxLength: 1024,
83
+ type: QueueType.FIFO,
84
+ dropOpts: {type: DropType.count, count: 1},
85
+ },
70
86
  };
71
87
 
72
88
  const indexedGossipQueueOpts: {
@@ -78,6 +78,9 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
78
78
  [GossipType.sync_committee]: {},
79
79
  [GossipType.light_client_finality_update]: {},
80
80
  [GossipType.light_client_optimistic_update]: {},
81
+ [GossipType.execution_payload]: {bypassQueue: true},
82
+ [GossipType.payload_attestation_message]: {},
83
+ [GossipType.execution_payload_bid]: {},
81
84
  };
82
85
  const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
83
86
 
@@ -4,7 +4,6 @@ import {GENESIS_SLOT, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
4
4
  import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
5
5
  import {computeEpochAtSlot} from "@lodestar/state-transition";
6
6
  import {deneb, phase0} from "@lodestar/types";
7
- import {fromHex} from "@lodestar/utils";
8
7
  import {IBeaconChain} from "../../../chain/index.js";
9
8
  import {IBeaconDb} from "../../../db/index.js";
10
9
  import {prettyPrintPeerId} from "../../util.ts";
@@ -22,7 +21,6 @@ export async function* onBeaconBlocksByRange(
22
21
  const endSlot = startSlot + count;
23
22
 
24
23
  const finalized = db.blockArchive;
25
- const unfinalized = db.block;
26
24
  // in the case of initializing from a non-finalized state, we don't have the finalized block so this api does not work
27
25
  // chain.forkChoice.getFinalizeBlock().slot
28
26
  const finalizedSlot = chain.forkChoice.getFinalizedCheckpointSlot();
@@ -65,7 +63,7 @@ export async function* onBeaconBlocksByRange(
65
63
  // re-org there's no need to abort the request
66
64
  // Spec: https://github.com/ethereum/consensus-specs/blob/a1e46d1ae47dd9d097725801575b46907c12a1f8/specs/eip4844/p2p-interface.md#blobssidecarsbyrange-v1
67
65
 
68
- const blockBytes = await unfinalized.getBinary(fromHex(block.blockRoot));
66
+ const blockBytes = await chain.getSerializedBlockByRoot(block.blockRoot);
69
67
  if (!blockBytes) {
70
68
  throw new ResponseError(
71
69
  RespStatus.SERVER_ERROR,
@@ -74,7 +72,7 @@ export async function* onBeaconBlocksByRange(
74
72
  }
75
73
 
76
74
  yield {
77
- data: blockBytes,
75
+ data: blockBytes.block,
78
76
  boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(block.slot)),
79
77
  };
80
78
  }