@lodestar/beacon-node 1.39.0-dev.3bf4734ba9 → 1.39.0-dev.4263377242

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 (475) hide show
  1. package/README.md +1 -1
  2. package/lib/api/impl/beacon/blocks/utils.js +1 -1
  3. package/lib/api/impl/beacon/blocks/utils.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/lodestar/index.js +1 -1
  9. package/lib/api/impl/lodestar/index.js.map +1 -1
  10. package/lib/api/impl/proof/index.d.ts.map +1 -1
  11. package/lib/api/impl/proof/index.js +1 -2
  12. package/lib/api/impl/proof/index.js.map +1 -1
  13. package/lib/api/impl/validator/index.d.ts.map +1 -1
  14. package/lib/api/impl/validator/index.js +1 -3
  15. package/lib/api/impl/validator/index.js.map +1 -1
  16. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  17. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -3
  18. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  19. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  20. package/lib/chain/blocks/importBlock.js +12 -3
  21. package/lib/chain/blocks/importBlock.js.map +1 -1
  22. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  23. package/lib/chain/blocks/verifyBlock.js +9 -2
  24. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  25. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  26. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +4 -2
  27. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  28. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -1
  29. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  30. package/lib/chain/blocks/verifyBlocksSignatures.js +3 -2
  31. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  32. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  33. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
  34. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  35. package/lib/chain/chain.d.ts +11 -14
  36. package/lib/chain/chain.d.ts.map +1 -1
  37. package/lib/chain/chain.js +36 -50
  38. package/lib/chain/chain.js.map +1 -1
  39. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  40. package/lib/chain/forkChoice/index.js +3 -3
  41. package/lib/chain/forkChoice/index.js.map +1 -1
  42. package/lib/chain/initState.d.ts +2 -15
  43. package/lib/chain/initState.d.ts.map +1 -1
  44. package/lib/chain/initState.js +6 -65
  45. package/lib/chain/initState.js.map +1 -1
  46. package/lib/chain/interface.d.ts +6 -11
  47. package/lib/chain/interface.d.ts.map +1 -1
  48. package/lib/chain/interface.js.map +1 -1
  49. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  50. package/lib/chain/lightClient/proofs.js +0 -2
  51. package/lib/chain/lightClient/proofs.js.map +1 -1
  52. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +8 -12
  53. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  54. package/lib/chain/opPools/aggregatedAttestationPool.js +13 -142
  55. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  56. package/lib/chain/opPools/opPool.d.ts +3 -0
  57. package/lib/chain/opPools/opPool.d.ts.map +1 -1
  58. package/lib/chain/opPools/opPool.js +14 -16
  59. package/lib/chain/opPools/opPool.js.map +1 -1
  60. package/lib/chain/prepareNextSlot.d.ts +0 -4
  61. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  62. package/lib/chain/prepareNextSlot.js +5 -28
  63. package/lib/chain/prepareNextSlot.js.map +1 -1
  64. package/lib/chain/produceBlock/produceBlockBody.d.ts +0 -1
  65. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  66. package/lib/chain/produceBlock/produceBlockBody.js +10 -13
  67. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  68. package/lib/chain/regen/interface.d.ts +1 -5
  69. package/lib/chain/regen/interface.d.ts.map +1 -1
  70. package/lib/chain/regen/queued.d.ts +4 -7
  71. package/lib/chain/regen/queued.d.ts.map +1 -1
  72. package/lib/chain/regen/queued.js +15 -25
  73. package/lib/chain/regen/queued.js.map +1 -1
  74. package/lib/chain/regen/regen.d.ts +1 -1
  75. package/lib/chain/regen/regen.d.ts.map +1 -1
  76. package/lib/chain/regen/regen.js +13 -17
  77. package/lib/chain/regen/regen.js.map +1 -1
  78. package/lib/chain/shufflingCache.d.ts +16 -11
  79. package/lib/chain/shufflingCache.d.ts.map +1 -1
  80. package/lib/chain/shufflingCache.js +47 -41
  81. package/lib/chain/shufflingCache.js.map +1 -1
  82. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
  83. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
  84. package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
  85. package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
  86. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
  87. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  88. package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
  89. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  90. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
  91. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
  92. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
  93. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
  94. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +9 -7
  95. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  96. package/lib/chain/stateCache/persistentCheckpointsCache.js +21 -19
  97. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  98. package/lib/chain/stateCache/types.d.ts +5 -6
  99. package/lib/chain/stateCache/types.d.ts.map +1 -1
  100. package/lib/chain/stateCache/types.js.map +1 -1
  101. package/lib/chain/validation/aggregateAndProof.js +9 -0
  102. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  103. package/lib/chain/validation/attestation.d.ts.map +1 -1
  104. package/lib/chain/validation/attestation.js +2 -2
  105. package/lib/chain/validation/attestation.js.map +1 -1
  106. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  107. package/lib/chain/validation/attesterSlashing.js +2 -2
  108. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  109. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  110. package/lib/chain/validation/blobSidecar.js +2 -3
  111. package/lib/chain/validation/blobSidecar.js.map +1 -1
  112. package/lib/chain/validation/block.d.ts.map +1 -1
  113. package/lib/chain/validation/block.js +5 -3
  114. package/lib/chain/validation/block.js.map +1 -1
  115. package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
  116. package/lib/chain/validation/blsToExecutionChange.js +10 -3
  117. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  118. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  119. package/lib/chain/validation/dataColumnSidecar.js +2 -3
  120. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  121. package/lib/chain/validation/proposerSlashing.js +3 -2
  122. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  123. package/lib/chain/validation/signatureSets/aggregateAndProof.js +1 -1
  124. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  125. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -1
  126. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  127. package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
  128. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  129. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -1
  130. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  131. package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
  132. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  133. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -1
  134. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  135. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  136. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  137. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -1
  138. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  139. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -2
  140. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  141. package/lib/chain/validation/syncCommittee.js +1 -1
  142. package/lib/chain/validation/syncCommittee.js.map +1 -1
  143. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  144. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -3
  145. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  146. package/lib/chain/validation/voluntaryExit.js +1 -1
  147. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  148. package/lib/db/beacon.d.ts +3 -7
  149. package/lib/db/beacon.d.ts.map +1 -1
  150. package/lib/db/beacon.js +33 -12
  151. package/lib/db/beacon.js.map +1 -1
  152. package/lib/db/buckets.d.ts +12 -6
  153. package/lib/db/buckets.d.ts.map +1 -1
  154. package/lib/db/buckets.js +6 -1
  155. package/lib/db/buckets.js.map +1 -1
  156. package/lib/db/interface.d.ts +2 -7
  157. package/lib/db/interface.d.ts.map +1 -1
  158. package/lib/db/repositories/checkpointState.d.ts +2 -6
  159. package/lib/db/repositories/checkpointState.d.ts.map +1 -1
  160. package/lib/db/repositories/checkpointState.js +3 -15
  161. package/lib/db/repositories/checkpointState.js.map +1 -1
  162. package/lib/db/repositories/index.d.ts +0 -3
  163. package/lib/db/repositories/index.d.ts.map +1 -1
  164. package/lib/db/repositories/index.js +0 -3
  165. package/lib/db/repositories/index.js.map +1 -1
  166. package/lib/db/repositories/stateArchive.d.ts +9 -9
  167. package/lib/db/repositories/stateArchive.d.ts.map +1 -1
  168. package/lib/db/repositories/stateArchive.js +6 -21
  169. package/lib/db/repositories/stateArchive.js.map +1 -1
  170. package/lib/execution/engine/http.d.ts +1 -1
  171. package/lib/execution/engine/http.d.ts.map +1 -1
  172. package/lib/execution/engine/http.js +2 -3
  173. package/lib/execution/engine/http.js.map +1 -1
  174. package/lib/execution/engine/index.d.ts.map +1 -1
  175. package/lib/execution/engine/index.js +1 -1
  176. package/lib/execution/engine/index.js.map +1 -1
  177. package/lib/execution/engine/interface.d.ts +1 -1
  178. package/lib/execution/engine/interface.d.ts.map +1 -1
  179. package/lib/execution/engine/interface.js.map +1 -1
  180. package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.d.ts +1 -1
  181. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -0
  182. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -0
  183. package/lib/execution/engine/jwt.d.ts.map +1 -0
  184. package/lib/execution/engine/jwt.js.map +1 -0
  185. package/lib/execution/engine/mock.d.ts +9 -6
  186. package/lib/execution/engine/mock.d.ts.map +1 -1
  187. package/lib/execution/engine/mock.js +35 -8
  188. package/lib/execution/engine/mock.js.map +1 -1
  189. package/lib/execution/engine/payloadIdCache.d.ts +1 -1
  190. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  191. package/lib/execution/engine/types.d.ts +1 -1
  192. package/lib/execution/engine/types.d.ts.map +1 -1
  193. package/lib/execution/engine/types.js +1 -1
  194. package/lib/execution/engine/types.js.map +1 -1
  195. package/lib/execution/engine/utils.d.ts +64 -2
  196. package/lib/execution/engine/utils.d.ts.map +1 -1
  197. package/lib/execution/engine/utils.js +91 -2
  198. package/lib/execution/engine/utils.js.map +1 -1
  199. package/lib/index.d.ts +1 -2
  200. package/lib/index.d.ts.map +1 -1
  201. package/lib/index.js +1 -2
  202. package/lib/index.js.map +1 -1
  203. package/lib/metrics/metrics/lodestar.d.ts +1 -41
  204. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  205. package/lib/metrics/metrics/lodestar.js +3 -107
  206. package/lib/metrics/metrics/lodestar.js.map +1 -1
  207. package/lib/network/core/events.d.ts +1 -1
  208. package/lib/network/core/events.d.ts.map +1 -1
  209. package/lib/network/core/events.js +1 -1
  210. package/lib/network/core/events.js.map +1 -1
  211. package/lib/network/events.d.ts +6 -1
  212. package/lib/network/events.d.ts.map +1 -1
  213. package/lib/network/events.js +7 -1
  214. package/lib/network/events.js.map +1 -1
  215. package/lib/network/peers/discover.d.ts.map +1 -1
  216. package/lib/network/peers/discover.js.map +1 -1
  217. package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
  218. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  219. package/lib/node/nodejs.d.ts +6 -3
  220. package/lib/node/nodejs.d.ts.map +1 -1
  221. package/lib/node/nodejs.js +30 -12
  222. package/lib/node/nodejs.js.map +1 -1
  223. package/lib/node/notifier.d.ts.map +1 -1
  224. package/lib/node/notifier.js +9 -6
  225. package/lib/node/notifier.js.map +1 -1
  226. package/lib/node/options.d.ts +0 -2
  227. package/lib/node/options.d.ts.map +1 -1
  228. package/lib/node/options.js +0 -2
  229. package/lib/node/options.js.map +1 -1
  230. package/lib/node/utils/interop/deposits.d.ts +2 -1
  231. package/lib/node/utils/interop/deposits.d.ts.map +1 -1
  232. package/lib/node/utils/interop/deposits.js.map +1 -1
  233. package/lib/node/utils/interop/state.d.ts +1 -1
  234. package/lib/node/utils/interop/state.d.ts.map +1 -1
  235. package/lib/node/utils/state.d.ts +1 -7
  236. package/lib/node/utils/state.d.ts.map +1 -1
  237. package/lib/node/utils/state.js +1 -14
  238. package/lib/node/utils/state.js.map +1 -1
  239. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  240. package/lib/sync/backfill/backfill.js +2 -4
  241. package/lib/sync/backfill/backfill.js.map +1 -1
  242. package/lib/sync/backfill/verify.d.ts +2 -2
  243. package/lib/sync/backfill/verify.d.ts.map +1 -1
  244. package/lib/sync/backfill/verify.js +3 -3
  245. package/lib/sync/backfill/verify.js.map +1 -1
  246. package/lib/util/sszBytes.js +1 -1
  247. package/lib/util/sszBytes.js.map +1 -1
  248. package/lib/util/workerEvents.d.ts +1 -6
  249. package/lib/util/workerEvents.d.ts.map +1 -1
  250. package/lib/util/workerEvents.js +8 -8
  251. package/lib/util/workerEvents.js.map +1 -1
  252. package/package.json +28 -26
  253. package/src/api/impl/beacon/blocks/utils.ts +1 -1
  254. package/src/api/impl/beacon/state/utils.ts +2 -22
  255. package/src/api/impl/lodestar/index.ts +1 -1
  256. package/src/api/impl/proof/index.ts +1 -2
  257. package/src/api/impl/validator/index.ts +1 -3
  258. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -3
  259. package/src/chain/blocks/importBlock.ts +13 -3
  260. package/src/chain/blocks/verifyBlock.ts +10 -3
  261. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -2
  262. package/src/chain/blocks/verifyBlocksSignatures.ts +13 -3
  263. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
  264. package/src/chain/chain.ts +50 -62
  265. package/src/chain/forkChoice/index.ts +3 -2
  266. package/src/chain/initState.ts +6 -100
  267. package/src/chain/interface.ts +6 -10
  268. package/src/chain/lightClient/proofs.ts +0 -2
  269. package/src/chain/opPools/aggregatedAttestationPool.ts +23 -195
  270. package/src/chain/opPools/opPool.ts +13 -15
  271. package/src/chain/prepareNextSlot.ts +3 -34
  272. package/src/chain/produceBlock/produceBlockBody.ts +15 -14
  273. package/src/chain/regen/interface.ts +1 -5
  274. package/src/chain/regen/queued.ts +15 -34
  275. package/src/chain/regen/regen.ts +12 -18
  276. package/src/chain/shufflingCache.ts +67 -50
  277. package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
  278. package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
  279. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
  280. package/src/chain/stateCache/persistentCheckpointsCache.ts +32 -27
  281. package/src/chain/stateCache/types.ts +5 -10
  282. package/src/chain/validation/aggregateAndProof.ts +12 -0
  283. package/src/chain/validation/attestation.ts +3 -3
  284. package/src/chain/validation/attesterSlashing.ts +14 -2
  285. package/src/chain/validation/blobSidecar.ts +3 -3
  286. package/src/chain/validation/block.ts +6 -2
  287. package/src/chain/validation/blsToExecutionChange.ts +10 -8
  288. package/src/chain/validation/dataColumnSidecar.ts +3 -3
  289. package/src/chain/validation/proposerSlashing.ts +8 -2
  290. package/src/chain/validation/signatureSets/aggregateAndProof.ts +1 -1
  291. package/src/chain/validation/signatureSets/contributionAndProof.ts +3 -1
  292. package/src/chain/validation/signatureSets/syncCommittee.ts +3 -1
  293. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +3 -1
  294. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -1
  295. package/src/chain/validation/syncCommittee.ts +1 -1
  296. package/src/chain/validation/syncCommitteeContributionAndProof.ts +8 -3
  297. package/src/chain/validation/voluntaryExit.ts +1 -1
  298. package/src/db/beacon.ts +38 -16
  299. package/src/db/buckets.ts +12 -7
  300. package/src/db/interface.ts +2 -13
  301. package/src/db/repositories/checkpointState.ts +3 -19
  302. package/src/db/repositories/index.ts +0 -3
  303. package/src/db/repositories/stateArchive.ts +13 -27
  304. package/src/execution/engine/http.ts +8 -9
  305. package/src/execution/engine/index.ts +1 -1
  306. package/src/execution/engine/interface.ts +1 -1
  307. package/src/{eth1/provider → execution/engine}/jsonRpcHttpClient.ts +1 -1
  308. package/src/execution/engine/mock.ts +41 -15
  309. package/src/execution/engine/payloadIdCache.ts +1 -1
  310. package/src/execution/engine/types.ts +9 -9
  311. package/src/execution/engine/utils.ts +111 -5
  312. package/src/index.ts +1 -2
  313. package/src/metrics/metrics/lodestar.ts +3 -109
  314. package/src/network/core/events.ts +1 -1
  315. package/src/network/events.ts +7 -1
  316. package/src/network/peers/discover.ts +3 -3
  317. package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
  318. package/src/node/nodejs.ts +37 -13
  319. package/src/node/notifier.ts +13 -7
  320. package/src/node/options.ts +0 -3
  321. package/src/node/utils/interop/deposits.ts +3 -1
  322. package/src/node/utils/interop/state.ts +1 -1
  323. package/src/node/utils/state.ts +3 -18
  324. package/src/sync/backfill/backfill.ts +2 -9
  325. package/src/sync/backfill/verify.ts +3 -8
  326. package/src/util/sszBytes.ts +1 -1
  327. package/src/util/workerEvents.ts +9 -8
  328. package/lib/chain/genesis/genesis.d.ts +0 -51
  329. package/lib/chain/genesis/genesis.d.ts.map +0 -1
  330. package/lib/chain/genesis/genesis.js +0 -123
  331. package/lib/chain/genesis/genesis.js.map +0 -1
  332. package/lib/chain/genesis/interface.d.ts +0 -13
  333. package/lib/chain/genesis/interface.d.ts.map +0 -1
  334. package/lib/chain/genesis/interface.js +0 -2
  335. package/lib/chain/genesis/interface.js.map +0 -1
  336. package/lib/chain/rewards/attestationsRewards.d.ts +0 -7
  337. package/lib/chain/rewards/attestationsRewards.d.ts.map +0 -1
  338. package/lib/chain/rewards/attestationsRewards.js +0 -112
  339. package/lib/chain/rewards/attestationsRewards.js.map +0 -1
  340. package/lib/chain/rewards/blockRewards.d.ts +0 -14
  341. package/lib/chain/rewards/blockRewards.d.ts.map +0 -1
  342. package/lib/chain/rewards/blockRewards.js +0 -94
  343. package/lib/chain/rewards/blockRewards.js.map +0 -1
  344. package/lib/chain/rewards/syncCommitteeRewards.d.ts +0 -6
  345. package/lib/chain/rewards/syncCommitteeRewards.d.ts.map +0 -1
  346. package/lib/chain/rewards/syncCommitteeRewards.js +0 -36
  347. package/lib/chain/rewards/syncCommitteeRewards.js.map +0 -1
  348. package/lib/db/repositories/depositDataRoot.d.ts +0 -22
  349. package/lib/db/repositories/depositDataRoot.d.ts.map +0 -1
  350. package/lib/db/repositories/depositDataRoot.js +0 -62
  351. package/lib/db/repositories/depositDataRoot.js.map +0 -1
  352. package/lib/db/repositories/depositEvent.d.ts +0 -13
  353. package/lib/db/repositories/depositEvent.d.ts.map +0 -1
  354. package/lib/db/repositories/depositEvent.js +0 -27
  355. package/lib/db/repositories/depositEvent.js.map +0 -1
  356. package/lib/db/repositories/eth1Data.d.ts +0 -13
  357. package/lib/db/repositories/eth1Data.d.ts.map +0 -1
  358. package/lib/db/repositories/eth1Data.js +0 -26
  359. package/lib/db/repositories/eth1Data.js.map +0 -1
  360. package/lib/db/single/index.d.ts +0 -3
  361. package/lib/db/single/index.d.ts.map +0 -1
  362. package/lib/db/single/index.js +0 -3
  363. package/lib/db/single/index.js.map +0 -1
  364. package/lib/db/single/preGenesisState.d.ts +0 -16
  365. package/lib/db/single/preGenesisState.d.ts.map +0 -1
  366. package/lib/db/single/preGenesisState.js +0 -29
  367. package/lib/db/single/preGenesisState.js.map +0 -1
  368. package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts +0 -14
  369. package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts.map +0 -1
  370. package/lib/db/single/preGenesisStateLastProcessedBlock.js +0 -27
  371. package/lib/db/single/preGenesisStateLastProcessedBlock.js.map +0 -1
  372. package/lib/eth1/errors.d.ts +0 -66
  373. package/lib/eth1/errors.d.ts.map +0 -1
  374. package/lib/eth1/errors.js +0 -27
  375. package/lib/eth1/errors.js.map +0 -1
  376. package/lib/eth1/eth1DataCache.d.ts +0 -19
  377. package/lib/eth1/eth1DataCache.d.ts.map +0 -1
  378. package/lib/eth1/eth1DataCache.js +0 -19
  379. package/lib/eth1/eth1DataCache.js.map +0 -1
  380. package/lib/eth1/eth1DepositDataTracker.d.ts +0 -80
  381. package/lib/eth1/eth1DepositDataTracker.d.ts.map +0 -1
  382. package/lib/eth1/eth1DepositDataTracker.js +0 -317
  383. package/lib/eth1/eth1DepositDataTracker.js.map +0 -1
  384. package/lib/eth1/eth1DepositsCache.d.ts +0 -42
  385. package/lib/eth1/eth1DepositsCache.d.ts.map +0 -1
  386. package/lib/eth1/eth1DepositsCache.js +0 -119
  387. package/lib/eth1/eth1DepositsCache.js.map +0 -1
  388. package/lib/eth1/index.d.ts +0 -31
  389. package/lib/eth1/index.d.ts.map +0 -1
  390. package/lib/eth1/index.js +0 -71
  391. package/lib/eth1/index.js.map +0 -1
  392. package/lib/eth1/interface.d.ts +0 -74
  393. package/lib/eth1/interface.d.ts.map +0 -1
  394. package/lib/eth1/interface.js +0 -8
  395. package/lib/eth1/interface.js.map +0 -1
  396. package/lib/eth1/options.d.ts +0 -22
  397. package/lib/eth1/options.d.ts.map +0 -1
  398. package/lib/eth1/options.js +0 -8
  399. package/lib/eth1/options.js.map +0 -1
  400. package/lib/eth1/provider/eth1Provider.d.ts +0 -39
  401. package/lib/eth1/provider/eth1Provider.d.ts.map +0 -1
  402. package/lib/eth1/provider/eth1Provider.js +0 -147
  403. package/lib/eth1/provider/eth1Provider.js.map +0 -1
  404. package/lib/eth1/provider/jsonRpcHttpClient.d.ts.map +0 -1
  405. package/lib/eth1/provider/jsonRpcHttpClient.js.map +0 -1
  406. package/lib/eth1/provider/jwt.d.ts.map +0 -1
  407. package/lib/eth1/provider/jwt.js.map +0 -1
  408. package/lib/eth1/provider/utils.d.ts +0 -65
  409. package/lib/eth1/provider/utils.d.ts.map +0 -1
  410. package/lib/eth1/provider/utils.js +0 -120
  411. package/lib/eth1/provider/utils.js.map +0 -1
  412. package/lib/eth1/stream.d.ts +0 -15
  413. package/lib/eth1/stream.d.ts.map +0 -1
  414. package/lib/eth1/stream.js +0 -54
  415. package/lib/eth1/stream.js.map +0 -1
  416. package/lib/eth1/utils/depositContract.d.ts +0 -14
  417. package/lib/eth1/utils/depositContract.d.ts.map +0 -1
  418. package/lib/eth1/utils/depositContract.js +0 -33
  419. package/lib/eth1/utils/depositContract.js.map +0 -1
  420. package/lib/eth1/utils/deposits.d.ts +0 -8
  421. package/lib/eth1/utils/deposits.d.ts.map +0 -1
  422. package/lib/eth1/utils/deposits.js +0 -47
  423. package/lib/eth1/utils/deposits.js.map +0 -1
  424. package/lib/eth1/utils/eth1Data.d.ts +0 -22
  425. package/lib/eth1/utils/eth1Data.d.ts.map +0 -1
  426. package/lib/eth1/utils/eth1Data.js +0 -77
  427. package/lib/eth1/utils/eth1Data.js.map +0 -1
  428. package/lib/eth1/utils/eth1DepositEvent.d.ts +0 -7
  429. package/lib/eth1/utils/eth1DepositEvent.d.ts.map +0 -1
  430. package/lib/eth1/utils/eth1DepositEvent.js +0 -13
  431. package/lib/eth1/utils/eth1DepositEvent.js.map +0 -1
  432. package/lib/eth1/utils/eth1Vote.d.ts +0 -17
  433. package/lib/eth1/utils/eth1Vote.d.ts.map +0 -1
  434. package/lib/eth1/utils/eth1Vote.js +0 -111
  435. package/lib/eth1/utils/eth1Vote.js.map +0 -1
  436. package/lib/eth1/utils/groupDepositEventsByBlock.d.ts +0 -9
  437. package/lib/eth1/utils/groupDepositEventsByBlock.d.ts.map +0 -1
  438. package/lib/eth1/utils/groupDepositEventsByBlock.js +0 -17
  439. package/lib/eth1/utils/groupDepositEventsByBlock.js.map +0 -1
  440. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts +0 -10
  441. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts.map +0 -1
  442. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js +0 -14
  443. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js.map +0 -1
  444. package/src/chain/genesis/genesis.ts +0 -190
  445. package/src/chain/genesis/interface.ts +0 -14
  446. package/src/chain/rewards/attestationsRewards.ts +0 -197
  447. package/src/chain/rewards/blockRewards.ts +0 -150
  448. package/src/chain/rewards/syncCommitteeRewards.ts +0 -58
  449. package/src/db/repositories/depositDataRoot.ts +0 -80
  450. package/src/db/repositories/depositEvent.ts +0 -32
  451. package/src/db/repositories/eth1Data.ts +0 -33
  452. package/src/db/single/index.ts +0 -2
  453. package/src/db/single/preGenesisState.ts +0 -37
  454. package/src/db/single/preGenesisStateLastProcessedBlock.ts +0 -34
  455. package/src/eth1/errors.ts +0 -40
  456. package/src/eth1/eth1DataCache.ts +0 -26
  457. package/src/eth1/eth1DepositDataTracker.ts +0 -410
  458. package/src/eth1/eth1DepositsCache.ts +0 -141
  459. package/src/eth1/index.ts +0 -94
  460. package/src/eth1/interface.ts +0 -87
  461. package/src/eth1/options.ts +0 -28
  462. package/src/eth1/provider/eth1Provider.ts +0 -229
  463. package/src/eth1/provider/utils.ts +0 -136
  464. package/src/eth1/stream.ts +0 -75
  465. package/src/eth1/utils/depositContract.ts +0 -37
  466. package/src/eth1/utils/deposits.ts +0 -70
  467. package/src/eth1/utils/eth1Data.ts +0 -100
  468. package/src/eth1/utils/eth1DepositEvent.ts +0 -12
  469. package/src/eth1/utils/eth1Vote.ts +0 -142
  470. package/src/eth1/utils/groupDepositEventsByBlock.ts +0 -19
  471. package/src/eth1/utils/optimizeNextBlockDiffForGenesis.ts +0 -18
  472. /package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.js +0 -0
  473. /package/lib/{eth1/provider → execution/engine}/jwt.d.ts +0 -0
  474. /package/lib/{eth1/provider → execution/engine}/jwt.js +0 -0
  475. /package/src/{eth1/provider → execution/engine}/jwt.ts +0 -0
