@lodestar/beacon-node 1.34.0-dev.27285cdee9 → 1.34.0-dev.44611dcdcc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/impl/beacon/blocks/index.js +35 -34
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +3 -3
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.js +15 -16
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/debug/index.js +2 -2
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.js +37 -26
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.d.ts +3 -3
- package/lib/api/impl/validator/utils.js +2 -2
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +19 -20
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/blocks/utils/zebraBanner.d.ts +2 -0
- package/lib/chain/blocks/utils/zebraBanner.js +45 -0
- package/lib/chain/blocks/utils/zebraBanner.js.map +1 -0
- package/lib/chain/blocks/verifyBlock.js +18 -5
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +7 -34
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts +8 -80
- package/lib/chain/chain.js +51 -76
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/interface.d.ts +3 -10
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +2 -1
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +30 -18
- package/lib/chain/produceBlock/produceBlockBody.js +27 -32
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.d.ts +6 -4
- package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js +21 -23
- package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts +2 -1
- package/lib/chain/validation/dataColumnSidecar.js +9 -8
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/db/beacon.d.ts +3 -3
- package/lib/db/beacon.js +3 -3
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/interface.d.ts +3 -3
- package/lib/db/repositories/dataColumnSidecar.d.ts +26 -0
- package/lib/db/repositories/dataColumnSidecar.js +39 -0
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -0
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +24 -0
- package/lib/db/repositories/dataColumnSidecarArchive.js +39 -0
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -0
- package/lib/db/repositories/index.d.ts +2 -2
- package/lib/db/repositories/index.js +2 -2
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/builder/http.d.ts +20 -4
- package/lib/execution/builder/http.js +30 -11
- package/lib/execution/builder/http.js.map +1 -1
- package/lib/execution/builder/interface.d.ts +5 -4
- package/lib/execution/engine/http.d.ts +2 -2
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -11
- package/lib/execution/engine/mock.d.ts +4 -1
- package/lib/execution/engine/mock.js +54 -16
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +5 -5
- package/lib/execution/engine/types.js +2 -2
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +1 -5
- package/lib/metrics/metrics/beacon.js +4 -14
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +5 -0
- package/lib/metrics/metrics/lodestar.js +14 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/networkCore.js +11 -6
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +579 -51
- package/lib/network/interface.d.ts +3 -3
- package/lib/network/network.d.ts +3 -3
- package/lib/network/network.js +1 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.js +2 -2
- package/lib/network/peers/discover.js +1 -1
- package/lib/network/peers/discover.js.map +1 -1
- package/lib/network/peers/peerManager.js +5 -5
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +2 -1
- package/lib/network/peers/utils/prioritizePeers.js +5 -5
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js +9 -6
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.d.ts +6 -3
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.js +45 -17
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRange.js.map +1 -1
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.d.ts +7 -2
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.js +7 -7
- package/lib/network/reqresp/beaconBlocksMaybeBlobsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +3 -3
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +2 -2
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +2 -3
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts +3 -3
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +27 -46
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts +2 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +7 -21
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.js +4 -3
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/rateLimit.js +11 -5
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +3 -3
- package/lib/network/reqresp/types.js +3 -3
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/sync/range/chain.d.ts +1 -1
- package/lib/sync/range/chain.js +2 -2
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.js +2 -2
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts +3 -1
- package/lib/sync/range/utils/peerBalancer.js +20 -1
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +46 -4
- package/lib/sync/unknownBlock.js +305 -201
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/blobs.d.ts +3 -13
- package/lib/util/blobs.js +9 -47
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/dataColumns.d.ts +7 -5
- package/lib/util/dataColumns.js +32 -27
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/types.d.ts +7 -0
- package/lib/util/types.js +3 -0
- package/lib/util/types.js.map +1 -1
- package/package.json +16 -16
- package/lib/db/repositories/dataColumnSidecars.d.ts +0 -47
- package/lib/db/repositories/dataColumnSidecars.js +0 -40
- package/lib/db/repositories/dataColumnSidecars.js.map +0 -1
- package/lib/db/repositories/dataColumnSidecarsArchive.d.ts +0 -15
- package/lib/db/repositories/dataColumnSidecarsArchive.js +0 -23
- package/lib/db/repositories/dataColumnSidecarsArchive.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PeerSyncMeta } from "../../../network/peers/peersData.js";
|
|
2
2
|
import { CustodyConfig } from "../../../util/dataColumns.js";
|
|
3
|
+
import { RangeSyncType } from "../../utils/remoteSyncType.js";
|
|
3
4
|
import { Batch } from "../batch.js";
|
|
4
5
|
import { ChainTarget } from "./chainTarget.js";
|
|
5
6
|
export type PeerSyncInfo = PeerSyncMeta & {
|
|
@@ -13,12 +14,13 @@ export declare class ChainPeersBalancer {
|
|
|
13
14
|
private peers;
|
|
14
15
|
private activeRequestsByPeer;
|
|
15
16
|
private readonly custodyConfig;
|
|
17
|
+
private readonly syncType;
|
|
16
18
|
private readonly maxConcurrentRequests;
|
|
17
19
|
/**
|
|
18
20
|
* No need to specify `maxConcurrentRequests` for production code
|
|
19
21
|
* It is used for testing purposes to limit the number of concurrent requests
|
|
20
22
|
*/
|
|
21
|
-
constructor(peers: PeerSyncInfo[], batches: Batch[], custodyConfig: CustodyConfig, maxConcurrentRequests?: number);
|
|
23
|
+
constructor(peers: PeerSyncInfo[], batches: Batch[], custodyConfig: CustodyConfig, syncType: RangeSyncType, maxConcurrentRequests?: number);
|
|
22
24
|
/**
|
|
23
25
|
* Return the most suitable peer to retry
|
|
24
26
|
* Sort peers by (1) no failed request (2) less active requests, then pick first
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { shuffle } from "../../../util/shuffle.js";
|
|
2
2
|
import { sortBy } from "../../../util/sortBy.js";
|
|
3
3
|
import { MAX_CONCURRENT_REQUESTS } from "../../constants.js";
|
|
4
|
+
import { RangeSyncType } from "../../utils/remoteSyncType.js";
|
|
4
5
|
import { BatchStatus } from "../batch.js";
|
|
5
6
|
/**
|
|
6
7
|
* Balance and organize peers to perform requests with a SyncChain
|
|
@@ -11,10 +12,11 @@ export class ChainPeersBalancer {
|
|
|
11
12
|
* No need to specify `maxConcurrentRequests` for production code
|
|
12
13
|
* It is used for testing purposes to limit the number of concurrent requests
|
|
13
14
|
*/
|
|
14
|
-
constructor(peers, batches, custodyConfig, maxConcurrentRequests = MAX_CONCURRENT_REQUESTS) {
|
|
15
|
+
constructor(peers, batches, custodyConfig, syncType, maxConcurrentRequests = MAX_CONCURRENT_REQUESTS) {
|
|
15
16
|
this.activeRequestsByPeer = new Map();
|
|
16
17
|
this.peers = shuffle(peers);
|
|
17
18
|
this.custodyConfig = custodyConfig;
|
|
19
|
+
this.syncType = syncType;
|
|
18
20
|
this.maxConcurrentRequests = maxConcurrentRequests;
|
|
19
21
|
// Compute activeRequestsByPeer from all batches internal states
|
|
20
22
|
for (const batch of batches) {
|
|
@@ -51,6 +53,9 @@ export class ChainPeersBalancer {
|
|
|
51
53
|
* Return peers with 0 or no active requests that has a higher target slot than this batch and has columns we need.
|
|
52
54
|
*/
|
|
53
55
|
idlePeerForBatch(batch) {
|
|
56
|
+
if (batch.state.status !== BatchStatus.AwaitingDownload) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
54
59
|
const eligiblePeers = this.filterPeers(batch, this.custodyConfig.sampledColumns, true);
|
|
55
60
|
// pick idle peer that has (for pre-fulu they are the same)
|
|
56
61
|
// - earliestAvailableSlot defined
|
|
@@ -67,6 +72,9 @@ export class ChainPeersBalancer {
|
|
|
67
72
|
}
|
|
68
73
|
filterPeers(batch, requestColumns, noActiveRequest) {
|
|
69
74
|
const eligiblePeers = [];
|
|
75
|
+
if (batch.state.status !== BatchStatus.AwaitingDownload) {
|
|
76
|
+
return eligiblePeers;
|
|
77
|
+
}
|
|
70
78
|
for (const peer of this.peers) {
|
|
71
79
|
const { earliestAvailableSlot, custodyGroups, target, peerId } = peer;
|
|
72
80
|
const activeRequest = this.activeRequestsByPeer.get(peerId) ?? 0;
|
|
@@ -81,6 +89,17 @@ export class ChainPeersBalancer {
|
|
|
81
89
|
if (target.slot < batch.request.startSlot) {
|
|
82
90
|
continue;
|
|
83
91
|
}
|
|
92
|
+
if (batch.isPostFulu() && this.syncType === RangeSyncType.Head) {
|
|
93
|
+
// for head sync, target slot is head slot and each peer may have a different head slot
|
|
94
|
+
// we don't want to retry a batch with a peer that's not as up-to-date as the previous peer
|
|
95
|
+
// see https://github.com/ChainSafe/lodestar/issues/8193
|
|
96
|
+
const blocks = batch.state.partialDownload?.blocks;
|
|
97
|
+
const lastBlock = blocks?.at(-1)?.block;
|
|
98
|
+
const lastBlockSlot = lastBlock?.message?.slot;
|
|
99
|
+
if (lastBlockSlot && lastBlockSlot > target.slot) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
84
103
|
if (!batch.isPostFulu()) {
|
|
85
104
|
// pre-fulu logic, we don't care columns and earliestAvailableSlot
|
|
86
105
|
eligiblePeers.push({ syncInfo: peer, columns: 0, hasEarliestAvailableSlots: false });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peerBalancer.js","sourceRoot":"","sources":["../../../../src/sync/range/utils/peerBalancer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAQ,WAAW,EAAC,MAAM,aAAa,CAAC;AAS/C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;
|
|
1
|
+
{"version":3,"file":"peerBalancer.js","sourceRoot":"","sources":["../../../../src/sync/range/utils/peerBalancer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAQ,WAAW,EAAC,MAAM,aAAa,CAAC;AAS/C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;OAGG;IACH,YACE,KAAqB,EACrB,OAAgB,EAChB,aAA4B,EAC5B,QAAuB,EACvB,qBAAqB,GAAG,uBAAuB;QAd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1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
2
|
import { Logger } from "@lodestar/utils";
|
|
3
|
+
import { BlockInput, NullBlockInput } from "../chain/blocks/types.js";
|
|
3
4
|
import { IBeaconChain } from "../chain/index.js";
|
|
4
5
|
import { Metrics } from "../metrics/index.js";
|
|
5
6
|
import { INetwork } from "../network/index.js";
|
|
7
|
+
import { PeerSyncMeta } from "../network/peers/peersData.js";
|
|
8
|
+
import { CustodyConfig } from "../util/dataColumns.js";
|
|
9
|
+
import { PeerIdStr } from "../util/peerId.js";
|
|
6
10
|
import { SyncOptions } from "./options.js";
|
|
7
11
|
export declare class UnknownBlockSync {
|
|
8
12
|
private readonly config;
|
|
@@ -21,6 +25,7 @@ export declare class UnknownBlockSync {
|
|
|
21
25
|
private subscribedToNetworkEvents;
|
|
22
26
|
private engineGetBlobsCache;
|
|
23
27
|
private blockInputsRetryTrackerCache;
|
|
28
|
+
private peerBalancer;
|
|
24
29
|
constructor(config: ChainForkConfig, network: INetwork, chain: IBeaconChain, logger: Logger, metrics: Metrics | null, opts?: SyncOptions | undefined);
|
|
25
30
|
subscribeToNetwork(): void;
|
|
26
31
|
unsubscribeFromNetwork(): void;
|
|
@@ -40,13 +45,15 @@ export declare class UnknownBlockSync {
|
|
|
40
45
|
private onUnknownParent;
|
|
41
46
|
/**
|
|
42
47
|
* When a blockInput comes with an unknown parent:
|
|
43
|
-
* - add the block to pendingBlocks with status downloaded
|
|
48
|
+
* - add the block to pendingBlocks with status downloaded or pending blockRootHex as key. This is similar to
|
|
44
49
|
* an `onUnknownBlock` event, but the blocks is downloaded.
|
|
45
50
|
* - add the parent root to pendingBlocks with status pending, parentBlockRootHex as key. This is
|
|
46
51
|
* the same to an `onUnknownBlock` event with parentBlockRootHex as root.
|
|
47
52
|
*/
|
|
48
53
|
private addUnknownParent;
|
|
49
54
|
private addUnknownBlock;
|
|
55
|
+
private onPeerConnected;
|
|
56
|
+
private onPeerDisconnected;
|
|
50
57
|
/**
|
|
51
58
|
* Gather tip parent blocks with unknown parent and do a search for all of them
|
|
52
59
|
*/
|
|
@@ -55,6 +62,7 @@ export declare class UnknownBlockSync {
|
|
|
55
62
|
/**
|
|
56
63
|
* Send block to the processor awaiting completition. If processed successfully, send all children to the processor.
|
|
57
64
|
* On error, remove and downscore all descendants.
|
|
65
|
+
* This function could run recursively for all descendant blocks
|
|
58
66
|
*/
|
|
59
67
|
private processBlock;
|
|
60
68
|
/**
|
|
@@ -63,7 +71,7 @@ export declare class UnknownBlockSync {
|
|
|
63
71
|
* - from deneb, fetch all missing blobs
|
|
64
72
|
* - from peerDAS, fetch sampled colmns
|
|
65
73
|
* TODO: this means we only have block root, and nothing else. Consider to reflect this in the function name
|
|
66
|
-
*
|
|
74
|
+
* prefulu, will attempt a max of `MAX_ATTEMPTS_PER_BLOCK` on different peers, postfulu we may attempt more as defined in `getMaxDownloadAttempts()` function
|
|
67
75
|
* Also verifies the received block root + returns the peer that provided the block for future downscoring.
|
|
68
76
|
*/
|
|
69
77
|
private fetchUnknownBlockRoot;
|
|
@@ -71,8 +79,7 @@ export declare class UnknownBlockSync {
|
|
|
71
79
|
* We have partial block input:
|
|
72
80
|
* - we have block but not have all blobs (deneb) or needed columns (fulu)
|
|
73
81
|
* - we don't have block and have some blobs (deneb) or some columns (fulu)
|
|
74
|
-
* Fetches missing
|
|
75
|
-
* along with the blobs (i.e. only some blobs are available)
|
|
82
|
+
* Fetches missing block/data columns/block for the blockinput. This function returns either preData or availableData BlockInput.
|
|
76
83
|
*/
|
|
77
84
|
private fetchUnavailableBlockInput;
|
|
78
85
|
/**
|
|
@@ -83,5 +90,40 @@ export declare class UnknownBlockSync {
|
|
|
83
90
|
*/
|
|
84
91
|
private removeAndDownscoreAllDescendants;
|
|
85
92
|
private removeAllDescendants;
|
|
93
|
+
private getMaxDownloadAttempts;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Class to track active byRoots requests and balance them across eligible peers.
|
|
97
|
+
*/
|
|
98
|
+
export declare class UnknownBlockPeerBalancer {
|
|
99
|
+
readonly peersMeta: Map<PeerIdStr, PeerSyncMeta>;
|
|
100
|
+
readonly activeRequests: Map<PeerIdStr, number>;
|
|
101
|
+
private readonly custodyConfig;
|
|
102
|
+
constructor(custodyConfig: CustodyConfig);
|
|
103
|
+
/** Trigger on each peer re-status */
|
|
104
|
+
onPeerConnected(peerId: PeerIdStr, syncMeta: PeerSyncMeta): void;
|
|
105
|
+
onPeerDisconnected(peerId: PeerIdStr): void;
|
|
106
|
+
/**
|
|
107
|
+
* called from fetchUnknownBlockRoot() where we only have block root and nothing else
|
|
108
|
+
* excludedPeers are the peers that we requested already so we don't want to try again
|
|
109
|
+
* pendingColumns is empty for prefulu, or the 1st time we we download a block by root
|
|
110
|
+
*/
|
|
111
|
+
bestPeerForPendingColumns(pendingColumns: Set<number> | null, excludedPeers: Set<PeerIdStr>): PeerSyncMeta | null;
|
|
112
|
+
/**
|
|
113
|
+
* called from fetchUnavailableBlockInput() where we have either BlockInput or NullBlockInput
|
|
114
|
+
* excludedPeers are the peers that we requested already so we don't want to try again
|
|
115
|
+
*/
|
|
116
|
+
bestPeerForBlockInput(unavailableBlockInput: BlockInput | NullBlockInput, excludedPeers: Set<PeerIdStr>): PeerSyncMeta | null;
|
|
117
|
+
/**
|
|
118
|
+
* Consumers don't need to call this method directly, it is called internally by bestPeer*() methods
|
|
119
|
+
* make this public for testing
|
|
120
|
+
*/
|
|
121
|
+
onRequest(peerId: PeerIdStr): void;
|
|
122
|
+
/**
|
|
123
|
+
* Consumers should call this method when a request is completed for a peer.
|
|
124
|
+
*/
|
|
125
|
+
onRequestCompleted(peerId: PeerIdStr): void;
|
|
126
|
+
getTotalActiveRequests(): number;
|
|
127
|
+
private filterPeers;
|
|
86
128
|
}
|
|
87
129
|
//# sourceMappingURL=unknownBlock.d.ts.map
|