@lodestar/beacon-node 1.49.0-dev.fbb58f7280 → 1.49.0-rc.0

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 (212) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +13 -4
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +4 -2
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
  8. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  9. package/lib/chain/archiveStore/archiveStore.js +5 -8
  10. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  11. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  12. package/lib/chain/archiveStore/historicalState/metrics.js +5 -6
  13. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  14. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +11 -2
  15. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  16. package/lib/chain/archiveStore/utils/archiveBlocks.js +46 -28
  17. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  18. package/lib/chain/archiveStore/utils/pruneHistory.d.ts +2 -2
  19. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  20. package/lib/chain/archiveStore/utils/pruneHistory.js +1 -0
  21. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  22. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  23. package/lib/chain/blocks/importExecutionPayload.js +13 -0
  24. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  25. package/lib/chain/chain.d.ts +10 -0
  26. package/lib/chain/chain.d.ts.map +1 -1
  27. package/lib/chain/chain.js +85 -16
  28. package/lib/chain/chain.js.map +1 -1
  29. package/lib/chain/errors/envelopeReconstructionError.d.ts +23 -0
  30. package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -0
  31. package/lib/chain/errors/envelopeReconstructionError.js +13 -0
  32. package/lib/chain/errors/envelopeReconstructionError.js.map +1 -0
  33. package/lib/chain/errors/index.d.ts +1 -0
  34. package/lib/chain/errors/index.d.ts.map +1 -1
  35. package/lib/chain/errors/index.js +1 -0
  36. package/lib/chain/errors/index.js.map +1 -1
  37. package/lib/chain/errors/payloadAttestation.d.ts +4 -0
  38. package/lib/chain/errors/payloadAttestation.d.ts.map +1 -1
  39. package/lib/chain/errors/payloadAttestation.js +1 -0
  40. package/lib/chain/errors/payloadAttestation.js.map +1 -1
  41. package/lib/chain/interface.d.ts +6 -1
  42. package/lib/chain/interface.d.ts.map +1 -1
  43. package/lib/chain/interface.js.map +1 -1
  44. package/lib/chain/options.d.ts +2 -4
  45. package/lib/chain/options.d.ts.map +1 -1
  46. package/lib/chain/options.js +1 -1
  47. package/lib/chain/options.js.map +1 -1
  48. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  49. package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
  50. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  51. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  52. package/lib/chain/validation/payloadAttestationMessage.js +8 -1
  53. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  54. package/lib/db/beacon.d.ts +1 -2
  55. package/lib/db/beacon.d.ts.map +1 -1
  56. package/lib/db/beacon.js +1 -3
  57. package/lib/db/beacon.js.map +1 -1
  58. package/lib/db/buckets.d.ts +0 -1
  59. package/lib/db/buckets.d.ts.map +1 -1
  60. package/lib/db/buckets.js +1 -1
  61. package/lib/db/buckets.js.map +1 -1
  62. package/lib/db/interface.d.ts +1 -2
  63. package/lib/db/interface.d.ts.map +1 -1
  64. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  65. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  66. package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +21 -9
  67. package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -1
  68. package/lib/db/repositories/executionPayloadEnvelopeArchive.js +32 -12
  69. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  70. package/lib/db/repositories/index.d.ts +1 -2
  71. package/lib/db/repositories/index.d.ts.map +1 -1
  72. package/lib/db/repositories/index.js +1 -2
  73. package/lib/db/repositories/index.js.map +1 -1
  74. package/lib/execution/engine/disabled.d.ts +1 -0
  75. package/lib/execution/engine/disabled.d.ts.map +1 -1
  76. package/lib/execution/engine/disabled.js +3 -0
  77. package/lib/execution/engine/disabled.js.map +1 -1
  78. package/lib/execution/engine/http.d.ts +2 -1
  79. package/lib/execution/engine/http.d.ts.map +1 -1
  80. package/lib/execution/engine/http.js +7 -1
  81. package/lib/execution/engine/http.js.map +1 -1
  82. package/lib/execution/engine/interface.d.ts +3 -1
  83. package/lib/execution/engine/interface.d.ts.map +1 -1
  84. package/lib/execution/engine/mock.d.ts +1 -0
  85. package/lib/execution/engine/mock.d.ts.map +1 -1
  86. package/lib/execution/engine/mock.js +14 -2
  87. package/lib/execution/engine/mock.js.map +1 -1
  88. package/lib/execution/engine/types.d.ts +11 -0
  89. package/lib/execution/engine/types.d.ts.map +1 -1
  90. package/lib/execution/engine/types.js +10 -0
  91. package/lib/execution/engine/types.js.map +1 -1
  92. package/lib/metrics/metrics/beacon.d.ts +9 -0
  93. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  94. package/lib/metrics/metrics/beacon.js +16 -0
  95. package/lib/metrics/metrics/beacon.js.map +1 -1
  96. package/lib/metrics/metrics/lodestar.d.ts +21 -11
  97. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  98. package/lib/metrics/metrics/lodestar.js +48 -23
  99. package/lib/metrics/metrics/lodestar.js.map +1 -1
  100. package/lib/metrics/metrics.d.ts +3 -1
  101. package/lib/metrics/metrics.d.ts.map +1 -1
  102. package/lib/metrics/metrics.js +2 -2
  103. package/lib/metrics/metrics.js.map +1 -1
  104. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  105. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +47 -34
  106. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  107. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
  108. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +23 -4
  109. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
  110. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  111. package/lib/network/reqresp/handlers/index.js +20 -4
  112. package/lib/network/reqresp/handlers/index.js.map +1 -1
  113. package/lib/node/nodejs.d.ts +2 -7
  114. package/lib/node/nodejs.d.ts.map +1 -1
  115. package/lib/node/nodejs.js +2 -22
  116. package/lib/node/nodejs.js.map +1 -1
  117. package/lib/sync/interface.d.ts +1 -2
  118. package/lib/sync/interface.d.ts.map +1 -1
  119. package/lib/sync/options.d.ts +0 -6
  120. package/lib/sync/options.d.ts.map +1 -1
  121. package/lib/sync/options.js +0 -2
  122. package/lib/sync/options.js.map +1 -1
  123. package/lib/sync/types.d.ts +18 -3
  124. package/lib/sync/types.d.ts.map +1 -1
  125. package/lib/sync/types.js +19 -3
  126. package/lib/sync/types.js.map +1 -1
  127. package/lib/sync/unknownBlock.d.ts +19 -0
  128. package/lib/sync/unknownBlock.d.ts.map +1 -1
  129. package/lib/sync/unknownBlock.js +184 -15
  130. package/lib/sync/unknownBlock.js.map +1 -1
  131. package/lib/util/execution.d.ts +42 -0
  132. package/lib/util/execution.d.ts.map +1 -1
  133. package/lib/util/execution.js +123 -2
  134. package/lib/util/execution.js.map +1 -1
  135. package/lib/util/headerEnvelope.d.ts +17 -0
  136. package/lib/util/headerEnvelope.d.ts.map +1 -0
  137. package/lib/util/headerEnvelope.js +43 -0
  138. package/lib/util/headerEnvelope.js.map +1 -0
  139. package/lib/util/shuffle.d.ts +0 -4
  140. package/lib/util/shuffle.d.ts.map +1 -1
  141. package/lib/util/shuffle.js +0 -8
  142. package/lib/util/shuffle.js.map +1 -1
  143. package/package.json +16 -16
  144. package/src/api/impl/beacon/blocks/index.ts +16 -3
  145. package/src/api/impl/beacon/pool/index.ts +6 -2
  146. package/src/chain/archiveStore/archiveStore.ts +6 -9
  147. package/src/chain/archiveStore/historicalState/metrics.ts +5 -7
  148. package/src/chain/archiveStore/utils/archiveBlocks.ts +54 -32
  149. package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
  150. package/src/chain/blocks/importExecutionPayload.ts +14 -0
  151. package/src/chain/chain.ts +96 -20
  152. package/src/chain/errors/envelopeReconstructionError.ts +22 -0
  153. package/src/chain/errors/index.ts +1 -0
  154. package/src/chain/errors/payloadAttestation.ts +2 -0
  155. package/src/chain/interface.ts +6 -1
  156. package/src/chain/options.ts +3 -5
  157. package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
  158. package/src/chain/validation/payloadAttestationMessage.ts +9 -0
  159. package/src/db/beacon.ts +0 -5
  160. package/src/db/buckets.ts +2 -2
  161. package/src/db/interface.ts +0 -3
  162. package/src/db/repositories/executionPayloadEnvelopeArchive.ts +43 -13
  163. package/src/db/repositories/index.ts +6 -2
  164. package/src/execution/engine/disabled.ts +4 -0
  165. package/src/execution/engine/http.ts +12 -0
  166. package/src/execution/engine/interface.ts +4 -1
  167. package/src/execution/engine/mock.ts +22 -2
  168. package/src/execution/engine/types.ts +25 -0
  169. package/src/metrics/metrics/beacon.ts +16 -0
  170. package/src/metrics/metrics/lodestar.ts +58 -26
  171. package/src/metrics/metrics.ts +7 -2
  172. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +57 -39
  173. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +27 -5
  174. package/src/network/reqresp/handlers/index.ts +49 -5
  175. package/src/node/nodejs.ts +0 -27
  176. package/src/sync/interface.ts +1 -2
  177. package/src/sync/options.ts +0 -8
  178. package/src/sync/types.ts +19 -3
  179. package/src/sync/unknownBlock.ts +192 -14
  180. package/src/util/execution.ts +175 -2
  181. package/src/util/headerEnvelope.ts +76 -0
  182. package/src/util/shuffle.ts +0 -9
  183. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
  184. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
  185. package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
  186. package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
  187. package/lib/db/repositories/backfilledRanges.d.ts +0 -18
  188. package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
  189. package/lib/db/repositories/backfilledRanges.js +0 -26
  190. package/lib/db/repositories/backfilledRanges.js.map +0 -1
  191. package/lib/sync/backfill/backfill.d.ts +0 -169
  192. package/lib/sync/backfill/backfill.d.ts.map +0 -1
  193. package/lib/sync/backfill/backfill.js +0 -686
  194. package/lib/sync/backfill/backfill.js.map +0 -1
  195. package/lib/sync/backfill/errors.d.ts +0 -30
  196. package/lib/sync/backfill/errors.d.ts.map +0 -1
  197. package/lib/sync/backfill/errors.js +0 -15
  198. package/lib/sync/backfill/errors.js.map +0 -1
  199. package/lib/sync/backfill/index.d.ts +0 -2
  200. package/lib/sync/backfill/index.d.ts.map +0 -1
  201. package/lib/sync/backfill/index.js +0 -2
  202. package/lib/sync/backfill/index.js.map +0 -1
  203. package/lib/sync/backfill/verify.d.ts +0 -18
  204. package/lib/sync/backfill/verify.d.ts.map +0 -1
  205. package/lib/sync/backfill/verify.js +0 -36
  206. package/lib/sync/backfill/verify.js.map +0 -1
  207. package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
  208. package/src/db/repositories/backfilledRanges.ts +0 -29
  209. package/src/sync/backfill/backfill.ts +0 -916
  210. package/src/sync/backfill/errors.ts +0 -23
  211. package/src/sync/backfill/index.ts +0 -1
  212. package/src/sync/backfill/verify.ts +0 -58
