@lodestar/beacon-node 1.49.0-dev.ceea36c6f2 → 1.49.0-dev.ee3c432d85
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/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/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -1
- package/lib/api/impl/validator/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 +0 -5
- 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 +4 -6
- package/lib/chain/archiveStore/historicalState/metrics.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/errors/payloadAttestation.d.ts +4 -0
- package/lib/chain/errors/payloadAttestation.d.ts.map +1 -1
- package/lib/chain/errors/payloadAttestation.js +1 -0
- package/lib/chain/errors/payloadAttestation.js.map +1 -1
- package/lib/chain/options.d.ts +0 -4
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- 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/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -1
- package/lib/chain/validation/payloadAttestationMessage.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/index.d.ts +0 -1
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +0 -1
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +12 -11
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +25 -23
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/processor/index.d.ts +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +42 -21
- package/lib/network/processor/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 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +19 -1
- 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 +143 -2
- package/lib/sync/unknownBlock.js.map +1 -1
- 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 +15 -16
- package/src/api/impl/beacon/pool/index.ts +6 -2
- package/src/api/impl/validator/index.ts +3 -1
- package/src/chain/archiveStore/archiveStore.ts +0 -6
- package/src/chain/archiveStore/historicalState/metrics.ts +4 -7
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/errors/payloadAttestation.ts +2 -0
- package/src/chain/options.ts +0 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
- package/src/chain/validation/payloadAttestationMessage.ts +9 -0
- package/src/db/beacon.ts +0 -5
- package/src/db/buckets.ts +1 -1
- package/src/db/interface.ts +0 -3
- package/src/db/repositories/index.ts +0 -1
- package/src/metrics/metrics/lodestar.ts +34 -26
- package/src/network/processor/index.ts +51 -22
- 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 -1
- package/src/sync/unknownBlock.ts +151 -1
- 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
|
-
}
|