@lodestar/beacon-node 1.42.0-dev.d73eccfa56 → 1.42.0-dev.e8407e9657

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 (467) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +25 -13
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.js +1 -1
  5. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  6. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  7. package/lib/api/impl/beacon/state/index.js +27 -32
  8. package/lib/api/impl/beacon/state/index.js.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.d.ts +4 -4
  10. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  11. package/lib/api/impl/beacon/state/utils.js +7 -10
  12. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  13. package/lib/api/impl/debug/index.js.map +1 -1
  14. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  15. package/lib/api/impl/lodestar/index.js +4 -6
  16. package/lib/api/impl/lodestar/index.js.map +1 -1
  17. package/lib/api/impl/proof/index.d.ts.map +1 -1
  18. package/lib/api/impl/proof/index.js +2 -6
  19. package/lib/api/impl/proof/index.js.map +1 -1
  20. package/lib/api/impl/validator/index.d.ts.map +1 -1
  21. package/lib/api/impl/validator/index.js +27 -27
  22. package/lib/api/impl/validator/index.js.map +1 -1
  23. package/lib/api/impl/validator/utils.d.ts +2 -2
  24. package/lib/api/impl/validator/utils.d.ts.map +1 -1
  25. package/lib/api/impl/validator/utils.js +3 -3
  26. package/lib/api/impl/validator/utils.js.map +1 -1
  27. package/lib/chain/ColumnReconstructionTracker.d.ts +2 -1
  28. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  29. package/lib/chain/ColumnReconstructionTracker.js +5 -5
  30. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  31. package/lib/chain/GetBlobsTracker.d.ts +2 -1
  32. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  33. package/lib/chain/GetBlobsTracker.js +14 -12
  34. package/lib/chain/GetBlobsTracker.js.map +1 -1
  35. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  36. package/lib/chain/archiveStore/archiveStore.js +1 -0
  37. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  38. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +3 -7
  39. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  40. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +8 -26
  41. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  42. package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts +2 -2
  43. package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
  44. package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -0
  45. package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
  46. package/lib/chain/archiveStore/historicalState/types.d.ts +2 -0
  47. package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
  48. package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
  49. package/lib/chain/archiveStore/historicalState/worker.js +1 -3
  50. package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
  51. package/lib/chain/archiveStore/interface.d.ts +1 -0
  52. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  53. package/lib/chain/balancesCache.d.ts +2 -2
  54. package/lib/chain/balancesCache.d.ts.map +1 -1
  55. package/lib/chain/balancesCache.js +4 -4
  56. package/lib/chain/balancesCache.js.map +1 -1
  57. package/lib/chain/blocks/blockInput/blockInput.d.ts +5 -5
  58. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  59. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  60. package/lib/chain/blocks/blockInput/types.d.ts +5 -4
  61. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  62. package/lib/chain/blocks/blockInput/types.js +1 -0
  63. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  64. package/lib/chain/blocks/importBlock.d.ts +3 -3
  65. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  66. package/lib/chain/blocks/importBlock.js +34 -22
  67. package/lib/chain/blocks/importBlock.js.map +1 -1
  68. package/lib/chain/blocks/importExecutionPayload.d.ts +10 -8
  69. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  70. package/lib/chain/blocks/importExecutionPayload.js +78 -51
  71. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  72. package/lib/chain/blocks/index.d.ts.map +1 -1
  73. package/lib/chain/blocks/index.js +3 -2
  74. package/lib/chain/blocks/index.js.map +1 -1
  75. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +14 -6
  76. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  77. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +33 -2
  78. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  79. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
  80. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  81. package/lib/chain/blocks/types.d.ts +21 -15
  82. package/lib/chain/blocks/types.d.ts.map +1 -1
  83. package/lib/chain/blocks/types.js.map +1 -1
  84. package/lib/chain/blocks/utils/checkpoint.d.ts +2 -2
  85. package/lib/chain/blocks/utils/checkpoint.d.ts.map +1 -1
  86. package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
  87. package/lib/chain/blocks/verifyBlock.d.ts +2 -2
  88. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  89. package/lib/chain/blocks/verifyBlock.js +4 -4
  90. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  91. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +5 -5
  92. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  93. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +4 -4
  94. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  95. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  96. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  97. package/lib/chain/blocks/verifyBlocksSignatures.js +1 -1
  98. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  99. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts +3 -3
  100. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  101. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +3 -3
  102. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  103. package/lib/chain/chain.d.ts +15 -14
  104. package/lib/chain/chain.d.ts.map +1 -1
  105. package/lib/chain/chain.js +102 -59
  106. package/lib/chain/chain.js.map +1 -1
  107. package/lib/chain/emitter.d.ts +31 -9
  108. package/lib/chain/emitter.d.ts.map +1 -1
  109. package/lib/chain/emitter.js +12 -3
  110. package/lib/chain/emitter.js.map +1 -1
  111. package/lib/chain/errors/blockError.d.ts +4 -4
  112. package/lib/chain/errors/blockError.d.ts.map +1 -1
  113. package/lib/chain/errors/dataColumnSidecarError.d.ts +31 -1
  114. package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
  115. package/lib/chain/errors/dataColumnSidecarError.js +7 -0
  116. package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
  117. package/lib/chain/forkChoice/index.d.ts +4 -4
  118. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  119. package/lib/chain/forkChoice/index.js +27 -23
  120. package/lib/chain/forkChoice/index.js.map +1 -1
  121. package/lib/chain/initState.d.ts +2 -2
  122. package/lib/chain/initState.d.ts.map +1 -1
  123. package/lib/chain/initState.js +1 -1
  124. package/lib/chain/initState.js.map +1 -1
  125. package/lib/chain/interface.d.ts +15 -14
  126. package/lib/chain/interface.d.ts.map +1 -1
  127. package/lib/chain/lightClient/index.d.ts +2 -2
  128. package/lib/chain/lightClient/index.d.ts.map +1 -1
  129. package/lib/chain/lightClient/index.js +4 -4
  130. package/lib/chain/lightClient/index.js.map +1 -1
  131. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +6 -6
  132. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  133. package/lib/chain/opPools/aggregatedAttestationPool.js +10 -13
  134. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  135. package/lib/chain/opPools/opPool.d.ts +3 -3
  136. package/lib/chain/opPools/opPool.d.ts.map +1 -1
  137. package/lib/chain/opPools/opPool.js +7 -7
  138. package/lib/chain/opPools/opPool.js.map +1 -1
  139. package/lib/chain/opPools/utils.d.ts +2 -2
  140. package/lib/chain/opPools/utils.d.ts.map +1 -1
  141. package/lib/chain/opPools/utils.js +1 -1
  142. package/lib/chain/opPools/utils.js.map +1 -1
  143. package/lib/chain/options.d.ts +1 -0
  144. package/lib/chain/options.d.ts.map +1 -1
  145. package/lib/chain/options.js +1 -0
  146. package/lib/chain/options.js.map +1 -1
  147. package/lib/chain/prepareNextSlot.d.ts +2 -2
  148. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  149. package/lib/chain/prepareNextSlot.js +3 -3
  150. package/lib/chain/prepareNextSlot.js.map +1 -1
  151. package/lib/chain/produceBlock/computeNewStateRoot.d.ts +4 -4
  152. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  153. package/lib/chain/produceBlock/computeNewStateRoot.js +3 -4
  154. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  155. package/lib/chain/produceBlock/produceBlockBody.d.ts +5 -5
  156. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  157. package/lib/chain/produceBlock/produceBlockBody.js +12 -16
  158. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  159. package/lib/chain/regen/interface.d.ts +13 -13
  160. package/lib/chain/regen/interface.d.ts.map +1 -1
  161. package/lib/chain/regen/queued.d.ts +14 -14
  162. package/lib/chain/regen/queued.d.ts.map +1 -1
  163. package/lib/chain/regen/queued.js.map +1 -1
  164. package/lib/chain/regen/regen.d.ts +6 -5
  165. package/lib/chain/regen/regen.d.ts.map +1 -1
  166. package/lib/chain/regen/regen.js +6 -6
  167. package/lib/chain/regen/regen.js.map +1 -1
  168. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +1 -1
  169. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  170. package/lib/chain/seenCache/seenGossipBlockInput.js +2 -2
  171. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  172. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +1 -1
  173. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  174. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +2 -2
  175. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  176. package/lib/chain/serializeState.d.ts +2 -2
  177. package/lib/chain/serializeState.d.ts.map +1 -1
  178. package/lib/chain/serializeState.js +1 -1
  179. package/lib/chain/serializeState.js.map +1 -1
  180. package/lib/chain/shufflingCache.d.ts +2 -2
  181. package/lib/chain/shufflingCache.d.ts.map +1 -1
  182. package/lib/chain/shufflingCache.js +3 -4
  183. package/lib/chain/shufflingCache.js.map +1 -1
  184. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +6 -6
  185. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  186. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  187. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +11 -11
  188. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  189. package/lib/chain/stateCache/persistentCheckpointsCache.js +12 -16
  190. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  191. package/lib/chain/stateCache/types.d.ts +14 -14
  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/attestation.js +3 -3
  195. package/lib/chain/validation/attestation.js.map +1 -1
  196. package/lib/chain/validation/attesterSlashing.js +3 -3
  197. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  198. package/lib/chain/validation/blobSidecar.js +1 -1
  199. package/lib/chain/validation/blobSidecar.js.map +1 -1
  200. package/lib/chain/validation/block.d.ts.map +1 -1
  201. package/lib/chain/validation/block.js +3 -3
  202. package/lib/chain/validation/block.js.map +1 -1
  203. package/lib/chain/validation/blsToExecutionChange.js +2 -2
  204. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  205. package/lib/chain/validation/dataColumnSidecar.d.ts +11 -4
  206. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  207. package/lib/chain/validation/dataColumnSidecar.js +185 -6
  208. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  209. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  210. package/lib/chain/validation/executionPayloadBid.js +4 -4
  211. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  212. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  213. package/lib/chain/validation/executionPayloadEnvelope.js +2 -3
  214. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  215. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  216. package/lib/chain/validation/payloadAttestationMessage.js +1 -2
  217. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  218. package/lib/chain/validation/proposerSlashing.js +1 -1
  219. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  220. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  221. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  222. package/lib/chain/validation/signatureSets/contributionAndProof.js +1 -1
  223. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  224. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  225. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  226. package/lib/chain/validation/signatureSets/syncCommittee.js +1 -1
  227. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  228. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
  229. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  230. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  231. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  232. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  233. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -1
  234. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  235. package/lib/chain/validation/syncCommittee.d.ts +4 -4
  236. package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
  237. package/lib/chain/validation/syncCommittee.js +13 -12
  238. package/lib/chain/validation/syncCommittee.js.map +1 -1
  239. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  240. package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
  241. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  242. package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
  243. package/lib/chain/validation/voluntaryExit.js +3 -3
  244. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  245. package/lib/chain/validatorMonitor.d.ts +3 -3
  246. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  247. package/lib/chain/validatorMonitor.js +9 -7
  248. package/lib/chain/validatorMonitor.js.map +1 -1
  249. package/lib/db/buckets.d.ts +2 -2
  250. package/lib/db/buckets.d.ts.map +1 -1
  251. package/lib/db/buckets.js +2 -2
  252. package/lib/db/buckets.js.map +1 -1
  253. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  254. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  255. package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
  256. package/lib/db/repositories/dataColumnSidecar.js +4 -2
  257. package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
  258. package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
  259. package/lib/db/repositories/dataColumnSidecarArchive.js +4 -2
  260. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  261. package/lib/metrics/metrics/lodestar.d.ts +32 -4
  262. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  263. package/lib/metrics/metrics/lodestar.js +52 -15
  264. package/lib/metrics/metrics/lodestar.js.map +1 -1
  265. package/lib/network/gossip/encoding.d.ts.map +1 -1
  266. package/lib/network/gossip/encoding.js +15 -0
  267. package/lib/network/gossip/encoding.js.map +1 -1
  268. package/lib/network/interface.d.ts +7 -4
  269. package/lib/network/interface.d.ts.map +1 -1
  270. package/lib/network/libp2p/index.d.ts.map +1 -1
  271. package/lib/network/libp2p/index.js +22 -11
  272. package/lib/network/libp2p/index.js.map +1 -1
  273. package/lib/network/network.d.ts +7 -4
  274. package/lib/network/network.d.ts.map +1 -1
  275. package/lib/network/network.js +12 -3
  276. package/lib/network/network.js.map +1 -1
  277. package/lib/network/options.d.ts.map +1 -1
  278. package/lib/network/options.js +7 -2
  279. package/lib/network/options.js.map +1 -1
  280. package/lib/network/processor/extractSlotRootFns.d.ts +1 -1
  281. package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
  282. package/lib/network/processor/extractSlotRootFns.js +25 -5
  283. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  284. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  285. package/lib/network/processor/gossipHandlers.js +265 -80
  286. package/lib/network/processor/gossipHandlers.js.map +1 -1
  287. package/lib/network/processor/index.d.ts +22 -7
  288. package/lib/network/processor/index.d.ts.map +1 -1
  289. package/lib/network/processor/index.js +311 -80
  290. package/lib/network/processor/index.js.map +1 -1
  291. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  292. package/lib/network/reqresp/ReqRespBeaconNode.js +9 -0
  293. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  294. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts +8 -0
  295. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -0
  296. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +69 -0
  297. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -0
  298. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts +6 -0
  299. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -0
  300. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +28 -0
  301. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -0
  302. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  303. package/lib/network/reqresp/handlers/index.js +11 -1
  304. package/lib/network/reqresp/handlers/index.js.map +1 -1
  305. package/lib/network/reqresp/protocols.d.ts +2 -0
  306. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  307. package/lib/network/reqresp/protocols.js +10 -0
  308. package/lib/network/reqresp/protocols.js.map +1 -1
  309. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  310. package/lib/network/reqresp/rateLimit.js +8 -0
  311. package/lib/network/reqresp/rateLimit.js.map +1 -1
  312. package/lib/network/reqresp/score.d.ts.map +1 -1
  313. package/lib/network/reqresp/score.js +2 -0
  314. package/lib/network/reqresp/score.js.map +1 -1
  315. package/lib/network/reqresp/types.d.ts +10 -4
  316. package/lib/network/reqresp/types.d.ts.map +1 -1
  317. package/lib/network/reqresp/types.js +16 -4
  318. package/lib/network/reqresp/types.js.map +1 -1
  319. package/lib/node/nodejs.d.ts +2 -2
  320. package/lib/node/nodejs.d.ts.map +1 -1
  321. package/lib/node/nodejs.js +1 -4
  322. package/lib/node/nodejs.js.map +1 -1
  323. package/lib/node/notifier.d.ts.map +1 -1
  324. package/lib/node/notifier.js +3 -3
  325. package/lib/node/notifier.js.map +1 -1
  326. package/lib/sync/backfill/backfill.d.ts +2 -2
  327. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  328. package/lib/sync/backfill/backfill.js +2 -2
  329. package/lib/sync/backfill/backfill.js.map +1 -1
  330. package/lib/sync/unknownBlock.d.ts +3 -9
  331. package/lib/sync/unknownBlock.d.ts.map +1 -1
  332. package/lib/sync/unknownBlock.js +10 -43
  333. package/lib/sync/unknownBlock.js.map +1 -1
  334. package/lib/sync/utils/downloadByRange.d.ts +3 -3
  335. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  336. package/lib/sync/utils/downloadByRange.js +4 -2
  337. package/lib/sync/utils/downloadByRange.js.map +1 -1
  338. package/lib/sync/utils/downloadByRoot.d.ts +3 -3
  339. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  340. package/lib/sync/utils/downloadByRoot.js +10 -5
  341. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  342. package/lib/util/blobs.d.ts +3 -3
  343. package/lib/util/blobs.d.ts.map +1 -1
  344. package/lib/util/blobs.js +21 -10
  345. package/lib/util/blobs.js.map +1 -1
  346. package/lib/util/dataColumns.d.ts +18 -11
  347. package/lib/util/dataColumns.d.ts.map +1 -1
  348. package/lib/util/dataColumns.js +51 -17
  349. package/lib/util/dataColumns.js.map +1 -1
  350. package/lib/util/execution.d.ts +6 -2
  351. package/lib/util/execution.d.ts.map +1 -1
  352. package/lib/util/execution.js +49 -25
  353. package/lib/util/execution.js.map +1 -1
  354. package/lib/util/sszBytes.d.ts +19 -2
  355. package/lib/util/sszBytes.d.ts.map +1 -1
  356. package/lib/util/sszBytes.js +173 -3
  357. package/lib/util/sszBytes.js.map +1 -1
  358. package/lib/util/types.d.ts +2 -0
  359. package/lib/util/types.d.ts.map +1 -1
  360. package/lib/util/types.js +1 -0
  361. package/lib/util/types.js.map +1 -1
  362. package/package.json +16 -16
  363. package/src/api/impl/beacon/blocks/index.ts +33 -16
  364. package/src/api/impl/beacon/pool/index.ts +1 -1
  365. package/src/api/impl/beacon/state/index.ts +29 -41
  366. package/src/api/impl/beacon/state/utils.ts +11 -25
  367. package/src/api/impl/debug/index.ts +2 -2
  368. package/src/api/impl/lodestar/index.ts +4 -8
  369. package/src/api/impl/proof/index.ts +2 -9
  370. package/src/api/impl/validator/index.ts +29 -41
  371. package/src/api/impl/validator/utils.ts +4 -7
  372. package/src/chain/ColumnReconstructionTracker.ts +6 -5
  373. package/src/chain/GetBlobsTracker.ts +14 -12
  374. package/src/chain/archiveStore/archiveStore.ts +1 -0
  375. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -39
  376. package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +2 -1
  377. package/src/chain/archiveStore/historicalState/types.ts +2 -0
  378. package/src/chain/archiveStore/historicalState/worker.ts +1 -4
  379. package/src/chain/archiveStore/interface.ts +1 -0
  380. package/src/chain/balancesCache.ts +5 -11
  381. package/src/chain/blocks/blockInput/blockInput.ts +8 -8
  382. package/src/chain/blocks/blockInput/types.ts +5 -4
  383. package/src/chain/blocks/importBlock.ts +41 -26
  384. package/src/chain/blocks/importExecutionPayload.ts +89 -63
  385. package/src/chain/blocks/index.ts +3 -2
  386. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +53 -12
  387. package/src/chain/blocks/payloadEnvelopeInput/types.ts +2 -1
  388. package/src/chain/blocks/types.ts +26 -15
  389. package/src/chain/blocks/utils/checkpoint.ts +2 -2
  390. package/src/chain/blocks/verifyBlock.ts +5 -10
  391. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -14
  392. package/src/chain/blocks/verifyBlocksSignatures.ts +3 -3
  393. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
  394. package/src/chain/chain.ts +138 -91
  395. package/src/chain/emitter.ts +27 -9
  396. package/src/chain/errors/blockError.ts +4 -4
  397. package/src/chain/errors/dataColumnSidecarError.ts +32 -1
  398. package/src/chain/forkChoice/index.ts +33 -42
  399. package/src/chain/initState.ts +7 -2
  400. package/src/chain/interface.ts +16 -15
  401. package/src/chain/lightClient/index.ts +9 -22
  402. package/src/chain/opPools/aggregatedAttestationPool.ts +15 -21
  403. package/src/chain/opPools/opPool.ts +13 -14
  404. package/src/chain/opPools/utils.ts +3 -3
  405. package/src/chain/options.ts +2 -0
  406. package/src/chain/prepareNextSlot.ts +6 -8
  407. package/src/chain/produceBlock/computeNewStateRoot.ts +6 -10
  408. package/src/chain/produceBlock/produceBlockBody.ts +22 -49
  409. package/src/chain/regen/interface.ts +13 -17
  410. package/src/chain/regen/queued.ts +16 -20
  411. package/src/chain/regen/regen.ts +16 -17
  412. package/src/chain/seenCache/seenGossipBlockInput.ts +2 -2
  413. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +2 -2
  414. package/src/chain/serializeState.ts +3 -3
  415. package/src/chain/shufflingCache.ts +5 -7
  416. package/src/chain/stateCache/fifoBlockStateCache.ts +7 -7
  417. package/src/chain/stateCache/persistentCheckpointsCache.ts +27 -42
  418. package/src/chain/stateCache/types.ts +14 -18
  419. package/src/chain/validation/attestation.ts +3 -3
  420. package/src/chain/validation/attesterSlashing.ts +3 -3
  421. package/src/chain/validation/blobSidecar.ts +1 -1
  422. package/src/chain/validation/block.ts +2 -4
  423. package/src/chain/validation/blsToExecutionChange.ts +2 -2
  424. package/src/chain/validation/dataColumnSidecar.ts +231 -8
  425. package/src/chain/validation/executionPayloadBid.ts +3 -7
  426. package/src/chain/validation/executionPayloadEnvelope.ts +2 -8
  427. package/src/chain/validation/payloadAttestationMessage.ts +2 -4
  428. package/src/chain/validation/proposerSlashing.ts +1 -1
  429. package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -7
  430. package/src/chain/validation/signatureSets/syncCommittee.ts +2 -7
  431. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -2
  432. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -7
  433. package/src/chain/validation/syncCommittee.ts +21 -20
  434. package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -10
  435. package/src/chain/validation/voluntaryExit.ts +3 -8
  436. package/src/chain/validatorMonitor.ts +12 -11
  437. package/src/db/buckets.ts +2 -2
  438. package/src/db/repositories/dataColumnSidecar.ts +4 -2
  439. package/src/db/repositories/dataColumnSidecarArchive.ts +4 -2
  440. package/src/metrics/metrics/lodestar.ts +57 -19
  441. package/src/network/gossip/encoding.ts +16 -0
  442. package/src/network/interface.ts +18 -4
  443. package/src/network/libp2p/index.ts +24 -13
  444. package/src/network/network.ts +39 -8
  445. package/src/network/options.ts +7 -2
  446. package/src/network/processor/extractSlotRootFns.ts +32 -6
  447. package/src/network/processor/gossipHandlers.ts +329 -94
  448. package/src/network/processor/index.ts +393 -92
  449. package/src/network/reqresp/ReqRespBeaconNode.ts +13 -0
  450. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +94 -0
  451. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +43 -0
  452. package/src/network/reqresp/handlers/index.ts +12 -0
  453. package/src/network/reqresp/protocols.ts +12 -0
  454. package/src/network/reqresp/rateLimit.ts +18 -0
  455. package/src/network/reqresp/score.ts +2 -0
  456. package/src/network/reqresp/types.ts +26 -5
  457. package/src/node/nodejs.ts +3 -5
  458. package/src/node/notifier.ts +4 -10
  459. package/src/sync/backfill/backfill.ts +3 -3
  460. package/src/sync/unknownBlock.ts +13 -53
  461. package/src/sync/utils/downloadByRange.ts +9 -7
  462. package/src/sync/utils/downloadByRoot.ts +16 -12
  463. package/src/util/blobs.ts +35 -15
  464. package/src/util/dataColumns.ts +69 -25
  465. package/src/util/execution.ts +49 -30
  466. package/src/util/sszBytes.ts +223 -7
  467. package/src/util/types.ts +6 -0
