@lodestar/beacon-node 1.49.0-dev.ee7c2aa8ee → 1.49.0-dev.f362c805cf

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 (105) hide show
  1. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/pool/index.js +4 -2
  3. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  4. package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
  5. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  6. package/lib/chain/archiveStore/archiveStore.js +0 -5
  7. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  8. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  9. package/lib/chain/archiveStore/historicalState/metrics.js +0 -6
  10. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  11. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  12. package/lib/chain/blocks/importExecutionPayload.js +13 -0
  13. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  14. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  15. package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
  16. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  17. package/lib/db/beacon.d.ts +1 -2
  18. package/lib/db/beacon.d.ts.map +1 -1
  19. package/lib/db/beacon.js +1 -3
  20. package/lib/db/beacon.js.map +1 -1
  21. package/lib/db/buckets.d.ts +0 -1
  22. package/lib/db/buckets.d.ts.map +1 -1
  23. package/lib/db/buckets.js +1 -1
  24. package/lib/db/buckets.js.map +1 -1
  25. package/lib/db/interface.d.ts +1 -2
  26. package/lib/db/interface.d.ts.map +1 -1
  27. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  28. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  29. package/lib/db/repositories/index.d.ts +0 -1
  30. package/lib/db/repositories/index.d.ts.map +1 -1
  31. package/lib/db/repositories/index.js +0 -1
  32. package/lib/db/repositories/index.js.map +1 -1
  33. package/lib/metrics/metrics/lodestar.d.ts +12 -11
  34. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  35. package/lib/metrics/metrics/lodestar.js +25 -23
  36. package/lib/metrics/metrics/lodestar.js.map +1 -1
  37. package/lib/node/nodejs.d.ts +2 -7
  38. package/lib/node/nodejs.d.ts.map +1 -1
  39. package/lib/node/nodejs.js +2 -22
  40. package/lib/node/nodejs.js.map +1 -1
  41. package/lib/sync/interface.d.ts +1 -2
  42. package/lib/sync/interface.d.ts.map +1 -1
  43. package/lib/sync/options.d.ts +0 -6
  44. package/lib/sync/options.d.ts.map +1 -1
  45. package/lib/sync/options.js +0 -2
  46. package/lib/sync/options.js.map +1 -1
  47. package/lib/sync/types.d.ts +18 -1
  48. package/lib/sync/types.d.ts.map +1 -1
  49. package/lib/sync/types.js +19 -1
  50. package/lib/sync/types.js.map +1 -1
  51. package/lib/sync/unknownBlock.d.ts +19 -0
  52. package/lib/sync/unknownBlock.d.ts.map +1 -1
  53. package/lib/sync/unknownBlock.js +143 -2
  54. package/lib/sync/unknownBlock.js.map +1 -1
  55. package/lib/util/shuffle.d.ts +0 -4
  56. package/lib/util/shuffle.d.ts.map +1 -1
  57. package/lib/util/shuffle.js +0 -8
  58. package/lib/util/shuffle.js.map +1 -1
  59. package/package.json +15 -16
  60. package/src/api/impl/beacon/pool/index.ts +6 -2
  61. package/src/chain/archiveStore/archiveStore.ts +0 -6
  62. package/src/chain/archiveStore/historicalState/metrics.ts +0 -7
  63. package/src/chain/blocks/importExecutionPayload.ts +14 -0
  64. package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
  65. package/src/db/beacon.ts +0 -5
  66. package/src/db/buckets.ts +1 -1
  67. package/src/db/interface.ts +0 -3
  68. package/src/db/repositories/index.ts +0 -1
  69. package/src/metrics/metrics/lodestar.ts +34 -26
  70. package/src/node/nodejs.ts +0 -27
  71. package/src/sync/interface.ts +1 -2
  72. package/src/sync/options.ts +0 -8
  73. package/src/sync/types.ts +19 -1
  74. package/src/sync/unknownBlock.ts +151 -1
  75. package/src/util/shuffle.ts +0 -9
  76. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
  77. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
  78. package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
  79. package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
  80. package/lib/db/repositories/backfilledRanges.d.ts +0 -18
  81. package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
  82. package/lib/db/repositories/backfilledRanges.js +0 -26
  83. package/lib/db/repositories/backfilledRanges.js.map +0 -1
  84. package/lib/sync/backfill/backfill.d.ts +0 -169
  85. package/lib/sync/backfill/backfill.d.ts.map +0 -1
  86. package/lib/sync/backfill/backfill.js +0 -686
  87. package/lib/sync/backfill/backfill.js.map +0 -1
  88. package/lib/sync/backfill/errors.d.ts +0 -30
  89. package/lib/sync/backfill/errors.d.ts.map +0 -1
  90. package/lib/sync/backfill/errors.js +0 -15
  91. package/lib/sync/backfill/errors.js.map +0 -1
  92. package/lib/sync/backfill/index.d.ts +0 -2
  93. package/lib/sync/backfill/index.d.ts.map +0 -1
  94. package/lib/sync/backfill/index.js +0 -2
  95. package/lib/sync/backfill/index.js.map +0 -1
  96. package/lib/sync/backfill/verify.d.ts +0 -18
  97. package/lib/sync/backfill/verify.d.ts.map +0 -1
  98. package/lib/sync/backfill/verify.js +0 -36
  99. package/lib/sync/backfill/verify.js.map +0 -1
  100. package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
  101. package/src/db/repositories/backfilledRanges.ts +0 -29
  102. package/src/sync/backfill/backfill.ts +0 -916
  103. package/src/sync/backfill/errors.ts +0 -23
  104. package/src/sync/backfill/index.ts +0 -1
  105. 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
- }