@lodestar/beacon-node 1.43.0-dev.aef3645690 → 1.43.0-dev.b05ea98d04

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 (401) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +17 -9
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +45 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +2 -2
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +0 -1
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/lodestar/index.js +1 -1
  14. package/lib/api/impl/lodestar/index.js.map +1 -1
  15. package/lib/api/impl/validator/index.d.ts.map +1 -1
  16. package/lib/api/impl/validator/index.js +68 -5
  17. package/lib/api/impl/validator/index.js.map +1 -1
  18. package/lib/chain/GetBlobsTracker.d.ts +1 -1
  19. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  20. package/lib/chain/GetBlobsTracker.js +1 -2
  21. package/lib/chain/GetBlobsTracker.js.map +1 -1
  22. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  23. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  24. package/lib/chain/archiveStore/interface.d.ts +4 -4
  25. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  26. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
  27. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
  28. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +2 -4
  29. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
  30. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +2 -2
  31. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  32. package/lib/chain/archiveStore/utils/archiveBlocks.js +110 -58
  33. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  34. package/lib/chain/blocks/blockInput/blockInput.d.ts +3 -0
  35. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  36. package/lib/chain/blocks/blockInput/blockInput.js +4 -1
  37. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  38. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  39. package/lib/chain/blocks/importBlock.js +38 -58
  40. package/lib/chain/blocks/importBlock.js.map +1 -1
  41. package/lib/chain/blocks/importExecutionPayload.d.ts +28 -14
  42. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  43. package/lib/chain/blocks/importExecutionPayload.js +89 -89
  44. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  45. package/lib/chain/blocks/index.d.ts +5 -3
  46. package/lib/chain/blocks/index.d.ts.map +1 -1
  47. package/lib/chain/blocks/index.js +59 -26
  48. package/lib/chain/blocks/index.js.map +1 -1
  49. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +7 -0
  50. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  51. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +29 -2
  52. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  53. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
  54. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  55. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +5 -0
  56. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  57. package/lib/chain/blocks/payloadEnvelopeProcessor.js +7 -5
  58. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  59. package/lib/chain/blocks/types.d.ts +16 -21
  60. package/lib/chain/blocks/types.d.ts.map +1 -1
  61. package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
  62. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  63. package/lib/chain/blocks/utils/chainSegment.js +89 -12
  64. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  65. package/lib/chain/blocks/verifyBlock.d.ts +5 -3
  66. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  67. package/lib/chain/blocks/verifyBlock.js +50 -7
  68. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  69. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
  70. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  71. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -2
  72. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  73. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
  74. package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
  75. package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
  76. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  77. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +24 -0
  78. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -0
  79. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +79 -0
  80. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -0
  81. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +14 -0
  82. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -0
  83. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +30 -0
  84. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -0
  85. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +1 -1
  86. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
  87. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +2 -11
  88. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
  89. package/lib/chain/chain.d.ts +8 -6
  90. package/lib/chain/chain.d.ts.map +1 -1
  91. package/lib/chain/chain.js +46 -50
  92. package/lib/chain/chain.js.map +1 -1
  93. package/lib/chain/emitter.d.ts +16 -15
  94. package/lib/chain/emitter.d.ts.map +1 -1
  95. package/lib/chain/emitter.js +5 -4
  96. package/lib/chain/emitter.js.map +1 -1
  97. package/lib/chain/errors/attestationError.d.ts +8 -1
  98. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  99. package/lib/chain/errors/attestationError.js +4 -0
  100. package/lib/chain/errors/attestationError.js.map +1 -1
  101. package/lib/chain/errors/blockError.d.ts +8 -1
  102. package/lib/chain/errors/blockError.d.ts.map +1 -1
  103. package/lib/chain/errors/blockError.js +2 -0
  104. package/lib/chain/errors/blockError.js.map +1 -1
  105. package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
  106. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  107. package/lib/chain/errors/executionPayloadBid.js +1 -0
  108. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  109. package/lib/chain/errors/executionPayloadEnvelope.d.ts +5 -0
  110. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  111. package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
  112. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  113. package/lib/chain/errors/index.d.ts +1 -0
  114. package/lib/chain/errors/index.d.ts.map +1 -1
  115. package/lib/chain/errors/index.js +1 -0
  116. package/lib/chain/errors/index.js.map +1 -1
  117. package/lib/chain/errors/proposerPreferences.d.ts +40 -0
  118. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  119. package/lib/chain/errors/proposerPreferences.js +14 -0
  120. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  121. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  122. package/lib/chain/forkChoice/index.js +11 -15
  123. package/lib/chain/forkChoice/index.js.map +1 -1
  124. package/lib/chain/initState.d.ts.map +1 -1
  125. package/lib/chain/initState.js +6 -1
  126. package/lib/chain/initState.js.map +1 -1
  127. package/lib/chain/interface.d.ts +7 -5
  128. package/lib/chain/interface.d.ts.map +1 -1
  129. package/lib/chain/interface.js.map +1 -1
  130. package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
  131. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  132. package/lib/chain/opPools/payloadAttestationPool.js +26 -4
  133. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  134. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  135. package/lib/chain/prepareNextSlot.js +47 -23
  136. package/lib/chain/prepareNextSlot.js.map +1 -1
  137. package/lib/chain/produceBlock/computeNewStateRoot.d.ts +3 -9
  138. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  139. package/lib/chain/produceBlock/computeNewStateRoot.js +5 -32
  140. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  141. package/lib/chain/produceBlock/produceBlockBody.d.ts +13 -8
  142. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  143. package/lib/chain/produceBlock/produceBlockBody.js +68 -25
  144. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  145. package/lib/chain/regen/errors.d.ts +1 -11
  146. package/lib/chain/regen/errors.d.ts.map +1 -1
  147. package/lib/chain/regen/errors.js +0 -2
  148. package/lib/chain/regen/errors.js.map +1 -1
  149. package/lib/chain/regen/interface.d.ts +7 -12
  150. package/lib/chain/regen/interface.d.ts.map +1 -1
  151. package/lib/chain/regen/interface.js +1 -0
  152. package/lib/chain/regen/interface.js.map +1 -1
  153. package/lib/chain/regen/queued.d.ts +6 -11
  154. package/lib/chain/regen/queued.d.ts.map +1 -1
  155. package/lib/chain/regen/queued.js +9 -44
  156. package/lib/chain/regen/queued.js.map +1 -1
  157. package/lib/chain/regen/regen.d.ts +0 -5
  158. package/lib/chain/regen/regen.d.ts.map +1 -1
  159. package/lib/chain/regen/regen.js +8 -38
  160. package/lib/chain/regen/regen.js.map +1 -1
  161. package/lib/chain/seenCache/index.d.ts +1 -0
  162. package/lib/chain/seenCache/index.d.ts.map +1 -1
  163. package/lib/chain/seenCache/index.js +1 -0
  164. package/lib/chain/seenCache/index.js.map +1 -1
  165. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +22 -6
  166. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  167. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +53 -17
  168. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  169. package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
  170. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  171. package/lib/chain/seenCache/seenProposerPreferences.js +26 -0
  172. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  173. package/lib/chain/stateCache/datastore/db.d.ts +5 -4
  174. package/lib/chain/stateCache/datastore/db.d.ts.map +1 -1
  175. package/lib/chain/stateCache/datastore/db.js +10 -32
  176. package/lib/chain/stateCache/datastore/db.js.map +1 -1
  177. package/lib/chain/stateCache/datastore/file.d.ts +1 -1
  178. package/lib/chain/stateCache/datastore/file.d.ts.map +1 -1
  179. package/lib/chain/stateCache/datastore/file.js +5 -5
  180. package/lib/chain/stateCache/datastore/file.js.map +1 -1
  181. package/lib/chain/stateCache/datastore/types.d.ts +1 -1
  182. package/lib/chain/stateCache/datastore/types.d.ts.map +1 -1
  183. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -7
  184. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  185. package/lib/chain/stateCache/fifoBlockStateCache.js +0 -8
  186. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  187. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +13 -30
  188. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  189. package/lib/chain/stateCache/persistentCheckpointsCache.js +120 -216
  190. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  191. package/lib/chain/stateCache/types.d.ts +8 -15
  192. package/lib/chain/stateCache/types.d.ts.map +1 -1
  193. package/lib/chain/stateCache/types.js.map +1 -1
  194. package/lib/chain/validation/aggregateAndProof.js +12 -0
  195. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  196. package/lib/chain/validation/attestation.d.ts.map +1 -1
  197. package/lib/chain/validation/attestation.js +12 -0
  198. package/lib/chain/validation/attestation.js.map +1 -1
  199. package/lib/chain/validation/block.d.ts.map +1 -1
  200. package/lib/chain/validation/block.js +1 -0
  201. package/lib/chain/validation/block.js.map +1 -1
  202. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  203. package/lib/chain/validation/executionPayloadBid.js +24 -9
  204. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  205. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  206. package/lib/chain/validation/executionPayloadEnvelope.js +21 -11
  207. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  208. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  209. package/lib/chain/validation/payloadAttestationMessage.js +4 -3
  210. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  211. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  212. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  213. package/lib/chain/validation/proposerPreferences.js +91 -0
  214. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  215. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +1 -1
  216. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  217. package/lib/execution/engine/http.d.ts.map +1 -1
  218. package/lib/execution/engine/http.js +21 -14
  219. package/lib/execution/engine/http.js.map +1 -1
  220. package/lib/execution/engine/interface.d.ts +1 -0
  221. package/lib/execution/engine/interface.d.ts.map +1 -1
  222. package/lib/execution/engine/mock.d.ts.map +1 -1
  223. package/lib/execution/engine/mock.js +6 -0
  224. package/lib/execution/engine/mock.js.map +1 -1
  225. package/lib/execution/engine/types.d.ts +20 -0
  226. package/lib/execution/engine/types.d.ts.map +1 -1
  227. package/lib/execution/engine/types.js +18 -0
  228. package/lib/execution/engine/types.js.map +1 -1
  229. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  230. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  231. package/lib/metrics/metrics/lodestar.js +4 -0
  232. package/lib/metrics/metrics/lodestar.js.map +1 -1
  233. package/lib/network/gossip/interface.d.ts +7 -1
  234. package/lib/network/gossip/interface.d.ts.map +1 -1
  235. package/lib/network/gossip/interface.js +1 -0
  236. package/lib/network/gossip/interface.js.map +1 -1
  237. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  238. package/lib/network/gossip/scoringParameters.js +12 -1
  239. package/lib/network/gossip/scoringParameters.js.map +1 -1
  240. package/lib/network/gossip/topic.d.ts +32 -748
  241. package/lib/network/gossip/topic.d.ts.map +1 -1
  242. package/lib/network/gossip/topic.js +6 -0
  243. package/lib/network/gossip/topic.js.map +1 -1
  244. package/lib/network/interface.d.ts +1 -0
  245. package/lib/network/interface.d.ts.map +1 -1
  246. package/lib/network/network.d.ts +1 -0
  247. package/lib/network/network.d.ts.map +1 -1
  248. package/lib/network/network.js +6 -1
  249. package/lib/network/network.js.map +1 -1
  250. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  251. package/lib/network/processor/gossipHandlers.js +60 -22
  252. package/lib/network/processor/gossipHandlers.js.map +1 -1
  253. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  254. package/lib/network/processor/gossipQueues/index.js +5 -0
  255. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  256. package/lib/network/processor/index.d.ts.map +1 -1
  257. package/lib/network/processor/index.js +6 -5
  258. package/lib/network/processor/index.js.map +1 -1
  259. package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
  260. package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
  261. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  262. package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
  263. package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
  264. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  265. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  266. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
  267. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  268. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  269. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
  270. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  271. package/lib/node/nodejs.d.ts.map +1 -1
  272. package/lib/node/nodejs.js +6 -4
  273. package/lib/node/nodejs.js.map +1 -1
  274. package/lib/sync/constants.d.ts +3 -1
  275. package/lib/sync/constants.d.ts.map +1 -1
  276. package/lib/sync/constants.js +3 -4
  277. package/lib/sync/constants.js.map +1 -1
  278. package/lib/sync/range/batch.d.ts +28 -2
  279. package/lib/sync/range/batch.d.ts.map +1 -1
  280. package/lib/sync/range/batch.js +146 -44
  281. package/lib/sync/range/batch.js.map +1 -1
  282. package/lib/sync/range/chain.d.ts +12 -2
  283. package/lib/sync/range/chain.d.ts.map +1 -1
  284. package/lib/sync/range/chain.js +53 -9
  285. package/lib/sync/range/chain.js.map +1 -1
  286. package/lib/sync/range/range.d.ts.map +1 -1
  287. package/lib/sync/range/range.js +17 -6
  288. package/lib/sync/range/range.js.map +1 -1
  289. package/lib/sync/types.d.ts +34 -0
  290. package/lib/sync/types.d.ts.map +1 -1
  291. package/lib/sync/types.js +34 -0
  292. package/lib/sync/types.js.map +1 -1
  293. package/lib/sync/unknownBlock.d.ts +22 -1
  294. package/lib/sync/unknownBlock.d.ts.map +1 -1
  295. package/lib/sync/unknownBlock.js +604 -53
  296. package/lib/sync/unknownBlock.js.map +1 -1
  297. package/lib/sync/utils/downloadByRange.d.ts +46 -10
  298. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  299. package/lib/sync/utils/downloadByRange.js +162 -24
  300. package/lib/sync/utils/downloadByRange.js.map +1 -1
  301. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  302. package/lib/sync/utils/downloadByRoot.js +16 -2
  303. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  304. package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
  305. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  306. package/lib/sync/utils/pendingBlocksTree.js +0 -9
  307. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  308. package/lib/util/sszBytes.d.ts.map +1 -1
  309. package/lib/util/sszBytes.js +20 -5
  310. package/lib/util/sszBytes.js.map +1 -1
  311. package/package.json +17 -16
  312. package/src/api/impl/beacon/blocks/index.ts +22 -9
  313. package/src/api/impl/beacon/pool/index.ts +83 -1
  314. package/src/api/impl/beacon/state/utils.ts +2 -2
  315. package/src/api/impl/debug/index.ts +0 -1
  316. package/src/api/impl/lodestar/index.ts +1 -1
  317. package/src/api/impl/validator/index.ts +84 -6
  318. package/src/chain/GetBlobsTracker.ts +1 -2
  319. package/src/chain/archiveStore/archiveStore.ts +5 -5
  320. package/src/chain/archiveStore/interface.ts +4 -4
  321. package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +6 -8
  322. package/src/chain/archiveStore/utils/archiveBlocks.ts +153 -94
  323. package/src/chain/blocks/blockInput/blockInput.ts +4 -1
  324. package/src/chain/blocks/importBlock.ts +38 -83
  325. package/src/chain/blocks/importExecutionPayload.ts +110 -102
  326. package/src/chain/blocks/index.ts +74 -24
  327. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +37 -2
  328. package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
  329. package/src/chain/blocks/payloadEnvelopeProcessor.ts +7 -6
  330. package/src/chain/blocks/types.ts +16 -26
  331. package/src/chain/blocks/utils/chainSegment.ts +114 -17
  332. package/src/chain/blocks/verifyBlock.ts +70 -9
  333. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
  334. package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
  335. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +134 -0
  336. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +41 -0
  337. package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
  338. package/src/chain/chain.ts +63 -72
  339. package/src/chain/emitter.ts +15 -14
  340. package/src/chain/errors/attestationError.ts +6 -1
  341. package/src/chain/errors/blockError.ts +4 -1
  342. package/src/chain/errors/executionPayloadBid.ts +6 -0
  343. package/src/chain/errors/executionPayloadEnvelope.ts +6 -0
  344. package/src/chain/errors/index.ts +1 -0
  345. package/src/chain/errors/proposerPreferences.ts +47 -0
  346. package/src/chain/forkChoice/index.ts +8 -20
  347. package/src/chain/initState.ts +9 -1
  348. package/src/chain/interface.ts +11 -3
  349. package/src/chain/opPools/payloadAttestationPool.ts +29 -8
  350. package/src/chain/prepareNextSlot.ts +55 -24
  351. package/src/chain/produceBlock/computeNewStateRoot.ts +6 -43
  352. package/src/chain/produceBlock/produceBlockBody.ts +91 -27
  353. package/src/chain/regen/errors.ts +1 -6
  354. package/src/chain/regen/interface.ts +7 -12
  355. package/src/chain/regen/queued.ts +14 -55
  356. package/src/chain/regen/regen.ts +10 -43
  357. package/src/chain/seenCache/index.ts +1 -0
  358. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +71 -20
  359. package/src/chain/seenCache/seenProposerPreferences.ts +32 -0
  360. package/src/chain/stateCache/datastore/db.ts +10 -33
  361. package/src/chain/stateCache/datastore/file.ts +5 -6
  362. package/src/chain/stateCache/datastore/types.ts +2 -3
  363. package/src/chain/stateCache/fifoBlockStateCache.ts +1 -10
  364. package/src/chain/stateCache/persistentCheckpointsCache.ts +139 -247
  365. package/src/chain/stateCache/types.ts +8 -14
  366. package/src/chain/validation/aggregateAndProof.ts +13 -0
  367. package/src/chain/validation/attestation.ts +13 -0
  368. package/src/chain/validation/block.ts +1 -0
  369. package/src/chain/validation/executionPayloadBid.ts +25 -8
  370. package/src/chain/validation/executionPayloadEnvelope.ts +22 -12
  371. package/src/chain/validation/payloadAttestationMessage.ts +5 -3
  372. package/src/chain/validation/proposerPreferences.ts +110 -0
  373. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +1 -1
  374. package/src/execution/engine/http.ts +21 -14
  375. package/src/execution/engine/interface.ts +1 -0
  376. package/src/execution/engine/mock.ts +8 -1
  377. package/src/execution/engine/types.ts +41 -0
  378. package/src/metrics/metrics/lodestar.ts +4 -0
  379. package/src/network/gossip/interface.ts +6 -0
  380. package/src/network/gossip/scoringParameters.ts +14 -1
  381. package/src/network/gossip/topic.ts +6 -0
  382. package/src/network/interface.ts +1 -0
  383. package/src/network/network.ts +12 -1
  384. package/src/network/processor/gossipHandlers.ts +79 -27
  385. package/src/network/processor/gossipQueues/index.ts +5 -0
  386. package/src/network/processor/index.ts +6 -5
  387. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
  388. package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
  389. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
  390. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
  391. package/src/node/nodejs.ts +6 -4
  392. package/src/sync/constants.ts +4 -4
  393. package/src/sync/range/batch.ts +204 -49
  394. package/src/sync/range/chain.ts +69 -11
  395. package/src/sync/range/range.ts +18 -6
  396. package/src/sync/types.ts +72 -0
  397. package/src/sync/unknownBlock.ts +762 -57
  398. package/src/sync/utils/downloadByRange.ts +272 -39
  399. package/src/sync/utils/downloadByRoot.ts +24 -2
  400. package/src/sync/utils/pendingBlocksTree.ts +0 -15
  401. package/src/util/sszBytes.ts +25 -5
