@lodestar/beacon-node 2.1.0-dev.5f507dce39 → 2.1.0-dev.6f6f023ffd
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 +8 -0
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +3 -2
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/validator/index.js +1 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -5
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +4 -2
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +24 -5
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +11 -2
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +181 -13
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +9 -3
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +22 -16
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -0
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +11 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +28 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +4 -2
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +8 -5
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/network/forks.d.ts +2 -2
- package/lib/network/forks.d.ts.map +1 -1
- package/lib/network/forks.js +3 -3
- package/lib/network/forks.js.map +1 -1
- package/lib/network/gossip/scoringParameters.js +19 -14
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +15 -7
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +3 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +1 -0
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +5 -1
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +14 -1
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +6 -0
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +17 -8
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +1 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js +6 -1
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/package.json +16 -19
- package/src/api/impl/beacon/pool/index.ts +11 -0
- package/src/api/impl/beacon/state/index.ts +3 -7
- package/src/api/impl/beacon/state/utils.ts +1 -1
- package/src/api/impl/validator/index.ts +1 -1
- package/src/chain/blocks/importBlock.ts +14 -7
- package/src/chain/blocks/importExecutionPayload.ts +4 -2
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +8 -1
- package/src/chain/chain.ts +29 -5
- package/src/chain/forkChoice/index.ts +235 -13
- package/src/chain/opPools/opPool.ts +27 -16
- package/src/chain/options.ts +1 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +28 -2
- package/src/chain/validation/attestation.ts +4 -2
- package/src/chain/validation/block.ts +8 -5
- package/src/network/forks.ts +7 -3
- package/src/network/gossip/scoringParameters.ts +23 -14
- package/src/network/processor/gossipHandlers.ts +28 -15
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -1
- package/src/sync/range/chain.ts +1 -0
- package/src/sync/range/range.ts +7 -1
- package/src/sync/unknownBlock.ts +20 -1
- package/src/sync/utils/downloadByRange.ts +30 -7
- package/src/sync/utils/downloadByRoot.ts +12 -9
- package/src/sync/utils/pendingBlocksTree.ts +6 -1
|
@@ -183,7 +183,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
183
183
|
blockRootHex: RootHex,
|
|
184
184
|
fork: ForkName,
|
|
185
185
|
peerIdStr: string,
|
|
186
|
-
seenTimestampSec: number
|
|
186
|
+
seenTimestampSec: number,
|
|
187
|
+
opts?: {unvalidated?: boolean}
|
|
187
188
|
): BlockInput {
|
|
188
189
|
const blockInput = chain.seenBlockInputCache.getByBlock({
|
|
189
190
|
block: signedBlock,
|
|
@@ -196,15 +197,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
196
197
|
// Also seed the payload-envelope cache, so we have PayloadEnvelopeInput even through "PARENT_BLOCK_UNKNOWN" error
|
|
197
198
|
// see https://github.com/ChainSafe/lodestar/issues/9475
|
|
198
199
|
if (isForkPostGloas(fork)) {
|
|
199
|
-
chain.seenPayloadEnvelopeInputCache.add(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
chain.seenPayloadEnvelopeInputCache.add(
|
|
201
|
+
{
|
|
202
|
+
blockRootHex,
|
|
203
|
+
block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
|
|
204
|
+
forkName: fork,
|
|
205
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
206
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
207
|
+
seenTimestampSec,
|
|
208
|
+
source: PayloadEnvelopeInputSource.gossip,
|
|
209
|
+
},
|
|
210
|
+
opts
|
|
211
|
+
);
|
|
208
212
|
}
|
|
209
213
|
|
|
210
214
|
return blockInput;
|
|
@@ -300,7 +304,9 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
300
304
|
}
|
|
301
305
|
chain.seenBlockProposers.add(slot, proposerIndex, blockRootHex);
|
|
302
306
|
|
|
303
|
-
const blockInput = cacheSignatureVerifiedBlock(signedBlock, blockRootHex, fork, peerIdStr, seenTimestampSec
|
|
307
|
+
const blockInput = cacheSignatureVerifiedBlock(signedBlock, blockRootHex, fork, peerIdStr, seenTimestampSec, {
|
|
308
|
+
unvalidated: true,
|
|
309
|
+
});
|
|
304
310
|
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
305
311
|
blockInput,
|
|
306
312
|
peer: peerIdStr,
|
|
@@ -575,7 +581,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
575
581
|
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
576
582
|
metrics?.gossipBlock.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
|
|
577
583
|
chain.validatorMonitor?.registerBeaconBlock(OpSource.gossip, delaySec, signedBlock.message);
|
|
578
|
-
|
|
584
|
+
const missingData = !blockInput.hasBlockAndAllData();
|
|
585
|
+
if (missingData) {
|
|
579
586
|
chain.logger.debug("Received gossip block, attempting fetch of unavailable data", blockInput.getLogMeta());
|
|
580
587
|
// The data is not yet fully available, immediately trigger an aggressive pull via unknown block sync
|
|
581
588
|
chain.emitter.emit(ChainEvent.incompleteBlockInput, {
|
|
@@ -668,8 +675,13 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
668
675
|
}
|
|
669
676
|
metrics?.gossipBlock.processBlockErrors.inc({error: e instanceof BlockError ? e.type.code : "NOT_BLOCK_ERROR"});
|
|
670
677
|
logger[logLevel]("Error processing block", {slot, root: blockInput.blockRootHex, peer: peerIdStr}, e as Error);
|
|
671
|
-
//
|
|
672
|
-
|
|
678
|
+
// BlockInputSync retries the import of a block with missing data from this same BlockInput, pruning it here
|
|
679
|
+
// would put later gossip columns into a new BlockInput that is never imported. The entry is released once the
|
|
680
|
+
// block is persisted, BlockInputSync removes it, on finalization or by the cache size limit
|
|
681
|
+
if (!missingData) {
|
|
682
|
+
// TODO(fulu): Revisit when we prune block inputs
|
|
683
|
+
chain.seenBlockInputCache.prune(blockInput.blockRootHex);
|
|
684
|
+
}
|
|
673
685
|
});
|
|
674
686
|
}
|
|
675
687
|
|
|
@@ -721,7 +733,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
721
733
|
e.type.root,
|
|
722
734
|
topic.boundary.fork,
|
|
723
735
|
peerIdStr,
|
|
724
|
-
seenTimestampSec
|
|
736
|
+
seenTimestampSec,
|
|
737
|
+
{unvalidated: false}
|
|
725
738
|
);
|
|
726
739
|
// We're returning IGNORE (thrown below), so this block is not forwarded to peers. Unlike the
|
|
727
740
|
// happy path there is no rush to forward, so we don't need to wrap in callInNextEventLoop.
|
|
@@ -226,5 +226,8 @@ export function validateDataColumnSidecarsByRangeRequest(
|
|
|
226
226
|
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
// Spec: sidecars MUST be sent in (slot, column_index) order, so serve each requested column once, ascending
|
|
230
|
+
const sortedColumns = Array.from(new Set(columns)).sort((a, b) => a - b);
|
|
231
|
+
|
|
232
|
+
return {startSlot, count, columns: sortedColumns};
|
|
230
233
|
}
|
package/src/sync/range/chain.ts
CHANGED
|
@@ -627,6 +627,7 @@ export class SyncChain {
|
|
|
627
627
|
case DownloadByRangeErrorCode.INVALID_ENVELOPE_BLOCK_HASH:
|
|
628
628
|
case DownloadByRangeErrorCode.INVALID_ENVELOPE_SLOT:
|
|
629
629
|
case DownloadByRangeErrorCode.INVALID_CHAIN_SEGMENT:
|
|
630
|
+
case DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS:
|
|
630
631
|
case DataColumnSidecarErrorCode.INCORRECT_KZG_COMMITMENTS_COUNT:
|
|
631
632
|
case DataColumnSidecarErrorCode.INCORRECT_KZG_PROOF_COUNT:
|
|
632
633
|
case DataColumnSidecarErrorCode.INVALID_KZG_PROOF_BATCH:
|
package/src/sync/range/range.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {EventEmitter} from "node:events";
|
|
2
2
|
import {StrictEventEmitter} from "strict-event-emitter-types";
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
|
+
import {isForkPostGloas} from "@lodestar/params";
|
|
4
5
|
import {IBeaconStateViewGloas, computeStartSlotAtEpoch, isStatePostGloas} from "@lodestar/state-transition";
|
|
5
6
|
import {Epoch, Status, fulu, ssz} from "@lodestar/types";
|
|
6
7
|
import {Logger, byteArrayEquals, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
|
|
@@ -434,7 +435,12 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
|
|
|
434
435
|
// the batch then downloads the head's payload as dangling parent and validates it against the bid
|
|
435
436
|
const headState = this.chain.getHeadState();
|
|
436
437
|
let parentPayload: ParentPayload | undefined;
|
|
437
|
-
|
|
438
|
+
// A pre-Gloas head block in a state upgraded to Gloas carried its own payload, no envelope follows it
|
|
439
|
+
if (
|
|
440
|
+
isStatePostGloas(headState) &&
|
|
441
|
+
headState.latestBlockHeader.slot > 0 &&
|
|
442
|
+
isForkPostGloas(this.config.getForkName(headState.latestBlockHeader.slot))
|
|
443
|
+
) {
|
|
438
444
|
const header = ssz.phase0.BeaconBlockHeader.clone(headState.latestBlockHeader);
|
|
439
445
|
if (byteArrayEquals(header.stateRoot, ssz.Root.defaultValue())) {
|
|
440
446
|
header.stateRoot = headState.hashTreeRoot();
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -928,6 +928,19 @@ export class BlockInputSync {
|
|
|
928
928
|
const connectedPeers = this.network.getConnectedPeers();
|
|
929
929
|
const hasConnectedPeers = connectedPeers.length > 0;
|
|
930
930
|
|
|
931
|
+
// Gossip, getBlobs or column reconstruction can complete a pending block's data through the shared BlockInput.
|
|
932
|
+
// With only half the columns the block stays pending, its fetch asks a peer for the rest before reconstructing
|
|
933
|
+
for (const block of this.pendingBlocks.values()) {
|
|
934
|
+
if (
|
|
935
|
+
isPendingBlockInput(block) &&
|
|
936
|
+
block.status === PendingBlockInputStatus.pending &&
|
|
937
|
+
block.blockInput.hasBlockAndAllData() &&
|
|
938
|
+
(!isBlockInputColumns(block.blockInput) || block.blockInput.hasComputedAllData())
|
|
939
|
+
) {
|
|
940
|
+
block.status = PendingBlockInputStatus.downloaded;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
931
944
|
const {unknowns, ancestors} = getUnknownAndAncestorBlocks(this.pendingBlocks);
|
|
932
945
|
let processedBlocks = 0;
|
|
933
946
|
let shouldRerunBlockSearch = false;
|
|
@@ -2201,7 +2214,13 @@ export class BlockInputSync {
|
|
|
2201
2214
|
const cacheItemRootHex = getBlockInputSyncCacheItemRootHex(cacheItem);
|
|
2202
2215
|
// pruning may have dropped it mid-fetch
|
|
2203
2216
|
if (this.pendingBlocks.has(cacheItemRootHex)) {
|
|
2204
|
-
|
|
2217
|
+
// A partial download stays fetching while the next peer is asked, a pending entry would be fetched again
|
|
2218
|
+
this.pendingBlocks.set(
|
|
2219
|
+
cacheItemRootHex,
|
|
2220
|
+
cacheItem.status === PendingBlockInputStatus.pending
|
|
2221
|
+
? {...cacheItem, status: PendingBlockInputStatus.fetching}
|
|
2222
|
+
: cacheItem
|
|
2223
|
+
);
|
|
2205
2224
|
}
|
|
2206
2225
|
|
|
2207
2226
|
if (cacheItem.status === PendingBlockInputStatus.downloaded) {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ForkName,
|
|
4
|
+
ForkPostDeneb,
|
|
5
|
+
ForkPostFulu,
|
|
6
|
+
ForkPostGloas,
|
|
7
|
+
isForkPostDeneb,
|
|
8
|
+
isForkPostFulu,
|
|
9
|
+
isForkPostGloas,
|
|
10
|
+
} from "@lodestar/params";
|
|
11
|
+
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
3
12
|
import {
|
|
4
13
|
ColumnIndex,
|
|
5
14
|
DataColumnSidecar,
|
|
@@ -28,6 +37,7 @@ import {INetwork} from "../../network/index.js";
|
|
|
28
37
|
import {CustodyConfig, getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
29
38
|
import {PeerIdStr} from "../../util/peerId.js";
|
|
30
39
|
import {WarnResult} from "../../util/wrapError.js";
|
|
40
|
+
import {getRateLimitedUntilMs} from "./rateLimit.js";
|
|
31
41
|
|
|
32
42
|
export type DownloadByRangeRequests = {
|
|
33
43
|
blocksRequest?: phase0.BeaconBlocksByRangeRequest;
|
|
@@ -327,6 +337,8 @@ export async function downloadByRange({
|
|
|
327
337
|
parentPayloadRequest,
|
|
328
338
|
});
|
|
329
339
|
} catch (err) {
|
|
340
|
+
// Rethrow rate limit errors as is, so range sync can back off from the peer instead of counting a failed download
|
|
341
|
+
if (getRateLimitedUntilMs(err) !== null) throw err;
|
|
330
342
|
throw new DownloadByRangeError({
|
|
331
343
|
code: DownloadByRangeErrorCode.REQ_RESP_ERROR,
|
|
332
344
|
reason: (err as Error).message,
|
|
@@ -697,6 +709,15 @@ export function validateBlockByRangeResponse(
|
|
|
697
709
|
|
|
698
710
|
for (let i = 0; i < blocks.length; i++) {
|
|
699
711
|
const block = blocks[i];
|
|
712
|
+
const slot = block.message.slot;
|
|
713
|
+
const fork = config.getForkName(slot);
|
|
714
|
+
if (isForkPostDeneb(fork)) {
|
|
715
|
+
const count = getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostDeneb>).length;
|
|
716
|
+
const limit = config.getMaxBlobsPerBlock(computeEpochAtSlot(slot));
|
|
717
|
+
if (count > limit) {
|
|
718
|
+
throw new DownloadByRangeError({code: DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS, slot, count, limit});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
700
721
|
const blockRoot = type.hashTreeRoot(block.message);
|
|
701
722
|
response.push({block, blockRoot});
|
|
702
723
|
|
|
@@ -825,12 +846,7 @@ export async function validateColumnsByRangeResponse(
|
|
|
825
846
|
}
|
|
826
847
|
|
|
827
848
|
seenSlotColumns.set(columnSidecar.index, columnSidecar);
|
|
828
|
-
|
|
829
|
-
// a new slot has started, reset index
|
|
830
|
-
currentIndex = -1;
|
|
831
|
-
} else {
|
|
832
|
-
currentIndex = columnSidecar.index;
|
|
833
|
-
}
|
|
849
|
+
currentIndex = columnSidecar.index;
|
|
834
850
|
currentSlot = slot;
|
|
835
851
|
}
|
|
836
852
|
|
|
@@ -1030,6 +1046,7 @@ export enum DownloadByRangeErrorCode {
|
|
|
1030
1046
|
|
|
1031
1047
|
PARENT_ROOT_MISMATCH = "DOWNLOAD_BY_RANGE_ERROR_PARENT_ROOT_MISMATCH",
|
|
1032
1048
|
EXTRA_BLOCKS = "DOWNLOAD_BY_RANGE_ERROR_EXTRA_BLOCKS",
|
|
1049
|
+
TOO_MANY_KZG_COMMITMENTS = "DOWNLOAD_BY_RANGE_ERROR_TOO_MANY_KZG_COMMITMENTS",
|
|
1033
1050
|
OUT_OF_RANGE_BLOCKS = "DOWNLOAD_BY_RANGE_OUT_OF_RANGE_BLOCKS",
|
|
1034
1051
|
OUT_OF_ORDER_BLOCKS = "DOWNLOAD_BY_RANGE_OUT_OF_ORDER_BLOCKS",
|
|
1035
1052
|
|
|
@@ -1072,6 +1089,12 @@ export type DownloadByRangeErrorType =
|
|
|
1072
1089
|
columnSidecarCount: number;
|
|
1073
1090
|
payloadEnvelopeCount: number;
|
|
1074
1091
|
}
|
|
1092
|
+
| {
|
|
1093
|
+
code: DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS;
|
|
1094
|
+
slot: Slot;
|
|
1095
|
+
count: number;
|
|
1096
|
+
limit: number;
|
|
1097
|
+
}
|
|
1075
1098
|
| {
|
|
1076
1099
|
code: DownloadByRangeErrorCode.OUT_OF_RANGE_BLOCKS;
|
|
1077
1100
|
slot: number;
|
|
@@ -104,15 +104,18 @@ export async function downloadByRoot({
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (isForkPostGloas(blockInput.forkName)) {
|
|
107
|
-
chain.seenPayloadEnvelopeInputCache.add(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
chain.seenPayloadEnvelopeInputCache.add(
|
|
108
|
+
{
|
|
109
|
+
blockRootHex: rootHex,
|
|
110
|
+
block: blockInput.getBlock() as SignedBeaconBlock<ForkPostGloas>,
|
|
111
|
+
forkName: blockInput.forkName,
|
|
112
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
113
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
114
|
+
seenTimestampSec: Date.now() / 1000,
|
|
115
|
+
source: PayloadEnvelopeInputSource.byRoot,
|
|
116
|
+
},
|
|
117
|
+
{unvalidated: true}
|
|
118
|
+
);
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
// Like range sync, download every sampled column, half of them only counts as available for reconstruction
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {RootHex} from "@lodestar/types";
|
|
2
2
|
import {MapDef} from "@lodestar/utils";
|
|
3
|
+
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
3
4
|
import {
|
|
4
5
|
BlockInputSyncCacheItem,
|
|
5
6
|
PendingBlockInput,
|
|
@@ -61,9 +62,13 @@ export function getUnknownAndAncestorBlocks(blocks: Map<RootHex, BlockInputSyncC
|
|
|
61
62
|
const ancestors = new Map<RootHex, PendingBlockInput>();
|
|
62
63
|
|
|
63
64
|
for (const block of blocks.values()) {
|
|
65
|
+
// Half the columns counts as all data, but a pending block is only complete with all sampled columns
|
|
64
66
|
if (
|
|
65
67
|
block.status === PendingBlockInputStatus.pending &&
|
|
66
|
-
(isPendingBlockInput(block)
|
|
68
|
+
(isPendingBlockInput(block)
|
|
69
|
+
? !block.blockInput.hasBlockAndAllData() ||
|
|
70
|
+
(isBlockInputColumns(block.blockInput) && !block.blockInput.hasComputedAllData())
|
|
71
|
+
: true)
|
|
67
72
|
) {
|
|
68
73
|
unknowns.set(getBlockInputSyncCacheItemRootHex(block), block);
|
|
69
74
|
} else if (
|