@lodestar/beacon-node 1.49.0-dev.b27f498c2c → 1.49.0-dev.c535e94f25
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 +5 -6
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +5 -1
- 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/emitter.d.ts +10 -0
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +4 -0
- package/lib/chain/emitter.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/blockArchive.d.ts +5 -0
- package/lib/db/repositories/blockArchive.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +36 -1
- package/lib/db/repositories/blockArchive.js.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/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 +6 -2
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +62 -24
- 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 +21 -2
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +22 -2
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +20 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +199 -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 +0 -6
- package/src/chain/archiveStore/historicalState/metrics.ts +5 -7
- package/src/chain/archiveStore/utils/pruneHistory.ts +5 -2
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/emitter.ts +7 -2
- 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/blockArchive.ts +38 -1
- package/src/db/repositories/index.ts +0 -1
- package/src/metrics/metrics/lodestar.ts +34 -26
- package/src/metrics/metrics.ts +7 -2
- package/src/network/processor/index.ts +81 -24
- 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 +24 -5
- package/src/sync/unknownBlock.ts +207 -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/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,8 +1,9 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {Db, DbBatch, FilterOptions, KeyValue, Repository} from "@lodestar/db";
|
|
3
3
|
import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
|
|
4
|
-
import {bytesToInt, intToBytes} from "@lodestar/utils";
|
|
4
|
+
import {bytesToInt, fromHex, intToBytes} from "@lodestar/utils";
|
|
5
5
|
import {getSignedBlockTypeFromBytes} from "../../util/multifork.js";
|
|
6
|
+
import {getParentRootFromSignedBeaconBlockSerialized} from "../../util/sszBytes.js";
|
|
6
7
|
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
7
8
|
import {
|
|
8
9
|
deleteParentRootIndex,
|
|
@@ -24,6 +25,10 @@ export type BlockArchiveBatchPutBinaryItem = KeyValue<Slot, Uint8Array> & {
|
|
|
24
25
|
parentRoot: Root;
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
// The initial prune can span millions of slots. This bounds the slot index reads in flight and keeps each
|
|
29
|
+
// delete batch at a few thousand keys, both tiny next to the block value batches in archiveBlocks
|
|
30
|
+
const DELETE_RANGE_CHUNK_SIZE = 1000;
|
|
31
|
+
|
|
27
32
|
/**
|
|
28
33
|
* Stores finalized blocks. Block slot is identifier.
|
|
29
34
|
*/
|
|
@@ -103,6 +108,38 @@ export class BlockArchiveRepository extends Repository<Slot, SignedBeaconBlock>
|
|
|
103
108
|
);
|
|
104
109
|
}
|
|
105
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Delete a contiguous range of archived blocks together with their index entries.
|
|
113
|
+
* `slots` must be every archived slot in the range, so the parent of each block is the entry before it.
|
|
114
|
+
*/
|
|
115
|
+
async batchDeleteRange(slots: Slot[]): Promise<void> {
|
|
116
|
+
const sorted = [...slots].sort((a, b) => a - b);
|
|
117
|
+
let prevRoot: Root | null = null;
|
|
118
|
+
|
|
119
|
+
for (let i = 0; i < sorted.length; i += DELETE_RANGE_CHUNK_SIZE) {
|
|
120
|
+
const chunk = sorted.slice(i, i + DELETE_RANGE_CHUNK_SIZE);
|
|
121
|
+
const roots = await Promise.all(chunk.map((slot) => this.getRootBySlot(slot)));
|
|
122
|
+
|
|
123
|
+
const keys: Uint8Array[] = [];
|
|
124
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
125
|
+
keys.push(this.encodeKey(chunk[j]), getSlotIndexKey(chunk[j]));
|
|
126
|
+
const root = roots[j];
|
|
127
|
+
if (root) keys.push(getRootIndexKey(root));
|
|
128
|
+
// The parent index entry pointing at this block is keyed by its parent root, which is the
|
|
129
|
+
// previous block's root unless that block is unindexed, then it is read from the block itself
|
|
130
|
+
let parentRoot = prevRoot;
|
|
131
|
+
if (parentRoot === null) {
|
|
132
|
+
const block = await this.getBinary(chunk[j]);
|
|
133
|
+
const parentRootHex = block ? getParentRootFromSignedBeaconBlockSerialized(block) : null;
|
|
134
|
+
parentRoot = parentRootHex ? fromHex(parentRootHex) : null;
|
|
135
|
+
}
|
|
136
|
+
if (parentRoot) keys.push(getParentRootIndexKey(parentRoot));
|
|
137
|
+
prevRoot = root;
|
|
138
|
+
}
|
|
139
|
+
await this.db.batchDelete(keys, this.dbReqOpts);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
106
143
|
async batch(operations: DbBatch<Slot, SignedBeaconBlock>): Promise<void> {
|
|
107
144
|
await this.batchBinary(
|
|
108
145
|
operations.map((operation) =>
|
|
@@ -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";
|
|
@@ -403,6 +409,15 @@ export function createLodestarMetrics(
|
|
|
403
409
|
labelNames: ["caller"],
|
|
404
410
|
}),
|
|
405
411
|
|
|
412
|
+
// this metrics stay here instead of @lodestar/state-transition in order to prepare
|
|
413
|
+
// for the native zig state-transition in the future
|
|
414
|
+
stateHashTreeRootTime: register.histogram<{source: StateHashTreeRootSource}>({
|
|
415
|
+
name: "lodestar_stfn_hash_tree_root_seconds",
|
|
416
|
+
help: "Time to compute the hash tree root of a post state in seconds",
|
|
417
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.3, 0.5],
|
|
418
|
+
labelNames: ["source"],
|
|
419
|
+
}),
|
|
420
|
+
|
|
406
421
|
// BLS verifier thread pool and queue
|
|
407
422
|
|
|
408
423
|
bls: {
|
|
@@ -655,6 +670,16 @@ export function createLodestarMetrics(
|
|
|
655
670
|
help: "Count of payload (execution payload envelope) sync triggers, labeled by their source",
|
|
656
671
|
labelNames: ["source"],
|
|
657
672
|
}),
|
|
673
|
+
deferredPayloadResult: register.counter<{result: DeferredPayloadResult}>({
|
|
674
|
+
name: "lodestar_sync_deferred_payload_result_total",
|
|
675
|
+
help: "Outcome of a slot's deferred optimistic payload searches, by result",
|
|
676
|
+
labelNames: ["result"],
|
|
677
|
+
}),
|
|
678
|
+
deferredPayloadPolls: register.histogram({
|
|
679
|
+
name: "lodestar_sync_deferred_payload_polls_count",
|
|
680
|
+
help: "Poll ticks after PAYLOAD_DUE until a searched payload was imported",
|
|
681
|
+
buckets: [0, 1, 2, 3, 6],
|
|
682
|
+
}),
|
|
658
683
|
pendingBlocks: register.gauge({
|
|
659
684
|
name: "lodestar_sync_unknown_block_pending_blocks_size",
|
|
660
685
|
help: "Current size of UnknownBlockSync pending blocks cache",
|
|
@@ -986,6 +1011,13 @@ export function createLodestarMetrics(
|
|
|
986
1011
|
help: "Count of errors, by error type, while processing execution payload envelopes",
|
|
987
1012
|
labelNames: ["error"],
|
|
988
1013
|
}),
|
|
1014
|
+
executionPayload: {
|
|
1015
|
+
recvToValidation: register.histogram({
|
|
1016
|
+
name: "lodestar_gossip_execution_payload_envelope_received_to_execution_payload_verification_seconds",
|
|
1017
|
+
help: "Time elapsed between execution payload envelope received and execution payload verification",
|
|
1018
|
+
buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 3, 4, 6, 8],
|
|
1019
|
+
}),
|
|
1020
|
+
},
|
|
989
1021
|
},
|
|
990
1022
|
gossipExecutionPayloadBid: {
|
|
991
1023
|
elapsedTimeTillReceived: register.histogram<{source: OpSource}>({
|
|
@@ -1120,30 +1152,6 @@ export function createLodestarMetrics(
|
|
|
1120
1152
|
help: "The total result of calling notifyForkchoiceUpdate execution engine api",
|
|
1121
1153
|
labelNames: ["result"],
|
|
1122
1154
|
}),
|
|
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
1155
|
opPool: {
|
|
1148
1156
|
aggregatedAttestationPool: {
|
|
1149
1157
|
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();
|
|
@@ -86,8 +86,13 @@ export const MAX_AWAITING_MESSAGES_PER_ROOT: Partial<Record<GossipType, number>>
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Track the forwarded peers we already emit to UnknownBlockInput sync.
|
|
89
|
+
* envelopeSlotEmitted: whether the unknownEnvelopeBlockRootSlot event was already emitted for this root.
|
|
89
90
|
*/
|
|
90
|
-
type SearchedRootEntry = {
|
|
91
|
+
type SearchedRootEntry = {
|
|
92
|
+
blockPeerIds?: Set<PeerIdStr>;
|
|
93
|
+
envelopePeerIds?: Set<PeerIdStr>;
|
|
94
|
+
envelopeSlotEmitted?: boolean;
|
|
95
|
+
};
|
|
91
96
|
|
|
92
97
|
/**
|
|
93
98
|
* This is respective to gossipsub seenTTL (which is 550 * 0.7 = 385s), also it's respective
|
|
@@ -192,6 +197,19 @@ type PreprocessResult =
|
|
|
192
197
|
| {action: PreprocessAction.AwaitBlock; root: RootHex}
|
|
193
198
|
| {action: PreprocessAction.AwaitEnvelope; root: RootHex};
|
|
194
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
|
+
|
|
195
213
|
/**
|
|
196
214
|
* Network processor handles the gossip queues and throtles processing to not overload the main thread
|
|
197
215
|
* - Decides when to process work and what to process
|
|
@@ -347,12 +365,17 @@ export class NetworkProcessor {
|
|
|
347
365
|
}
|
|
348
366
|
|
|
349
367
|
/**
|
|
350
|
-
* Search envelope via `ChainEvent.unknownEnvelopeBlockRoot` event
|
|
368
|
+
* Search envelope via `ChainEvent.unknownEnvelopeBlockRoot` / `ChainEvent.unknownEnvelopeBlockRootSlot` event
|
|
351
369
|
* Slot is the message slot, which is not necessarily the same as the envelope's slot, but it can be used for a good prune strategy.
|
|
352
370
|
* In the rare case, if 2 messages on 2 slots search for the same root (for example beacon_attestation) we may emit the same root twice but BlockInputSync should handle it well.
|
|
353
371
|
* Same peer-forwarding + dedup behavior as searchUnknownBlock.
|
|
354
372
|
*/
|
|
355
|
-
searchUnknownEnvelope(
|
|
373
|
+
searchUnknownEnvelope(
|
|
374
|
+
{slot, root}: SlotRootHex,
|
|
375
|
+
source: BlockInputSource,
|
|
376
|
+
peer?: PeerIdStr,
|
|
377
|
+
slotIsPayloadSlot = false
|
|
378
|
+
): void {
|
|
356
379
|
if (this.chain.seenPayloadEnvelope(root)) {
|
|
357
380
|
return;
|
|
358
381
|
}
|
|
@@ -369,8 +392,17 @@ export class NetworkProcessor {
|
|
|
369
392
|
forwardedPeers.add(peer);
|
|
370
393
|
shouldEmit = true;
|
|
371
394
|
}
|
|
395
|
+
// the payload-slot seed must reach the sync once, even if a slot-less trigger started the search first
|
|
396
|
+
if (slotIsPayloadSlot && !entry.envelopeSlotEmitted) {
|
|
397
|
+
shouldEmit = true;
|
|
398
|
+
}
|
|
372
399
|
if (shouldEmit) {
|
|
373
|
-
|
|
400
|
+
if (slotIsPayloadSlot) {
|
|
401
|
+
entry.envelopeSlotEmitted = true;
|
|
402
|
+
this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRootSlot, {rootHex: root, slot, peer, source});
|
|
403
|
+
} else {
|
|
404
|
+
this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, {rootHex: root, peer, source});
|
|
405
|
+
}
|
|
374
406
|
}
|
|
375
407
|
}
|
|
376
408
|
|
|
@@ -431,7 +463,7 @@ export class NetworkProcessor {
|
|
|
431
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
|
|
432
464
|
if (root && !this.chain.forkChoice.hasBlockHexUnsafe(root)) {
|
|
433
465
|
// starting from GLOAS, unknown root from data_column_sidecar also falls into this case
|
|
434
|
-
this.searchUnknownRoot({slot, root},
|
|
466
|
+
this.searchUnknownRoot({slot, root}, peerId, {target: SearchTarget.Block});
|
|
435
467
|
// for beacon_attestation and beacon_aggregate_and_proof messages, this is only temporary.
|
|
436
468
|
// if "index = 1" we need to await for the Envelope instead
|
|
437
469
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root};
|
|
@@ -446,27 +478,28 @@ export class NetworkProcessor {
|
|
|
446
478
|
if (topicType === GossipType.beacon_block) {
|
|
447
479
|
const parentRoot = getParentRootFromSignedBeaconBlockSerialized(message.msg.data);
|
|
448
480
|
if (parentRoot) {
|
|
449
|
-
let
|
|
450
|
-
let searchParentEnvelope = false;
|
|
481
|
+
let search: SearchUnknownRootTarget | null = null;
|
|
451
482
|
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
452
483
|
// GLOAS: also check parent envelope, same logic as execution_payload_bid
|
|
453
484
|
const parentBlockHash = getParentBlockHashFromGloasSignedBeaconBlockSerialized(message.msg.data);
|
|
454
485
|
if (parentBlockHash && !this.chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHash)) {
|
|
455
486
|
const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
|
|
456
487
|
if (protoBlock === null) {
|
|
457
|
-
|
|
488
|
+
search = {target: SearchTarget.Block};
|
|
458
489
|
} else if (
|
|
459
490
|
protoBlock.executionPayloadBlockHash &&
|
|
460
491
|
protoBlock.executionPayloadBlockHash !== parentBlockHash
|
|
461
492
|
) {
|
|
462
493
|
// only search for the envelope by block root if we're sure there is one. Otherwise UnknownBlockSync will penalize the peer.
|
|
463
|
-
|
|
494
|
+
search = {target: SearchTarget.PayloadEnvelope, slotIsPayloadSlot: false};
|
|
464
495
|
}
|
|
465
496
|
}
|
|
466
497
|
} else if (!this.chain.forkChoice.hasBlockHexUnsafe(parentRoot)) {
|
|
467
|
-
|
|
498
|
+
search = {target: SearchTarget.Block};
|
|
499
|
+
}
|
|
500
|
+
if (search !== null) {
|
|
501
|
+
this.searchUnknownRoot({slot, root: parentRoot}, peerId, search);
|
|
468
502
|
}
|
|
469
|
-
this.searchUnknownRoot({slot, root: parentRoot}, searchParentBlock, searchParentEnvelope, peerId);
|
|
470
503
|
}
|
|
471
504
|
preprocessResult = {action: PreprocessAction.PushToQueue};
|
|
472
505
|
}
|
|
@@ -485,7 +518,10 @@ export class NetworkProcessor {
|
|
|
485
518
|
: getDataIndexFromSignedAggregateAndProofSerialized(message.msg.data);
|
|
486
519
|
if (attIndex === 1 && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
487
520
|
// attestation votes that the payload is available but it is not yet known
|
|
488
|
-
this.searchUnknownRoot({slot, root},
|
|
521
|
+
this.searchUnknownRoot({slot, root}, peerId, {
|
|
522
|
+
target: SearchTarget.PayloadEnvelope,
|
|
523
|
+
slotIsPayloadSlot: false,
|
|
524
|
+
});
|
|
489
525
|
preprocessResult = {action: PreprocessAction.AwaitEnvelope, root};
|
|
490
526
|
}
|
|
491
527
|
break;
|
|
@@ -494,8 +530,13 @@ export class NetworkProcessor {
|
|
|
494
530
|
if (root == null) break;
|
|
495
531
|
const payloadPresent = getPayloadPresentFromPayloadAttestationMessageSerialized(message.msg.data);
|
|
496
532
|
if (payloadPresent && !this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
497
|
-
// payload attestation votes that the payload is available but it is not yet known
|
|
498
|
-
this
|
|
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).
|
|
535
|
+
// the PTC vote's slot is the payload's slot
|
|
536
|
+
this.searchUnknownRoot({slot, root}, undefined, {
|
|
537
|
+
target: SearchTarget.PayloadEnvelope,
|
|
538
|
+
slotIsPayloadSlot: true,
|
|
539
|
+
});
|
|
499
540
|
// do not await the envelope, payload attestation processing only requires that the block is known
|
|
500
541
|
// also do not reset preprocessResult, we may already await for the block
|
|
501
542
|
}
|
|
@@ -504,7 +545,12 @@ export class NetworkProcessor {
|
|
|
504
545
|
case GossipType.data_column_sidecar: {
|
|
505
546
|
if (root == null) break;
|
|
506
547
|
if (!this.chain.forkChoice.hasPayloadHexUnsafe(root)) {
|
|
507
|
-
this
|
|
548
|
+
// this is optimistic search, the peer may not have the payload.
|
|
549
|
+
// the sidecar's slot is the block's (and so the payload's) slot
|
|
550
|
+
this.searchUnknownRoot({slot, root}, undefined, {
|
|
551
|
+
target: SearchTarget.PayloadEnvelope,
|
|
552
|
+
slotIsPayloadSlot: true,
|
|
553
|
+
});
|
|
508
554
|
// do not await the envelope, we can do gossip validation
|
|
509
555
|
// also do not reset preprocessResult, we may already await for the block
|
|
510
556
|
}
|
|
@@ -515,7 +561,7 @@ export class NetworkProcessor {
|
|
|
515
561
|
// Extract beacon_block_root directly
|
|
516
562
|
const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
|
|
517
563
|
if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
|
|
518
|
-
this.searchUnknownRoot({slot, root: blockRoot},
|
|
564
|
+
this.searchUnknownRoot({slot, root: blockRoot}, peerId, {target: SearchTarget.Block});
|
|
519
565
|
// We always want to await the block
|
|
520
566
|
// This allows us to properly forward the payload envelope
|
|
521
567
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root: blockRoot};
|
|
@@ -534,13 +580,16 @@ export class NetworkProcessor {
|
|
|
534
580
|
) {
|
|
535
581
|
const protoBlock = this.chain.forkChoice.getBlockHexDefaultStatus(parentBlockRoot);
|
|
536
582
|
if (protoBlock === null) {
|
|
537
|
-
this.searchUnknownRoot({slot, root: parentBlockRoot},
|
|
583
|
+
this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {target: SearchTarget.Block});
|
|
538
584
|
preprocessResult = {action: PreprocessAction.AwaitBlock, root: parentBlockRoot};
|
|
539
585
|
} else if (
|
|
540
586
|
protoBlock.executionPayloadBlockHash &&
|
|
541
587
|
protoBlock.executionPayloadBlockHash !== parentBlockHash
|
|
542
588
|
) {
|
|
543
|
-
this.searchUnknownRoot({slot, root: parentBlockRoot},
|
|
589
|
+
this.searchUnknownRoot({slot, root: parentBlockRoot}, peerId, {
|
|
590
|
+
target: SearchTarget.PayloadEnvelope,
|
|
591
|
+
slotIsPayloadSlot: false,
|
|
592
|
+
});
|
|
544
593
|
preprocessResult = {action: PreprocessAction.AwaitEnvelope, root: parentBlockRoot};
|
|
545
594
|
}
|
|
546
595
|
}
|
|
@@ -641,16 +690,24 @@ export class NetworkProcessor {
|
|
|
641
690
|
return true;
|
|
642
691
|
}
|
|
643
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Search block/envelope given a SlotRootHex
|
|
695
|
+
* undefined peer id means optimistic search
|
|
696
|
+
*/
|
|
644
697
|
private searchUnknownRoot(
|
|
645
698
|
slotRoot: SlotRootHex,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
peerId: PeerIdStr
|
|
699
|
+
peerId: PeerIdStr | undefined,
|
|
700
|
+
search: SearchUnknownRootTarget
|
|
649
701
|
): void {
|
|
650
|
-
if (!searchBlock && !searchEnvelope) return;
|
|
651
702
|
if (this.tooManySearchedRoots(slotRoot.slot, slotRoot.root)) return;
|
|
652
|
-
|
|
653
|
-
|
|
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;
|
|
710
|
+
}
|
|
654
711
|
}
|
|
655
712
|
|
|
656
713
|
private pushPendingGossipsubMessageToQueue(message: PendingGossipsubMessage): void {
|
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
|
}
|
package/src/sync/options.ts
CHANGED
|
@@ -16,12 +16,6 @@ export type SyncOptions = {
|
|
|
16
16
|
disableRangeSync?: boolean;
|
|
17
17
|
/** USE FOR TESTING ONLY. Disable unknown block sync completely */
|
|
18
18
|
disableBlockInputSync?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The batch size of slots for backfill sync can attempt to sync/process before yielding
|
|
21
|
-
* to sync loop. This number can be increased or decreased to make a suitable resource
|
|
22
|
-
* allocation to backfill sync. The default of 0 would mean backfill sync will be skipped
|
|
23
|
-
*/
|
|
24
|
-
backfillBatchSize: number;
|
|
25
19
|
/** For testing only, MAX_PENDING_BLOCKS by default */
|
|
26
20
|
maxPendingBlocks?: number;
|
|
27
21
|
|
|
@@ -39,7 +33,5 @@ export type SyncOptions = {
|
|
|
39
33
|
export const defaultSyncOptions: SyncOptions = {
|
|
40
34
|
isSingleNode: false,
|
|
41
35
|
disableProcessAsChainSegment: false,
|
|
42
|
-
/** By default skip the backfill sync */
|
|
43
|
-
backfillBatchSize: 0,
|
|
44
36
|
slotImportTolerance: SLOTS_PER_EPOCH,
|
|
45
37
|
};
|