@@ -90,6 +90,19 @@ async function validateAggregateAndProof(
90
90
  });
91
91
  }
92
92
 
93
+ // [REJECT] If `aggregate.data.index == 1` (payload present for a past
94
+ // block), the execution payload for `block` passes validation.
95
+ // [IGNORE] When `aggregate.data.index == 1` (payload present for a past block),
96
+ // the corresponding execution payload for `block` has been seen (a client MAY queue
97
+ // attestations for processing once the payload is retrieved and SHOULD request the
98
+ // payload envelope via `ExecutionPayloadEnvelopesByRoot`).
99
+ if (block !== null && attData.index === 1 && !chain.seenPayloadEnvelope(toRootHex(attData.beaconBlockRoot))) {
100
+ throw new AttestationError(GossipAction.IGNORE, {
101
+ code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
102
+ beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
103
+ });
104
+ }
105
+
93
106
  // [REJECT] len(committee_indices) == 1, where committee_indices = get_committee_indices(aggregate)
94
107
  committeeIndex = (aggregate as electra.Attestation).committeeBits.getSingleTrueBit();
95
108
  if (committeeIndex === null) {
@@ -315,6 +315,19 @@ async function validateAttestationNoSignatureCheck(
315
315
  code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT,
316
316
  });
317
317
  }