@@ -23,9 +23,9 @@ import {
23
23
  altair,
24
24
  capella,
25
25
  phase0,
26
+ rewards,
26
27
  } from "@lodestar/types";
27
28
  import {Logger} from "@lodestar/utils";
28
- import {IEth1ForBlockProduction} from "../eth1/index.js";
29
29
  import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
30
30
  import {Metrics} from "../metrics/metrics.js";
31
31
  import {BufferPool} from "../util/bufferPool.js";
@@ -49,9 +49,6 @@ import {IChainOptions} from "./options.js";
49
49
  import {AssembledBlockType, BlockAttributes, BlockType, ProduceResult} from "./produceBlock/produceBlockBody.js";
50
50
  import {IStateRegenerator, RegenCaller} from "./regen/index.js";
51
51
  import {ReprocessController} from "./reprocess.js";
52
- import {AttestationsRewards} from "./rewards/attestationsRewards.js";
53
- import {BlockRewards} from "./rewards/blockRewards.js";
54
- import {SyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js";
55
52
  import {
56
53
  SeenAggregators,
57
54
  SeenAttesters,
@@ -88,7 +85,6 @@ export interface IBeaconChain {
88
85
  readonly genesisTime: UintNum64;
89
86
  readonly genesisValidatorsRoot: Root;
90
87
  readonly earliestAvailableSlot: Slot;
91
- readonly eth1: IEth1ForBlockProduction;
92
88
  readonly executionEngine: IExecutionEngine;
93
89
  readonly executionBuilder?: IExecutionBuilder;
94
90
  // Expose config for convenience in modularized functions
@@ -172,12 +168,12 @@ export interface IBeaconChain {
172
168
  getStateBySlot(
173
169
  slot: Slot,
174
170
  opts?: StateGetOpts
175
- ): Promise<{state: BeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null>;
171
+ ): Promise<{state: CachedBeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null>;
176
172
  /** Returns a local state by state root */
177
173
  getStateByStateRoot(
178
174
  stateRoot: RootHex,
179
175
  opts?: StateGetOpts
180
- ): Promise<{state: BeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null>;
176
+ ): Promise<{state: CachedBeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null>;
181
177
  /** Return serialized bytes of a persisted checkpoint state */
182
178
  getPersistedCheckpointState(checkpoint?: phase0.Checkpoint): Promise<Uint8Array | null>;
183
179
  /** Returns a cached state by checkpoint */
@@ -257,15 +253,15 @@ export interface IBeaconChain {
257
253
  regenCanAcceptWork(): boolean;
258
254
  blsThreadPoolCanAcceptWork(): boolean;
259
255
 
260
- getBlockRewards(blockRef: BeaconBlock | BlindedBeaconBlock): Promise<BlockRewards>;
256
+ getBlockRewards(blockRef: BeaconBlock | BlindedBeaconBlock): Promise<rewards.BlockRewards>;
261
257
  getAttestationsRewards(
262
258
  epoch: Epoch,
263
259
  validatorIds?: (ValidatorIndex | string)[]
264
- ): Promise<{rewards: AttestationsRewards; executionOptimistic: boolean; finalized: boolean}>;
260
+ ): Promise<{rewards: rewards.AttestationsRewards; executionOptimistic: boolean; finalized: boolean}>;
265
261
  getSyncCommitteeRewards(
266
262
  blockRef: BeaconBlock | BlindedBeaconBlock,
267
263
  validatorIds?: (ValidatorIndex | string)[]
268
- ): Promise<SyncCommitteeRewards>;
264
+ ): Promise<rewards.SyncCommitteeRewards>;
269
265
  }
270
266
 
271
267
  export type SSZObjectType =
@@ -12,7 +12,6 @@ import {BeaconBlockBody, SSZTypesFor, ssz} from "@lodestar/types";
12
12
  import {SyncCommitteeWitness} from "./types.js";
13
13
 
14
14
  export function getSyncCommitteesWitness(fork: ForkName, state: BeaconStateAllForks): SyncCommitteeWitness {
15
- state.commit();
16
15
  const n1 = state.node;
17
16
  let witness: Uint8Array[];
18
17
  let currentSyncCommitteeRoot: Uint8Array;
@@ -71,7 +70,6 @@ export function getCurrentSyncCommitteeBranch(syncCommitteesWitness: SyncCommitt
71
70
  }
72
71
 
73
72
  export function getFinalizedRootProof(state: CachedBeaconStateAllForks): Uint8Array[] {
74
- state.commit();
75
73
  const finalizedRootGindex = state.epochCtx.isPostElectra() ? FINALIZED_ROOT_GINDEX_ELECTRA : FINALIZED_ROOT_GINDEX;
76
74
  return new Tree(state.node).getSingleProof(BigInt(finalizedRootGindex));
77
75
  }
@@ -1,11 +1,10 @@
1
1
  import {Signature, aggregateSignatures} from "@chainsafe/blst";
2
2
  import {BitArray} from "@chainsafe/ssz";
3
- import {ChainForkConfig} from "@lodestar/config";
3
+ import {BeaconConfig} from "@lodestar/config";
4
4
  import {IForkChoice} from "@lodestar/fork-choice";
5
5
  import {
6
6
  ForkName,
7
7
  ForkSeq,
8
- MAX_ATTESTATIONS,
9
8
  MAX_ATTESTATIONS_ELECTRA,
10
9
  MAX_COMMITTEES_PER_SLOT,
11
10
  MIN_ATTESTATION_INCLUSION_DELAY,
@@ -23,7 +22,6 @@ import {
23
22
  CachedBeaconStateAllForks,
24
23
  CachedBeaconStateAltair,
25
24
  CachedBeaconStateGloas,
26
- CachedBeaconStatePhase0,
27
25
  EffectiveBalanceIncrements,
28
26
  RootCache,
29
27
  computeEpochAtSlot,
@@ -32,21 +30,12 @@ import {
32
30
  getAttestationParticipationStatus,
33
31
  getBlockRootAtSlot,
34
32
  } from "@lodestar/state-transition";
35
- import {
36
- Attestation,
37
- Epoch,
38
- RootHex,
39
- Slot,
40
- ValidatorIndex,
41
- electra,
42
- isElectraAttestation,
43
- phase0,
44
- ssz,
45
- } from "@lodestar/types";
33
+ import {Attestation, Epoch, RootHex, Slot, electra, isElectraAttestation, phase0, ssz} from "@lodestar/types";
46
34
  import {MapDef, assert, toRootHex} from "@lodestar/utils";
47
35
  import {Metrics} from "../../metrics/metrics.js";
48
36
  import {IntersectResult, intersectUint8Arrays} from "../../util/bitArray.js";
49
37
  import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
38
+ import {ShufflingCache} from "../shufflingCache.js";
50
39
  import {InsertOutcome} from "./types.js";
51
40
  import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js";
52
41
 
@@ -54,8 +43,6 @@ type DataRootHex = string;
54
43
 
55
44
  type CommitteeIndex = number;
56
45
 
57
- // for pre-electra
58
- type AttestationWithScore = {attestation: Attestation; score: number};
59
46
  /**
60
47
  * for electra, this is to consolidate aggregated attestations of the same attestation data into a single attestation to be included in block
61
48
  * note that this is local definition in this file and it's NOT validator consolidation
@@ -110,15 +97,6 @@ const MAX_RETAINED_ATTESTATIONS_PER_GROUP = 4;
110
97
  */
111
98
  const MAX_RETAINED_ATTESTATIONS_PER_GROUP_ELECTRA = 8;
112
99
 
113
- /**
114
- * Pre-electra, each slot has 64 committees, and each block has 128 attestations max so in average
115
- * we get 2 attestation per groups.
116
- * Starting from Jan 2024, we have a performance issue getting attestations for a block. Based on the
117
- * fact that lot of groups will have only 1 full participation attestation, increase this number
118
- * a bit higher than average. This also help decrease number of slots to search for attestations.
119
- */
120
- const MAX_ATTESTATIONS_PER_GROUP = 3;
121
-
122
100
  /**
123
101
  * For electra, there is on chain aggregation of attestations across committees, so we can just pick up to 8
124
102
  * attestations per group, sort by scores to get first 8.
@@ -162,7 +140,7 @@ export class AggregatedAttestationPool {
162
140
  private lowestPermissibleSlot = 0;
163
141
 
164
142
  constructor(
165
- private readonly config: ChainForkConfig,
143
+ private readonly config: BeaconConfig,
166
144
  private readonly metrics: Metrics | null = null
167
145
  ) {
168
146
  metrics?.opPool.aggregatedAttestationPool.attDataPerSlot.addCollect(() => this.onScrapeMetrics(metrics));
@@ -230,123 +208,18 @@ export class AggregatedAttestationPool {
230
208
  this.lowestPermissibleSlot = Math.max(clockSlot - slotsToRetain, 0);
231
209
  }
232
210
 
233
- getAttestationsForBlock(fork: ForkName, forkChoice: IForkChoice, state: CachedBeaconStateAllForks): Attestation[] {
234
- const forkSeq = ForkSeq[fork];
235
- return forkSeq >= ForkSeq.electra
236
- ? this.getAttestationsForBlockElectra(fork, forkChoice, state)
237
- : this.getAttestationsForBlockPreElectra(fork, forkChoice, state);
238
- }
239
-
240
- /**
241
- * Get attestations to be included in a block pre-electra. Returns up to $MAX_ATTESTATIONS items
242
- */
243
- getAttestationsForBlockPreElectra(
211
+ getAttestationsForBlock(
244
212
  fork: ForkName,
245
213
  forkChoice: IForkChoice,
214
+ shufflingCache: ShufflingCache,
246
215
  state: CachedBeaconStateAllForks
247
- ): phase0.Attestation[] {
248
- const stateSlot = state.slot;
249
- const stateEpoch = state.epochCtx.epoch;
250
- const statePrevEpoch = stateEpoch - 1;
251
-
252
- const notSeenValidatorsFn = getNotSeenValidatorsFn(state);
253
- const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
254
-
255
- const attestationsByScore: AttestationWithScore[] = [];
256
-
257
- const slots = Array.from(this.attestationGroupByIndexByDataHexBySlot.keys()).sort((a, b) => b - a);
258
- let minScore = Number.MAX_SAFE_INTEGER;
259
- let slotCount = 0;
260
- slot: for (const slot of slots) {
261
- slotCount++;
262
- const attestationGroupByIndexByDataHash = this.attestationGroupByIndexByDataHexBySlot.get(slot);
263
- // should not happen
264
- if (!attestationGroupByIndexByDataHash) {
265
- throw Error(`No aggregated attestation pool for slot=${slot}`);
266
- }
267
-
268
- const epoch = computeEpochAtSlot(slot);
269
- // validateAttestation condition: Attestation target epoch not in previous or current epoch
270
- if (!(epoch === stateEpoch || epoch === statePrevEpoch)) {
271
- continue; // Invalid attestations
272
- }
273
- // validateAttestation condition: Attestation slot not within inclusion window
274
- if (
275
- !(
276
- slot + MIN_ATTESTATION_INCLUSION_DELAY <= stateSlot &&
277
- // Post deneb, attestations are valid for current and previous epoch
278
- (ForkSeq[fork] >= ForkSeq.deneb || stateSlot <= slot + SLOTS_PER_EPOCH)
279
- )
280
- ) {
281
- continue; // Invalid attestations
282
- }
283
-
284
- const inclusionDistance = stateSlot - slot;
285
- for (const attestationGroupByIndex of attestationGroupByIndexByDataHash.values()) {
286
- for (const [committeeIndex, attestationGroup] of attestationGroupByIndex.entries()) {
287
- const notSeenCommitteeMembers = notSeenValidatorsFn(epoch, slot, committeeIndex);
288
- if (notSeenCommitteeMembers === null || notSeenCommitteeMembers.size === 0) {
289
- continue;
290
- }
291
-
292
- if (
293
- slotCount > 2 &&
294
- attestationsByScore.length >= MAX_ATTESTATIONS &&
295
- notSeenCommitteeMembers.size / inclusionDistance < minScore
296
- ) {
297
- // after 2 slots, there are a good chance that we have 2 * MAX_ATTESTATIONS attestations and break the for loop early
298
- // if not, we may have to scan all slots in the pool
299
- // if we have enough attestations and the max possible score is lower than scores of `attestationsByScore`, we should skip
300
- // otherwise it takes time to check attestation, add it and remove it later after the sort by score
301
- continue;
302
- }
303
-
304
- if (validateAttestationDataFn(attestationGroup.data) !== null) {
305
- continue;
306
- }
307
-
308
- // TODO: Is it necessary to validateAttestation for:
309
- // - Attestation committee index not within current committee count
310
- // - Attestation aggregation bits length does not match committee length
311
- //
312
- // These properties should not change after being validate in gossip
313
- // IF they have to be validated, do it only with one attestation per group since same data
314
- // The committeeCountPerSlot can be precomputed once per slot
315
- const getAttestationsResult = attestationGroup.getAttestationsForBlock(
316
- fork,
317
- state.epochCtx.effectiveBalanceIncrements,
318
- notSeenCommitteeMembers,
319
- MAX_ATTESTATIONS_PER_GROUP
320
- );
321
- for (const {attestation, newSeenEffectiveBalance} of getAttestationsResult.result) {
322
- const score = newSeenEffectiveBalance / inclusionDistance;
323
- if (score < minScore) {
324
- minScore = score;
325
- }
326
- attestationsByScore.push({
327
- attestation,
328
- score,
329
- });
330
- }
331
-
332
- // Stop accumulating attestations there are enough that may have good scoring
333
- if (attestationsByScore.length >= MAX_ATTESTATIONS * 2) {
334
- break slot;
335
- }
336
- }
337
- }
216
+ ): Attestation[] {
217
+ const forkSeq = ForkSeq[fork];
218
+ if (forkSeq < ForkSeq.electra) {
219
+ throw new Error("Does not support producing blocks for pre-electra forks anymore");
338
220
  }
339
221
 
340
- const sortedAttestationsByScore = attestationsByScore.sort((a, b) => b.score - a.score);
341
- const attestationsForBlock: phase0.Attestation[] = [];
342
- for (const [i, attestationWithScore] of sortedAttestationsByScore.entries()) {
343
- if (i >= MAX_ATTESTATIONS) {
344
- break;
345
- }
346
- // attestations could be modified in this op pool, so we need to clone for block
347
- attestationsForBlock.push(ssz.phase0.Attestation.clone(attestationWithScore.attestation));
348
- }
349
- return attestationsForBlock;
222
+ return this.getAttestationsForBlockElectra(fork, forkChoice, shufflingCache, state);
350
223
  }
351
224
 
352
225
  /**
@@ -355,6 +228,7 @@ export class AggregatedAttestationPool {
355
228
  getAttestationsForBlockElectra(
356
229
  fork: ForkName,
357
230
  forkChoice: IForkChoice,
231
+ shufflingCache: ShufflingCache,
358
232
  state: CachedBeaconStateAllForks
359
233
  ): electra.Attestation[] {
360
234
  const stateSlot = state.slot;
@@ -362,7 +236,7 @@ export class AggregatedAttestationPool {
362
236
  const statePrevEpoch = stateEpoch - 1;
363
237
  const rootCache = new RootCache(state);
364
238
 
365
- const notSeenValidatorsFn = getNotSeenValidatorsFn(state);
239
+ const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, shufflingCache, state);
366
240
  const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
367
241
 
368
242
  const slots = Array.from(this.attestationGroupByIndexByDataHexBySlot.keys()).sort((a, b) => b - a);
@@ -656,7 +530,7 @@ export class MatchingDataAttestationGroup {
656
530
  private readonly attestations: AttestationWithIndex[] = [];
657
531
 
658
532
  constructor(
659
- private readonly config: ChainForkConfig,
533
+ private readonly config: BeaconConfig,
660
534
  readonly committee: Uint32Array,
661
535
  readonly data: phase0.AttestationData
662
536
  ) {}
@@ -864,41 +738,14 @@ export function aggregateConsolidation({byCommittee, attData}: AttestationsConso
864
738
  * Pre-compute participation from a CachedBeaconStateAllForks, for use to check if an attestation's committee
865
739
  * has already attested or not.
866
740
  */
867
- export function getNotSeenValidatorsFn(state: CachedBeaconStateAllForks): GetNotSeenValidatorsFn {
741
+ export function getNotSeenValidatorsFn(
742
+ config: BeaconConfig,
743
+ shufflingCache: ShufflingCache,
744
+ state: CachedBeaconStateAllForks
745
+ ): GetNotSeenValidatorsFn {
868
746
  const stateSlot = state.slot;
869
- if (state.config.getForkName(stateSlot) === ForkName.phase0) {
870
- // Get attestations to be included in a phase0 block.
871
- // As we are close to altair, this is not really important, it's mainly for e2e.
872
- // The performance is not great due to the different BeaconState data structure to altair.
873
- // check for phase0 block already
874
- const phase0State = state as CachedBeaconStatePhase0;
875
- const stateEpoch = computeEpochAtSlot(stateSlot);
876
-
877
- const previousEpochParticipants = extractParticipationPhase0(
878
- phase0State.previousEpochAttestations.getAllReadonly(),
879
- state
880
- );
881
- const currentEpochParticipants = extractParticipationPhase0(
882
- phase0State.currentEpochAttestations.getAllReadonly(),
883
- state
884
- );
885
-
886
- return (epoch: Epoch, slot: Slot, committeeIndex: number) => {
887
- const participants =
888
- epoch === stateEpoch ? currentEpochParticipants : epoch === stateEpoch - 1 ? previousEpochParticipants : null;
889
- if (participants === null) {
890
- return null;
891
- }
892
- const committee = state.epochCtx.getBeaconCommittee(slot, committeeIndex);
893
-
894
- const notSeenCommitteeMembers = new Set<number>();
895
- for (const [i, validatorIndex] of committee.entries()) {
896
- if (!participants.has(validatorIndex)) {
897
- notSeenCommitteeMembers.add(i);
898
- }
899
- }
900
- return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
901
- };
747
+ if (config.getForkName(stateSlot) === ForkName.phase0) {
748
+ throw new Error("getNotSeenValidatorsFn is not supported phase0 state");
902
749
  }
903
750
 
904
751
  // altair and future forks
@@ -927,7 +774,8 @@ export function getNotSeenValidatorsFn(state: CachedBeaconStateAllForks): GetNot
927
774
  return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
928
775
  }
929
776
 
930
- const committee = state.epochCtx.getBeaconCommittee(slot, committeeIndex);
777
+ const decisionRoot = state.epochCtx.getShufflingDecisionRoot(computeEpochAtSlot(slot));
778
+ const committee = shufflingCache.getBeaconCommittee(epoch, decisionRoot, slot, committeeIndex);
931
779
  notSeenCommitteeMembers = new Set<number>();
932
780
  for (const [i, validatorIndex] of committee.entries()) {
933
781
  // no need to check flagIsTimelySource as if validator is not seen, it's participation status is 0
@@ -942,26 +790,6 @@ export function getNotSeenValidatorsFn(state: CachedBeaconStateAllForks): GetNot
942
790
  };
943
791
  }
944
792
 
945
- export function extractParticipationPhase0(
946
- attestations: phase0.PendingAttestation[],
947
- state: CachedBeaconStateAllForks
948
- ): Set<ValidatorIndex> {
949
- const {epochCtx} = state;
950
- const allParticipants = new Set<ValidatorIndex>();
951
- for (const att of attestations) {
952
- const aggregationBits = att.aggregationBits;
953
- const attData = att.data;
954
- const attSlot = attData.slot;
955
- const committeeIndex = attData.index;
956
- const committee = epochCtx.getBeaconCommittee(attSlot, committeeIndex);
957
- const participants = aggregationBits.intersectValues(committee);
958
- for (const participant of participants) {
959
- allParticipants.add(participant);
960
- }
961
- }
962
- return allParticipants;
963
- }
964
-
965
793
  /**
966
794
  * This returns a function to validate if an attestation data is compatible to a state.
967
795
  *
@@ -1,4 +1,5 @@
1
- import {Id, Repository} from "@lodestar/db";
1
+ import {BeaconConfig} from "@lodestar/config";
2
+ import {DbBatch, Id, Repository} from "@lodestar/db";
2
3
  import {
3
4
  BLS_WITHDRAWAL_PREFIX,
4
5
  ForkName,
@@ -51,6 +52,8 @@ export class OpPool {
51
52
  /** Map of validator index -> SignedBLSToExecutionChange */
52
53
  private readonly blsToExecutionChanges = new Map<ValidatorIndex, SignedBLSToExecutionChangeVersioned>();
53
54
 
55
+ constructor(private readonly config: BeaconConfig) {}
56
+
54
57
  // Getters for metrics
55
58
 
56
59
  get attesterSlashingsSize(): number {
@@ -191,9 +194,8 @@ export class OpPool {
191
194
  phase0.SignedVoluntaryExit[],
192
195
  capella.SignedBLSToExecutionChange[],
193
196
  ] {
194
- const {config} = state;
195
197
  const stateEpoch = computeEpochAtSlot(state.slot);
196
- const stateFork = config.getForkSeq(state.slot);
198
+ const stateFork = this.config.getForkSeq(state.slot);
197
199
  const toBeSlashedIndices = new Set<ValidatorIndex>();
198
200
  const proposerSlashings: phase0.ProposerSlashing[] = [];
199
201
 
@@ -265,7 +267,7 @@ export class OpPool {
265
267
  // a future fork.
266
268
  isVoluntaryExitSignatureIncludable(
267
269
  stateFork,
268
- config.getForkSeq(computeStartSlotAtEpoch(voluntaryExit.message.epoch))
270
+ this.config.getForkSeq(computeStartSlotAtEpoch(voluntaryExit.message.epoch))
269
271
  )
270
272
  ) {
271
273
  voluntaryExits.push(voluntaryExit);
@@ -368,14 +370,13 @@ export class OpPool {
368
370
  * Prune if validator has already exited at or before the finalized checkpoint of the head.
369
371
  */
370
372
  private pruneVoluntaryExits(headState: CachedBeaconStateAllForks): void {
371
- const {config} = headState;
372
- const headStateFork = config.getForkSeq(headState.slot);
373
+ const headStateFork = this.config.getForkSeq(headState.slot);
373
374
  const finalizedEpoch = headState.finalizedCheckpoint.epoch;
374
375
 
375
376
  for (const [key, voluntaryExit] of this.voluntaryExits.entries()) {
376
377
  // VoluntaryExit messages signed in the previous fork become invalid and can never be included in any future
377
378
  // block, so just drop as the head state advances into the next fork.
378
- if (config.getForkSeq(computeStartSlotAtEpoch(voluntaryExit.message.epoch)) < headStateFork) {
379
+ if (this.config.getForkSeq(computeStartSlotAtEpoch(voluntaryExit.message.epoch)) < headStateFork) {
379
380
  this.voluntaryExits.delete(key);
380
381
  }
381
382
 
@@ -392,9 +393,8 @@ export class OpPool {
392
393
  * to opPool once gossipsub seen cache TTL passes.
393
394
  */
394
395
  private pruneBlsToExecutionChanges(headBlock: SignedBeaconBlock, headState: CachedBeaconStateAllForks): void {
395
- const {config} = headState;
396
396
  const recentBlsToExecutionChanges =
397
- config.getForkSeq(headBlock.message.slot) >= ForkSeq.capella
397
+ this.config.getForkSeq(headBlock.message.slot) >= ForkSeq.capella
398
398
  ? (headBlock as capella.SignedBeaconBlock).message.body.blsToExecutionChanges
399
399
  : [];
400
400
 
@@ -440,23 +440,21 @@ async function persistDiff<K extends Id, V>(
440
440
  serializeKey: (key: K) => number | string
441
441
  ): Promise<void> {
442
442
  const persistedKeys = await dbRepo.keys();
443
- const itemsToPut: {key: K; value: V}[] = [];
444
- const keysToDelete: K[] = [];
443
+ const batch: DbBatch<K, V> = [];
445
444
 
446
445
  const persistedKeysSerialized = new Set(persistedKeys.map(serializeKey));
447
446
  for (const item of items) {
448
447
  if (!persistedKeysSerialized.has(serializeKey(item.key))) {
449
- itemsToPut.push(item);
448
+ batch.push({type: "put", key: item.key, value: item.value});
450
449
  }
451
450
  }
452
451
 
453
452
  const targetKeysSerialized = new Set(items.map((item) => serializeKey(item.key)));
454
453
  for (const persistedKey of persistedKeys) {
455
454
  if (!targetKeysSerialized.has(serializeKey(persistedKey))) {
456
- keysToDelete.push(persistedKey);
455
+ batch.push({type: "del", key: persistedKey});
457
456
  }
458
457
  }
459
458
 
460
- if (itemsToPut.length > 0) await dbRepo.batchPut(itemsToPut);
461
- if (keysToDelete.length > 0) await dbRepo.batchDelete(keysToDelete);
459
+ if (batch.length > 0) await dbRepo.batch(batch);
462
460
  }
@@ -1,9 +1,8 @@
1
1
  import {routes} from "@lodestar/api";
2
2
  import {ChainForkConfig} from "@lodestar/config";
3
3
  import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
4
- import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostElectra} from "@lodestar/params";
4
+ import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
5
5
  import {
6
- BeaconStateElectra,
7
6
  CachedBeaconStateAllForks,
8
7
  CachedBeaconStateExecutions,
9
8
  StateHashTreeRootSource,
@@ -118,12 +117,7 @@ export class PrepareNextSlotScheduler {
118
117
  // the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
119
118
  // the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
120
119
  // for other slots dontTransferCached=true because we don't run state transition on this state
121
- //
122
- // Shuffling calculation will be done asynchronously when passing asyncShufflingCalculation=true. Shuffling will be queued in
123
- // beforeProcessEpoch and should theoretically be ready immediately after the synchronous epoch transition finished and the
124
- // event loop is free. In long periods of non-finality too many forks will cause the shufflingCache to throw an error for
125
- // too many queued shufflings so only run async during normal epoch transition. See issue ChainSafe/lodestar#7244
126
- {dontTransferCache: !isEpochTransition, asyncShufflingCalculation: true},
120
+ {dontTransferCache: !isEpochTransition},
127
121
  RegenCaller.precomputeEpoch
128
122
  );
129
123
 
@@ -149,6 +143,7 @@ export class PrepareNextSlotScheduler {
149
143
  updatedPrepareState = (await this.chain.regen.getBlockSlotState(
150
144
  proposerHeadRoot,
151
145
  prepareSlot,
146
+ // only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
152
147
  {dontTransferCache: !isEpochTransition},
153
148
  RegenCaller.predictProposerHead
154
149
  )) as CachedBeaconStateExecutions;
@@ -222,9 +217,6 @@ export class PrepareNextSlotScheduler {
222
217
  }
223
218
  this.metrics?.precomputeNextEpochTransition.hits.set(previousHits ?? 0);
224
219
 
225
- // Check if we can stop polling eth1 data
226
- this.stopEth1Polling();
227
-
228
220
  this.logger.verbose("Completed PrepareNextSlotScheduler epoch transition", {
229
221
  nextEpoch,
230
222
  headSlot,
@@ -252,27 +244,4 @@ export class PrepareNextSlotScheduler {
252
244
  state.hashTreeRoot();
253
245
  hashTreeRootTimer?.();
254
246
  }
255
-
256
- /**
257
- * Stop eth1 data polling after eth1_deposit_index has reached deposit_requests_start_index in Electra as described in EIP-6110
258
- */
259
- stopEth1Polling(): void {
260
- // Only continue if eth1 is still polling and finalized checkpoint is in Electra. State regen is expensive
261
- if (this.chain.eth1.isPollingEth1Data()) {
262
- const finalizedCheckpoint = this.chain.forkChoice.getFinalizedCheckpoint();
263
- const checkpointFork = this.config.getForkInfoAtEpoch(finalizedCheckpoint.epoch).name;
264
-
265
- if (isForkPostElectra(checkpointFork)) {
266
- const finalizedState = this.chain.getStateByCheckpoint(finalizedCheckpoint)?.state;
267
-
268
- if (
269
- finalizedState !== undefined &&
270
- finalizedState.eth1DepositIndex === Number((finalizedState as BeaconStateElectra).depositRequestsStartIndex)
271
- ) {
272
- // Signal eth1 to stop polling eth1Data
273
- this.chain.eth1.stopPollingEth1Data();
274
- }
275
- }
276
- }
277
- }
278
247
  }
@@ -45,7 +45,7 @@ import {
45
45
  } from "@lodestar/types";
46
46
  import {Logger, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
47
47
  import {ZERO_HASH_HEX} from "../../constants/index.js";
48
- import {numToQuantity} from "../../eth1/provider/utils.js";
48
+ import {numToQuantity} from "../../execution/engine/utils.js";
49
49
  import {
50
50
  IExecutionBuilder,
51
51
  IExecutionEngine,
@@ -78,7 +78,6 @@ export enum BlockProductionStep {
78
78
  voluntaryExits = "voluntaryExits",
79
79
  blsToExecutionChanges = "blsToExecutionChanges",
80
80
  attestations = "attestations",
81
- eth1DataAndDeposits = "eth1DataAndDeposits",
82
81
  syncAggregate = "syncAggregate",
83
82
  executionPayload = "executionPayload",
84
83
  }
@@ -166,7 +165,7 @@ export async function produceBlockBody<T extends BlockType>(
166
165
  // even though shouldOverrideBuilder is relevant for the engine response, for simplicity of typing
167
166
  // we just return it undefined for the builder which anyway doesn't get consumed downstream
168
167
  let shouldOverrideBuilder: boolean | undefined;
169
- const fork = currentState.config.getForkName(blockSlot);
168
+ const fork = this.config.getForkName(blockSlot);
170
169
  const produceResult = {
171
170
  type: blockType,
172
171
  fork,
@@ -624,7 +623,7 @@ function preparePayloadAttributes(
624
623
  (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals = getExpectedWithdrawals(
625
624
  ForkSeq[fork],
626
625
  prepareState as CachedBeaconStateCapella
627
- ).withdrawals;
626
+ ).expectedWithdrawals;
628
627
  }
629
628
 
630
629
  if (ForkSeq[fork] >= ForkSeq.deneb) {
@@ -645,7 +644,7 @@ export async function produceCommonBlockBody<T extends BlockType>(
645
644
  ? this.metrics?.executionBlockProductionTimeSteps
646
645
  : this.metrics?.builderBlockProductionTimeSteps;
647
646
 
648
- const fork = currentState.config.getForkName(slot);
647
+ const fork = this.config.getForkName(slot);
649
648
 
650
649
  // TODO:
651
650
  // Iterate through the naive aggregation pool and ensure all the attestations from there
@@ -662,25 +661,27 @@ export async function produceCommonBlockBody<T extends BlockType>(
662
661
  this.opPool.getSlashingsAndExits(currentState, blockType, this.metrics);
663
662
 
664
663
  const endAttestations = stepsMetrics?.startTimer();
665
- const attestations = this.aggregatedAttestationPool.getAttestationsForBlock(fork, this.forkChoice, currentState);
664
+ const attestations = this.aggregatedAttestationPool.getAttestationsForBlock(
665
+ fork,
666
+ this.forkChoice,
667
+ this.shufflingCache,
668
+ currentState
669
+ );
666
670
  endAttestations?.({
667
671
  step: BlockProductionStep.attestations,
668
672
  });
669
673
 
670
- const endEth1DataAndDeposits = stepsMetrics?.startTimer();
671
- const {eth1Data, deposits} = await this.eth1.getEth1DataAndDeposits(currentState);
672
- endEth1DataAndDeposits?.({
673
- step: BlockProductionStep.eth1DataAndDeposits,
674
- });
675
-
676
674
  const blockBody: Omit<CommonBlockBody, "blsToExecutionChanges" | "syncAggregate"> = {
677
675
  randaoReveal,
678
676
  graffiti,
679
- eth1Data,
677
+ // Eth1 data voting is no longer required since electra
678
+ eth1Data: currentState.eth1Data,
680
679
  proposerSlashings,
681
680
  attesterSlashings,
682
681
  attestations,
683
- deposits,
682
+ // Since electra, deposits are processed by the execution layer,
683
+ // we no longer support handling deposits from earlier forks.
684
+ deposits: [],
684
685
  voluntaryExits,
685
686
  };
686
687
 
@@ -31,10 +31,6 @@ export enum RegenFnName {
31
31
 
32
32
  export type StateRegenerationOpts = {
33
33
  dontTransferCache: boolean;
34
- /**
35
- * Do not queue shuffling calculation async. Forces sync JIT calculation in afterProcessEpoch if not passed as `true`
36
- */
37
- asyncShufflingCalculation?: boolean;
38
34
  };
39
35
 
40
36
  export interface IStateRegenerator extends IStateRegeneratorInternal {
@@ -90,5 +86,5 @@ export interface IStateRegeneratorInternal {
90
86
  /**
91
87
  * Return the exact state with `stateRoot`
92
88
  */
93
- getState(stateRoot: RootHex, rCaller: RegenCaller, opts?: StateRegenerationOpts): Promise<CachedBeaconStateAllForks>;
89
+ getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
94
90
  }