@lodestar/beacon-node 1.49.0-dev.ee7c2aa8ee → 1.49.0-dev.f1b14bce8f
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.
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +13 -4
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +4 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +5 -8
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +2 -7
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +11 -2
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +46 -28
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +2 -2
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +1 -0
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +13 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +85 -16
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.d.ts +23 -0
- package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -0
- package/lib/chain/errors/envelopeReconstructionError.js +13 -0
- package/lib/chain/errors/envelopeReconstructionError.js.map +1 -0
- package/lib/chain/errors/index.d.ts +1 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +1 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/options.d.ts +2 -0
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -0
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/db/beacon.d.ts +1 -2
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +1 -3
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +0 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +1 -1
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +1 -2
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +21 -9
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +32 -12
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
- package/lib/db/repositories/index.d.ts +1 -2
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -2
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/disabled.d.ts +1 -0
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +3 -0
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +2 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +7 -1
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +3 -1
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/mock.d.ts +1 -0
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +14 -2
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +11 -0
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +10 -0
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +9 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +16 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +21 -11
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +48 -23
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts +3 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +2 -2
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +47 -34
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +23 -4
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +20 -4
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/node/nodejs.d.ts +2 -7
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +2 -22
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/interface.d.ts +1 -2
- package/lib/sync/interface.d.ts.map +1 -1
- package/lib/sync/options.d.ts +0 -6
- package/lib/sync/options.d.ts.map +1 -1
- package/lib/sync/options.js +0 -2
- package/lib/sync/options.js.map +1 -1
- package/lib/sync/types.d.ts +18 -3
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +19 -3
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +19 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +184 -15
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/execution.d.ts +42 -0
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +123 -2
- package/lib/util/execution.js.map +1 -1
- package/lib/util/headerEnvelope.d.ts +17 -0
- package/lib/util/headerEnvelope.d.ts.map +1 -0
- package/lib/util/headerEnvelope.js +43 -0
- package/lib/util/headerEnvelope.js.map +1 -0
- package/lib/util/shuffle.d.ts +0 -4
- package/lib/util/shuffle.d.ts.map +1 -1
- package/lib/util/shuffle.js +0 -8
- package/lib/util/shuffle.js.map +1 -1
- package/package.json +16 -16
- package/src/api/impl/beacon/blocks/index.ts +16 -3
- package/src/api/impl/beacon/pool/index.ts +6 -2
- package/src/chain/archiveStore/archiveStore.ts +6 -9
- package/src/chain/archiveStore/historicalState/metrics.ts +3 -9
- package/src/chain/archiveStore/utils/archiveBlocks.ts +54 -32
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/chain.ts +96 -20
- package/src/chain/errors/envelopeReconstructionError.ts +22 -0
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/interface.ts +6 -1
- package/src/chain/options.ts +3 -0
- package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
- package/src/db/beacon.ts +0 -5
- package/src/db/buckets.ts +2 -2
- package/src/db/interface.ts +0 -3
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +43 -13
- package/src/db/repositories/index.ts +6 -2
- package/src/execution/engine/disabled.ts +4 -0
- package/src/execution/engine/http.ts +12 -0
- package/src/execution/engine/interface.ts +4 -1
- package/src/execution/engine/mock.ts +22 -2
- package/src/execution/engine/types.ts +25 -0
- package/src/metrics/metrics/beacon.ts +16 -0
- package/src/metrics/metrics/lodestar.ts +58 -26
- package/src/metrics/metrics.ts +7 -2
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +57 -39
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +27 -5
- package/src/network/reqresp/handlers/index.ts +49 -5
- package/src/node/nodejs.ts +0 -27
- package/src/sync/interface.ts +1 -2
- package/src/sync/options.ts +0 -8
- package/src/sync/types.ts +19 -3
- package/src/sync/unknownBlock.ts +192 -14
- package/src/util/execution.ts +175 -2
- package/src/util/headerEnvelope.ts +76 -0
- package/src/util/shuffle.ts +0 -9
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
- package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
- package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
- package/lib/db/repositories/backfilledRanges.d.ts +0 -18
- package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
- package/lib/db/repositories/backfilledRanges.js +0 -26
- package/lib/db/repositories/backfilledRanges.js.map +0 -1
- package/lib/sync/backfill/backfill.d.ts +0 -169
- package/lib/sync/backfill/backfill.d.ts.map +0 -1
- package/lib/sync/backfill/backfill.js +0 -686
- package/lib/sync/backfill/backfill.js.map +0 -1
- package/lib/sync/backfill/errors.d.ts +0 -30
- package/lib/sync/backfill/errors.d.ts.map +0 -1
- package/lib/sync/backfill/errors.js +0 -15
- package/lib/sync/backfill/errors.js.map +0 -1
- package/lib/sync/backfill/index.d.ts +0 -2
- package/lib/sync/backfill/index.d.ts.map +0 -1
- package/lib/sync/backfill/index.js +0 -2
- package/lib/sync/backfill/index.js.map +0 -1
- package/lib/sync/backfill/verify.d.ts +0 -18
- package/lib/sync/backfill/verify.d.ts.map +0 -1
- package/lib/sync/backfill/verify.js +0 -36
- package/lib/sync/backfill/verify.js.map +0 -1
- package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
- package/src/db/repositories/backfilledRanges.ts +0 -29
- package/src/sync/backfill/backfill.ts +0 -916
- package/src/sync/backfill/errors.ts +0 -23
- package/src/sync/backfill/index.ts +0 -1
- 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
|
-
}
|