318
+
319
+ // [REJECT] If `attestation.data.index == 1` (payload present for a past
320
+ // block), the execution payload for `block` passes validation.
321
+ // [IGNORE] When `attestation.data.index == 1` (payload present for a past block),
322
+ // the corresponding execution payload for `block` has been seen (a client MAY queue
323
+ // attestations for processing once the payload is retrieved and SHOULD request the
324
+ // payload envelope via `ExecutionPayloadEnvelopesByRoot`).
325
+ if (block !== null && attData.index === 1 && !chain.seenPayloadEnvelope(toRootHex(attData.beaconBlockRoot))) {
326
+ throw new AttestationError(GossipAction.IGNORE, {
327
+ code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
328
+ beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
329
+ });
330
+ }
318
331
  } else {
319
332
  // [REJECT] attestation.data.index == 0
320
333
  if (attData.index !== 0) {
@@ -103,6 +103,7 @@ export async function validateGossipBlock(
103
103
  if (chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHashHex) === null) {
104
104
  throw new BlockGossipError(GossipAction.IGNORE, {
105
105
  code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
106
+ parentRoot,
106
107
  parentBlockHash: parentBlockHashHex,
107
108
  });
108
109
  }
@@ -1,5 +1,6 @@
1
1
  import {PublicKey} from "@chainsafe/blst";
2
2
  import {
3
+ computeEpochAtSlot,
3
4
  createSingleSignatureSetFromComponents,
4
5
  getExecutionPayloadBidSigningRoot,
5
6
  isActiveBuilder,
@@ -47,9 +48,12 @@ async function validateExecutionPayloadBid(
47
48
  });
48
49
  }
49
50
 
50
- // [IGNORE] the `SignedProposerPreferences` where `preferences.proposal_slot`
51
- // is equal to `bid.slot` has been seen.
52
- // TODO GLOAS: Implement this along with proposer preference
51
+ // [IGNORE] A `SignedProposerPreferences` matching `bid.slot` and the bid's branch has been
52
+ // seen i.e. `proposal_slot == bid.slot` AND `dependent_root ==
53
+ // get_proposer_dependent_root(parent_state, compute_epoch_at_slot(bid.slot))`,
54
+ // where `parent_state` is the post-state of `bid.parent_block_root`.
55
+ // This is the message referenced as `proposer_preferences` in the following REJECT rules.
56
+ // TODO GLOAS: Implement once a ProposerPreferencesPool exists.
53
57
 
54
58
  // [REJECT] `bid.builder_index` is a valid/active builder index -- i.e.
55
59
  // `is_active_builder(state, bid.builder_index)` returns `True`.
@@ -70,11 +74,24 @@ async function validateExecutionPayloadBid(
70
74
  });
