@lodestar/beacon-node 1.49.0-dev.161265afaf → 1.49.0-dev.187799490c
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 +4 -7
- 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 +5 -6
- package/lib/chain/archiveStore/historicalState/metrics.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/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/interface.d.ts +1 -1
- package/lib/chain/interface.d.ts.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 +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/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/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/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/pool/index.ts +6 -2
- package/src/api/impl/validator/index.ts +3 -1
- package/src/chain/archiveStore/archiveStore.ts +4 -8
- package/src/chain/archiveStore/historicalState/metrics.ts +5 -7
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/errors/payloadAttestation.ts +2 -0
- package/src/chain/interface.ts +1 -1
- 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 +58 -26
- package/src/metrics/metrics.ts +7 -2
- package/src/network/processor/index.ts +51 -22
- 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/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
package/src/chain/interface.ts
CHANGED
|
@@ -96,7 +96,7 @@ export enum FindHeadFnName {
|
|
|
96
96
|
export interface IBeaconChain {
|
|
97
97
|
readonly genesisTime: UintNum64;
|
|
98
98
|
readonly genesisValidatorsRoot: Root;
|
|
99
|
-
|
|
99
|
+
earliestAvailableSlot: Slot;
|
|
100
100
|
readonly executionEngine: IExecutionEngine;
|
|
101
101
|
readonly executionBuilder?: IExecutionBuilder;
|
|
102
102
|
readonly builderCircuitBreaker: BuilderCircuitBreaker;
|
package/src/chain/options.ts
CHANGED
|
@@ -63,10 +63,6 @@ export type BlockProcessOpts = {
|
|
|
63
63
|
* Will double processing times. Use only for debugging purposes.
|
|
64
64
|
*/
|
|
65
65
|
disableBlsBatchVerify?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Assert progressive balances the same to EpochTransitionCache
|
|
68
|
-
*/
|
|
69
|
-
assertCorrectProgressiveBalances?: boolean;
|
|
70
66
|
/** Used for fork_choice spec tests */
|
|
71
67
|
disableOnBlockError?: boolean;
|
|
72
68
|
/** Used for fork_choice spec tests */
|
|
@@ -114,7 +110,6 @@ export const defaultChainOptions: IChainOptions = {
|
|
|
114
110
|
suggestedFeeRecipient: defaultValidatorOptions.suggestedFeeRecipient,
|
|
115
111
|
graffitiAppend: true,
|
|
116
112
|
serveHistoricalState: false,
|
|
117
|
-
assertCorrectProgressiveBalances: false,
|
|
118
113
|
archiveStateEpochFrequency: 1024,
|
|
119
114
|
archiveMode: DEFAULT_ARCHIVE_MODE,
|
|
120
115
|
pruneHistory: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {EMPTY_SIGNATURE, IBeaconStateView} from "@lodestar/state-transition";
|
|
1
|
+
import {EMPTY_SIGNATURE, IBeaconStateView, StateHashTreeRootSource} from "@lodestar/state-transition";
|
|
2
2
|
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
|
|
@@ -14,5 +14,12 @@ export function computeNewStateRoot(
|
|
|
14
14
|
): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
|
|
15
15
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
16
16
|
const signedBlock = {message: block, signature: EMPTY_SIGNATURE};
|
|
17
|
-
|
|
17
|
+
const {newStateRoot, proposerReward, postState, hashTreeRootTime} = state.computeNewStateRoot(
|
|
18
|
+
{block: signedBlock},
|
|
19
|
+
{metrics}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
metrics?.stateHashTreeRootTime.observe({source: StateHashTreeRootSource.computeNewStateRoot}, hashTreeRootTime);
|
|
23
|
+
|
|
24
|
+
return {newStateRoot, proposerReward, postState};
|
|
18
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
computeEpochAtSlot,
|
|
2
3
|
createIndexedSignatureSetFromComponents,
|
|
3
4
|
getPayloadAttestationDataSigningRoot,
|
|
4
5
|
isStatePostGloas,
|
|
@@ -35,6 +36,14 @@ async function validatePayloadAttestationMessage(
|
|
|
35
36
|
): Promise<PayloadAttestationValidationResult> {
|
|
36
37
|
const {data, validatorIndex} = payloadAttestationMessage;
|
|
37
38
|
|
|
39
|
+
// [REJECT] The payload attestation slot is at or after the Gloas fork.
|
|
40
|
+
if (computeEpochAtSlot(data.slot) < chain.config.GLOAS_FORK_EPOCH) {
|
|
41
|
+
throw new PayloadAttestationError(GossipAction.REJECT, {
|
|
42
|
+
code: PayloadAttestationErrorCode.PRE_GLOAS_SLOT,
|
|
43
|
+
slot: data.slot,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
// [IGNORE] The message's slot is for the current slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance), i.e. `data.slot == current_slot`.
|
|
39
48
|
if (!chain.clock.isCurrentSlotGivenGossipDisparity(data.slot)) {
|
|
40
49
|
throw new PayloadAttestationError(GossipAction.IGNORE, {
|
package/src/db/beacon.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
|
11
11
|
import {
|
|
12
12
|
AttesterSlashingRepository,
|
|
13
13
|
BLSToExecutionChangeRepository,
|
|
14
|
-
BackfilledRanges,
|
|
15
14
|
BestLightClientUpdateRepository,
|
|
16
15
|
BlobSidecarsArchiveRepository,
|
|
17
16
|
BlobSidecarsRepository,
|
|
@@ -61,8 +60,6 @@ export class BeaconDb implements IBeaconDb {
|
|
|
61
60
|
syncCommittee: SyncCommitteeRepository;
|
|
62
61
|
syncCommitteeWitness: SyncCommitteeWitnessRepository;
|
|
63
62
|
|
|
64
|
-
backfilledRanges: BackfilledRanges;
|
|
65
|
-
|
|
66
63
|
readonly dataColumns: IDataColumnStore;
|
|
67
64
|
lastLegacyArchiveSlot: Slot | null = null;
|
|
68
65
|
private readonly flatFileStore: FlatFileStore;
|
|
@@ -97,8 +94,6 @@ export class BeaconDb implements IBeaconDb {
|
|
|
97
94
|
this.syncCommittee = new SyncCommitteeRepository(config, db);
|
|
98
95
|
this.syncCommitteeWitness = new SyncCommitteeWitnessRepository(config, db);
|
|
99
96
|
|
|
100
|
-
this.backfilledRanges = new BackfilledRanges(config, db);
|
|
101
|
-
|
|
102
97
|
this.flatFileStore = new FlatFileStore(opts.dataColumnDir, config, opts.logger, opts.metrics);
|
|
103
98
|
this.dataColumns = new LegacyDataColumnStore(
|
|
104
99
|
this.flatFileStore,
|
package/src/db/buckets.ts
CHANGED
|
@@ -56,7 +56,7 @@ export enum Bucket {
|
|
|
56
56
|
// altair_lightClientSyncCommitteeProof = 35, // DEPRECATED on v0.32.0
|
|
57
57
|
// index_lightClientInitProof = 36, // DEPRECATED on v0.32.0
|
|
58
58
|
|
|
59
|
-
backfilled_ranges = 42, //
|
|
59
|
+
// backfilled_ranges = 42, // DEPRECATED on v1.48.0
|
|
60
60
|
|
|
61
61
|
// Buckets to support LightClient server v2
|
|
62
62
|
lightClient_syncCommitteeWitness = 51, // BlockRoot -> SyncCommitteeWitness
|
package/src/db/interface.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
|
6
6
|
import {
|
|
7
7
|
AttesterSlashingRepository,
|
|
8
8
|
BLSToExecutionChangeRepository,
|
|
9
|
-
BackfilledRanges,
|
|
10
9
|
BestLightClientUpdateRepository,
|
|
11
10
|
BlobSidecarsArchiveRepository,
|
|
12
11
|
BlobSidecarsRepository,
|
|
@@ -60,8 +59,6 @@ export interface IBeaconDb {
|
|
|
60
59
|
syncCommittee: SyncCommitteeRepository;
|
|
61
60
|
syncCommitteeWitness: SyncCommitteeWitnessRepository;
|
|
62
61
|
|
|
63
|
-
backfilledRanges: BackfilledRanges;
|
|
64
|
-
|
|
65
62
|
dataColumns: IDataColumnStore;
|
|
66
63
|
/** Highest legacy column slot at startup; later archival writes the block-root index first. */
|
|
67
64
|
readonly lastLegacyArchiveSlot: Slot | null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export {AttesterSlashingRepository} from "./attesterSlashing.js";
|
|
2
|
-
export {BackfilledRanges} from "./backfilledRanges.js";
|
|
3
2
|
export {BlobSidecarsRepository} from "./blobSidecars.js";
|
|
4
3
|
export {BlobSidecarsArchiveRepository} from "./blobSidecarsArchive.js";
|
|
5
4
|
export {BlockRepository} from "./block.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** biome-ignore-all lint/suspicious/noTemplateCurlyInString: The metric templates requires to have `${}` in a normal string */
|
|
2
2
|
import {NotReorgedReason} from "@lodestar/fork-choice";
|
|
3
|
+
import {StateHashTreeRootSource} from "@lodestar/state-transition";
|
|
3
4
|
import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
|
|
4
5
|
import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
|
|
5
6
|
import type {LateCanonicalBlockReason} from "../../chain/archiveStore/utils/archiveBlocks.js";
|
|
@@ -25,8 +26,13 @@ import type {FlatFileStoreOperation} from "../../db/flatFileStore/metrics.js";
|
|
|
25
26
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
26
27
|
import {GossipType} from "../../network/index.js";
|
|
27
28
|
import {CannotAcceptWorkReason, ReprocessRejectReason} from "../../network/processor/index.js";
|
|
28
|
-
import {
|
|
29
|
-
|
|
29
|
+
import {
|
|
30
|
+
DeferredPayloadResult,
|
|
31
|
+
DownloadResult,
|
|
32
|
+
DroppedItemReason,
|
|
33
|
+
FetchResult,
|
|
34
|
+
PendingBlockType,
|
|
35
|
+
} from "../../sync/types.js";
|
|
30
36
|
import {PeerSyncType, RangeSyncType} from "../../sync/utils/remoteSyncType.js";
|
|
31
37
|
import {AllocSource} from "../../util/bufferPool.js";
|
|
32
38
|
import {DataColumnReconstructionCode} from "../../util/dataColumns.js";
|
|
@@ -174,6 +180,30 @@ export function createLodestarMetrics(
|
|
|
174
180
|
buckets: [0.001, 0.003, 0.01, 0.03, 0.1],
|
|
175
181
|
}),
|
|
176
182
|
|
|
183
|
+
reqRespByRange: {
|
|
184
|
+
requestedSlots: register.histogram<{method: string}>({
|
|
185
|
+
name: "lodestar_reqresp_by_range_requested_slots",
|
|
186
|
+
help: "Histogram of slot count requested per served by_range request",
|
|
187
|
+
labelNames: ["method"],
|
|
188
|
+
buckets: [1, 16, 32, 64, 128],
|
|
189
|
+
}),
|
|
190
|
+
// data_column_sidecars_by_range is the only by_range request carrying columns
|
|
191
|
+
requestedColumns: register.histogram({
|
|
192
|
+
name: "lodestar_reqresp_by_range_requested_columns",
|
|
193
|
+
help: "Histogram of column count requested per served data_column_sidecars_by_range request",
|
|
194
|
+
// 128 is NUMBER_OF_COLUMNS.
|
|
195
|
+
buckets: [1, 4, 8, 32, 128],
|
|
196
|
+
}),
|
|
197
|
+
servedBytes: register.histogram<{method: string}>({
|
|
198
|
+
name: "lodestar_reqresp_by_range_served_bytes",
|
|
199
|
+
help: "Histogram of total serialized bytes served per by_range request",
|
|
200
|
+
labelNames: ["method"],
|
|
201
|
+
// min bucket is roughly a typical mainnet block is 100MB,
|
|
202
|
+
// max bucket is roughly 100 * MAX_PAYLOAD_SIZE
|
|
203
|
+
buckets: [100e3, 1e6, 10e6, 100e6, 1000e6],
|
|
204
|
+
}),
|
|
205
|
+
},
|
|
206
|
+
|
|
177
207
|
regenQueue: {
|
|
178
208
|
length: register.gauge({
|
|
179
209
|
name: "lodestar_regen_queue_length",
|
|
@@ -403,6 +433,15 @@ export function createLodestarMetrics(
|
|
|
403
433
|
labelNames: ["caller"],
|
|
404
434
|
}),
|
|
405
435
|
|
|
436
|
+
// this metrics stay here instead of @lodestar/state-transition in order to prepare
|
|
437
|
+
// for the native zig state-transition in the future
|
|
438
|
+
stateHashTreeRootTime: register.histogram<{source: StateHashTreeRootSource}>({
|
|
439
|
+
name: "lodestar_stfn_hash_tree_root_seconds",
|
|
440
|
+
help: "Time to compute the hash tree root of a post state in seconds",
|
|
441
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.3, 0.5],
|
|
442
|
+
labelNames: ["source"],
|
|
443
|
+
}),
|
|
444
|
+
|
|
406
445
|
// BLS verifier thread pool and queue
|
|
407
446
|
|
|
408
447
|
bls: {
|
|
@@ -655,6 +694,16 @@ export function createLodestarMetrics(
|
|
|
655
694
|
help: "Count of payload (execution payload envelope) sync triggers, labeled by their source",
|
|
656
695
|
labelNames: ["source"],
|
|
657
696
|
}),
|
|
697
|
+
deferredPayloadResult: register.counter<{result: DeferredPayloadResult}>({
|
|
698
|
+
name: "lodestar_sync_deferred_payload_result_total",
|
|
699
|
+
help: "Outcome of a slot's deferred optimistic payload searches, by result",
|
|
700
|
+
labelNames: ["result"],
|
|
701
|
+
}),
|
|
702
|
+
deferredPayloadPolls: register.histogram({
|
|
703
|
+
name: "lodestar_sync_deferred_payload_polls_count",
|
|
704
|
+
help: "Poll ticks after PAYLOAD_DUE until a searched payload was imported",
|
|
705
|
+
buckets: [0, 1, 2, 3, 6],
|
|
706
|
+
}),
|
|
658
707
|
pendingBlocks: register.gauge({
|
|
659
708
|
name: "lodestar_sync_unknown_block_pending_blocks_size",
|
|
660
709
|
help: "Current size of UnknownBlockSync pending blocks cache",
|
|
@@ -986,6 +1035,13 @@ export function createLodestarMetrics(
|
|
|
986
1035
|
help: "Count of errors, by error type, while processing execution payload envelopes",
|
|
987
1036
|
labelNames: ["error"],
|
|
988
1037
|
}),
|
|
1038
|
+
executionPayload: {
|
|
1039
|
+
recvToValidation: register.histogram({
|
|
1040
|
+
name: "lodestar_gossip_execution_payload_envelope_received_to_execution_payload_verification_seconds",
|
|
1041
|
+
help: "Time elapsed between execution payload envelope received and execution payload verification",
|
|
1042
|
+
buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 3, 4, 6, 8],
|
|
1043
|
+
}),
|
|
1044
|
+
},
|
|
989
1045
|
},
|
|
990
1046
|
gossipExecutionPayloadBid: {
|
|
991
1047
|
elapsedTimeTillReceived: register.histogram<{source: OpSource}>({
|
|
@@ -1120,30 +1176,6 @@ export function createLodestarMetrics(
|
|
|
1120
1176
|
help: "The total result of calling notifyForkchoiceUpdate execution engine api",
|
|
1121
1177
|
labelNames: ["result"],
|
|
1122
1178
|
}),
|
|
1123
|
-
backfillSync: {
|
|
1124
|
-
backfilledTillSlot: register.gauge({
|
|
1125
|
-
name: "lodestar_backfill_till_slot",
|
|
1126
|
-
help: "Current lowest backfilled slot",
|
|
1127
|
-
}),
|
|
1128
|
-
prevFinOrWsSlot: register.gauge({
|
|
1129
|
-
name: "lodestar_backfill_prev_fin_or_ws_slot",
|
|
1130
|
-
help: "Slot of previous finalized or wsCheckpoint block to be validated",
|
|
1131
|
-
}),
|
|
1132
|
-
totalBlocks: register.gauge<{method: BackfillSyncMethod}>({
|
|
1133
|
-
name: "lodestar_backfill_sync_blocks_total",
|
|
1134
|
-
help: "Total amount of backfilled blocks",
|
|
1135
|
-
labelNames: ["method"],
|
|
1136
|
-
}),
|
|
1137
|
-
errors: register.gauge({
|
|
1138
|
-
name: "lodestar_backfill_sync_errors_total",
|
|
1139
|
-
help: "Total number of errors while backfilling",
|
|
1140
|
-
}),
|
|
1141
|
-
status: register.gauge({
|
|
1142
|
-
name: "lodestar_backfill_sync_status",
|
|
1143
|
-
help: "Current backfill syncing status: [Aborted, Pending, Syncing, Completed]",
|
|
1144
|
-
}),
|
|
1145
|
-
},
|
|
1146
|
-
|
|
1147
1179
|
opPool: {
|
|
1148
1180
|
aggregatedAttestationPool: {
|
|
1149
1181
|
size: register.gauge({
|
package/src/metrics/metrics.ts
CHANGED
|
@@ -12,7 +12,12 @@ export type Metrics = BeaconMetrics &
|
|
|
12
12
|
BeaconStateTransitionMetrics &
|
|
13
13
|
LodestarMetrics & {register: RegistryMetricCreator; close: () => void};
|
|
14
14
|
|
|
15
|
-
export function createMetrics(
|
|
15
|
+
export function createMetrics(
|
|
16
|
+
opts: MetricsOptions,
|
|
17
|
+
genesisTime: number,
|
|
18
|
+
externalRegistries: Registry[] = [],
|
|
19
|
+
{collectNodeMetrics = true}: {collectNodeMetrics?: boolean} = {}
|
|
20
|
+
): Metrics {
|
|
16
21
|
const register = new RegistryMetricCreator();
|
|
17
22
|
const beacon = createBeaconMetrics(register);
|
|
18
23
|
const forkChoice = getForkChoiceMetrics(register);
|
|
@@ -24,7 +29,7 @@ export function createMetrics(opts: MetricsOptions, genesisTime: number, externa
|
|
|
24
29
|
};
|
|
25
30
|
process.on("unhandledRejection", onUnhandledRejection);
|
|
26
31
|
|
|
27
|
-
const nodeJsMetricsClose = collectNodeJSMetrics(register);
|
|
32
|
+
const nodeJsMetricsClose = collectNodeMetrics ? collectNodeJSMetrics(register) : (): void => {};
|
|
28
33
|
const close = (): void => {
|
|
29
34
|
process.removeListener("unhandledRejection", onUnhandledRejection);
|
|
30
35
|
nodeJsMetricsClose();
|
|
@@ -197,6 +197,19 @@ type PreprocessResult =
|
|
|
197
197
|
| {action: PreprocessAction.AwaitBlock; root: RootHex}
|
|
198
198
|
| {action: PreprocessAction.AwaitEnvelope; root: RootHex};
|
|
199
199
|
|
|
200
|
+
enum SearchTarget {
|
|
201
|
+
Block,
|
|
202
|
+
PayloadEnvelope,
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
type SearchUnknownRootTarget =
|
|
206
|
+
| {target: SearchTarget.Block}
|
|
207
|
+
| {
|
|
208
|
+
target: SearchTarget.PayloadEnvelope;
|
|
209
|
+
/** The message slot is the payload's slot, so it can be used for UnknownBlockInput search */
|
|
210
|
+
slotIsPayloadSlot: boolean;
|
|
211
|
+
};
|
|
212
|
+
|
|
200
213
|
/**
|
|
201
214
|
* Network processor handles the gossip queues and throtles processing to not overload the main thread
|
|
202
215
|
* - Decides when to process work and what to process
|
|
@@ -450,7 +463,7 @@ export class NetworkProcessor {
|
|
|
450
463
|
// no need to check if root is a descendant of the current finalized block, it will be checked once we validate the message if needed
|
|
451
464
|
if (root && !this.chain.forkChoice.hasBlockHexUnsafe(root)) {
|
|
452
465
|
// starting from GLOAS, unknown root from data_column_sidecar also falls into this case
|
|
453
|
-
this.searchUnknownRoot({slot, root},
|
|
466
|
+
this.searchUnknownRoot({slot, root}, peerId, {target: SearchTarget.Block});
|
|
454
467
|
// for beacon_attestation and beacon_aggregate_and_proof messages, this is only temporary.
|
|
455
468
|
// if "index = 1" we need to await for the Envelope instead
|
|
456
469
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root};
|
|
@@ -465,27 +478,28 @@ export class NetworkProcessor {
|
|
|
465
478
|
if (topicType === GossipType.beacon_block) {
|
|
466
479
|
const parentRoot = getParentRootFromSignedBeaconBlockSerialized(message.msg.data);
|
|
467
480
|
if (parentRoot) {
|
|
468
|
-
let
|
|
469
|
-
let searchParentEnvelope = false;
|
|
481
|
+
let search: SearchUnknownRootTarget | null = null;
|
|
470
482
|
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
471
483
|
// GLOAS: also check parent envelope, same logic as execution_payload_bid
|
|
472
484
|
const parentBlockHash = getParentBlockHashFromGloasSignedBeaconBlockSerialized(message.msg.data);
|
|
473
485
|
if (parentBlockHash && !this.chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHash)) {
|
|
474
486
|
const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
|
|
475
487
|
if (protoBlock === null) {
|
|
476
|
-
|
|
488
|
+
search = {target: SearchTarget.Block};
|
|
477
489
|
} else if (
|
|
478
490
|
protoBlock.executionPayloadBlockHash &&
|
|
479
491
|
protoBlock.executionPayloadBlockHash !== parentBlockHash
|
|
480
492
|
) {
|
|
481
493
|
// only search for the envelope by block root if we're sure there is one. Otherwise UnknownBlockSync will penalize the peer.
|
|
482
|
-
|
|
494
|
+
search = {target: SearchTarget.PayloadEnvelope, slotIsPayloadSlot: false};
|
|
483
495
|
}
|
|
484
496
|
}
|
|
485
497
|
} else if (!this.chain.forkChoice.hasBlockHexUnsafe(parentRoot)) {
|
|
486
|
-
|
|
498
|
+
search = {target: SearchTarget.Block};
|
|
499
|
+
}
|
|
500
|
+
if (search !== null) {
|
|
501
|
+
this.searchUnknownRoot({slot, root: parentRoot}, peerId, search);
|
|
487
502
|
}
|
|
488
|
-
this.searchUnknownRoot({slot, root: parentRoot}, searchParentBlock, searchParentEnvelope, peerId);
|
|
489
503
|
}
|
|
490
504
|
preprocessResult = {action: PreprocessAction.PushToQueue};
|
|
491
505
|
}
|
|
@@ -504,7 +518,10 @@ export class NetworkProcessor {
|
|
|
504
518
|
: getDataIndexFromSignedAggregateAndProofSerialized(message.msg.data);
|
|
505
519
|
if (attIndex === 1 && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
506
520
|
// attestation votes that the payload is available but it is not yet known
|
|
507
|
-
this.searchUnknownRoot({slot, root},
|
|
521
|
+
this.searchUnknownRoot({slot, root}, peerId, {
|
|
522
|
+
target: SearchTarget.PayloadEnvelope,
|
|
523
|
+
slotIsPayloadSlot: false,
|
|
524
|
+
});
|
|
508
525
|
preprocessResult = {action: PreprocessAction.AwaitEnvelope, root};
|
|
509
526
|
}
|
|
510
527
|
break;
|
|
@@ -514,8 +531,12 @@ export class NetworkProcessor {
|
|
|
514
531
|
const payloadPresent = getPayloadPresentFromPayloadAttestationMessageSerialized(message.msg.data);
|
|
515
532
|
if (payloadPresent && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
516
533
|
// payload attestation votes that the payload is available but it is not yet known.
|
|
534
|
+
// this is optimistic search, the peer may not have the payload (only the ptc committee had).
|
|
517
535
|
// the PTC vote's slot is the payload's slot
|
|
518
|
-
this.searchUnknownRoot({slot, root},
|
|
536
|
+
this.searchUnknownRoot({slot, root}, undefined, {
|
|
537
|
+
target: SearchTarget.PayloadEnvelope,
|
|
538
|
+
slotIsPayloadSlot: true,
|
|
539
|
+
});
|
|
519
540
|
// do not await the envelope, payload attestation processing only requires that the block is known
|
|
520
541
|
// also do not reset preprocessResult, we may already await for the block
|
|
521
542
|
}
|
|
@@ -524,8 +545,12 @@ export class NetworkProcessor {
|
|
|
524
545
|
case GossipType.data_column_sidecar: {
|
|
525
546
|
if (root == null) break;
|
|
526
547
|
if (!this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
548
|
+
// this is optimistic search, the peer may not have the payload.
|
|
527
549
|
// the sidecar's slot is the block's (and so the payload's) slot
|
|
528
|
-
this.searchUnknownRoot({slot, root},
|
|
550
|
+
this.searchUnknownRoot({slot, root}, undefined, {
|
|
551
|
+
target: SearchTarget.PayloadEnvelope,
|
|
552
|
+
slotIsPayloadSlot: true,
|
|
553
|
+
});
|
|
529
554
|
// do not await the envelope, we can do gossip validation
|
|
530
555
|
// also do not reset preprocessResult, we may already await for the block
|
|
531
556
|
}
|
|
@@ -536,7 +561,7 @@ export class NetworkProcessor {
|
|
|
536
561
|
// Extract beacon_block_root directly
|
|
537
562
|
const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
|
|
538
563
|
if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
|
|
539
|
-
this.searchUnknownRoot({slot, root: blockRoot},
|
|
564
|
+
this.searchUnknownRoot({slot, root: blockRoot}, peerId, {target: SearchTarget.Block});
|
|
540
565
|
// We always want to await the block
|
|
541
566
|
// This allows us to properly forward the payload envelope
|
|
542
567
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root: blockRoot};
|
|
@@ -555,13 +580,16 @@ export class NetworkProcessor {
|
|
|
555
580
|
) {
|
|
556
581
|
const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentBlockRoot);
|
|
557
582
|
if (protoBlock === null) {
|
|
558
|
-
this.searchUnknownRoot({slot, root: parentBlockRoot},
|
|
583
|
+
this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {target: SearchTarget.Block});
|
|
559
584
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root: parentBlockRoot};
|
|
560
585
|
} else if (
|
|
561
586
|
protoBlock.executionPayloadBlockHash &&
|
|
562
587
|
protoBlock.executionPayloadBlockHash !== parentBlockHash
|
|
563
588
|
) {
|
|
564
|
-
this.searchUnknownRoot({slot, root: parentBlockRoot},
|
|
589
|
+
this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {
|
|
590
|
+
target: SearchTarget.PayloadEnvelope,
|
|
591
|
+
slotIsPayloadSlot: false,
|
|
592
|
+
});
|
|
565
593
|
preprocessResult = {action: PreprocessAction.AwaitEnvelope, root: parentBlockRoot};
|
|
566
594
|
}
|
|
567
595
|
}
|
|
@@ -664,20 +692,21 @@ export class NetworkProcessor {
|
|
|
664
692
|
|
|
665
693
|
/**
|
|
666
694
|
* Search block/envelope given a SlotRootHex
|
|
667
|
-
*
|
|
695
|
+
* undefined peer id means optimistic search
|
|
668
696
|
*/
|
|
669
697
|
private searchUnknownRoot(
|
|
670
698
|
slotRoot: SlotRootHex,
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
peerId: PeerIdStr,
|
|
674
|
-
envelopeSlotIsPayloadSlot = false
|
|
699
|
+
peerId: PeerIdStr | undefined,
|
|
700
|
+
search: SearchUnknownRootTarget
|
|
675
701
|
): void {
|
|
676
|
-
if (!searchBlock && !searchEnvelope) return;
|
|
677
702
|
if (this.tooManySearchedRoots(slotRoot.slot, slotRoot.root)) return;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
703
|
+
switch (search.target) {
|
|
704
|
+
case SearchTarget.Block:
|
|
705
|
+
this.searchUnknownBlock(slotRoot, BlockInputSource.network_processor, peerId);
|
|
706
|
+
break;
|
|
707
|
+
case SearchTarget.PayloadEnvelope:
|
|
708
|
+
this.searchUnknownEnvelope(slotRoot, BlockInputSource.network_processor, peerId, search.slotIsPayloadSlot);
|
|
709
|
+
break;
|
|
681
710
|
}
|
|
682
711
|
}
|
|
683
712
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {Type} from "@chainsafe/ssz";
|
|
2
|
-
import {ProtocolHandler, RespStatus, ResponseError} from "@lodestar/reqresp";
|
|
2
|
+
import {ProtocolHandler, RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
|
|
3
3
|
import {ssz} from "@lodestar/types";
|
|
4
4
|
import {IBeaconChain} from "../../../chain/index.js";
|
|
5
5
|
import {IBeaconDb} from "../../../db/index.js";
|
|
@@ -38,6 +38,29 @@ function deserializeRequestBody<T>(type: Type<T>, data: Uint8Array): T {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
async function* trackByRangeResponse(
|
|
42
|
+
chain: IBeaconChain,
|
|
43
|
+
method: ReqRespMethod,
|
|
44
|
+
count: number,
|
|
45
|
+
source: AsyncIterable<ResponseOutgoing>,
|
|
46
|
+
columns?: number
|
|
47
|
+
): AsyncIterable<ResponseOutgoing> {
|
|
48
|
+
chain.metrics?.reqRespByRange.requestedSlots.observe({method}, count);
|
|
49
|
+
if (columns !== undefined) {
|
|
50
|
+
chain.metrics?.reqRespByRange.requestedColumns.observe(columns);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let servedBytes = 0;
|
|
54
|
+
try {
|
|
55
|
+
for await (const chunk of source) {
|
|
56
|
+
servedBytes += chunk.data.length;
|
|
57
|
+
yield chunk;
|
|
58
|
+
}
|
|
59
|
+
} finally {
|
|
60
|
+
chain.metrics?.reqRespByRange.servedBytes.observe({method}, servedBytes);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
/**
|
|
42
65
|
* The ReqRespHandler module handles app-level requests / responses from other peers,
|
|
43
66
|
* fetching state from the chain and database as needed.
|
|
@@ -50,7 +73,12 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
|
|
|
50
73
|
[ReqRespMethod.Metadata]: notImplemented(ReqRespMethod.Metadata),
|
|
51
74
|
[ReqRespMethod.BeaconBlocksByRange]: (req, peerId, peerClient) => {
|
|
52
75
|
const body = deserializeRequestBody(ssz.phase0.BeaconBlocksByRangeRequest, req.data);
|
|
53
|
-
return
|
|
76
|
+
return trackByRangeResponse(
|
|
77
|
+
chain,
|
|
78
|
+
ReqRespMethod.BeaconBlocksByRange,
|
|
79
|
+
body.count,
|
|
80
|
+
onBeaconBlocksByRange(body, chain, db, peerId, peerClient)
|
|
81
|
+
);
|
|
54
82
|
},
|
|
55
83
|
[ReqRespMethod.BeaconBlocksByRoot]: (req) => {
|
|
56
84
|
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
@@ -68,11 +96,22 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
|
|
|
68
96
|
},
|
|
69
97
|
[ReqRespMethod.BlobSidecarsByRange]: (req) => {
|
|
70
98
|
const body = deserializeRequestBody(ssz.deneb.BlobSidecarsByRangeRequest, req.data);
|
|
71
|
-
return
|
|
99
|
+
return trackByRangeResponse(
|
|
100
|
+
chain,
|
|
101
|
+
ReqRespMethod.BlobSidecarsByRange,
|
|
102
|
+
body.count,
|
|
103
|
+
onBlobSidecarsByRange(body, chain, db)
|
|
104
|
+
);
|
|
72
105
|
},
|
|
73
106
|
[ReqRespMethod.DataColumnSidecarsByRange]: (req, peerId, peerClient) => {
|
|
74
107
|
const body = deserializeRequestBody(ssz.fulu.DataColumnSidecarsByRangeRequest, req.data);
|
|
75
|
-
return
|
|
108
|
+
return trackByRangeResponse(
|
|
109
|
+
chain,
|
|
110
|
+
ReqRespMethod.DataColumnSidecarsByRange,
|
|
111
|
+
body.count,
|
|
112
|
+
onDataColumnSidecarsByRange(body, chain, db, peerId, peerClient),
|
|
113
|
+
body.columns.length
|
|
114
|
+
);
|
|
76
115
|
},
|
|
77
116
|
[ReqRespMethod.DataColumnSidecarsByRoot]: (req, peerId, peerClient) => {
|
|
78
117
|
const body = deserializeRequestBody(DataColumnSidecarsByRootRequestType(chain.config), req.data);
|
|
@@ -85,7 +124,12 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
|
|
|
85
124
|
},
|
|
86
125
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: (req, peerId, peerClient) => {
|
|
87
126
|
const body = deserializeRequestBody(ssz.gloas.ExecutionPayloadEnvelopesByRangeRequest, req.data);
|
|
88
|
-
return
|
|
127
|
+
return trackByRangeResponse(
|
|
128
|
+
chain,
|
|
129
|
+
ReqRespMethod.ExecutionPayloadEnvelopesByRange,
|
|
130
|
+
body.count,
|
|
131
|
+
onExecutionPayloadEnvelopesByRange(body, chain, db, peerId, peerClient)
|
|
132
|
+
);
|
|
89
133
|
},
|
|
90
134
|
|
|
91
135
|
[ReqRespMethod.LightClientBootstrap]: (req) => {
|
package/src/node/nodejs.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {BeaconConfig} from "@lodestar/config";
|
|
|
8
8
|
import type {LoggerNode} from "@lodestar/logger/node";
|
|
9
9
|
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
10
10
|
import {IBeaconStateView, isStatePostBellatrix, isStatePostGloas} from "@lodestar/state-transition";
|
|
11
|
-
import {phase0} from "@lodestar/types";
|
|
12
11
|
import {sleep, toRootHex} from "@lodestar/utils";
|
|
13
12
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
14
13
|
import {BeaconRestApiServer, getApi} from "../api/index.js";
|
|
@@ -19,7 +18,6 @@ import {initializeExecutionBuilder, initializeExecutionEngine} from "../executio
|
|
|
19
18
|
import {HttpMetricsServer, Metrics, createMetrics, getHttpMetricsServer} from "../metrics/index.js";
|
|
20
19
|
import {MonitoringService} from "../monitoring/index.js";
|
|
21
20
|
import {Network, getReqRespHandlers} from "../network/index.js";
|
|
22
|
-
import {BackfillSync} from "../sync/backfill/index.js";
|
|
23
21
|
import {BeaconSync, IBeaconSync} from "../sync/index.js";
|
|
24
22
|
import {Clock} from "../util/clock.js";
|
|
25
23
|
import {startDeferredVoluntaryExitPublisher} from "./deferredVoluntaryExitPublisher.js";
|
|
@@ -38,7 +36,6 @@ export type BeaconNodeModules = {
|
|
|
38
36
|
chain: IBeaconChain;
|
|
39
37
|
api: BeaconApiMethods;
|
|
40
38
|
sync: IBeaconSync;
|
|
41
|
-
backfillSync: BackfillSync | null;
|
|
42
39
|
metricsServer: HttpMetricsServer | null;
|
|
43
40
|
monitoring: MonitoringService | null;
|
|
44
41
|
restApi?: BeaconRestApiServer;
|
|
@@ -58,7 +55,6 @@ export type BeaconNodeInitModules = {
|
|
|
58
55
|
peerStoreDir?: string;
|
|
59
56
|
anchorState: IBeaconStateView;
|
|
60
57
|
isAnchorStateFinalized: boolean;
|
|
61
|
-
wsCheckpoint?: phase0.Checkpoint;
|
|
62
58
|
metricsRegistries?: Registry[];
|
|
63
59
|
};
|
|
64
60
|
|
|
@@ -70,7 +66,6 @@ export enum BeaconNodeStatus {
|
|
|
70
66
|
|
|
71
67
|
enum LoggerModule {
|
|
72
68
|
api = "api",
|
|
73
|
-
backfill = "backfill",
|
|
74
69
|
chain = "chain",
|
|
75
70
|
execution = "execution",
|
|
76
71
|
metrics = "metrics",
|
|
@@ -105,7 +100,6 @@ export class BeaconNode {
|
|
|
105
100
|
api: BeaconApiMethods;
|
|
106
101
|
restApi?: BeaconRestApiServer;
|
|
107
102
|
sync: IBeaconSync;
|
|
108
|
-
backfillSync: BackfillSync | null;
|
|
109
103
|
|
|
110
104
|
status: BeaconNodeStatus;
|
|
111
105
|
private controller?: AbortController;
|
|
@@ -123,7 +117,6 @@ export class BeaconNode {
|
|
|
123
117
|
api,
|
|
124
118
|
restApi,
|
|
125
119
|
sync,
|
|
126
|
-
backfillSync,
|
|
127
120
|
controller,
|
|
128
121
|
}: BeaconNodeModules) {
|
|
129
122
|
this.opts = opts;
|
|
@@ -138,7 +131,6 @@ export class BeaconNode {
|
|
|
138
131
|
this.restApi = restApi;
|
|
139
132
|
this.network = network;
|
|
140
133
|
this.sync = sync;
|
|
141
|
-
this.backfillSync = backfillSync;
|
|
142
134
|
this.controller = controller;
|
|
143
135
|
|
|
144
136
|
this.status = BeaconNodeStatus.started;
|
|
@@ -161,7 +153,6 @@ export class BeaconNode {
|
|
|
161
153
|
peerStoreDir,
|
|
162
154
|
anchorState,
|
|
163
155
|
isAnchorStateFinalized,
|
|
164
|
-
wsCheckpoint,
|
|
165
156
|
metricsRegistries = [],
|
|
166
157
|
}: BeaconNodeInitModules): Promise<T> {
|
|
167
158
|
if (hasher.name !== "hashtree") {
|
|
@@ -295,25 +286,9 @@ export class BeaconNode {
|
|
|
295
286
|
chain,
|
|
296
287
|
metrics,
|
|
297
288
|
network,
|
|
298
|
-
wsCheckpoint,
|
|
299
289
|
logger: logger.child({module: LoggerModule.sync}),
|
|
300
290
|
});
|
|
301
291
|
|
|
302
|
-
const backfillSync =
|
|
303
|
-
opts.sync.backfillBatchSize > 0
|
|
304
|
-
? await BackfillSync.init(opts.sync, {
|
|
305
|
-
config,
|
|
306
|
-
db,
|
|
307
|
-
chain,
|
|
308
|
-
metrics,
|
|
309
|
-
network,
|
|
310
|
-
wsCheckpoint,
|
|
311
|
-
anchorState,
|
|
312
|
-
logger: logger.child({module: LoggerModule.backfill}),
|
|
313
|
-
signal,
|
|
314
|
-
})
|
|
315
|
-
: null;
|
|
316
|
-
|
|
317
292
|
const api = getApi(opts.api, {
|
|
318
293
|
config,
|
|
319
294
|
logger: logger.child({module: LoggerModule.api}),
|
|
@@ -361,7 +336,6 @@ export class BeaconNode {
|
|
|
361
336
|
api,
|
|
362
337
|
restApi,
|
|
363
338
|
sync,
|
|
364
|
-
backfillSync,
|
|
365
339
|
controller,
|
|
366
340
|
}) as T;
|
|
367
341
|
}
|
|
@@ -373,7 +347,6 @@ export class BeaconNode {
|
|
|
373
347
|
if (this.status === BeaconNodeStatus.started) {
|
|
374
348
|
this.status = BeaconNodeStatus.closing;
|
|
375
349
|
this.sync.close();
|
|
376
|
-
this.backfillSync?.close();
|
|
377
350
|
if (this.restApi) await this.restApi.close();
|
|
378
351
|
await this.network.close();
|
|
379
352
|
if (this.metricsServer) await this.metricsServer.close();
|
package/src/sync/interface.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
|
-
import {Slot
|
|
3
|
+
import {Slot} from "@lodestar/types";
|
|
4
4
|
import {Logger} from "@lodestar/utils";
|
|
5
5
|
import {IBeaconChain} from "../chain/index.js";
|
|
6
6
|
import {IBeaconDb} from "../db/index.js";
|
|
@@ -51,5 +51,4 @@ export interface SyncModules {
|
|
|
51
51
|
metrics: Metrics | null;
|
|
52
52
|
logger: Logger;
|
|
53
53
|
chain: IBeaconChain;
|
|
54
|
-
wsCheckpoint?: phase0.Checkpoint;
|
|
55
54
|
}
|