@lodestar/beacon-node 1.38.0 → 1.39.0-dev.2fe8de2346

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 (365) hide show
  1. package/lib/api/impl/beacon/blocks/utils.js +1 -1
  2. package/lib/api/impl/beacon/blocks/utils.js.map +1 -1
  3. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  4. package/lib/api/impl/beacon/state/index.js +4 -5
  5. package/lib/api/impl/beacon/state/index.js.map +1 -1
  6. package/lib/api/impl/validator/index.js +1 -1
  7. package/lib/api/impl/validator/index.js.map +1 -1
  8. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  9. package/lib/chain/blocks/verifyBlock.js +1 -21
  10. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  11. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -6
  12. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  13. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +10 -131
  14. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  15. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  16. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  17. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
  18. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  19. package/lib/chain/chain.d.ts +1 -4
  20. package/lib/chain/chain.d.ts.map +1 -1
  21. package/lib/chain/chain.js +6 -26
  22. package/lib/chain/chain.js.map +1 -1
  23. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  24. package/lib/chain/forkChoice/index.js +3 -3
  25. package/lib/chain/forkChoice/index.js.map +1 -1
  26. package/lib/chain/initState.d.ts +1 -14
  27. package/lib/chain/initState.d.ts.map +1 -1
  28. package/lib/chain/initState.js +1 -62
  29. package/lib/chain/initState.js.map +1 -1
  30. package/lib/chain/interface.d.ts +0 -2
  31. package/lib/chain/interface.d.ts.map +1 -1
  32. package/lib/chain/interface.js.map +1 -1
  33. package/lib/chain/options.d.ts +0 -4
  34. package/lib/chain/options.d.ts.map +1 -1
  35. package/lib/chain/options.js +0 -2
  36. package/lib/chain/options.js.map +1 -1
  37. package/lib/chain/prepareNextSlot.d.ts +0 -4
  38. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  39. package/lib/chain/prepareNextSlot.js +2 -22
  40. package/lib/chain/prepareNextSlot.js.map +1 -1
  41. package/lib/chain/produceBlock/produceBlockBody.d.ts +2 -22
  42. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  43. package/lib/chain/produceBlock/produceBlockBody.js +30 -96
  44. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  45. package/lib/chain/rewards/attestationsRewards.d.ts +3 -3
  46. package/lib/chain/rewards/attestationsRewards.d.ts.map +1 -1
  47. package/lib/chain/rewards/attestationsRewards.js +4 -4
  48. package/lib/chain/rewards/attestationsRewards.js.map +1 -1
  49. package/lib/chain/rewards/syncCommitteeRewards.d.ts +2 -2
  50. package/lib/chain/rewards/syncCommitteeRewards.d.ts.map +1 -1
  51. package/lib/chain/rewards/syncCommitteeRewards.js +1 -2
  52. package/lib/chain/rewards/syncCommitteeRewards.js.map +1 -1
  53. package/lib/chain/validation/attesterSlashing.js +2 -2
  54. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  55. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  56. package/lib/chain/validation/blobSidecar.js +2 -2
  57. package/lib/chain/validation/blobSidecar.js.map +1 -1
  58. package/lib/chain/validation/block.d.ts.map +1 -1
  59. package/lib/chain/validation/block.js +3 -3
  60. package/lib/chain/validation/block.js.map +1 -1
  61. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  62. package/lib/chain/validation/dataColumnSidecar.js +2 -2
  63. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  64. package/lib/chain/validation/proposerSlashing.js +1 -1
  65. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  66. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
  67. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  68. package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -3
  69. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  70. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
  71. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  72. package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
  73. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  74. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
  75. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  76. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
  77. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  78. package/lib/chain/validation/syncCommittee.js +1 -1
  79. package/lib/chain/validation/syncCommittee.js.map +1 -1
  80. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  81. package/lib/chain/validation/syncCommitteeContributionAndProof.js +4 -3
  82. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  83. package/lib/chain/validation/voluntaryExit.js +1 -1
  84. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  85. package/lib/db/beacon.d.ts +1 -7
  86. package/lib/db/beacon.d.ts.map +1 -1
  87. package/lib/db/beacon.js +1 -12
  88. package/lib/db/beacon.js.map +1 -1
  89. package/lib/db/buckets.d.ts +0 -6
  90. package/lib/db/buckets.d.ts.map +1 -1
  91. package/lib/db/buckets.js +6 -7
  92. package/lib/db/buckets.js.map +1 -1
  93. package/lib/db/interface.d.ts +1 -7
  94. package/lib/db/interface.d.ts.map +1 -1
  95. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  96. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  97. package/lib/db/repositories/index.d.ts +0 -3
  98. package/lib/db/repositories/index.d.ts.map +1 -1
  99. package/lib/db/repositories/index.js +0 -3
  100. package/lib/db/repositories/index.js.map +1 -1
  101. package/lib/execution/engine/http.d.ts +5 -13
  102. package/lib/execution/engine/http.d.ts.map +1 -1
  103. package/lib/execution/engine/http.js +6 -15
  104. package/lib/execution/engine/http.js.map +1 -1
  105. package/lib/execution/engine/index.d.ts.map +1 -1
  106. package/lib/execution/engine/index.js +1 -1
  107. package/lib/execution/engine/index.js.map +1 -1
  108. package/lib/execution/engine/interface.d.ts +1 -1
  109. package/lib/execution/engine/interface.d.ts.map +1 -1
  110. package/lib/execution/engine/interface.js.map +1 -1
  111. package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.d.ts +1 -1
  112. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -0
  113. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -0
  114. package/lib/execution/engine/jwt.d.ts.map +1 -0
  115. package/lib/execution/engine/jwt.js.map +1 -0
  116. package/lib/execution/engine/mock.d.ts +2 -6
  117. package/lib/execution/engine/mock.d.ts.map +1 -1
  118. package/lib/execution/engine/mock.js +4 -15
  119. package/lib/execution/engine/mock.js.map +1 -1
  120. package/lib/execution/engine/payloadIdCache.d.ts +1 -1
  121. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  122. package/lib/execution/engine/types.d.ts +1 -1
  123. package/lib/execution/engine/types.d.ts.map +1 -1
  124. package/lib/execution/engine/types.js +1 -1
  125. package/lib/execution/engine/types.js.map +1 -1
  126. package/lib/execution/engine/utils.d.ts +64 -2
  127. package/lib/execution/engine/utils.d.ts.map +1 -1
  128. package/lib/execution/engine/utils.js +91 -2
  129. package/lib/execution/engine/utils.js.map +1 -1
  130. package/lib/index.d.ts +1 -2
  131. package/lib/index.d.ts.map +1 -1
  132. package/lib/index.js +1 -2
  133. package/lib/index.js.map +1 -1
  134. package/lib/metrics/metrics/lodestar.d.ts +0 -49
  135. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  136. package/lib/metrics/metrics/lodestar.js +0 -134
  137. package/lib/metrics/metrics/lodestar.js.map +1 -1
  138. package/lib/network/core/events.d.ts +1 -1
  139. package/lib/network/core/events.d.ts.map +1 -1
  140. package/lib/network/core/events.js +1 -1
  141. package/lib/network/core/events.js.map +1 -1
  142. package/lib/network/events.d.ts +6 -1
  143. package/lib/network/events.d.ts.map +1 -1
  144. package/lib/network/events.js +7 -1
  145. package/lib/network/events.js.map +1 -1
  146. package/lib/node/nodejs.d.ts.map +1 -1
  147. package/lib/node/nodejs.js +0 -9
  148. package/lib/node/nodejs.js.map +1 -1
  149. package/lib/node/notifier.d.ts.map +1 -1
  150. package/lib/node/notifier.js +6 -22
  151. package/lib/node/notifier.js.map +1 -1
  152. package/lib/node/options.d.ts +0 -2
  153. package/lib/node/options.d.ts.map +1 -1
  154. package/lib/node/options.js +0 -2
  155. package/lib/node/options.js.map +1 -1
  156. package/lib/node/utils/interop/deposits.d.ts +2 -1
  157. package/lib/node/utils/interop/deposits.d.ts.map +1 -1
  158. package/lib/node/utils/interop/deposits.js.map +1 -1
  159. package/lib/node/utils/interop/state.d.ts +1 -1
  160. package/lib/node/utils/interop/state.d.ts.map +1 -1
  161. package/lib/node/utils/state.d.ts +1 -7
  162. package/lib/node/utils/state.d.ts.map +1 -1
  163. package/lib/node/utils/state.js +1 -14
  164. package/lib/node/utils/state.js.map +1 -1
  165. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  166. package/lib/sync/backfill/backfill.js +4 -2
  167. package/lib/sync/backfill/backfill.js.map +1 -1
  168. package/lib/sync/backfill/verify.d.ts +2 -2
  169. package/lib/sync/backfill/verify.d.ts.map +1 -1
  170. package/lib/sync/backfill/verify.js +3 -3
  171. package/lib/sync/backfill/verify.js.map +1 -1
  172. package/lib/util/workerEvents.d.ts +1 -6
  173. package/lib/util/workerEvents.d.ts.map +1 -1
  174. package/lib/util/workerEvents.js +8 -8
  175. package/lib/util/workerEvents.js.map +1 -1
  176. package/package.json +14 -21
  177. package/src/api/impl/beacon/blocks/utils.ts +1 -1
  178. package/src/api/impl/beacon/state/index.ts +4 -5
  179. package/src/api/impl/validator/index.ts +1 -1
  180. package/src/chain/blocks/verifyBlock.ts +2 -24
  181. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +11 -170
  182. package/src/chain/blocks/verifyBlocksSignatures.ts +3 -2
  183. package/src/chain/chain.ts +5 -30
  184. package/src/chain/forkChoice/index.ts +2 -3
  185. package/src/chain/initState.ts +1 -97
  186. package/src/chain/interface.ts +0 -2
  187. package/src/chain/options.ts +0 -6
  188. package/src/chain/prepareNextSlot.ts +2 -29
  189. package/src/chain/produceBlock/produceBlockBody.ts +31 -130
  190. package/src/chain/rewards/attestationsRewards.ts +6 -5
  191. package/src/chain/rewards/syncCommitteeRewards.ts +2 -2
  192. package/src/chain/validation/attesterSlashing.ts +2 -2
  193. package/src/chain/validation/blobSidecar.ts +10 -2
  194. package/src/chain/validation/block.ts +2 -3
  195. package/src/chain/validation/dataColumnSidecar.ts +6 -1
  196. package/src/chain/validation/proposerSlashing.ts +1 -1
  197. package/src/chain/validation/signatureSets/contributionAndProof.ts +3 -2
  198. package/src/chain/validation/signatureSets/syncCommittee.ts +3 -1
  199. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +4 -2
  200. package/src/chain/validation/syncCommittee.ts +1 -1
  201. package/src/chain/validation/syncCommitteeContributionAndProof.ts +4 -5
  202. package/src/chain/validation/voluntaryExit.ts +1 -1
  203. package/src/db/beacon.ts +0 -15
  204. package/src/db/buckets.ts +6 -7
  205. package/src/db/interface.ts +0 -13
  206. package/src/db/repositories/index.ts +0 -3
  207. package/src/execution/engine/http.ts +12 -21
  208. package/src/execution/engine/index.ts +1 -1
  209. package/src/execution/engine/interface.ts +1 -1
  210. package/src/{eth1/provider → execution/engine}/jsonRpcHttpClient.ts +1 -1
  211. package/src/execution/engine/mock.ts +4 -17
  212. package/src/execution/engine/payloadIdCache.ts +1 -1
  213. package/src/execution/engine/types.ts +9 -9
  214. package/src/execution/engine/utils.ts +111 -5
  215. package/src/index.ts +1 -2
  216. package/src/metrics/metrics/lodestar.ts +0 -144
  217. package/src/network/core/events.ts +1 -1
  218. package/src/network/events.ts +7 -1
  219. package/src/node/nodejs.ts +0 -9
  220. package/src/node/notifier.ts +7 -29
  221. package/src/node/options.ts +0 -3
  222. package/src/node/utils/interop/deposits.ts +3 -1
  223. package/src/node/utils/interop/state.ts +1 -1
  224. package/src/node/utils/state.ts +3 -18
  225. package/src/sync/backfill/backfill.ts +9 -2
  226. package/src/sync/backfill/verify.ts +8 -2
  227. package/src/util/workerEvents.ts +9 -8
  228. package/lib/chain/genesis/genesis.d.ts +0 -51
  229. package/lib/chain/genesis/genesis.d.ts.map +0 -1
  230. package/lib/chain/genesis/genesis.js +0 -123
  231. package/lib/chain/genesis/genesis.js.map +0 -1
  232. package/lib/chain/genesis/interface.d.ts +0 -13
  233. package/lib/chain/genesis/interface.d.ts.map +0 -1
  234. package/lib/chain/genesis/interface.js +0 -2
  235. package/lib/chain/genesis/interface.js.map +0 -1
  236. package/lib/db/repositories/depositDataRoot.d.ts +0 -22
  237. package/lib/db/repositories/depositDataRoot.d.ts.map +0 -1
  238. package/lib/db/repositories/depositDataRoot.js +0 -62
  239. package/lib/db/repositories/depositDataRoot.js.map +0 -1
  240. package/lib/db/repositories/depositEvent.d.ts +0 -13
  241. package/lib/db/repositories/depositEvent.d.ts.map +0 -1
  242. package/lib/db/repositories/depositEvent.js +0 -27
  243. package/lib/db/repositories/depositEvent.js.map +0 -1
  244. package/lib/db/repositories/eth1Data.d.ts +0 -13
  245. package/lib/db/repositories/eth1Data.d.ts.map +0 -1
  246. package/lib/db/repositories/eth1Data.js +0 -26
  247. package/lib/db/repositories/eth1Data.js.map +0 -1
  248. package/lib/db/single/index.d.ts +0 -3
  249. package/lib/db/single/index.d.ts.map +0 -1
  250. package/lib/db/single/index.js +0 -3
  251. package/lib/db/single/index.js.map +0 -1
  252. package/lib/db/single/preGenesisState.d.ts +0 -16
  253. package/lib/db/single/preGenesisState.d.ts.map +0 -1
  254. package/lib/db/single/preGenesisState.js +0 -29
  255. package/lib/db/single/preGenesisState.js.map +0 -1
  256. package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts +0 -14
  257. package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts.map +0 -1
  258. package/lib/db/single/preGenesisStateLastProcessedBlock.js +0 -27
  259. package/lib/db/single/preGenesisStateLastProcessedBlock.js.map +0 -1
  260. package/lib/eth1/errors.d.ts +0 -66
  261. package/lib/eth1/errors.d.ts.map +0 -1
  262. package/lib/eth1/errors.js +0 -27
  263. package/lib/eth1/errors.js.map +0 -1
  264. package/lib/eth1/eth1DataCache.d.ts +0 -19
  265. package/lib/eth1/eth1DataCache.d.ts.map +0 -1
  266. package/lib/eth1/eth1DataCache.js +0 -19
  267. package/lib/eth1/eth1DataCache.js.map +0 -1
  268. package/lib/eth1/eth1DepositDataTracker.d.ts +0 -80
  269. package/lib/eth1/eth1DepositDataTracker.d.ts.map +0 -1
  270. package/lib/eth1/eth1DepositDataTracker.js +0 -317
  271. package/lib/eth1/eth1DepositDataTracker.js.map +0 -1
  272. package/lib/eth1/eth1DepositsCache.d.ts +0 -42
  273. package/lib/eth1/eth1DepositsCache.d.ts.map +0 -1
  274. package/lib/eth1/eth1DepositsCache.js +0 -119
  275. package/lib/eth1/eth1DepositsCache.js.map +0 -1
  276. package/lib/eth1/eth1MergeBlockTracker.d.ts +0 -65
  277. package/lib/eth1/eth1MergeBlockTracker.d.ts.map +0 -1
  278. package/lib/eth1/eth1MergeBlockTracker.js +0 -262
  279. package/lib/eth1/eth1MergeBlockTracker.js.map +0 -1
  280. package/lib/eth1/index.d.ts +0 -46
  281. package/lib/eth1/index.d.ts.map +0 -1
  282. package/lib/eth1/index.js +0 -121
  283. package/lib/eth1/index.js.map +0 -1
  284. package/lib/eth1/interface.d.ts +0 -112
  285. package/lib/eth1/interface.d.ts.map +0 -1
  286. package/lib/eth1/interface.js +0 -8
  287. package/lib/eth1/interface.js.map +0 -1
  288. package/lib/eth1/options.d.ts +0 -22
  289. package/lib/eth1/options.d.ts.map +0 -1
  290. package/lib/eth1/options.js +0 -8
  291. package/lib/eth1/options.js.map +0 -1
  292. package/lib/eth1/provider/eth1Provider.d.ts +0 -39
  293. package/lib/eth1/provider/eth1Provider.d.ts.map +0 -1
  294. package/lib/eth1/provider/eth1Provider.js +0 -147
  295. package/lib/eth1/provider/eth1Provider.js.map +0 -1
  296. package/lib/eth1/provider/jsonRpcHttpClient.d.ts.map +0 -1
  297. package/lib/eth1/provider/jsonRpcHttpClient.js.map +0 -1
  298. package/lib/eth1/provider/jwt.d.ts.map +0 -1
  299. package/lib/eth1/provider/jwt.js.map +0 -1
  300. package/lib/eth1/provider/utils.d.ts +0 -65
  301. package/lib/eth1/provider/utils.d.ts.map +0 -1
  302. package/lib/eth1/provider/utils.js +0 -120
  303. package/lib/eth1/provider/utils.js.map +0 -1
  304. package/lib/eth1/stream.d.ts +0 -15
  305. package/lib/eth1/stream.d.ts.map +0 -1
  306. package/lib/eth1/stream.js +0 -54
  307. package/lib/eth1/stream.js.map +0 -1
  308. package/lib/eth1/utils/depositContract.d.ts +0 -14
  309. package/lib/eth1/utils/depositContract.d.ts.map +0 -1
  310. package/lib/eth1/utils/depositContract.js +0 -33
  311. package/lib/eth1/utils/depositContract.js.map +0 -1
  312. package/lib/eth1/utils/deposits.d.ts +0 -8
  313. package/lib/eth1/utils/deposits.d.ts.map +0 -1
  314. package/lib/eth1/utils/deposits.js +0 -47
  315. package/lib/eth1/utils/deposits.js.map +0 -1
  316. package/lib/eth1/utils/eth1Data.d.ts +0 -22
  317. package/lib/eth1/utils/eth1Data.d.ts.map +0 -1
  318. package/lib/eth1/utils/eth1Data.js +0 -77
  319. package/lib/eth1/utils/eth1Data.js.map +0 -1
  320. package/lib/eth1/utils/eth1DepositEvent.d.ts +0 -7
  321. package/lib/eth1/utils/eth1DepositEvent.d.ts.map +0 -1
  322. package/lib/eth1/utils/eth1DepositEvent.js +0 -13
  323. package/lib/eth1/utils/eth1DepositEvent.js.map +0 -1
  324. package/lib/eth1/utils/eth1Vote.d.ts +0 -17
  325. package/lib/eth1/utils/eth1Vote.d.ts.map +0 -1
  326. package/lib/eth1/utils/eth1Vote.js +0 -111
  327. package/lib/eth1/utils/eth1Vote.js.map +0 -1
  328. package/lib/eth1/utils/groupDepositEventsByBlock.d.ts +0 -9
  329. package/lib/eth1/utils/groupDepositEventsByBlock.d.ts.map +0 -1
  330. package/lib/eth1/utils/groupDepositEventsByBlock.js +0 -17
  331. package/lib/eth1/utils/groupDepositEventsByBlock.js.map +0 -1
  332. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts +0 -10
  333. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts.map +0 -1
  334. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js +0 -14
  335. package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js.map +0 -1
  336. package/src/chain/genesis/genesis.ts +0 -190
  337. package/src/chain/genesis/interface.ts +0 -14
  338. package/src/db/repositories/depositDataRoot.ts +0 -80
  339. package/src/db/repositories/depositEvent.ts +0 -32
  340. package/src/db/repositories/eth1Data.ts +0 -33
  341. package/src/db/single/index.ts +0 -2
  342. package/src/db/single/preGenesisState.ts +0 -37
  343. package/src/db/single/preGenesisStateLastProcessedBlock.ts +0 -34
  344. package/src/eth1/errors.ts +0 -40
  345. package/src/eth1/eth1DataCache.ts +0 -26
  346. package/src/eth1/eth1DepositDataTracker.ts +0 -410
  347. package/src/eth1/eth1DepositsCache.ts +0 -141
  348. package/src/eth1/eth1MergeBlockTracker.ts +0 -328
  349. package/src/eth1/index.ts +0 -157
  350. package/src/eth1/interface.ts +0 -131
  351. package/src/eth1/options.ts +0 -28
  352. package/src/eth1/provider/eth1Provider.ts +0 -229
  353. package/src/eth1/provider/utils.ts +0 -136
  354. package/src/eth1/stream.ts +0 -75
  355. package/src/eth1/utils/depositContract.ts +0 -37
  356. package/src/eth1/utils/deposits.ts +0 -70
  357. package/src/eth1/utils/eth1Data.ts +0 -100
  358. package/src/eth1/utils/eth1DepositEvent.ts +0 -12
  359. package/src/eth1/utils/eth1Vote.ts +0 -142
  360. package/src/eth1/utils/groupDepositEventsByBlock.ts +0 -19
  361. package/src/eth1/utils/optimizeNextBlockDiffForGenesis.ts +0 -18
  362. /package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.js +0 -0
  363. /package/lib/{eth1/provider → execution/engine}/jwt.d.ts +0 -0
  364. /package/lib/{eth1/provider → execution/engine}/jwt.js +0 -0
  365. /package/src/{eth1/provider → execution/engine}/jwt.ts +0 -0