71
75
  }
72
76
 
73
- // [REJECT] `bid.fee_recipient` matches the `fee_recipient` from the proposer's
74
- // `SignedProposerPreferences` associated with `bid.slot`.
75
- // [REJECT] `bid.gas_limit` matches the `gas_limit` from the proposer's
76
- // `SignedProposerPreferences` associated with `bid.slot`.
77
- // TODO GLOAS: Implement this along with proposer preference
77
+ // [REJECT] `bid.fee_recipient == proposer_preferences.fee_recipient`.
78
+ // [REJECT] `bid.gas_limit == proposer_preferences.gas_limit`.
79
+ // Both compared against the matching `proposer_preferences` defined above (same branch
80
+ // via dependent_root, same proposal_slot).
81
+ // TODO GLOAS: Implement once a ProposerPreferencesPool exists.
82
+
83
+ // [REJECT] The length of KZG commitments is less than or equal to the limitation defined in the
84
+ // consensus layer -- i.e. validate that
85
+ // `len(bid.blob_kzg_commitments) <= get_blob_parameters(compute_epoch_at_slot(bid.slot)).max_blobs_per_block`.
86
+ const blobKzgCommitmentsLen = bid.blobKzgCommitments.length;
87
+ const maxBlobsPerBlock = chain.config.getMaxBlobsPerBlock(computeEpochAtSlot(bid.slot));
88
+ if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
89
+ throw new ExecutionPayloadBidError(GossipAction.REJECT, {
90
+ code: ExecutionPayloadBidErrorCode.TOO_MANY_KZG_COMMITMENTS,
91
+ blobKzgCommitmentsLen,
92
+ commitmentLimit: maxBlobsPerBlock,
93
+ });
94
+ }
78
95
 
79
96
  // [IGNORE] this is the first signed bid seen with a valid signature from the given builder for this slot.
80
97
  if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex)) {
@@ -4,8 +4,8 @@ import {
4
4
  getExecutionPayloadEnvelopeSignatureSet,
5
5
  isStatePostGloas,
6
6
  } from "@lodestar/state-transition";
7
- import {gloas} from "@lodestar/types";
8
- import {toRootHex} from "@lodestar/utils";
7
+ import {gloas, ssz} from "@lodestar/types";
8
+ import {byteArrayEquals, toRootHex} from "@lodestar/utils";
9
9
  import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.js";
10
10
  import {IBeaconChain} from "../index.js";
11
11
  import {RegenCaller} from "../regen/index.js";
@@ -32,7 +32,7 @@ async function validateExecutionPayloadEnvelope(
32
32
  const {payload} = envelope;
33
33
  const blockRootHex = toRootHex(envelope.beaconBlockRoot);
34
34
 
35
- // [IGNORE] The envelope's block root `envelope.block_root` has been seen (via
35
+ // [IGNORE] The envelope's block root `envelope.beacon_block_root` has been seen (via
36
36
  // gossip or non-gossip sources) (a client MAY queue payload for processing once
37
37
  // the block is retrieved).
38
38
  // TODO GLOAS: Need to review this, we should queue the envelope for later
@@ -53,7 +53,7 @@ async function validateExecutionPayloadEnvelope(
53
53
  throw new ExecutionPayloadEnvelopeError(GossipAction.IGNORE, {
54
54
  code: ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN,
55
55
  blockRoot: blockRootHex,
56
- slot: envelope.slot,
56
+ slot: payload.slotNumber,
57
57
  });
58
58
  }
59
59
 
@@ -65,13 +65,13 @@ async function validateExecutionPayloadEnvelope(
65
65
  });
66
66
  }
67
67
 
68
- // [IGNORE] The envelope is from a slot greater than or equal to the latest finalized slot -- i.e. validate that `envelope.slot >= compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)`
68
+ // [IGNORE] The envelope is from a slot greater than or equal to the latest finalized slot -- i.e. validate that `payload.slotNumber >= compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)`
69
69
  const finalizedCheckpoint = chain.forkChoice.getFinalizedCheckpoint();
70
70
  const finalizedSlot = computeStartSlotAtEpoch(finalizedCheckpoint.epoch);
