@lodestar/beacon-node 1.49.0-dev.ceea36c6f2 → 1.49.0-dev.fa4ae94ccc

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