@@ -19,16 +19,13 @@ import {
19
19
  isForkPostElectra,
20
20
  } from "@lodestar/params";
21
21
  import {
22
- CachedBeaconStateAllForks,
23
- CachedBeaconStateAltair,
24
- CachedBeaconStateGloas,
25
22
  EffectiveBalanceIncrements,
23
+ IBeaconStateView,
26
24
  RootCache,
27
25
  computeEpochAtSlot,
28
26
  computeSlotsSinceEpochStart,
29
27
  computeStartSlotAtEpoch,
30
28
  getAttestationParticipationStatus,
31
- getBlockRootAtSlot,
32
29
  } from "@lodestar/state-transition";
33
30
  import {Attestation, Epoch, RootHex, Slot, electra, isElectraAttestation, phase0, ssz} from "@lodestar/types";
34
31
  import {MapDef, assert, toRootHex} from "@lodestar/utils";
@@ -212,7 +209,7 @@ export class AggregatedAttestationPool {
212
209
  fork: ForkName,
213
210
  forkChoice: IForkChoice,
214
211
  shufflingCache: ShufflingCache,
215
- state: CachedBeaconStateAllForks
212
+ state: IBeaconStateView
216
213
  ): Attestation[] {
217
214
  const forkSeq = ForkSeq[fork];
218
215
  if (forkSeq < ForkSeq.electra) {
@@ -229,10 +226,10 @@ export class AggregatedAttestationPool {
229
226
  fork: ForkName,
230
227
  forkChoice: IForkChoice,
231
228
  shufflingCache: ShufflingCache,
232
- state: CachedBeaconStateAllForks
229
+ state: IBeaconStateView
233
230
  ): electra.Attestation[] {
234
231
  const stateSlot = state.slot;
235
- const stateEpoch = state.epochCtx.epoch;
232
+ const stateEpoch = state.epoch;
236
233
  const statePrevEpoch = stateEpoch - 1;
237
234
  const rootCache = new RootCache(state);
238
235
 
@@ -312,7 +309,7 @@ export class AggregatedAttestationPool {
312
309
  // The committeeCountPerSlot can be precomputed once per slot
313
310
  const getAttestationGroupResult = attestationGroup.getAttestationsForBlock(
314
311
  fork,
315
- state.epochCtx.effectiveBalanceIncrements,
312
+ state.effectiveBalanceIncrements,
316
313
  notSeenCommitteeMembers,
317
314
  MAX_ATTESTATIONS_PER_GROUP_ELECTRA
318
315
  );
@@ -362,9 +359,7 @@ export class AggregatedAttestationPool {
362
359
  inclusionDistance,
363
360
  stateEpoch,
364
361
  rootCache,
365
- ForkSeq[fork] >= ForkSeq.gloas
366
- ? (state as CachedBeaconStateGloas).executionPayloadAvailability.toBoolArray()
367
- : null
362
+ ForkSeq[fork] >= ForkSeq.gloas ? state.executionPayloadAvailability : null
368
363
  );
369
364
 
370
365
  const weight =
@@ -735,13 +730,13 @@ export function aggregateConsolidation({byCommittee, attData}: AttestationsConso
735
730
  }
736
731
 
737
732
  /**
738
- * Pre-compute participation from a CachedBeaconStateAllForks, for use to check if an attestation's committee
733
+ * Pre-compute participation from a IBeaconStateView, for use to check if an attestation's committee
739
734
  * has already attested or not.
740
735
  */
741
736
  export function getNotSeenValidatorsFn(
742
737
  config: BeaconConfig,
743
738
  shufflingCache: ShufflingCache,
744
- state: CachedBeaconStateAllForks
739
+ state: IBeaconStateView
745
740
  ): GetNotSeenValidatorsFn {
746
741
  const stateSlot = state.slot;
747
742
  if (config.getForkName(stateSlot) === ForkName.phase0) {
@@ -753,9 +748,8 @@ export function getNotSeenValidatorsFn(
753
748
  // Attestations are sorted by inclusion distance then number of attesters.
754
749
  // Attestations should pass the validation when processing attestations in state-transition.
755
750
  // check for altair block already
756
- const altairState = state as CachedBeaconStateAltair;
757
- const previousParticipation = altairState.previousEpochParticipation.getAll();
758
- const currentParticipation = altairState.currentEpochParticipation.getAll();
751
+ const previousParticipation = state.previousEpochParticipation;
752
+ const currentParticipation = state.currentEpochParticipation;
759
753
  const stateEpoch = computeEpochAtSlot(stateSlot);
760
754
  // this function could be called multiple times with same slot + committeeIndex
761
755
  const cachedNotSeenValidators = new Map<string, Set<number>>();
@@ -774,7 +768,7 @@ export function getNotSeenValidatorsFn(
774
768
  return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
775
769
  }
776
770
 
777
- const decisionRoot = state.epochCtx.getShufflingDecisionRoot(computeEpochAtSlot(slot));
771
+ const decisionRoot = state.getShufflingDecisionRoot(computeEpochAtSlot(slot));
778
772
  const committee = shufflingCache.getBeaconCommittee(epoch, decisionRoot, slot, committeeIndex);
779
773
  notSeenCommitteeMembers = new Set<number>();
780
774
  for (const [i, validatorIndex] of committee.entries()) {
@@ -804,11 +798,11 @@ export function getNotSeenValidatorsFn(
804
798
  */
805
799
  export function getValidateAttestationDataFn(
806
800
  forkChoice: IForkChoice,
807
- state: CachedBeaconStateAllForks
801
+ state: IBeaconStateView
808
802
  ): ValidateAttestationDataFn {
809
803
  const cachedValidatedAttestationData = new Map<string, InvalidAttestationData | null>();
810
804
  const {previousJustifiedCheckpoint, currentJustifiedCheckpoint} = state;
811
- const stateEpoch = state.epochCtx.epoch;
805
+ const stateEpoch = state.epoch;
812
806
  return (attData: phase0.AttestationData) => {
813
807
  const targetEpoch = attData.target.epoch;
814
808
  let justifiedCheckpoint: phase0.Checkpoint;
@@ -850,14 +844,14 @@ export function getValidateAttestationDataFn(
850
844
  */
851
845
  function isValidShuffling(
852
846
  forkChoice: IForkChoice,
853
- state: CachedBeaconStateAllForks,
847
+ state: IBeaconStateView,
854
848
  blockRootHex: RootHex,
855
849
  targetEpoch: Epoch
856
850
  ): InvalidAttestationData | null {
857
851
  // Otherwise the shuffling is determined by the block at the end of the target epoch
858
852
  // minus the shuffling lookahead (usually 2). We call this the "pivot".
859
853
  const pivotSlot = computeStartSlotAtEpoch(targetEpoch - 1) - 1;
860
- const stateDependentRoot = toRootHex(getBlockRootAtSlot(state, pivotSlot));
854
+ const stateDependentRoot = toRootHex(state.getBlockRootAtSlot(pivotSlot));
861
855
 
862
856
  // Use fork choice's view of the block DAG to quickly evaluate whether the attestation's
863
857
  // pivot block is the same as the current state's pivot block. If it is, then the
@@ -11,11 +11,10 @@ import {
11
11
  MAX_VOLUNTARY_EXITS,
12
12
  } from "@lodestar/params";
13
13
  import {
14
- CachedBeaconStateAllForks,
14
+ IBeaconStateView,
15
15
  computeEpochAtSlot,
16
16
  computeStartSlotAtEpoch,
17
17
  getAttesterSlashableIndices,
18
- isValidVoluntaryExit,
19
18
  } from "@lodestar/state-transition";
20
19
  import {
21
20
  AttesterSlashing,
@@ -185,7 +184,7 @@ export class OpPool {
185
184
  * slashings included earlier in the block.
186
185
  */
187
186
  getSlashingsAndExits(
188
- state: CachedBeaconStateAllForks,
187
+ state: IBeaconStateView,
189
188
  blockType: BlockType,
190
189
  metrics: Metrics | null
191
190
  ): [
@@ -207,7 +206,7 @@ export class OpPool {
207
206
  const endProposerSlashing = stepsMetrics?.startTimer();
208
207
  for (const proposerSlashing of this.proposerSlashings.values()) {
209
208
  const index = proposerSlashing.signedHeader1.message.proposerIndex;
210
- const validator = state.validators.getReadonly(index);
209
+ const validator = state.getValidator(index);
211
210
  if (!validator.slashed && validator.activationEpoch <= stateEpoch && stateEpoch < validator.withdrawableEpoch) {
212
211
  proposerSlashings.push(proposerSlashing);
213
212
  // Set of validators to be slashed, so we don't attempt to construct invalid attester slashings.
@@ -234,7 +233,7 @@ export class OpPool {
234
233
  continue attesterSlashing;
235
234
  }
236
235
 
237
- const validator = state.validators.getReadonly(index);
236
+ const validator = state.getValidator(index);
238
237
  if (isSlashableAtEpoch(validator, stateEpoch)) {
239
238
  slashableIndices.add(index);
240
239
  }
@@ -261,7 +260,7 @@ export class OpPool {
261
260
  for (const voluntaryExit of this.voluntaryExits.values()) {
262
261
  if (
263
262
  !toBeSlashedIndices.has(voluntaryExit.message.validatorIndex) &&
264
- isValidVoluntaryExit(stateFork, state, voluntaryExit, false) &&
263
+ state.isValidVoluntaryExit(voluntaryExit, false) &&
265
264
  // Signature validation is skipped in `isValidVoluntaryExit(,,false)` since it was already validated in gossip
266
265
  // However we must make sure that the signature fork is the same, or it will become invalid if included through
267
266
  // a future fork.
@@ -320,7 +319,7 @@ export class OpPool {
320
319
  /**
321
320
  * Prune all types of transactions given the latest head state
322
321
  */
323
- pruneAll(headBlock: SignedBeaconBlock, headState: CachedBeaconStateAllForks): void {
322
+ pruneAll(headBlock: SignedBeaconBlock, headState: IBeaconStateView): void {
324
323
  this.pruneAttesterSlashings(headState);
325
324
  this.pruneProposerSlashings(headState);
326
325
  this.pruneVoluntaryExits(headState);
@@ -330,7 +329,7 @@ export class OpPool {
330
329
  /**
331
330
  * Prune attester slashings for all slashed or withdrawn validators.
332
331
  */
333
- private pruneAttesterSlashings(headState: CachedBeaconStateAllForks): void {
332
+ private pruneAttesterSlashings(headState: IBeaconStateView): void {
334
333
  const finalizedEpoch = headState.finalizedCheckpoint.epoch;
335
334
  attesterSlashing: for (const [key, attesterSlashing] of this.attesterSlashings.entries()) {
336
335
  // Slashings that don't slash any validators can be dropped
@@ -342,7 +341,7 @@ export class OpPool {
342
341
  //
343
342
  // We cannot check the `slashed` field since the `head` is not finalized and
344
343
  // a fork could un-slash someone.
345
- if (headState.validators.getReadonly(index).exitEpoch > finalizedEpoch) {
344
+ if (headState.getValidator(index).exitEpoch > finalizedEpoch) {
346
345
  continue attesterSlashing;
347
346
  }
348
347
  }
@@ -355,11 +354,11 @@ export class OpPool {
355
354
  /**
356
355
  * Prune proposer slashings for validators which are exited in the finalized epoch.
357
356
  */
358
- private pruneProposerSlashings(headState: CachedBeaconStateAllForks): void {
357
+ private pruneProposerSlashings(headState: IBeaconStateView): void {
359
358
  const finalizedEpoch = headState.finalizedCheckpoint.epoch;
360
359
  for (const [key, proposerSlashing] of this.proposerSlashings.entries()) {
361
360
  const index = proposerSlashing.signedHeader1.message.proposerIndex;
362
- if (headState.validators.getReadonly(index).exitEpoch <= finalizedEpoch) {
361
+ if (headState.getValidator(index).exitEpoch <= finalizedEpoch) {
363
362
  this.proposerSlashings.delete(key);
364
363
  }
365
364
  }
@@ -369,7 +368,7 @@ export class OpPool {
369
368
  * Call after finalizing
370
369
  * Prune if validator has already exited at or before the finalized checkpoint of the head.
371
370
  */
372
- private pruneVoluntaryExits(headState: CachedBeaconStateAllForks): void {
371
+ private pruneVoluntaryExits(headState: IBeaconStateView): void {
373
372
  const headStateFork = this.config.getForkSeq(headState.slot);
374
373
  const finalizedEpoch = headState.finalizedCheckpoint.epoch;
375
374
 
@@ -392,7 +391,7 @@ export class OpPool {
392
391
  * In the worse case where head block is reorged, the same BlsToExecutionChange message can be re-added
393
392
  * to opPool once gossipsub seen cache TTL passes.
394
393
  */
395
- private pruneBlsToExecutionChanges(headBlock: SignedBeaconBlock, headState: CachedBeaconStateAllForks): void {
394
+ private pruneBlsToExecutionChanges(headBlock: SignedBeaconBlock, headState: IBeaconStateView): void {
396
395
  const recentBlsToExecutionChanges =
397
396
  this.config.getForkSeq(headBlock.message.slot) >= ForkSeq.capella
398
397
  ? (headBlock as capella.SignedBeaconBlock).message.body.blsToExecutionChanges
@@ -405,7 +404,7 @@ export class OpPool {
405
404
  for (const [key, blsToExecutionChange] of this.blsToExecutionChanges.entries()) {
406
405
  const {validatorIndex} = blsToExecutionChange.data.message;
407
406
  if (!recentBlsToExecutionChangeIndexes.has(validatorIndex)) {
408
- const validator = headState.validators.getReadonly(validatorIndex);
407
+ const validator = headState.getValidator(validatorIndex);
409
408
  if (validator.withdrawalCredentials[0] !== BLS_WITHDRAWAL_PREFIX) {
410
409
  this.blsToExecutionChanges.delete(key);
411
410
  }
@@ -1,6 +1,6 @@
1
1
  import {Signature} from "@chainsafe/blst";
2
2
  import {BLS_WITHDRAWAL_PREFIX} from "@lodestar/params";
3
- import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
3
+ import {IBeaconStateView} from "@lodestar/state-transition";
4
4
  import {Slot, capella} from "@lodestar/types";
5
5
  import {AggregateFast, AggregateFastElectra} from "./attestationPool.js";
6
6
 
@@ -38,7 +38,7 @@ export function signatureFromBytesNoCheck(signature: Uint8Array): Signature {
38
38
  * can become invalid for certain forks.
39
39
  */
40
40
  export function isValidBlsToExecutionChangeForBlockInclusion(
41
- state: CachedBeaconStateAllForks,
41
+ state: IBeaconStateView,
42
42
  signedBLSToExecutionChange: capella.SignedBLSToExecutionChange
43
43
  ): boolean {
44
44
  // For each condition from https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
@@ -48,7 +48,7 @@ export function isValidBlsToExecutionChangeForBlockInclusion(
48
48
  //
49
49
  // 2. assert validator.withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX:
50
50
  // Must be checked again, since it can already be changed by now.
51
- const validator = state.validators.getReadonly(signedBLSToExecutionChange.message.validatorIndex);
51
+ const validator = state.getValidator(signedBLSToExecutionChange.message.validatorIndex);
52
52
  const {withdrawalCredentials} = validator;
53
53
  if (withdrawalCredentials[0] !== BLS_WITHDRAWAL_PREFIX) {
54
54
  return false;
@@ -47,6 +47,7 @@ export type IChainOptions = BlockProcessOpts &
47
47
  minSameMessageSignatureSetsToBatch: number;
48
48
  archiveDateEpochs?: number;
49
49
  nHistoricalStatesFileDataStore?: boolean;
50
+ nativeStateView?: boolean;
50
51
  };
51
52
 
52
53
  export type BlockProcessOpts = {
@@ -124,6 +125,7 @@ export const defaultChainOptions: IChainOptions = {
124
125
  // - users can prune the persisted checkpoint state files manually to save disc space
125
126
  // - it helps debug easier when network is unfinalized
126
127
  nHistoricalStatesFileDataStore: true,
128
+ nativeStateView: false,
127
129
  maxBlockStates: DEFAULT_MAX_BLOCK_STATES,
128
130
  maxCPStateEpochsInMemory: DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY,
129
131
  maxCPStateEpochsOnDisk: DEFAULT_MAX_CP_STATE_ON_DISK,
@@ -3,9 +3,7 @@ import {ChainForkConfig} from "@lodestar/config";
3
3
  import {PayloadStatus, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
4
4
  import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix} from "@lodestar/params";
5
5
  import {
6
- CachedBeaconStateAllForks,
7
- CachedBeaconStateExecutions,
8
- CachedBeaconStateGloas,
6
+ IBeaconStateView,
9
7
  StateHashTreeRootSource,
10
8
  computeEpochAtSlot,
11
9
  computeTimeAtSlot,
@@ -121,9 +119,9 @@ export class PrepareNextSlotScheduler {
121
119
  );
122
120
 
123
121
  if (isForkPostBellatrix(fork)) {
124
- const proposerIndex = prepareState.epochCtx.getBeaconProposer(prepareSlot);
122
+ const proposerIndex = prepareState.getBeaconProposer(prepareSlot);
125
123
  const feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
126
- let updatedPrepareState = prepareState as CachedBeaconStateExecutions | CachedBeaconStateGloas;
124
+ let updatedPrepareState = prepareState;
127
125
  let updatedHeadRoot = headRoot;
128
126
 
129
127
  if (feeRecipient) {
@@ -140,13 +138,13 @@ export class PrepareNextSlotScheduler {
140
138
  headRoot,
141
139
  });
142
140
  this.metrics?.weakHeadDetected.inc();
143
- updatedPrepareState = (await this.chain.regen.getBlockSlotState(
141
+ updatedPrepareState = await this.chain.regen.getBlockSlotState(
144
142
  proposerHead,
145
143
  prepareSlot,
146
144
  // only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
147
145
  {dontTransferCache: !isEpochTransition},
148
146
  RegenCaller.predictProposerHead
149
- )) as CachedBeaconStateExecutions | CachedBeaconStateGloas;
147
+ );
150
148
  updatedHeadRoot = proposerHeadRoot;
151
149
  }
152
150
 
@@ -239,7 +237,7 @@ export class PrepareNextSlotScheduler {
239
237
  }
240
238
  };
241
239
 
242
- computeStateHashTreeRoot(state: CachedBeaconStateAllForks, isEpochTransition: boolean): void {
240
+ computeStateHashTreeRoot(state: IBeaconStateView, isEpochTransition: boolean): void {
243
241
  // cache HashObjects for faster hashTreeRoot() later, especially for computeNewStateRoot() if we need to produce a block at slot 0 of epoch
244
242
  // see https://github.com/ChainSafe/lodestar/issues/6194
245
243
  const hashTreeRootTimer = this.metrics?.stateHashTreeRootTime.startTimer({
@@ -1,13 +1,10 @@
1
1
  import {
2
- CachedBeaconStateAllForks,
3
- CachedBeaconStateGloas,
4
2
  DataAvailabilityStatus,
5
3
  ExecutionPayloadStatus,
6
4
  G2_POINT_AT_INFINITY,
5
+ IBeaconStateView,
7
6
  StateHashTreeRootSource,
8
- stateTransition,
9
7
  } from "@lodestar/state-transition";
10
- import {processExecutionPayloadEnvelope} from "@lodestar/state-transition/block";
11
8
  import {BeaconBlock, BlindedBeaconBlock, Gwei, Root, gloas} from "@lodestar/types";
12
9
  import {ZERO_HASH} from "../../constants/index.js";
13
10
  import {Metrics} from "../../metrics/index.js";
@@ -19,14 +16,13 @@ import {Metrics} from "../../metrics/index.js";
19
16
  */
20
17
  export function computeNewStateRoot(
21
18
  metrics: Metrics | null,
22
- state: CachedBeaconStateAllForks,
19
+ state: IBeaconStateView,
23
20
  block: BeaconBlock | BlindedBeaconBlock
24
- ): {newStateRoot: Root; proposerReward: Gwei; postState: CachedBeaconStateAllForks} {
21
+ ): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
25
22
  // Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
26
23
  const blockEmptySig = {message: block, signature: ZERO_HASH};
27
24
 
28
- const postState = stateTransition(
29
- state,
25
+ const postState = state.stateTransition(
30
26
  blockEmptySig,
31
27
  {
32
28
  // ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL
@@ -64,7 +60,7 @@ export function computeNewStateRoot(
64
60
  */
65
61
  export function computeEnvelopeStateRoot(
66
62
  metrics: Metrics | null,
67
- postBlockState: CachedBeaconStateGloas,
63
+ postBlockState: IBeaconStateView,
68
64
  envelope: gloas.ExecutionPayloadEnvelope
69
65
  ): Root {
70
66
  const signedEnvelope: gloas.SignedExecutionPayloadEnvelope = {
@@ -73,7 +69,7 @@ export function computeEnvelopeStateRoot(
73
69
  };
74
70
 
75
71
  const processEnvelopeTimer = metrics?.blockPayload.executionPayloadEnvelopeProcessingTime.startTimer();
76
- const postEnvelopeState = processExecutionPayloadEnvelope(postBlockState, signedEnvelope, {
72
+ const postEnvelopeState = postBlockState.processExecutionPayloadEnvelope(signedEnvelope, {
77
73
  // Signature is zero-ed (G2_POINT_AT_INFINITY), skip verification
78
74
  verifySignature: false,
79
75
  // State root is being computed here, the envelope doesn't have it yet
@@ -14,17 +14,7 @@ import {
14
14
  isForkPostBellatrix,
15
15
  isForkPostGloas,
16
16
  } from "@lodestar/params";
17
- import {
18
- CachedBeaconStateAllForks,
19
- CachedBeaconStateBellatrix,
20
- CachedBeaconStateCapella,
21
- CachedBeaconStateExecutions,
22
- CachedBeaconStateGloas,
23
- G2_POINT_AT_INFINITY,
24
- computeTimeAtSlot,
25
- getExpectedWithdrawals,
26
- getRandaoMix,
27
- } from "@lodestar/state-transition";
17
+ import {G2_POINT_AT_INFINITY, IBeaconStateView, computeTimeAtSlot} from "@lodestar/state-transition";
28
18
  import {
29
19
  BLSPubkey,
30
20
  BLSSignature,
@@ -161,7 +151,7 @@ export type ProduceResult =
161
151
  export async function produceBlockBody<T extends BlockType>(
162
152
  this: BeaconChain,
163
153
  blockType: T,
164
- currentState: CachedBeaconStateAllForks,
154
+ currentState: IBeaconStateView,
165
155
  blockAttr: BlockAttributes & {
166
156
  proposerIndex: ValidatorIndex;
167
157
  proposerPubKey: BLSPubkey;
@@ -204,7 +194,6 @@ export async function produceBlockBody<T extends BlockType>(
204
194
  // TODO GLOAS: support non self-building here, the block type differentiation between
205
195
  // full and blinded no longer makes sense in gloas, it might be a good idea to move
206
196
  // this into a completely separate function and have pre/post gloas more separated
207
- const gloasState = currentState as CachedBeaconStateGloas;
208
197
  const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
209
198
  const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
210
199
  const feeRecipient = requestedFeeRecipient ?? this.beaconProposerCache.getOrDefault(proposerIndex);
@@ -225,7 +214,7 @@ export async function produceBlockBody<T extends BlockType>(
225
214
  parentBlockRoot,
226
215
  safeBlockHash,
227
216
  finalizedBlockHash ?? ZERO_HASH_HEX,
228
- gloasState,
217
+ currentState,
229
218
  feeRecipient
230
219
  );
231
220
 
@@ -259,10 +248,10 @@ export async function produceBlockBody<T extends BlockType>(
259
248
 
260
249
  // Create self-build execution payload bid
261
250
  const bid: gloas.ExecutionPayloadBid = {
262
- parentBlockHash: gloasState.latestBlockHash,
251
+ parentBlockHash: currentState.latestBlockHash,
263
252
  parentBlockRoot: parentBlockRoot,
264
253
  blockHash: executionPayload.blockHash,
265
- prevRandao: getRandaoMix(gloasState, gloasState.epochCtx.epoch),
254
+ prevRandao: currentState.getRandaoMix(currentState.epoch),
266
255
  feeRecipient: executionPayload.feeRecipient,
267
256
  gasLimit: BigInt(executionPayload.gasLimit),
268
257
  builderIndex: BUILDER_INDEX_SELF_BUILD,
@@ -336,7 +325,7 @@ export async function produceBlockBody<T extends BlockType>(
336
325
  parentBlockRoot,
337
326
  safeBlockHash,
338
327
  finalizedBlockHash ?? ZERO_HASH_HEX,
339
- currentState as CachedBeaconStateBellatrix,
328
+ currentState,
340
329
  executionBuilder.issueLocalFcUWithFeeRecipient
341
330
  );
342
331
  }
@@ -348,12 +337,7 @@ export async function produceBlockBody<T extends BlockType>(
348
337
  slot: blockSlot,
349
338
  proposerPubKey: toHex(proposerPubKey),
350
339
  });
351
- const headerRes = await prepareExecutionPayloadHeader(
352
- this,
353
- fork,
354
- currentState as CachedBeaconStateBellatrix,
355
- proposerPubKey
356
- );
340
+ const headerRes = await prepareExecutionPayloadHeader(this, fork, currentState, proposerPubKey);
357
341
 
358
342
  endExecutionPayloadHeader?.({
359
343
  step: BlockProductionStep.executionPayload,
@@ -388,7 +372,7 @@ export async function produceBlockBody<T extends BlockType>(
388
372
  });
389
373
  } else {
390
374
  const headerGasLimit = builderRes.header.gasLimit;
391
- const parentGasLimit = (currentState as CachedBeaconStateBellatrix).latestExecutionPayloadHeader.gasLimit;
375
+ const parentGasLimit = currentState.latestExecutionPayloadHeader.gasLimit;
392
376
  const expectedGasLimit = getExpectedGasLimit(parentGasLimit, targetGasLimit);
393
377
 
394
378
  const lowerBound = Math.min(parentGasLimit, expectedGasLimit);
@@ -449,7 +433,7 @@ export async function produceBlockBody<T extends BlockType>(
449
433
  parentBlockRoot,
450
434
  safeBlockHash,
451
435
  finalizedBlockHash ?? ZERO_HASH_HEX,
452
- currentState as CachedBeaconStateExecutions,
436
+ currentState,
453
437
  feeRecipient
454
438
  );
455
439
 
@@ -614,14 +598,12 @@ export async function prepareExecutionPayload(
614
598
  parentBlockRoot: Root,
615
599
  safeBlockHash: RootHex,
616
600
  finalizedBlockHash: RootHex,
617
- state: CachedBeaconStateExecutions | CachedBeaconStateGloas,
601
+ state: IBeaconStateView,
618
602
  suggestedFeeRecipient: string
619
603
  ): Promise<{prepType: PayloadPreparationType; payloadId: PayloadId}> {
620
- const parentHash = isForkPostGloas(fork)
621
- ? (state as CachedBeaconStateGloas).latestBlockHash
622
- : (state as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockHash;
604
+ const parentHash = state.latestBlockHash;
623
605
  const timestamp = computeTimeAtSlot(chain.config, state.slot, state.genesisTime);
624
- const prevRandao = getRandaoMix(state, state.epochCtx.epoch);
606
+ const prevRandao = state.getRandaoMix(state.epoch);
625
607
 
626
608
  const payloadIdCached = chain.executionEngine.payloadIdCache.get({
627
609
  headBlockHash: toRootHex(parentHash),
@@ -684,7 +666,7 @@ async function prepareExecutionPayloadHeader(
684
666
  config: ChainForkConfig;
685
667
  },
686
668
  fork: ForkPostBellatrix,
687
- state: CachedBeaconStateBellatrix,
669
+ state: IBeaconStateView,
688
670
  proposerPubKey: BLSPubkey
689
671
  ): Promise<{
690
672
  header: ExecutionPayloadHeader;
@@ -711,16 +693,9 @@ export function getPayloadAttributesForSSE(
711
693
  prepareSlot,
712
694
  parentBlockRoot,
713
695
  feeRecipient,
714
- }: {
715
- prepareState: CachedBeaconStateExecutions | CachedBeaconStateGloas;
716
- prepareSlot: Slot;
717
- parentBlockRoot: Root;
718
- feeRecipient: string;
719
- }
696
+ }: {prepareState: IBeaconStateView; prepareSlot: Slot; parentBlockRoot: Root; feeRecipient: string}
720
697
  ): SSEPayloadAttributes {
721
- const parentHash = isForkPostGloas(fork)
722
- ? (prepareState as CachedBeaconStateGloas).latestBlockHash
723
- : (prepareState as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockHash;
698
+ const parentHash = prepareState.latestBlockHash;
724
699
  const payloadAttributes = preparePayloadAttributes(fork, chain, {
725
700
  prepareState,
726
701
  prepareSlot,
@@ -736,11 +711,11 @@ export function getPayloadAttributesForSSE(
736
711
  }
737
712
  parentBlockNumber = parentBlock.executionPayloadNumber;
738
713
  } else {
739
- parentBlockNumber = (prepareState as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockNumber;
714
+ parentBlockNumber = prepareState.payloadBlockNumber;
740
715
  }
741
716
 
742
717
  const ssePayloadAttributes: SSEPayloadAttributes = {
743
- proposerIndex: prepareState.epochCtx.getBeaconProposer(prepareSlot),
718
+ proposerIndex: prepareState.getBeaconProposer(prepareSlot),
744
719
  proposalSlot: prepareSlot,
745
720
  parentBlockNumber,
746
721
  parentBlockRoot,
@@ -761,14 +736,14 @@ function preparePayloadAttributes(
761
736
  parentBlockRoot,
762
737
  feeRecipient,
763
738
  }: {
764
- prepareState: CachedBeaconStateExecutions | CachedBeaconStateGloas;
739
+ prepareState: IBeaconStateView;
765
740
  prepareSlot: Slot;
766
741
  parentBlockRoot: Root;
767
742
  feeRecipient: string;
768
743
  }
769
744
  ): SSEPayloadAttributes["payloadAttributes"] {
770
745
  const timestamp = computeTimeAtSlot(chain.config, prepareSlot, prepareState.genesisTime);
771
- const prevRandao = getRandaoMix(prepareState, prepareState.epochCtx.epoch);
746
+ const prevRandao = prepareState.getRandaoMix(prepareState.epoch);
772
747
  const payloadAttributes = {
773
748
  timestamp,
774
749
  prevRandao,
@@ -777,10 +752,8 @@ function preparePayloadAttributes(
777
752
 
778
753
  if (ForkSeq[fork] >= ForkSeq.capella) {
779
754
  // withdrawals logic is now fork aware as it changes on electra fork post capella
780
- (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals = getExpectedWithdrawals(
781
- ForkSeq[fork],
782
- prepareState as CachedBeaconStateCapella
783
- ).expectedWithdrawals;
755
+ (payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
756
+ prepareState.getExpectedWithdrawals().expectedWithdrawals;
784
757
  }
785
758
 
786
759
  if (ForkSeq[fork] >= ForkSeq.deneb) {
@@ -793,7 +766,7 @@ function preparePayloadAttributes(
793
766
  export async function produceCommonBlockBody<T extends BlockType>(
794
767
  this: BeaconChain,
795
768
  blockType: T,
796
- currentState: CachedBeaconStateAllForks,
769
+ currentState: IBeaconStateView,
797
770
  {randaoReveal, graffiti, slot, parentBlock}: BlockAttributes
798
771
  ): Promise<CommonBlockBody> {
799
772
  const stepsMetrics =
@@ -1,6 +1,6 @@
1
1
  import {routes} from "@lodestar/api";
2
2
  import {ProtoBlock} from "@lodestar/fork-choice";
3
- import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
3
+ import {IBeaconStateView} from "@lodestar/state-transition";
4
4
  import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types";
5
5
  import {CheckpointHexPayload} from "../stateCache/types.js";
6
6
 
@@ -38,21 +38,21 @@ export type StateRegenerationOpts = {
38
38
  export interface IStateRegenerator extends IStateRegeneratorInternal {
39
39
  dropCache(): void;
40
40
  dumpCacheSummary(): routes.lodestar.StateCacheItem[];
41
- getStateSync(stateRoot: RootHex): CachedBeaconStateAllForks | null;
42
- getPreStateSync(block: BeaconBlock): CachedBeaconStateAllForks | null;
43
- getCheckpointStateOrBytes(cp: CheckpointHexPayload): Promise<CachedBeaconStateAllForks | Uint8Array | null>;
44
- getCheckpointStateSync(cp: CheckpointHexPayload): CachedBeaconStateAllForks | null;
45
- getClosestHeadState(head: ProtoBlock): CachedBeaconStateAllForks | null;
41
+ getStateSync(stateRoot: RootHex): IBeaconStateView | null;
42
+ getPreStateSync(block: BeaconBlock): IBeaconStateView | null;
43
+ getCheckpointStateOrBytes(cp: CheckpointHexPayload): Promise<IBeaconStateView | Uint8Array | null>;
44
+ getCheckpointStateSync(cp: CheckpointHexPayload): IBeaconStateView | null;
45
+ getClosestHeadState(head: ProtoBlock): IBeaconStateView | null;
46
46
  pruneOnCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void;
47
47
  pruneOnFinalized(finalizedEpoch: Epoch): void;
48
- processBlockState(blockRootHex: RootHex, postState: CachedBeaconStateAllForks): void;
49
- processPayloadState(payloadState: CachedBeaconStateAllForks): void;
48
+ processBlockState(blockRootHex: RootHex, postState: IBeaconStateView): void;
49
+ processPayloadState(payloadState: IBeaconStateView): void;
50
50
  /**
51
51
  * payloadPresent is true if this is payload state, false if block state.
52
52
  * payloadPresent is always true for pre-gloas.
53
53
  */
54
- addCheckpointState(cp: phase0.Checkpoint, item: CachedBeaconStateAllForks, payloadPresent: boolean): void;
55
- updateHeadState(newHead: ProtoBlock, maybeHeadState: CachedBeaconStateAllForks): void;
54
+ addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView, payloadPresent: boolean): void;
55
+ updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void;
56
56
  updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch, payloadPresent: boolean): number | null;
57
57
  upgradeForGloas(epoch: Epoch): void;
58
58
  }
@@ -65,11 +65,7 @@ export interface IStateRegeneratorInternal {
65
65
  * Return a valid pre-state for a beacon block
66
66
  * This will always return a state in the latest viable epoch
67
67
  */
68
- getPreState(
69
- block: BeaconBlock,
70
- opts: StateRegenerationOpts,
71
- rCaller: RegenCaller
72
- ): Promise<CachedBeaconStateAllForks>;
68
+ getPreState(block: BeaconBlock, opts: StateRegenerationOpts, rCaller: RegenCaller): Promise<IBeaconStateView>;
73
69
 
74
70
  /**
75
71
  * Return the state of `blockRoot` processed to slot `slot`
@@ -79,10 +75,10 @@ export interface IStateRegeneratorInternal {
79
75
  slot: Slot,
80
76
  opts: StateRegenerationOpts,
81
77
  rCaller: RegenCaller
82
- ): Promise<CachedBeaconStateAllForks>;
78
+ ): Promise<IBeaconStateView>;
83
79
 
84
80
  /**
85
81
  * Return the exact state with `stateRoot`
86
82
  */
87
- getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
83
+ getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<IBeaconStateView>;
88
84
  }