71
- if (envelope.slot < finalizedSlot) {
71
+ if (payload.slotNumber < finalizedSlot) {
72
72
  throw new ExecutionPayloadEnvelopeError(GossipAction.IGNORE, {
73
73
  code: ExecutionPayloadEnvelopeErrorCode.BELONG_TO_FINALIZED_BLOCK,
74
- envelopeSlot: envelope.slot,
74
+ envelopeSlot: payload.slotNumber,
75
75
  finalizedSlot,
76
76
  });
77
77
  }
@@ -80,11 +80,11 @@ async function validateExecutionPayloadEnvelope(
80
80
  // TODO GLOAS: implement this. Technically if we cannot get proto block from fork choice,
81
81
  // it is possible that the block didn't pass the validation
82
82
 
83
- // [REJECT] `block.slot` equals `envelope.slot`.
84
- if (block.slot !== envelope.slot) {
83
+ // [REJECT] `block.slot` equals `payload.slotNumber`.
84
+ if (block.slot !== payload.slotNumber) {
85
85
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
86
86
  code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH,
87
- envelopeSlot: envelope.slot,
87
+ envelopeSlot: payload.slotNumber,
88
88
  blockSlot: block.slot,
89
89
  });
90
90
  }
@@ -107,14 +107,24 @@ async function validateExecutionPayloadEnvelope(
107
107
  });
108
108
  }
109
109
 
110
- // Get the post block state which is the pre-payload state to verify the builder's signature.
110
+ // [REJECT] `hash_tree_root(envelope.execution_requests) == bid.execution_requests_root`
111
+ const requestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
112
+ if (!byteArrayEquals(requestsRoot, payloadInput.getBid().executionRequestsRoot)) {
113
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
114
+ code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH,
115
+ envelopeRequestsRoot: toRootHex(requestsRoot),
116
+ bidRequestsRoot: toRootHex(payloadInput.getBid().executionRequestsRoot),
117
+ });
118
+ }
119
+
120
+ // Get the block state to verify the builder's signature.
111
121
  const blockState = await chain.regen
112
122
  .getState(block.stateRoot, RegenCaller.validateGossipPayloadEnvelope)
113
123
  .catch(() => {
114
124
  throw new ExecutionPayloadEnvelopeError(GossipAction.IGNORE, {
115
125
  code: ExecutionPayloadEnvelopeErrorCode.UNKNOWN_BLOCK_STATE,
116
126
  blockRoot: blockRootHex,
117
- slot: envelope.slot,
127
+ slot: payload.slotNumber,
118
128
  });
119
129
  });
120
130
  if (!isStatePostGloas(blockState)) {
@@ -18,7 +18,8 @@ export async function validateApiPayloadAttestationMessage(
18
18
  chain: IBeaconChain,
19
19
  payloadAttestationMessage: gloas.PayloadAttestationMessage
20
20
  ): Promise<PayloadAttestationValidationResult> {
21
- return validatePayloadAttestationMessage(chain, payloadAttestationMessage);
21
+ const prioritizeBls = true;
22
+ return validatePayloadAttestationMessage(chain, payloadAttestationMessage, prioritizeBls);
22
23
  }
23
24
 
24
25
  export async function validateGossipPayloadAttestationMessage(
@@ -30,7 +31,8 @@ export async function validateGossipPayloadAttestationMessage(
30
31
 
31
32
  async function validatePayloadAttestationMessage(
32
33
  chain: IBeaconChain,
33
- payloadAttestationMessage: gloas.PayloadAttestationMessage
34
+ payloadAttestationMessage: gloas.PayloadAttestationMessage,
35
+ prioritizeBls = false
34
36
  ): Promise<PayloadAttestationValidationResult> {
35
37
  const {data, validatorIndex} = payloadAttestationMessage;
36
38
  const epoch = computeEpochAtSlot(data.slot);
@@ -102,7 +104,7 @@ async function validatePayloadAttestationMessage(
102
104
  payloadAttestationMessage.signature
103
105
  );
104
106
 
105
- if (!(await chain.bls.verifySignatureSets([signatureSet]))) {
107
+ if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
106
108
  throw new PayloadAttestationError(GossipAction.REJECT, {
107
109
  code: PayloadAttestationErrorCode.INVALID_SIGNATURE,
108
110
  });
@@ -0,0 +1,110 @@
1
+ import {SLOTS_PER_EPOCH} from "@lodestar/params";
2
+ import {
3
+ computeEpochAtSlot,
4
+ createSingleSignatureSetFromComponents,
5
+ getProposerPreferencesSigningRoot,
6
+ } from "@lodestar/state-transition";
7
+ import {ValidatorIndex, gloas} from "@lodestar/types";
8
+ import {toRootHex} from "@lodestar/utils";
9
+ import {GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode} from "../errors/index.js";
10
+ import {IBeaconChain} from "../index.js";
11
+
12
+ /**
13
+ * Validates a gossiped `SignedProposerPreferences` per
14
+ * https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#proposer_preferences
15
+ */
16
+ export async function validateGossipProposerPreferences(
17
+ chain: IBeaconChain,
18
+ signedProposerPreferences: gloas.SignedProposerPreferences
19
+ ): Promise<void> {
20
+ const preferences = signedProposerPreferences.message;
21
+ const {proposalSlot, validatorIndex, dependentRoot} = preferences;
22
+ const dependentRootHex = toRootHex(dependentRoot);
23
+ const proposalEpoch = computeEpochAtSlot(proposalSlot);
24
+
25
+ // [IGNORE] `preferences.proposal_slot` is in the current or next epoch.
26
+ const currentEpoch = chain.clock.currentEpoch;
27
+ if (proposalEpoch < currentEpoch || proposalEpoch > currentEpoch + 1) {
28
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
29
+ code: ProposerPreferencesErrorCode.INVALID_EPOCH,
30
+ proposalSlot,
31
+ currentEpoch,
32
+ });
33
+ }
34
+
35
+ // [IGNORE] `preferences.proposal_slot` has not already passed.
36
+ const currentSlot = chain.clock.currentSlot;
37
+ if (proposalSlot <= currentSlot) {
38
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
39
+ code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
40
+ proposalSlot,
41
+ currentSlot,
42
+ });
43
+ }
44
+
45
+ // [IGNORE] The block with root `dependent_root` has been seen by the node.
46
+ // Resolve the proposer lookahead for the message's branch via head state (fast path) or
47
+ // the previous-root checkpoint state (populated by `processSlotsToNearestCheckpoint` for
48
+ // any imported branch crossing into `proposalEpoch - 1`). The head-state path also handles
49
+ // narrow timing windows where the checkpoint state isn't yet populated.
50
+ const headState = chain.getHeadState();
51
+ let proposers: ValidatorIndex[] | null = null;
52
+ if (headState.epoch === proposalEpoch && headState.currentDecisionRoot === dependentRootHex) {
53
+ proposers = headState.currentProposers;
54
+ } else if (headState.epoch === proposalEpoch - 1 && headState.nextDecisionRoot === dependentRootHex) {
55
+ proposers = headState.nextProposers;
56
+ } else {
57
+ // Sync lookup only to not trigger disk reload from gossip input.
58
+ const checkpointState = chain.regen.getCheckpointStateSync({epoch: proposalEpoch - 1, rootHex: dependentRootHex});
59
+ if (checkpointState !== null) {
60
+ // State is at `proposalEpoch - 1`, so proposers for `proposalSlot` (next epoch from
61
+ // the state's perspective) live in `nextProposers`.
62
+ proposers = checkpointState.nextProposers;
63
+ }
64
+ }
65
+ if (proposers === null) {
66
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
67
+ code: ProposerPreferencesErrorCode.UNKNOWN_DEPENDENT_ROOT,
68
+ proposalSlot,
69
+ dependentRoot: dependentRootHex,
70
+ });
71
+ }
72
+
73
+ // [REJECT] `is_valid_proposal_slot(state, preferences)` returns True.
74
+ if (proposers[proposalSlot % SLOTS_PER_EPOCH] !== validatorIndex) {
75
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
76
+ code: ProposerPreferencesErrorCode.INVALID_PROPOSER,
77
+ proposalSlot,
78
+ validatorIndex,
79
+ dependentRoot: dependentRootHex,
80
+ });
81
+ }
82
+
83
+ // [IGNORE] First valid message for (dependent_root, proposal_slot, validator_index).
84
+ if (chain.seenProposerPreferences.isKnown(dependentRootHex, proposalSlot, validatorIndex)) {
85
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
86
+ code: ProposerPreferencesErrorCode.ALREADY_KNOWN,
87
+ proposalSlot,
88
+ validatorIndex,
89
+ dependentRoot: dependentRootHex,
90
+ });
91
+ }
92
+
93
+ // [REJECT] `signed_proposer_preferences.signature` is valid with respect to the validator's public key.
94
+ const signatureSet = createSingleSignatureSetFromComponents(
95
+ chain.pubkeyCache.getOrThrow(validatorIndex),
96
+ getProposerPreferencesSigningRoot(chain.config, preferences),
97
+ signedProposerPreferences.signature
98
+ );
99
+
100
+ if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true}))) {
101
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
102
+ code: ProposerPreferencesErrorCode.INVALID_SIGNATURE,
103
+ proposalSlot,
104
+ validatorIndex,
105
+ });
106
+ }
107
+
108
+ // Valid
109
+ chain.seenProposerPreferences.add(dependentRootHex, proposalSlot, validatorIndex);
110
+ }
@@ -19,7 +19,7 @@ export class ExecutionPayloadEnvelopeArchiveRepository extends Repository<Slot,
19
19
  * Id is the slot from the envelope
