@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.
- 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 +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 +0 -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/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/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/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/chain/archiveStore/archiveStore.ts +0 -6
- package/src/chain/archiveStore/historicalState/metrics.ts +0 -7
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
- 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/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,169 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "node:events";
|
|
2
|
-
import { StrictEventEmitter } from "strict-event-emitter-types";
|
|
3
|
-
import { BeaconConfig } from "@lodestar/config";
|
|
4
|
-
import { IBeaconStateView } from "@lodestar/state-transition";
|
|
5
|
-
import { Root, SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
6
|
-
import { Logger } from "@lodestar/utils";
|
|
7
|
-
import { IBeaconChain } from "../../chain/index.js";
|
|
8
|
-
import { IBeaconDb } from "../../db/index.js";
|
|
9
|
-
import { Metrics } from "../../metrics/metrics.js";
|
|
10
|
-
import { INetwork } from "../../network/index.js";
|
|
11
|
-
import { BackfillBlock, BackfillBlockHeader } from "./verify.js";
|
|
12
|
-
export type BackfillSyncModules = {
|
|
13
|
-
chain: IBeaconChain;
|
|
14
|
-
db: IBeaconDb;
|
|
15
|
-
network: INetwork;
|
|
16
|
-
config: BeaconConfig;
|
|
17
|
-
logger: Logger;
|
|
18
|
-
metrics: Metrics | null;
|
|
19
|
-
anchorState: IBeaconStateView;
|
|
20
|
-
wsCheckpoint?: phase0.Checkpoint;
|
|
21
|
-
signal: AbortSignal;
|
|
22
|
-
};
|
|
23
|
-
type BackfillModules = BackfillSyncModules & {
|
|
24
|
-
syncAnchor: BackFillSyncAnchor;
|
|
25
|
-
backfillStartFromSlot: Slot;
|
|
26
|
-
prevFinalizedCheckpointBlock: BackfillBlockHeader;
|
|
27
|
-
wsCheckpointHeader: BackfillBlockHeader | null;
|
|
28
|
-
backfillRangeWrittenSlot: Slot | null;
|
|
29
|
-
};
|
|
30
|
-
export type BackfillSyncOpts = {
|
|
31
|
-
backfillBatchSize: number;
|
|
32
|
-
};
|
|
33
|
-
export declare enum BackfillSyncEvent {
|
|
34
|
-
completed = "BackfillSync-completed"
|
|
35
|
-
}
|
|
36
|
-
export declare enum BackfillSyncMethod {
|
|
37
|
-
database = "database",
|
|
38
|
-
backfilled_ranges = "backfilled_ranges",
|
|
39
|
-
rangesync = "rangesync",
|
|
40
|
-
blockbyroot = "blockbyroot"
|
|
41
|
-
}
|
|
42
|
-
export declare enum BackfillSyncStatus {
|
|
43
|
-
pending = "pending",
|
|
44
|
-
syncing = "syncing",
|
|
45
|
-
completed = "completed",
|
|
46
|
-
aborted = "aborted"
|
|
47
|
-
}
|
|
48
|
-
type BackfillSyncEvents = {
|
|
49
|
-
[BackfillSyncEvent.completed]: (
|
|
50
|
-
/** Oldest slot synced */
|
|
51
|
-
oldestSlotSynced: Slot) => void;
|
|
52
|
-
};
|
|
53
|
-
type BackfillSyncEmitter = StrictEventEmitter<EventEmitter, BackfillSyncEvents>;
|
|
54
|
-
/**
|
|
55
|
-
* At any given point, we should have
|
|
56
|
-
* 1. anchorBlock (with its root anchorBlockRoot at anchorSlot) for next round of sync
|
|
57
|
-
* which is the same as the lastBackSyncedBlock
|
|
58
|
-
* 2. We know the anchorBlockRoot but don't have its anchorBlock and anchorSlot yet, and its
|
|
59
|
-
* parent of lastBackSyncedBlock we synced in a previous successfull round
|
|
60
|
-
* 3. We just started with only anchorBlockRoot, but we know (and will validate) its anchorSlot
|
|
61
|
-
*/
|
|
62
|
-
type BackFillSyncAnchor = {
|
|
63
|
-
anchorBlock: SignedBeaconBlock;
|
|
64
|
-
anchorBlockRoot: Root;
|
|
65
|
-
anchorSlot: Slot;
|
|
66
|
-
lastBackSyncedBlock: BackfillBlock;
|
|
67
|
-
} | {
|
|
68
|
-
anchorBlock: null;
|
|
69
|
-
anchorBlockRoot: Root;
|
|
70
|
-
anchorSlot: null;
|
|
71
|
-
lastBackSyncedBlock: BackfillBlock;
|
|
72
|
-
} | {
|
|
73
|
-
anchorBlock: null;
|
|
74
|
-
anchorBlockRoot: Root;
|
|
75
|
-
anchorSlot: Slot;
|
|
76
|
-
lastBackSyncedBlock: null;
|
|
77
|
-
};
|
|
78
|
-
declare const BackfillSync_base: new () => BackfillSyncEmitter;
|
|
79
|
-
export declare class BackfillSync extends BackfillSync_base {
|
|
80
|
-
/** Lowest slot that we have backfilled to */
|
|
81
|
-
syncAnchor: BackFillSyncAnchor;
|
|
82
|
-
private readonly chain;
|
|
83
|
-
private readonly network;
|
|
84
|
-
private readonly db;
|
|
85
|
-
private readonly config;
|
|
86
|
-
private readonly logger;
|
|
87
|
-
private readonly metrics;
|
|
88
|
-
/**
|
|
89
|
-
* Process in blocks of at max batchSize
|
|
90
|
-
*/
|
|
91
|
-
private opts;
|
|
92
|
-
/**
|
|
93
|
-
* If wsCheckpoint provided was in past then the (db) state from which beacon node started,
|
|
94
|
-
* needs to be validated as per spec.
|
|
95
|
-
*
|
|
96
|
-
* 1. This could lie in between of the previous backfilled range, in which case it would be
|
|
97
|
-
* sufficient to check if its DB, once the linkage to that range has been verified.
|
|
98
|
-
* 2. Else if it lies outside the backfilled range, the linkage to this checkpoint in
|
|
99
|
-
* backfill needs to be verified.
|
|
100
|
-
*/
|
|
101
|
-
private wsCheckpointHeader;
|
|
102
|
-
private wsValidated;
|
|
103
|
-
/**
|
|
104
|
-
* From https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/phase0/weak-subjectivity.md
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* If
|
|
108
|
-
* 1. The wsCheckpoint provided was ahead of the db's finalized checkpoint or
|
|
109
|
-
* 2. There were gaps in the backfill - keys to backfillRanges are always (by construction)
|
|
110
|
-
* a) Finalized Checkpoint or b) previous wsCheckpoint
|
|
111
|
-
*
|
|
112
|
-
* the linkage to the previous finalized/wss checkpoint(s) needs to be verfied. If there is
|
|
113
|
-
* no such checkpoint remaining, the linkage to genesis needs to be validated
|
|
114
|
-
*
|
|
115
|
-
* Initialize with the blockArchive's last block, and on verification update to the next
|
|
116
|
-
* preceding backfillRange key's checkpoint.
|
|
117
|
-
*/
|
|
118
|
-
private prevFinalizedCheckpointBlock;
|
|
119
|
-
/** Starting point that this specific backfill sync "session" started from */
|
|
120
|
-
private backfillStartFromSlot;
|
|
121
|
-
private backfillRangeWrittenSlot;
|
|
122
|
-
private processor;
|
|
123
|
-
private peers;
|
|
124
|
-
private status;
|
|
125
|
-
private signal;
|
|
126
|
-
constructor(opts: BackfillSyncOpts, modules: BackfillModules);
|
|
127
|
-
/**
|
|
128
|
-
* Use the root of the anchorState of the beacon node as the starting point of the
|
|
129
|
-
* backfill sync with its expected slot to be anchorState.slot, which will be
|
|
130
|
-
* validated once the block is resolved in the backfill sync.
|
|
131
|
-
*
|
|
132
|
-
* NOTE: init here is quite light involving couple of
|
|
133
|
-
*
|
|
134
|
-
* 1. db keys lookup in stateArchive/backfilledRanges
|
|
135
|
-
* 2. computing root(s) for anchorBlockRoot and prevFinalizedCheckpointBlock
|
|
136
|
-
*
|
|
137
|
-
* The way we initialize beacon node, wsCheckpoint's slot is always <= anchorSlot
|
|
138
|
-
* If:
|
|
139
|
-
* the root belonging to wsCheckpoint is in the DB, we need to verify linkage to it
|
|
140
|
-
* i.e. it becomes our first prevFinalizedCheckpointBlock
|
|
141
|
-
* Else
|
|
142
|
-
* we initialize prevFinalizedCheckpointBlock from the last stored db finalized state
|
|
143
|
-
* for verification and when we go below its epoch we just check if a correct block
|
|
144
|
-
* corresponding to wsCheckpoint root was stored.
|
|
145
|
-
*
|
|
146
|
-
* and then we continue going back and verifying the next unconnected previous finalized
|
|
147
|
-
* or wsCheckpoints identifiable as the keys of backfill sync.
|
|
148
|
-
*/
|
|
149
|
-
static init<T extends BackfillSync = BackfillSync>(opts: BackfillSyncOpts, modules: BackfillSyncModules): Promise<T>;
|
|
150
|
-
/** Throw / return all AsyncGenerators */
|
|
151
|
-
close(): void;
|
|
152
|
-
/**
|
|
153
|
-
* @returns Returns oldestSlotSynced
|
|
154
|
-
*/
|
|
155
|
-
private sync;
|
|
156
|
-
private addPeer;
|
|
157
|
-
private removePeer;
|
|
158
|
-
/**
|
|
159
|
-
* Ensure that any weak subjectivity checkpoint provided in past with respect
|
|
160
|
-
* the initialization point is the same block tree as the DB once backfill
|
|
161
|
-
*/
|
|
162
|
-
private checkIfCheckpointSyncedAndValidate;
|
|
163
|
-
private checkUpdateFromBackfillSequences;
|
|
164
|
-
private fastBackfillDb;
|
|
165
|
-
private syncBlockByRoot;
|
|
166
|
-
private syncRange;
|
|
167
|
-
}
|
|
168
|
-
export {};
|
|
169
|
-
//# sourceMappingURL=backfill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../../../src/sync/backfill/backfill.ts"],"names":[],"mappings":"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