@@ -1,23 +0,0 @@
1
- import {PeerId} from "@libp2p/interface";
2
- import {Root} from "@lodestar/types";
3
- import {LodestarError} from "@lodestar/utils";
4
-
5
- export enum BackfillSyncErrorCode {
6
- /** fetched block doesn't connect to anchor block */
7
- NOT_ANCHORED = "not_anchored",
8
- /** fetched blocks are not linear */
9
- NOT_LINEAR = "not_linear",
10
- /** peer doesn't have required block by root */
11
- MISSING_BLOCK = "missing_blocks",
12
- INVALID_SIGNATURE = "invalid_proposer_signature",
13
- INTERNAL_ERROR = "backfill_internal_error",
14
- }
15
-
16
- export type BackfillSyncErrorType =
17
- | {code: BackfillSyncErrorCode.NOT_ANCHORED}
18
- | {code: BackfillSyncErrorCode.NOT_LINEAR}
19
- | {code: BackfillSyncErrorCode.INVALID_SIGNATURE}
20
- | {code: BackfillSyncErrorCode.MISSING_BLOCK; root: Root; peerId: PeerId}
21
- | {code: BackfillSyncErrorCode.INTERNAL_ERROR; reason: string};
22
-
23
- export class BackfillSyncError extends LodestarError<BackfillSyncErrorType> {}
@@ -1 +0,0 @@
1
- export * from "./backfill.js";
@@ -1,58 +0,0 @@
1
- import {BeaconConfig} from "@lodestar/config";
2
- import {GENESIS_SLOT} from "@lodestar/params";
3
- import {ISignatureSet, getBlockProposerSignatureSet} from "@lodestar/state-transition";
4
- import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
5
- import {IBlsVerifier} from "../../chain/bls/index.js";
6
- import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js";
7
-
8
- export type BackfillBlockHeader = {
9
- slot: Slot;
10
- root: Root;
11
- };
12
-
13
- export type BackfillBlock = BackfillBlockHeader & {block: SignedBeaconBlock};
14
-
15
- export function verifyBlockSequence(
16
- config: BeaconConfig,
17
- blocks: SignedBeaconBlock[],
18
- anchorRoot: Root
19
- ): {
20
- nextAnchor: BackfillBlock | null;
21
- verifiedBlocks: SignedBeaconBlock[];
22
- error?: BackfillSyncErrorCode.NOT_LINEAR;
23
- } {
24
- let nextRoot: Root = anchorRoot;
25
- let nextAnchor: BackfillBlock | null = null;
26
-
27
- const verifiedBlocks: SignedBeaconBlock[] = [];
28
- for (const block of blocks.reverse()) {
29
- const blockRoot = config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message);
30
- if (!ssz.Root.equals(blockRoot, nextRoot)) {
31
- if (ssz.Root.equals(nextRoot, anchorRoot)) {
32
- throw new BackfillSyncError({code: BackfillSyncErrorCode.NOT_ANCHORED});
33
- }
34
- return {nextAnchor, verifiedBlocks, error: BackfillSyncErrorCode.NOT_LINEAR};
35
- }
36
- verifiedBlocks.push(block);
37
- nextAnchor = {block: block, slot: block.message.slot, root: nextRoot};
38
- nextRoot = block.message.parentRoot;
39
- }
40
- return {nextAnchor, verifiedBlocks};
41
- }
42
-
43
- export async function verifyBlockProposerSignature(
44
- config: BeaconConfig,
45
- bls: IBlsVerifier,
46
- blocks: SignedBeaconBlock[]
47
- ): Promise<void> {
48
- if (blocks.length === 1 && blocks[0].message.slot === GENESIS_SLOT) return;
49
- const signatures = blocks.reduce((sigs: ISignatureSet[], block) => {
50
- // genesis block doesn't have valid signature
51
- if (block.message.slot !== GENESIS_SLOT) sigs.push(getBlockProposerSignatureSet(config, block));
52
- return sigs;
53
- }, []);
54
-
55
- if (!(await bls.verifySignatureSets(signatures, {batchable: true}))) {
56
- throw new BackfillSyncError({code: BackfillSyncErrorCode.INVALID_SIGNATURE});
57
- }
58
- }