20
20
  */
21
21
  getId(value: gloas.SignedExecutionPayloadEnvelope): Slot {
22
- return value.message.slot;
22
+ return value.message.payload.slotNumber;
23
23
  }
24
24
 
25
25
  encodeKey(id: Slot): Uint8Array {
@@ -216,13 +216,15 @@ export class ExecutionEngineHttp implements IExecutionEngine {
216
216
  executionRequests?: ExecutionRequests
217
217
  ): Promise<ExecutePayloadResponse> {
218
218
  const method =
219
- ForkSeq[fork] >= ForkSeq.electra
220
- ? "engine_newPayloadV4"
221
- : ForkSeq[fork] >= ForkSeq.deneb
222
- ? "engine_newPayloadV3"
223
- : ForkSeq[fork] >= ForkSeq.capella
224
- ? "engine_newPayloadV2"
225
- : "engine_newPayloadV1";
219
+ ForkSeq[fork] >= ForkSeq.gloas
220
+ ? "engine_newPayloadV5"
221
+ : ForkSeq[fork] >= ForkSeq.electra
222
+ ? "engine_newPayloadV4"
223
+ : ForkSeq[fork] >= ForkSeq.deneb
224
+ ? "engine_newPayloadV3"
225
+ : ForkSeq[fork] >= ForkSeq.capella
226
+ ? "engine_newPayloadV2"
227
+ : "engine_newPayloadV1";
226
228
 
227
229
  const serializedExecutionPayload = serializeExecutionPayload(fork, executionPayload);
228
230
 
@@ -244,7 +246,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
244
246
  }
245
247
  const serializedExecutionRequests = serializeExecutionRequests(executionRequests);
246
248
  engineRequest = {
247
- method: "engine_newPayloadV4",
249
+ method: ForkSeq[fork] >= ForkSeq.gloas ? "engine_newPayloadV5" : "engine_newPayloadV4",
248
250
  params: [
249
251
  serializedExecutionPayload,
250
252
  serializedVersionedHashes,
@@ -348,11 +350,13 @@ export class ExecutionEngineHttp implements IExecutionEngine {
348
350
  // Once on capella, should this need to be permanently switched to v2 when payload attrs
349
351
  // not provided
350
352
  const method =
351
- ForkSeq[fork] >= ForkSeq.deneb
352
- ? "engine_forkchoiceUpdatedV3"
353
- : ForkSeq[fork] >= ForkSeq.capella
354
- ? "engine_forkchoiceUpdatedV2"
355
- : "engine_forkchoiceUpdatedV1";
353
+ ForkSeq[fork] >= ForkSeq.gloas
354
+ ? "engine_forkchoiceUpdatedV4"
355
+ : ForkSeq[fork] >= ForkSeq.deneb
356
+ ? "engine_forkchoiceUpdatedV3"
357
+ : ForkSeq[fork] >= ForkSeq.capella
358
+ ? "engine_forkchoiceUpdatedV2"
359
+ : "engine_forkchoiceUpdatedV1";
356
360
  const payloadAttributesRpc = payloadAttributes ? serializePayloadAttributes(payloadAttributes) : undefined;
357
361
  // If we are just fcUing and not asking execution for payload, retry is not required
358
362
  // and we can move on, as the next fcU will be issued soon on the new slot
@@ -438,9 +442,12 @@ export class ExecutionEngineHttp implements IExecutionEngine {
438
442
  case ForkName.electra:
439
443
  method = "engine_getPayloadV4";
440
444
  break;
441
- default:
445
+ case ForkName.fulu:
442
446
  method = "engine_getPayloadV5";
443
447
  break;
448
+ default:
449
+ method = "engine_getPayloadV6";
450
+ break;
444
451
  }
445
452
  const payloadResponse = await this.rpc.fetchWithRetries<
446
453
  EngineApiRpcReturnTypes[typeof method],
@@ -87,6 +87,7 @@ export type PayloadAttributes = {
87
87
  suggestedFeeRecipient: string;
88
88
  withdrawals?: capella.Withdrawal[];
89
89
  parentBeaconBlockRoot?: Uint8Array;
90
+ slotNumber?: number; // EIP-7843
90
91
  };
91
92
 
92
93
  export type VersionedHashes = Uint8Array[];
@@ -11,7 +11,7 @@ import {
11
11
  SLOTS_PER_EPOCH,
12
12
  } from "@lodestar/params";
13
13
  import {computeTimeAtSlot} from "@lodestar/state-transition";
14
- import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
14
+ import {ExecutionPayload, RootHex, bellatrix, deneb, gloas, ssz} from "@lodestar/types";
15
15
  import {fromHex, toRootHex} from "@lodestar/utils";
16
16
  import {ZERO_HASH_HEX} from "../../constants/index.js";
17
17
  import {INTEROP_BLOCK_HASH} from "../../node/utils/interop/state.js";
@@ -132,14 +132,17 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
132
132
  engine_newPayloadV2: this.notifyNewPayload.bind(this),
133
133
  engine_newPayloadV3: this.notifyNewPayload.bind(this),
134
134
  engine_newPayloadV4: this.notifyNewPayload.bind(this),
135
+ engine_newPayloadV5: this.notifyNewPayload.bind(this),
135
136
  engine_forkchoiceUpdatedV1: this.notifyForkchoiceUpdate.bind(this),
136
137
  engine_forkchoiceUpdatedV2: this.notifyForkchoiceUpdate.bind(this),
137
138
  engine_forkchoiceUpdatedV3: this.notifyForkchoiceUpdate.bind(this),
139
+ engine_forkchoiceUpdatedV4: this.notifyForkchoiceUpdate.bind(this),
138
140
  engine_getPayloadV1: this.getPayloadV1.bind(this),
139
141
  engine_getPayloadV2: this.getPayloadV5.bind(this),
140
142
  engine_getPayloadV3: this.getPayloadV5.bind(this),
141
143
  engine_getPayloadV4: this.getPayloadV5.bind(this),
142
144
  engine_getPayloadV5: this.getPayloadV5.bind(this),
145
+ engine_getPayloadV6: this.getPayloadV5.bind(this),
143
146
  engine_getPayloadBodiesByHashV1: this.getPayloadBodiesByHash.bind(this),
144
147
  engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this),
145
148
  engine_getClientVersionV1: this.getClientVersionV1.bind(this),
@@ -379,6 +382,10 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
379
382
  (executionPayload as ExecutionPayload<ForkPostCapella>).withdrawals = ssz.capella.Withdrawals.defaultValue();
380
383
  }
381
384
 
385
+ if (ForkSeq[fork] >= ForkSeq.gloas && payloadAttributes.slotNumber != null) {
386
+ (executionPayload as gloas.ExecutionPayload).slotNumber = payloadAttributes.slotNumber;
387
+ }
388
+
382
389
  this.preparingPayloads.set(payloadId, {
383
390
  executionPayload: serializeExecutionPayload(fork, executionPayload),
384
391
  blobsBundle: serializeBlobsBundle({
@@ -19,6 +19,7 @@ import {
19
19
  capella,
20
20
  deneb,
21
21
  electra,
22
+ gloas,
22
23
  ssz,
23
24
  } from "@lodestar/types";
24
25
  import {BlobAndProof} from "@lodestar/types/deneb";
@@ -50,6 +51,7 @@ export type EngineApiRpcParamTypes = {
50
51
  engine_newPayloadV2: [ExecutionPayloadRpc];
51
52
  engine_newPayloadV3: [ExecutionPayloadRpc, VersionedHashesRpc, DATA];
52
53
  engine_newPayloadV4: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
54
+ engine_newPayloadV5: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
53
55
  /**
54
56
  * 1. Object - Payload validity status with respect to the consensus rules:
55
57
  * - blockHash: DATA, 32 Bytes - block hash value of the payload
@@ -67,6 +69,10 @@ export type EngineApiRpcParamTypes = {
67
69
  forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
68
70
  payloadAttributes?: PayloadAttributesRpc,
69
71
  ];
72
+ engine_forkchoiceUpdatedV4: [
73
+ forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
74
+ payloadAttributes?: PayloadAttributesRpc,
75
+ ];
70
76
  /**
71
77
  * 1. payloadId: QUANTITY, 64 Bits - Identifier of the payload building process
72
78
  */
@@ -75,6 +81,7 @@ export type EngineApiRpcParamTypes = {
75
81
  engine_getPayloadV3: [QUANTITY];
76
82
  engine_getPayloadV4: [QUANTITY];
77
83
  engine_getPayloadV5: [QUANTITY];
84
+ engine_getPayloadV6: [QUANTITY];
78
85
 
79
86
  /**
80
87
  * 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
@@ -111,6 +118,7 @@ export type EngineApiRpcReturnTypes = {
111
118
  engine_newPayloadV2: PayloadStatus;
112
119
  engine_newPayloadV3: PayloadStatus;
113
120
  engine_newPayloadV4: PayloadStatus;
121
+ engine_newPayloadV5: PayloadStatus;
114
122
  engine_forkchoiceUpdatedV1: {
115
123
  payloadStatus: PayloadStatus;
116
124
  payloadId: QUANTITY | null;
@@ -123,6 +131,10 @@ export type EngineApiRpcReturnTypes = {
123
131
  payloadStatus: PayloadStatus;
124
132
  payloadId: QUANTITY | null;
125
133
  };
134
+ engine_forkchoiceUpdatedV4: {
135
+ payloadStatus: PayloadStatus;
136
+ payloadId: QUANTITY | null;
137
+ };
126
138
  /**
127
139
  * payloadId | Error: QUANTITY, 64 Bits - Identifier of the payload building process
128
140
  */
@@ -131,6 +143,7 @@ export type EngineApiRpcReturnTypes = {
131
143
  engine_getPayloadV3: ExecutionPayloadResponse;
132
144
  engine_getPayloadV4: ExecutionPayloadResponse;
133
145
  engine_getPayloadV5: ExecutionPayloadResponse;
146
+ engine_getPayloadV6: ExecutionPayloadResponse;
134
147
 
135
148
  engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
136
149
 
@@ -180,6 +193,8 @@ export type ExecutionPayloadRpc = {
180
193
  withdrawals?: WithdrawalRpc[]; // Capella hardfork
181
194
  blobGasUsed?: QUANTITY; // DENEB
182
195
  excessBlobGas?: QUANTITY; // DENEB
196
+ blockAccessList?: DATA; // GLOAS:EIP-7928
197
+ slotNumber?: QUANTITY; // GLOAS:EIP-7843
183
198
  };
184
199
 
185
200
  export type WithdrawalRpc = {
@@ -228,6 +243,8 @@ export type PayloadAttributesRpc = {
228
243
  withdrawals?: WithdrawalRpc[];
229
244
  /** DATA, 32 Bytes - value for the parentBeaconBlockRoot to be used for building block */
230
245
  parentBeaconBlockRoot?: DATA;
246
+ /** QUANTITY, 64 Bits - value for the slot number field of the new payload (EIP-7843) */
247
+ slotNumber?: QUANTITY;
231
248
  };
232
249
 
233
250
  export type ClientVersionRpc = {
@@ -280,6 +297,12 @@ export function serializeExecutionPayload(fork: ForkName, data: ExecutionPayload
280
297
 
281
298
  // No changes in Electra
282
299
 
300
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
301
+ const {blockAccessList, slotNumber} = data as gloas.ExecutionPayload;
302
+ payload.blockAccessList = bytesToData(blockAccessList);
303
+ payload.slotNumber = numToQuantity(slotNumber);
304
+ }
305
+
283
306
  return payload;
284
307
  }
285
308
 
@@ -375,6 +398,22 @@ export function parseExecutionPayload(
375
398
 
376
399
  // No changes in Electra
377
400
 
401
+ if (ForkSeq[fork] >= ForkSeq.gloas) {
402
+ const {blockAccessList, slotNumber} = data;
403
+ if (blockAccessList == null) {
404
+ throw Error(
405
+ `blockAccessList missing for ${fork} >= gloas executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
406
+ );
407
+ }
408
+ if (slotNumber == null) {
409
+ throw Error(
410
+ `slotNumber missing for ${fork} >= gloas executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
411
+ );
412
+ }
413
+ (executionPayload as gloas.ExecutionPayload).blockAccessList = dataToBytes(blockAccessList, null);
414
+ (executionPayload as gloas.ExecutionPayload).slotNumber = quantityToNum(slotNumber);
415
+ }
416
+
378
417
  return {executionPayload, executionPayloadValue, blobsBundle, executionRequests, shouldOverrideBuilder};
379
418
  }
380
419
 
@@ -385,6 +424,7 @@ export function serializePayloadAttributes(data: PayloadAttributes): PayloadAttr
385
424
  suggestedFeeRecipient: data.suggestedFeeRecipient,
386
425
  withdrawals: data.withdrawals?.map(serializeWithdrawal),
387
426
  parentBeaconBlockRoot: data.parentBeaconBlockRoot ? bytesToData(data.parentBeaconBlockRoot) : undefined,
427
+ slotNumber: data.slotNumber !== undefined ? numToQuantity(data.slotNumber) : undefined,
388
428
  };
389
429
  }
390
430
 
@@ -401,6 +441,7 @@ export function deserializePayloadAttributes(data: PayloadAttributesRpc): Payloa
401
441
  suggestedFeeRecipient: data.suggestedFeeRecipient,
402
442
  withdrawals: data.withdrawals?.map((withdrawal) => deserializeWithdrawal(withdrawal)),
403
443
  parentBeaconBlockRoot: data.parentBeaconBlockRoot ? dataToBytes(data.parentBeaconBlockRoot, 32) : undefined,
444
+ slotNumber: data.slotNumber !== undefined ? quantityToNum(data.slotNumber) : undefined,
404
445
  };
405
446
  }
406
447
 
@@ -613,6 +613,10 @@ export function createLodestarMetrics(
613
613
  name: "lodestar_sync_unknown_block_pending_blocks_size",
614
614
  help: "Current size of UnknownBlockSync pending blocks cache",
615
615
  }),
616
+ pendingPayloads: register.gauge({
617
+ name: "lodestar_sync_unknown_block_pending_payloads_size",
618
+ help: "Current size of UnknownBlockSync pending payloads cache",
619
+ }),
616
620
  knownBadBlocks: register.gauge({
617
621
  name: "lodestar_sync_unknown_block_known_bad_blocks_size",
618
622
  help: "Current size of UnknownBlockSync known bad blocks cache",
@@ -41,6 +41,7 @@ export enum GossipType {
41
41
  execution_payload = "execution_payload",
42
42
  payload_attestation_message = "payload_attestation_message",
43
43
  execution_payload_bid = "execution_payload_bid",
44
+ proposer_preferences = "proposer_preferences",
44
45
  }
45
46
 
46
47
  export type SequentialGossipType = Exclude<GossipType, GossipType.beacon_attestation>;
@@ -78,6 +79,7 @@ export type GossipTopicTypeMap = {
78
79
  [GossipType.execution_payload]: {type: GossipType.execution_payload};
79
80
  [GossipType.payload_attestation_message]: {type: GossipType.payload_attestation_message};
80
81
  [GossipType.execution_payload_bid]: {type: GossipType.execution_payload_bid};
82
+ [GossipType.proposer_preferences]: {type: GossipType.proposer_preferences};
81
83
  };
82
84
 
83
85
  export type GossipTopicMap = {
@@ -110,6 +112,7 @@ export type GossipTypeMap = {
110
112
  [GossipType.execution_payload]: gloas.SignedExecutionPayloadEnvelope;
111
113
  [GossipType.payload_attestation_message]: gloas.PayloadAttestationMessage;
112
114
  [GossipType.execution_payload_bid]: gloas.SignedExecutionPayloadBid;
115
+ [GossipType.proposer_preferences]: gloas.SignedProposerPreferences;
113
116
  };
114
117
 
115
118
  export type GossipFnByType = {
@@ -141,6 +144,9 @@ export type GossipFnByType = {
141
144
  payloadAttestationMessage: gloas.PayloadAttestationMessage
142
145
  ) => Promise<void> | void;
143
146
  [GossipType.execution_payload_bid]: (executionPayloadBid: gloas.SignedExecutionPayloadBid) => Promise<void> | void;
147
+ [GossipType.proposer_preferences]: (
148
+ signedProposerPreferences: gloas.SignedProposerPreferences
149
+ ) => Promise<void> | void;
144
150
  };
145
151
 
146
152
  export type GossipFn = GossipFnByType[keyof GossipFnByType];
@@ -27,6 +27,7 @@ const BLS_TO_EXECUTION_CHANGE_WEIGHT = 0.05;
27
27
  const EXECUTION_PAYLOAD_WEIGHT = 0.5;
28
28
  const PAYLOAD_ATTESTATION_WEIGHT = 0.05;
29
29
  const EXECUTION_PAYLOAD_BID_WEIGHT = 0.05;
30
+ const PROPOSER_PREFERENCES_WEIGHT = 0.05;
30
31
 
31
32
  const beaconAttestationSubnetWeight = 1 / ATTESTATION_SUBNET_COUNT;
32
33
  const maxPositiveScore =
@@ -40,7 +41,8 @@ const maxPositiveScore =
40
41
  BLS_TO_EXECUTION_CHANGE_WEIGHT +
41
42
  EXECUTION_PAYLOAD_WEIGHT +
42
43
  PAYLOAD_ATTESTATION_WEIGHT +
43
- EXECUTION_PAYLOAD_BID_WEIGHT);
44
+ EXECUTION_PAYLOAD_BID_WEIGHT +
45
+ PROPOSER_PREFERENCES_WEIGHT);
44
46
 
45
47
  /**
46
48
  * The following params is implemented by Lighthouse at
@@ -198,6 +200,17 @@ function getAllTopicsScoreParams(
198
200
  expectedMessageRate: 1024, // TODO GLOAS: Need an estimate for this
199
201
  firstMessageDecayTime: epochDurationMs * 100,
200
202
  });
203
+ topicsParams[
204
+ stringifyGossipTopic(config, {
205
+ type: GossipType.proposer_preferences,
206
+ boundary,
207
+ })
208
+ ] = getTopicScoreParams(config, precomputedParams, {
209
+ topicWeight: PROPOSER_PREFERENCES_WEIGHT,
210
+ // Upper bound ~64 messages per epoch: one per proposer across the current + next epoch.
211
+ expectedMessageRate: 64 / SLOTS_PER_EPOCH,
212
+ firstMessageDecayTime: epochDurationMs * 100,
213
+ });
201
214
 
202
215
  // other topics
203
216
  topicsParams[