package/src/db/beacon.ts CHANGED
@@ -14,16 +14,12 @@ import {
14
14
  CheckpointHeaderRepository,
15
15
  DataColumnSidecarArchiveRepository,
16
16
  DataColumnSidecarRepository,
17
- DepositDataRootRepository,
18
- DepositEventRepository,
19
- Eth1DataRepository,
20
17
  ProposerSlashingRepository,
21
18
  StateArchiveRepository,
22
19
  SyncCommitteeRepository,
23
20
  SyncCommitteeWitnessRepository,
24
21
  VoluntaryExitRepository,
25
22
  } from "./repositories/index.js";
26
- import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "./single/index.js";
27
23
 
28
24
  export type BeaconDbModules = {
29
25
  config: ChainForkConfig;
@@ -45,14 +41,8 @@ export class BeaconDb implements IBeaconDb {
45
41
  voluntaryExit: VoluntaryExitRepository;
46
42
  proposerSlashing: ProposerSlashingRepository;
47
43
  attesterSlashing: AttesterSlashingRepository;
48
- depositEvent: DepositEventRepository;
49
44
  blsToExecutionChange: BLSToExecutionChangeRepository;
50
45
 
51
- depositDataRoot: DepositDataRootRepository;
52
- eth1Data: Eth1DataRepository;
53
- preGenesisState: PreGenesisState;
54
- preGenesisStateLastProcessedBlock: PreGenesisStateLastProcessedBlock;
55
-
56
46
  // lightclient
57
47
  bestLightClientUpdate: BestLightClientUpdateRepository;
58
48
  checkpointHeader: CheckpointHeaderRepository;
@@ -80,11 +70,6 @@ export class BeaconDb implements IBeaconDb {
80
70
  this.blsToExecutionChange = new BLSToExecutionChangeRepository(config, db);
81
71
  this.proposerSlashing = new ProposerSlashingRepository(config, db);
82
72
  this.attesterSlashing = new AttesterSlashingRepository(config, db);
83
- this.depositEvent = new DepositEventRepository(config, db);
84
- this.depositDataRoot = new DepositDataRootRepository(config, db);
85
- this.eth1Data = new Eth1DataRepository(config, db);
86
- this.preGenesisState = new PreGenesisState(config, db);
87
- this.preGenesisStateLastProcessedBlock = new PreGenesisStateLastProcessedBlock(config, db);
88
73
 
89
74
  // lightclient
90
75
  this.bestLightClientUpdate = new BestLightClientUpdateRepository(config, db);
package/src/db/buckets.ts CHANGED
@@ -16,14 +16,13 @@ export enum Bucket {
16
16
  index_mainChain = 6, // Slot -> Root<BeaconBlock>
17
17
  // justified, finalized state and block hashes
18
18
  index_chainInfo = 7, // Key -> Number64 | stateHash | blockHash
19
- // eth1 processing
20
- phase0_eth1Data = 8, // timestamp -> Eth1Data
21
- index_depositDataRoot = 9, // depositIndex -> Root<DepositData>
19
+ // phase0_eth1Data = 8, // DEPRECATED - eth1 deposit tracking is not required since electra
20
+ // index_depositDataRoot = 9, // DEPRECATED - eth1 deposit tracking is not required since electra
22
21
 
23
22
  // op pool
24
23
  // phase0_attestation = 10, // DEPRECATED on v0.25.0
25
24
  // phase0_aggregateAndProof = 11, // Root -> AggregateAndProof, DEPRECATED on v.27.0
26
- phase0_depositData = 12, // [DEPRECATED] index -> DepositData
25
+ // phase0_depositData = 12, // DEPRECATED - eth1 deposit tracking is not required since electra
27
26
  phase0_exit = 13, // ValidatorIndex -> VoluntaryExit
28
27
  phase0_proposerSlashing = 14, // ValidatorIndex -> ProposerSlashing
29
28
  allForks_attesterSlashing = 15, // Root -> AttesterSlashing
@@ -32,15 +31,15 @@ export enum Bucket {
32
31
  allForks_checkpointState = 17, // Root -> BeaconState
33
32
 
34
33
  // allForks_pendingBlock = 25, // Root -> SignedBeaconBlock // DEPRECATED on v0.30.0
35
- phase0_depositEvent = 19, // depositIndex -> DepositEvent
34
+ // phase0_depositEvent = 19, // DEPRECATED - eth1 deposit tracking is not required since electra
36
35
 
37
36
  index_stateArchiveRootIndex = 26, // State Root -> slot
38
37
 
39
38
  deneb_blobSidecars = 27, // DENEB BeaconBlockRoot -> BlobSidecars
40
39
  deneb_blobSidecarsArchive = 28, // DENEB BeaconBlockSlot -> BlobSidecars
41
40
 
42
- phase0_preGenesisState = 30, // Single = phase0.BeaconState
43
- phase0_preGenesisStateLastProcessedBlock = 31, // Single = Uint8
41
+ // phase0_preGenesisState = 30, // DEPRECATED - genesis from eth1 is no longer supported
42
+ // phase0_preGenesisStateLastProcessedBlock = 31, // DEPRECATED - genesis from eth1 is no longer supported
44
43
 
45
44
  // Lightclient server
46
45
  // altair_bestUpdatePerCommitteePeriod = 30, // DEPRECATED on v0.32.0
@@ -12,16 +12,12 @@ import {
12
12
  CheckpointHeaderRepository,
13
13
  DataColumnSidecarArchiveRepository,
14
14
  DataColumnSidecarRepository,
15
- DepositDataRootRepository,
16
- DepositEventRepository,
17
- Eth1DataRepository,
18
15
  ProposerSlashingRepository,
19
16
  StateArchiveRepository,
20
17
  SyncCommitteeRepository,
21
18
  SyncCommitteeWitnessRepository,
22
19
  VoluntaryExitRepository,
23
20
  } from "./repositories/index.js";
24
- import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "./single/index.js";
25
21
 
26
22
  /**
27
23
  * The DB service manages the data layer of the beacon chain
@@ -48,17 +44,8 @@ export interface IBeaconDb {
48
44
  voluntaryExit: VoluntaryExitRepository;
49
45
  proposerSlashing: ProposerSlashingRepository;
50
46
  attesterSlashing: AttesterSlashingRepository;
51
- depositEvent: DepositEventRepository;
52
47
  blsToExecutionChange: BLSToExecutionChangeRepository;
53
48
 
54
- // eth1 processing
55
- preGenesisState: PreGenesisState;
56
- preGenesisStateLastProcessedBlock: PreGenesisStateLastProcessedBlock;
57
-
58
- // all deposit data roots and merkle tree
59
- depositDataRoot: DepositDataRootRepository;
60
- eth1Data: Eth1DataRepository;
61
-
62
49
  // lightclient
63
50
  bestLightClientUpdate: BestLightClientUpdateRepository;
64
51
  checkpointHeader: CheckpointHeaderRepository;
@@ -8,9 +8,6 @@ export {BlockArchiveRepository} from "./blockArchive.js";
8
8
  export {BLSToExecutionChangeRepository} from "./blsToExecutionChange.js";
9
9
  export {DataColumnSidecarRepository} from "./dataColumnSidecar.js";
10
10
  export {DataColumnSidecarArchiveRepository} from "./dataColumnSidecarArchive.js";
11
- export {DepositDataRootRepository} from "./depositDataRoot.js";
12
- export {DepositEventRepository} from "./depositEvent.js";
13
- export {Eth1DataRepository} from "./eth1Data.js";
14
11
  export {BestLightClientUpdateRepository} from "./lightclientBestUpdate.js";
15
12
  export {CheckpointHeaderRepository} from "./lightclientCheckpointHeader.js";
16
13
  export {SyncCommitteeRepository} from "./lightclientSyncCommittee.js";
@@ -4,14 +4,6 @@ import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} fr
4
4
  import {BlobAndProof} from "@lodestar/types/deneb";
5
5
  import {BlobAndProofV2} from "@lodestar/types/fulu";
6
6
  import {strip0xPrefix} from "@lodestar/utils";
7
- import {
8
- ErrorJsonRpcResponse,
9
- HttpRpcError,
10
- IJsonRpcHttpClient,
11
- JsonRpcHttpClientEvent,
12
- ReqOpts,
13
- } from "../../eth1/provider/jsonRpcHttpClient.js";
14
- import {bytesToData, numToQuantity} from "../../eth1/provider/utils.js";
15
7
  import {Metrics} from "../../metrics/index.js";
16
8
  import {EPOCHS_PER_BATCH} from "../../sync/constants.js";
17
9
  import {getLodestarClientVersion} from "../../util/metadata.js";
@@ -27,6 +19,13 @@ import {
27
19
  PayloadId,
28
20
  VersionedHashes,
29
21
  } from "./interface.js";
22
+ import {
23
+ ErrorJsonRpcResponse,
24
+ HttpRpcError,
25
+ IJsonRpcHttpClient,
26
+ JsonRpcHttpClientEvent,
27
+ ReqOpts,
28
+ } from "./jsonRpcHttpClient.js";
30
29
  import {PayloadIdCache} from "./payloadIdCache.js";
31
30
  import {
32
31
  BLOB_AND_PROOF_V2_RPC_BYTES,
@@ -45,7 +44,7 @@ import {
45
44
  serializePayloadAttributes,
46
45
  serializeVersionedHashes,
47
46
  } from "./types.js";
48
- import {getExecutionEngineState} from "./utils.js";
47
+ import {bytesToData, getExecutionEngineState, numToQuantity} from "./utils.js";
49
48
 
50
49
  export type ExecutionEngineModules = {
51
50
  signal: AbortSignal;
@@ -194,15 +193,12 @@ export class ExecutionEngineHttp implements IExecutionEngine {
194
193
  * 1. {status: INVALID_BLOCK_HASH, latestValidHash: null, validationError:
195
194
  * errorMessage | null} if the blockHash validation has failed
196
195
  *
197
- * 2. {status: INVALID_TERMINAL_BLOCK, latestValidHash: null, validationError:
198
- * errorMessage | null} if terminal block conditions are not satisfied
199
- *
200
- * 3. {status: SYNCING, latestValidHash: null, validationError: null} if the payload
196
+ * 2. {status: SYNCING, latestValidHash: null, validationError: null} if the payload
201
197
  * extends the canonical chain and requisite data for its validation is missing
202
198
  * with the payload status obtained from the Payload validation process if the payload
203
199
  * has been fully validated while processing the call
204
200
  *
205
- * 4. {status: ACCEPTED, latestValidHash: null, validationError: null} if the
201
+ * 3. {status: ACCEPTED, latestValidHash: null, validationError: null} if the
206
202
  * following conditions are met:
207
203
  * i) the blockHash of the payload is valid
208
204
  * ii) the payload doesn't extend the canonical chain
@@ -330,16 +326,11 @@ export class ExecutionEngineHttp implements IExecutionEngine {
330
326
  * errorMessage | null}, payloadId: null}
331
327
  * obtained from the Payload validation process if the payload is deemed INVALID
332
328
  *
333
- * 3. {payloadStatus: {status: INVALID_TERMINAL_BLOCK, latestValidHash: null,
334
- * validationError: errorMessage | null}, payloadId: null}
335
- * either obtained from the Payload validation process or as a result of validating a
336
- * PoW block referenced by forkchoiceState.headBlockHash
337
- *
338
- * 4. {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash,
329
+ * 3. {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash,
339
330
  * validationError: null}, payloadId: null}
340
331
  * if the payload is deemed VALID and a build process hasn't been started
341
332
  *
342
- * 5. {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash,
333
+ * 4. {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash,
343
334
  * validationError: null}, payloadId: buildProcessId}
344
335
  * if the payload is deemed VALID and the build process has begun.
345
336
  *
@@ -1,5 +1,4 @@
1
1
  import {fromHex, toPrintableUrl} from "@lodestar/utils";
2
- import {JsonRpcHttpClient} from "../../eth1/provider/jsonRpcHttpClient.js";
3
2
  import {ExecutionEngineDisabled} from "./disabled.js";
4
3
  import {
5
4
  ExecutionEngineHttp,
@@ -8,6 +7,7 @@ import {
8
7
  defaultExecutionEngineHttpOpts,
9
8
  } from "./http.js";
10
9
  import {IExecutionEngine} from "./interface.js";
10
+ import {JsonRpcHttpClient} from "./jsonRpcHttpClient.js";
11
11
  import {ExecutionEngineMockBackend, ExecutionEngineMockOpts} from "./mock.js";
12
12
  import {ExecutionEngineMockJsonRpcClient, JsonRpcBackend} from "./utils.js";
13
13
 
@@ -9,9 +9,9 @@ import {
9
9
  import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei, capella} from "@lodestar/types";
10
10
  import {BlobAndProof} from "@lodestar/types/deneb";
11
11
  import {BlobAndProofV2} from "@lodestar/types/fulu";
12
- import {DATA} from "../../eth1/provider/utils.js";
13
12
  import {PayloadId, PayloadIdCache, WithdrawalV1} from "./payloadIdCache.js";
14
13
  import {ExecutionPayloadBody} from "./types.js";
14
+ import {DATA} from "./utils.js";
15
15
 
16
16
  export {PayloadIdCache, type PayloadId, type WithdrawalV1};
17
17
 
@@ -1,8 +1,8 @@
1
1
  import {EventEmitter} from "node:events";
2
2
  import {StrictEventEmitter} from "strict-event-emitter-types";
3
3
  import {ErrorAborted, Gauge, Histogram, TimeoutError, fetch, isValidHttpUrl, retry} from "@lodestar/utils";
4
- import {IJson, RpcPayload} from "../interface.js";
5
4
  import {JwtClaim, encodeJwtToken} from "./jwt.js";
5
+ import {IJson, RpcPayload} from "./utils.js";
6
6
 
7
7
  export enum JsonRpcHttpClientEvent {
8
8
  /**
@@ -9,9 +9,8 @@ import {
9
9
  ForkSeq,
10
10
  } from "@lodestar/params";
11
11
  import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
12
- import {fromHex, toHex, toRootHex} from "@lodestar/utils";
12
+ import {fromHex, toRootHex} from "@lodestar/utils";
13
13
  import {ZERO_HASH_HEX} from "../../constants/index.js";
14
- import {quantityToNum} from "../../eth1/provider/utils.js";
15
14
  import {INTEROP_BLOCK_HASH} from "../../node/utils/interop/state.js";
16
15
  import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
17
16
  import {kzg} from "../../util/kzg.js";
@@ -29,7 +28,7 @@ import {
29
28
  serializeExecutionPayload,
30
29
  serializeExecutionRequests,
31
30
  } from "./types.js";
32
- import {JsonRpcBackend} from "./utils.js";
31
+ import {JsonRpcBackend, quantityToNum} from "./utils.js";
33
32
 
34
33
  const INTEROP_GAS_LIMIT = 30e6;
35
34
  const PRUNE_PAYLOAD_ID_AFTER_MS = 5000;
@@ -70,7 +69,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
70
69
  finalizedBlockHash = ZERO_HASH_HEX;
71
70
  readonly payloadIdCache = new PayloadIdCache();
72
71
 
73
- /** Known valid blocks, both pre-merge and post-merge */
72
+ /** Known valid blocks */
74
73
  private readonly validBlocks = new Map<RootHex, ExecutionBlock>();
75
74
  /** Preparing payloads to be retrieved via engine_getPayloadV1 */
76
75
  private readonly preparingPayloads = new Map<number, PreparedPayload>();
@@ -135,18 +134,6 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
135
134
  return [] as ExecutionPayloadBodyRpc[];
136
135
  }
137
136
 
138
- /**
139
- * Mock manipulator to add more known blocks to this mock.
140
- */
141
- addPowBlock(powBlock: bellatrix.PowBlock): void {
142
- this.validBlocks.set(toHex(powBlock.blockHash), {
143
- parentHash: toHex(powBlock.parentHash),
144
- blockHash: toHex(powBlock.blockHash),
145
- timestamp: 0,
146
- blockNumber: 0,
147
- });
148
- }
149
-
150
137
  /**
151
138
  * Mock manipulator to add predefined responses before execution engine client calls
152
139
  */
@@ -258,7 +245,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
258
245
  // section of the EIP. Additionally, if this validation fails, client software MUST NOT update the forkchoice
259
246
  // state and MUST NOT begin a payload build process.
260
247
  //
261
- // > TODO
248
+ // > N/A: All networks have completed the merge transition
262
249
 
263
250
  // 4. Before updating the forkchoice state, client software MUST ensure the validity of the payload referenced by
264
251
  // forkchoiceState.headBlockHash, and MAY validate the payload while processing the call. The validation process
@@ -1,7 +1,7 @@
1
1
  import {SLOTS_PER_EPOCH} from "@lodestar/params";
2
2
  import {pruneSetToMax} from "@lodestar/utils";
3
- import {DATA, QUANTITY} from "../../eth1/provider/utils.js";
4
3
  import {PayloadAttributesRpc} from "./types.js";
4
+ import {DATA, QUANTITY} from "./utils.js";
5
5
 
6
6
  // Idealy this only need to be set to the max head reorgs number
7
7
  const MAX_PAYLOAD_IDS = SLOTS_PER_EPOCH;
@@ -23,6 +23,14 @@ import {
23
23
  } from "@lodestar/types";
24
24
  import {BlobAndProof} from "@lodestar/types/deneb";
25
25
  import {BlobAndProofV2} from "@lodestar/types/fulu";
26
+ import {
27
+ ExecutionPayloadStatus,
28
+ ExecutionRequestType,
29
+ PayloadAttributes,
30
+ VersionedHashes,
31
+ isExecutionRequestType,
32
+ } from "./interface.js";
33
+ import {WithdrawalV1} from "./payloadIdCache.js";
26
34
  import {
27
35
  DATA,
28
36
  QUANTITY,
@@ -32,15 +40,7 @@ import {
32
40
  numToQuantity,
33
41
  quantityToBigint,
34
42
  quantityToNum,
35
- } from "../../eth1/provider/utils.js";
36
- import {
37
- ExecutionPayloadStatus,
38
- ExecutionRequestType,
39
- PayloadAttributes,
40
- VersionedHashes,
41
- isExecutionRequestType,
42
- } from "./interface.js";
43
- import {WithdrawalV1} from "./payloadIdCache.js";
43
+ } from "./utils.js";
44
44
 
45
45
  export type EngineApiRpcParamTypes = {
46
46
  /**
@@ -1,14 +1,120 @@
1
- import {isErrorAborted, isFetchError} from "@lodestar/utils";
2
- import {IJson, RpcPayload} from "../../eth1/interface.js";
1
+ import {bigIntToBytes, bytesToBigInt, fromHex, fromHexInto, isErrorAborted, isFetchError, toHex} from "@lodestar/utils";
2
+ import {isQueueErrorAborted} from "../../util/queue/errors.js";
3
+ import {ExecutionEngineState, ExecutionPayloadStatus} from "./interface.js";
3
4
  import {
4
5
  ErrorJsonRpcResponse,
5
6
  HttpRpcError,
6
7
  IJsonRpcHttpClient,
7
8
  JsonRpcHttpClientEvent,
8
9
  JsonRpcHttpClientEventEmitter,
9
- } from "../../eth1/provider/jsonRpcHttpClient.js";
10
- import {isQueueErrorAborted} from "../../util/queue/errors.js";
11
- import {ExecutionEngineState, ExecutionPayloadStatus} from "./interface.js";
10
+ } from "./jsonRpcHttpClient.js";
11
+
12
+ /** QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
13
+ export type QUANTITY = string;
14
+ /** DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
15
+ export type DATA = string;
16
+
17
+ export const rootHexRegex = /^0x[a-fA-F0-9]{64}$/;
18
+
19
+ export type IJson = string | number | boolean | undefined | IJson[] | {[key: string]: IJson};
20
+
21
+ export interface RpcPayload<P = IJson[]> {
22
+ method: string;
23
+ params: P;
24
+ }
25
+
26
+ /**
27
+ * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
28
+ *
29
+ * When encoding QUANTITIES (integers, numbers): encode as hex, prefix with “0x”, the most compact representation (slight exception: zero should be represented as “0x0”). Examples:
30
+ * - 0x41 (65 in decimal)
31
+ * - 0x400 (1024 in decimal)
32
+ * - WRONG: 0x (should always have at least one digit - zero is “0x0”)
33
+ * - WRONG: 0x0400 (no leading zeroes allowed)
34
+ * - WRONG: ff (must be prefixed 0x)
35
+ */
36
+ export function numToQuantity(num: number | bigint): QUANTITY {
37
+ return "0x" + num.toString(16);
38
+ }
39
+
40
+ /**
41
+ * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
42
+ */
43
+ export function quantityToNum(hex: QUANTITY, id = ""): number {
44
+ const num = parseInt(hex, 16);
45
+ if (Number.isNaN(num) || num < 0) throw Error(`Invalid hex decimal ${id} '${hex}'`);
46
+ return num;
47
+ }
48
+
49
+ /**
50
+ * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
51
+ * Typesafe fn to convert hex string to bigint. The BigInt constructor param is any
52
+ */
53
+ export function quantityToBigint(hex: QUANTITY, id = ""): bigint {
54
+ try {
55
+ return BigInt(hex);
56
+ } catch (e) {
57
+ throw Error(`Invalid hex bigint ${id} '${hex}': ${(e as Error).message}`);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
63
+ */
64
+ export function quantityToBytes(hex: QUANTITY): Uint8Array {
65
+ const bn = quantityToBigint(hex);
66
+ return bigIntToBytes(bn, 32, "le");
67
+ }
68
+
69
+ /**
70
+ * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
71
+ * Compress a 32 ByteVector into a QUANTITY
72
+ */
73
+ export function bytesToQuantity(bytes: Uint8Array): QUANTITY {
74
+ const bn = bytesToBigInt(bytes, "le");
75
+ return numToQuantity(bn);
76
+ }
77
+
78
+ /**
79
+ * DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
80
+ *
81
+ * When encoding UNFORMATTED DATA (byte arrays, account addresses, hashes, bytecode arrays): encode as hex, prefix with
82
+ * “0x”, two hex digits per byte. Examples:
83
+ *
84
+ * - 0x41 (size 1, “A”)
85
+ * - 0x004200 (size 3, “\0B\0”)
86
+ * - 0x (size 0, “”)
87
+ * - WRONG: 0xf0f0f (must be even number of digits)
88
+ * - WRONG: 004200 (must be prefixed 0x)
89
+ */
90
+ export function bytesToData(bytes: Uint8Array): DATA {
91
+ return toHex(bytes);
92
+ }
93
+
94
+ /**
95
+ * DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
96
+ */
97
+ export function dataToBytes(hex: DATA, fixedLength: number | null): Uint8Array {
98
+ try {
99
+ const bytes = fromHex(hex);
100
+ if (fixedLength != null && bytes.length !== fixedLength) {
101
+ throw Error(`Wrong data length ${bytes.length} expected ${fixedLength}`);
102
+ }
103
+ return bytes;
104
+ } catch (e) {
105
+ (e as Error).message = `Invalid hex string: ${(e as Error).message}`;
106
+ throw e;
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Convert DATA into a preallocated buffer
112
+ * fromHexInto will throw if buffer's length is not the same as the decoded hex length
113
+ */
114
+ export function dataIntoBytes(hex: DATA, buffer: Uint8Array): Uint8Array {
115
+ fromHexInto(hex, buffer);
116
+ return buffer;
117
+ }
12
118
 
13
119
  export type JsonRpcBackend = {
14
120
  // biome-ignore lint/suspicious/noExplicitAny: We need to use `any` type here
package/src/index.ts CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  export type {RestApiServerMetrics, RestApiServerModules, RestApiServerOpts} from "./api/rest/base.js";
4
4
  export {RestApiServer} from "./api/rest/base.js";
5
- export {checkAndPersistAnchorState, initStateFromDb, initStateFromEth1} from "./chain/index.js";
5
+ export {checkAndPersistAnchorState, initStateFromDb} from "./chain/index.js";
6
6
  export {DbCPStateDatastore} from "./chain/stateCache/datastore/db.js";
7
7
  export {FileCPStateDatastore} from "./chain/stateCache/datastore/file.js";
8
8
  export {BeaconDb, type IBeaconDb} from "./db/index.js";
9
- export {Eth1Provider, type IEth1Provider} from "./eth1/index.js";
10
9
  // Export metrics utilities to de-duplicate validator metrics
11
10
  export {
12
11
  type HttpMetricsServer,
@@ -1619,150 +1619,6 @@ export function createLodestarMetrics(
1619
1619
  }),
1620
1620
  },
1621
1621
 
1622
- eth1: {
1623
- depositTrackerIsCaughtup: register.gauge({
1624
- name: "lodestar_eth1_deposit_tracker_is_caughtup",
1625
- help: "Eth1 deposit is caught up 0=false 1=true",
1626
- }),
1627
- depositTrackerUpdateErrors: register.gauge({
1628
- name: "lodestar_eth1_deposit_tracker_update_errors_total",
1629
- help: "Eth1 deposit update loop errors total",
1630
- }),
1631
- remoteHighestBlock: register.gauge({
1632
- name: "lodestar_eth1_remote_highest_block",
1633
- help: "Eth1 current highest block number",
1634
- }),
1635
- depositEventsFetched: register.gauge({
1636
- name: "lodestar_eth1_deposit_events_fetched_total",
1637
- help: "Eth1 deposit events fetched total",
1638
- }),
1639
- lastProcessedDepositBlockNumber: register.gauge({
1640
- name: "lodestar_eth1_last_processed_deposit_block_number",
1641
- help: "Eth1 deposit tracker lastProcessedDepositBlockNumber",
1642
- }),
1643
- blocksFetched: register.gauge({
1644
- name: "lodestar_eth1_blocks_fetched_total",
1645
- help: "Eth1 blocks fetched total",
1646
- }),
1647
- lastFetchedBlockBlockNumber: register.gauge({
1648
- name: "lodestar_eth1_last_fetched_block_block_number",
1649
- help: "Eth1 deposit tracker last fetched block's block number",
1650
- }),
1651
- lastFetchedBlockTimestamp: register.gauge({
1652
- name: "lodestar_eth1_last_fetched_block_timestamp",
1653
- help: "Eth1 deposit tracker last fetched block's timestamp",
1654
- }),
1655
- eth1FollowDistanceSecondsConfig: register.gauge({
1656
- name: "lodestar_eth1_follow_distance_seconds_config",
1657
- help: "Constant with value = SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE",
1658
- }),
1659
- eth1FollowDistanceDynamic: register.gauge({
1660
- name: "lodestar_eth1_follow_distance_dynamic",
1661
- help: "Eth1 dynamic follow distance changed by the deposit tracker if blocks are slow",
1662
- }),
1663
- eth1GetBlocksBatchSizeDynamic: register.gauge({
1664
- name: "lodestar_eth1_blocks_batch_size_dynamic",
1665
- help: "Dynamic batch size to fetch blocks",
1666
- }),
1667
- eth1GetLogsBatchSizeDynamic: register.gauge({
1668
- name: "lodestar_eth1_logs_batch_size_dynamic",
1669
- help: "Dynamic batch size to fetch deposit logs",
1670
- }),
1671
-
1672
- // Merge Search info
1673
- eth1MergeStatus: register.gauge({
1674
- name: "lodestar_eth1_merge_status",
1675
- help: "Eth1 Merge Status 0 PRE_MERGE 1 SEARCHING 2 FOUND 3 POST_MERGE",
1676
- }),
1677
- eth1MergeTDFactor: register.gauge({
1678
- name: "lodestar_eth1_merge_td_factor",
1679
- help: "TTD set for the merge",
1680
- }),
1681
- eth1MergeTTD: register.gauge({
1682
- name: "lodestar_eth1_merge_ttd",
1683
- help: "TTD set for the merge scaled down by td_factor",
1684
- }),
1685
-
1686
- eth1PollMergeBlockErrors: register.gauge({
1687
- name: "lodestar_eth1_poll_merge_block_errors_total",
1688
- help: "Total count of errors polling merge block",
1689
- }),
1690
- getTerminalPowBlockPromiseCacheHit: register.gauge({
1691
- name: "lodestar_eth1_get_terminal_pow_block_promise_cache_hit_total",
1692
- help: "Total count of skipped runs in poll merge block, because a previous promise existed",
1693
- }),
1694
- eth1ParentBlocksFetched: register.gauge({
1695
- name: "lodestar_eth1_parent_blocks_fetched_total",
1696
- help: "Total count of parent blocks fetched searching for merge block",
1697
- }),
1698
-
1699
- // Latest block details
1700
- eth1LatestBlockTD: register.gauge({
1701
- name: "lodestar_eth1_latest_block_ttd",
1702
- help: "Eth1 latest Block td scaled down by td_factor",
1703
- }),
1704
- eth1LatestBlockNumber: register.gauge({
1705
- name: "lodestar_eth1_latest_block_number",
1706
- help: "Eth1 latest block number",
1707
- }),
1708
- eth1LatestBlockTimestamp: register.gauge({
1709
- name: "lodestar_eth1_latest_block_timestamp",
1710
- help: "Eth1 latest block timestamp",
1711
- }),
1712
-
1713
- // Merge details
1714
- eth1MergeBlockDetails: register.gauge<{
1715
- terminalBlockHash: string;
1716
- terminalBlockNumber: string;
1717
- terminalBlockTD: string;
1718
- }>({
1719
- name: "lodestar_eth1_merge_block_details",
1720
- help: "If found then 1 with terminal block details",
1721
- labelNames: ["terminalBlockHash", "terminalBlockNumber", "terminalBlockTD"],
1722
- }),
1723
- },
1724
-
1725
- eth1HttpClient: {
1726
- requestTime: register.histogram<{routeId: string}>({
1727
- name: "lodestar_eth1_http_client_request_time_seconds",
1728
- help: "eth1 JsonHttpClient - histogram or roundtrip request times",
1729
- labelNames: ["routeId"],
1730
- // Provide max resolution on problematic values around 1 second
1731
- buckets: [0.1, 0.5, 1, 2, 5, 15],
1732
- }),
1733
- streamTime: register.histogram<{routeId: string}>({
1734
- name: "lodestar_eth1_http_client_stream_time_seconds",
1735
- help: "eth1 JsonHttpClient - streaming time by routeId",
1736
- labelNames: ["routeId"],
1737
- // Provide max resolution on problematic values around 1 second
1738
- buckets: [0.1, 0.5, 1, 2, 5, 15],
1739
- }),
1740
- requestErrors: register.gauge<{routeId: string}>({
1741
- name: "lodestar_eth1_http_client_request_errors_total",
1742
- help: "eth1 JsonHttpClient - total count of request errors",
1743
- labelNames: ["routeId"],
1744
- }),
1745
- retryCount: register.gauge<{routeId: string}>({
1746
- name: "lodestar_eth1_http_client_request_retries_total",
1747
- help: "eth1 JsonHttpClient - total count of request retries",
1748
- labelNames: ["routeId"],
1749
- }),
1750
- requestUsedFallbackUrl: register.gauge<{routeId: string}>({
1751
- name: "lodestar_eth1_http_client_request_used_fallback_url_total",
1752
- help: "eth1 JsonHttpClient - total count of requests on fallback url(s)",
1753
- labelNames: ["routeId"],
1754
- }),
1755
- activeRequests: register.gauge<{routeId: string}>({
1756
- name: "lodestar_eth1_http_client_active_requests",
1757
- help: "eth1 JsonHttpClient - current count of active requests",
1758
- labelNames: ["routeId"],
1759
- }),
1760
- configUrlsCount: register.gauge({
1761
- name: "lodestar_eth1_http_client_config_urls_count",
1762
- help: "eth1 JsonHttpClient - static config urls count",
1763
- }),
1764
- },
1765
-
1766
1622
  executionEnginerHttpClient: {
1767
1623
  requestTime: register.histogram<{routeId: string}>({
1768
1624
  name: "lodestar_execution_engine_http_client_request_time_seconds",
@@ -2,7 +2,7 @@ import EventEmitter from "node:events";
2
2
  import {ResponseIncoming, ResponseOutgoing} from "@lodestar/reqresp";
3
3
  import {AsyncIterableEventBus, IteratorEvent, RequestEvent} from "../../util/asyncIterableToEvents.js";
4
4
  import {StrictEventEmitterSingleArg} from "../../util/strictEvents.js";
5
- import {EventDirection} from "../../util/workerEvents.js";
5
+ import {EventDirection} from "../events.js";
6
6
  import {IncomingRequestArgs, OutgoingRequestArgs} from "../reqresp/types.js";
7
7
 
8
8
  export enum ReqRespBridgeEvent {
@@ -3,7 +3,6 @@ import {PeerId, TopicValidatorResult} from "@libp2p/interface";
3
3
  import {CustodyIndex, Status} from "@lodestar/types";
4
4
  import {PeerIdStr} from "../util/peerId.js";
5
5
  import {StrictEventEmitterSingleArg} from "../util/strictEvents.js";
6
- import {EventDirection} from "../util/workerEvents.js";
7
6
  import {PendingGossipsubMessage} from "./processor/types.js";
8
7
  import {RequestTypedContainer} from "./reqresp/ReqRespBeaconNode.js";
9
8
 
@@ -38,6 +37,13 @@ export type NetworkEventData = {
38
37
  };
39
38
  };
40
39
 
40
+ export enum EventDirection {
41
+ workerToMain,
42
+ mainToWorker,
43
+ /** Event not emitted through worker boundary */
44
+ none,
45
+ }
46
+
41
47
  export const networkEventDirection: Record<NetworkEvent, EventDirection> = {
42
48
  [NetworkEvent.peerConnected]: EventDirection.workerToMain,
43
49
  [NetworkEvent.peerDisconnected]: EventDirection.workerToMain,