@lodestar/beacon-node 1.49.0-dev.126f2989bc → 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/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +4 -2
- 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 +2 -1
- 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/interface.d.ts +1 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +9 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +23 -0
- 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/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/sync/types.d.ts +0 -2
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +0 -2
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +41 -13
- package/lib/sync/unknownBlock.js.map +1 -1
- package/package.json +15 -14
- package/src/chain/archiveStore/archiveStore.ts +4 -2
- package/src/chain/archiveStore/historicalState/metrics.ts +3 -2
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
- package/src/chain/interface.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +24 -0
- package/src/metrics/metrics.ts +7 -2
- package/src/network/reqresp/handlers/index.ts +49 -5
- package/src/sync/types.ts +0 -2
- package/src/sync/unknownBlock.ts +41 -13
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -227,8 +227,11 @@ export class BlockInputSync {
|
|
|
227
227
|
private onUnknownBlockRoot = (data: ChainEventData[ChainEvent.unknownBlockRoot]): void => {
|
|
228
228
|
try {
|
|
229
229
|
const isNewRoot = this.addByRootHex(data.rootHex, data.peer);
|
|
230
|
-
|
|
230
|
+
// A retained entry (an earlier download failed, #10018) is not new but still needs a retry pass.
|
|
231
|
+
if (this.pendingBlocks.get(data.rootHex)?.status === PendingBlockInputStatus.pending) {
|
|
231
232
|
this.triggerUnknownBlockSearch();
|
|
233
|
+
}
|
|
234
|
+
if (isNewRoot) {
|
|
232
235
|
this.metrics?.blockInputSync.requests.inc({type: PendingBlockType.UNKNOWN_BLOCK_ROOT});
|
|
233
236
|
this.metrics?.blockInputSync.source.inc({source: data.source});
|
|
234
237
|
}
|
|
@@ -393,12 +396,21 @@ export class BlockInputSync {
|
|
|
393
396
|
}
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
let
|
|
399
|
+
let belowFinalizedBlocks = 0;
|
|
400
|
+
let agedOutBlocks = 0;
|
|
397
401
|
for (const [rootHex, block] of this.pendingBlocks) {
|
|
398
402
|
const slot = getBlockInputSyncCacheItemSlot(block);
|
|
399
|
-
if (typeof slot
|
|
403
|
+
if (typeof slot !== "number") {
|
|
404
|
+
// we may not be able to download a root, hence there is no slot for it
|
|
405
|
+
if (nowSec - block.timeAddedSec > maxSecInCache) {
|
|
406
|
+
this.pendingBlocks.delete(rootHex);
|
|
407
|
+
agedOutBlocks++;
|
|
408
|
+
}
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (slot < finalizedSlot) {
|
|
400
412
|
this.pendingBlocks.delete(rootHex);
|
|
401
|
-
|
|
413
|
+
belowFinalizedBlocks++;
|
|
402
414
|
}
|
|
403
415
|
}
|
|
404
416
|
|
|
@@ -411,16 +423,20 @@ export class BlockInputSync {
|
|
|
411
423
|
if (agedOutPayloads > 0) {
|
|
412
424
|
this.metrics?.blockInputSync.removedPayloads.inc({reason: DroppedItemReason.agedOut}, agedOutPayloads);
|
|
413
425
|
}
|
|
414
|
-
if (
|
|
415
|
-
this.metrics?.blockInputSync.removedBlocks.inc({reason: DroppedItemReason.belowFinalized},
|
|
426
|
+
if (belowFinalizedBlocks > 0) {
|
|
427
|
+
this.metrics?.blockInputSync.removedBlocks.inc({reason: DroppedItemReason.belowFinalized}, belowFinalizedBlocks);
|
|
428
|
+
}
|
|
429
|
+
if (agedOutBlocks > 0) {
|
|
430
|
+
this.metrics?.blockInputSync.removedBlocks.inc({reason: DroppedItemReason.agedOut}, agedOutBlocks);
|
|
416
431
|
}
|
|
417
432
|
|
|
418
|
-
this.logger.debug("BlockInputSync.pruneFinalized dropped
|
|
433
|
+
this.logger.debug("BlockInputSync.pruneFinalized dropped stale pending items", {
|
|
419
434
|
finalizedSlot,
|
|
420
435
|
finalizedRoot: checkpoint.rootHex,
|
|
421
436
|
belowFinalizedPayloads,
|
|
422
437
|
agedOutPayloads,
|
|
423
|
-
|
|
438
|
+
belowFinalizedBlocks,
|
|
439
|
+
agedOutBlocks,
|
|
424
440
|
unresolvedSlotPayloads,
|
|
425
441
|
});
|
|
426
442
|
};
|
|
@@ -973,7 +989,12 @@ export class BlockInputSync {
|
|
|
973
989
|
if (!res.err) {
|
|
974
990
|
this.metrics?.blockInputSync.downloadedBlocksSuccess.inc();
|
|
975
991
|
const pending = res.result;
|
|
976
|
-
this
|
|
992
|
+
// pruning may have deleted this entry while we were awaiting the network, do not resurrect it via the set below
|
|
993
|
+
if (!this.pendingBlocks.has(rootHex)) {
|
|
994
|
+
this.logger.verbose("Dropping downloaded block, entry pruned during fetch", logCtx);
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
this.pendingBlocks.set(rootHex, pending);
|
|
977
998
|
const blockSlot = pending.blockInput.slot;
|
|
978
999
|
const finalizedSlot = this.chain.forkChoice.getFinalizedBlock().slot;
|
|
979
1000
|
const delaySec = Date.now() / 1000 - computeTimeAtSlot(this.config, blockSlot, this.chain.genesisTime);
|
|
@@ -1035,8 +1056,11 @@ export class BlockInputSync {
|
|
|
1035
1056
|
}
|
|
1036
1057
|
|
|
1037
1058
|
this.metrics?.blockInputSync.downloadedBlocksError.inc();
|
|
1038
|
-
this.logger.debug("
|
|
1039
|
-
this.
|
|
1059
|
+
this.logger.debug("Failed to download unknown block root, retained for retry", logCtx, res.err);
|
|
1060
|
+
const pendingBlock = this.pendingBlocks.get(rootHex);
|
|
1061
|
+
if (pendingBlock && pendingBlock.status === PendingBlockInputStatus.fetching) {
|
|
1062
|
+
pendingBlock.status = PendingBlockInputStatus.pending;
|
|
1063
|
+
}
|
|
1040
1064
|
}
|
|
1041
1065
|
}
|
|
1042
1066
|
|
|
@@ -1303,7 +1327,7 @@ export class BlockInputSync {
|
|
|
1303
1327
|
}
|
|
1304
1328
|
|
|
1305
1329
|
this.metrics?.blockInputSync.downloadedPayloadsResult.inc({result: DownloadResult.Failed});
|
|
1306
|
-
this.logger.debug("
|
|
1330
|
+
this.logger.debug("Failed to download unknown payload root, retained for retry", logCtx, res.err);
|
|
1307
1331
|
if (!isPendingPayloadEnvelope(payload)) {
|
|
1308
1332
|
payload.status = PendingPayloadInputStatus.pending;
|
|
1309
1333
|
}
|
|
@@ -1763,7 +1787,11 @@ export class BlockInputSync {
|
|
|
1763
1787
|
this.peerBalancer.onRequestCompleted(peerId);
|
|
1764
1788
|
}
|
|
1765
1789
|
|
|
1766
|
-
|
|
1790
|
+
const cacheItemRootHex = getBlockInputSyncCacheItemRootHex(cacheItem);
|
|
1791
|
+
// pruning may have dropped it mid-fetch
|
|
1792
|
+
if (this.pendingBlocks.has(cacheItemRootHex)) {
|
|
1793
|
+
this.pendingBlocks.set(cacheItemRootHex, cacheItem);
|
|
1794
|
+
}
|
|
1767
1795
|
|
|
1768
1796
|
if (cacheItem.status === PendingBlockInputStatus.downloaded) {
|
|
1769
1797
|
// download was successful, no need to go with another peer, return
|