@lodestar/beacon-node 1.52.0-dev.0e16c08e28 → 1.52.0-dev.119f1f9fe6
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/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +2 -4
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +9 -5
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +6 -1
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +45 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +265 -69
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -0
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +23 -15
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +17 -2
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +21 -5
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +39 -6
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/execution/engine/blockHash.d.ts +12 -0
- package/lib/execution/engine/blockHash.d.ts.map +1 -0
- package/lib/execution/engine/blockHash.js +17 -0
- package/lib/execution/engine/blockHash.js.map +1 -0
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -6
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +6 -1
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +7 -2
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +5 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +5 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/sync/range/batch.d.ts +4 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +12 -0
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +17 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +52 -19
- 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 +1 -0
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +20 -4
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +31 -13
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
- package/lib/sync/range/utils/peerBalancer.js +5 -2
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/types.d.ts +2 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +60 -19
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +8 -0
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +43 -23
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/util/dataColumns.d.ts +1 -1
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +4 -1
- package/lib/util/dataColumns.js.map +1 -1
- package/package.json +17 -17
- package/src/api/impl/validator/index.ts +2 -4
- package/src/chain/archiveStore/utils/archiveBlocks.ts +1 -1
- package/src/chain/chain.ts +9 -5
- package/src/chain/errors/executionPayloadBid.ts +6 -0
- package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
- package/src/chain/prepareNextSlot.ts +347 -89
- package/src/chain/produceBlock/produceBlockBody.ts +25 -16
- package/src/chain/validation/executionPayloadBid.ts +20 -2
- package/src/chain/validation/executionPayloadEnvelope.ts +28 -5
- package/src/chain/validation/voluntaryExit.ts +44 -6
- package/src/execution/engine/blockHash.ts +27 -0
- package/src/execution/engine/mock.ts +13 -8
- package/src/execution/engine/payloadIdCache.ts +12 -4
- package/src/metrics/metrics/beacon.ts +9 -0
- package/src/metrics/metrics/lodestar.ts +5 -0
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +1 -1
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
- package/src/sync/range/batch.ts +13 -0
- package/src/sync/range/chain.ts +64 -17
- package/src/sync/range/range.ts +1 -0
- package/src/sync/range/utils/batches.ts +38 -13
- package/src/sync/range/utils/peerBalancer.ts +4 -1
- package/src/sync/types.ts +2 -0
- package/src/sync/unknownBlock.ts +65 -21
- package/src/sync/utils/downloadByRange.ts +60 -26
- package/src/util/dataColumns.ts +4 -1
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -1501,10 +1501,22 @@ export class BlockInputSync {
|
|
|
1501
1501
|
return;
|
|
1502
1502
|
}
|
|
1503
1503
|
if (validationResult.err) {
|
|
1504
|
+
const err = validationResult.err;
|
|
1505
|
+
const {envelopePeerId} = pendingPayload;
|
|
1506
|
+
// Same penalties as for an envelope validated right after download in fetchPayloadInput
|
|
1507
|
+
if (
|
|
1508
|
+
envelopePeerId !== undefined &&
|
|
1509
|
+
err instanceof ExecutionPayloadEnvelopeError &&
|
|
1510
|
+
(pendingPayload.envelope.message.payload.slotNumber !== payloadInput.slot ||
|
|
1511
|
+
toRootHex(pendingPayload.envelope.message.payload.blockHash) !== payloadInput.getBlockHashHex())
|
|
1512
|
+
) {
|
|
1513
|
+
this.network.reportPeer(envelopePeerId, PeerAction.LowToleranceError, err.type.code);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1504
1516
|
this.logger.debug(
|
|
1505
1517
|
"Pending payload envelope failed validation after block import, refetching by root",
|
|
1506
1518
|
{slot: pendingPayload.envelope.message.payload.slotNumber, root: rootHex},
|
|
1507
|
-
|
|
1519
|
+
err
|
|
1508
1520
|
);
|
|
1509
1521
|
|
|
1510
1522
|
const pendingPayloadByRoot: PendingPayloadRootHex = {
|
|
@@ -1514,6 +1526,10 @@ export class BlockInputSync {
|
|
|
1514
1526
|
timeAddedSec: pendingPayload.timeAddedSec,
|
|
1515
1527
|
peerIdStrings: new Set(pendingPayload.peerIdStrings),
|
|
1516
1528
|
};
|
|
1529
|
+
// Do not prefer the peer whose envelope just failed validation
|
|
1530
|
+
if (envelopePeerId !== undefined) {
|
|
1531
|
+
pendingPayloadByRoot.peerIdStrings.delete(envelopePeerId);
|
|
1532
|
+
}
|
|
1517
1533
|
this.pendingPayloads.set(rootHex, pendingPayloadByRoot);
|
|
1518
1534
|
|
|
1519
1535
|
if (this.network.getConnectedPeers().length > 0) {
|
|
@@ -1722,6 +1738,8 @@ export class BlockInputSync {
|
|
|
1722
1738
|
? cacheItem.payloadInput
|
|
1723
1739
|
: await this.chain.seenPayloadEnvelopeInputCache.getOrReload(rootHex);
|
|
1724
1740
|
let envelope = payloadInput?.hasPayloadEnvelope() ? payloadInput.getPayloadEnvelope() : undefined;
|
|
1741
|
+
// An envelope downloaded in an earlier attempt is validated with the peer of a later one
|
|
1742
|
+
let envelopePeerId: PeerIdStr | undefined;
|
|
1725
1743
|
|
|
1726
1744
|
const fetchStartSec = Date.now() / 1000;
|
|
1727
1745
|
if (typeof slot === "number") {
|
|
@@ -1769,6 +1787,7 @@ export class BlockInputSync {
|
|
|
1769
1787
|
try {
|
|
1770
1788
|
if (!envelope) {
|
|
1771
1789
|
envelope = await this.fetchExecutionPayloadEnvelope(peerId, blockRoot, rootHex);
|
|
1790
|
+
envelopePeerId = peerId;
|
|
1772
1791
|
cacheItem.peerIdStrings.add(peerId);
|
|
1773
1792
|
const slotWasUnknown = typeof slot !== "number";
|
|
1774
1793
|
slot = envelope.message.payload.slotNumber;
|
|
@@ -1792,6 +1811,7 @@ export class BlockInputSync {
|
|
|
1792
1811
|
return {
|
|
1793
1812
|
status: PendingPayloadInputStatus.waitingForBlock,
|
|
1794
1813
|
envelope,
|
|
1814
|
+
envelopePeerId,
|
|
1795
1815
|
timeAddedSec: cacheItem.timeAddedSec,
|
|
1796
1816
|
peerIdStrings: cacheItem.peerIdStrings,
|
|
1797
1817
|
};
|
|
@@ -1877,24 +1897,39 @@ export class BlockInputSync {
|
|
|
1877
1897
|
excludedPeers.add(peerId);
|
|
1878
1898
|
}
|
|
1879
1899
|
|
|
1900
|
+
// Honest peers serve the requested root and columns, and every path that stores payload columns verifies them
|
|
1901
|
+
if (e instanceof DownloadByRootError || e instanceof DataColumnSidecarValidationError) {
|
|
1902
|
+
this.network.reportPeer(peerId, PeerAction.LowToleranceError, e.type.code);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1880
1905
|
if (e instanceof ExecutionPayloadEnvelopeError) {
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1906
|
+
// Range sync stores an envelope after checking only its root, slot and block hash, so an honest peer may
|
|
1907
|
+
// serve one that fails the other checks. Compared directly since validation stops at the first failure.
|
|
1908
|
+
if (
|
|
1909
|
+
envelope !== undefined &&
|
|
1910
|
+
payloadInput &&
|
|
1911
|
+
(envelope.message.payload.slotNumber !== payloadInput.slot ||
|
|
1912
|
+
toRootHex(envelope.message.payload.blockHash) !== payloadInput.getBlockHashHex())
|
|
1913
|
+
) {
|
|
1914
|
+
if (envelopePeerId !== undefined) {
|
|
1915
|
+
this.network.reportPeer(envelopePeerId, PeerAction.LowToleranceError, e.type.code);
|
|
1916
|
+
}
|
|
1917
|
+
envelope = payloadInput.hasPayloadEnvelope() ? payloadInput.getPayloadEnvelope() : undefined;
|
|
1918
|
+
} else {
|
|
1919
|
+
switch (e.type.code) {
|
|
1920
|
+
// Caused by local state, the downloaded envelope may still be valid
|
|
1921
|
+
case ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN:
|
|
1922
|
+
case ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN:
|
|
1923
|
+
case ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING:
|
|
1924
|
+
case ExecutionPayloadEnvelopeErrorCode.UNKNOWN_BLOCK_STATE:
|
|
1925
|
+
// Every copy fails once the block is finalized
|
|
1926
|
+
case ExecutionPayloadEnvelopeErrorCode.BELONG_TO_FINALIZED_BLOCK:
|
|
1927
|
+
break;
|
|
1928
|
+
// The served copy is invalid, take the envelope from payloadInput or another peer on the next attempt
|
|
1929
|
+
default:
|
|
1891
1930
|
envelope = payloadInput?.hasPayloadEnvelope() ? payloadInput.getPayloadEnvelope() : undefined;
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
// The served copy is invalid, take the envelope from payloadInput or another peer on the next attempt
|
|
1895
|
-
default:
|
|
1896
|
-
envelope = payloadInput?.hasPayloadEnvelope() ? payloadInput.getPayloadEnvelope() : undefined;
|
|
1897
|
-
break;
|
|
1931
|
+
break;
|
|
1932
|
+
}
|
|
1898
1933
|
}
|
|
1899
1934
|
}
|
|
1900
1935
|
} finally {
|
|
@@ -1931,7 +1966,12 @@ export class BlockInputSync {
|
|
|
1931
1966
|
|
|
1932
1967
|
const receivedRootHex = toRootHex(envelope.message.beaconBlockRoot);
|
|
1933
1968
|
if (receivedRootHex !== rootHex) {
|
|
1934
|
-
throw new
|
|
1969
|
+
throw new DownloadByRootError({
|
|
1970
|
+
code: DownloadByRootErrorCode.MISMATCH_BLOCK_ROOT,
|
|
1971
|
+
peer: prettyPrintPeerIdStr(peerIdStr),
|
|
1972
|
+
requestedBlockRoot: rootHex,
|
|
1973
|
+
receivedBlockRoot: receivedRootHex,
|
|
1974
|
+
});
|
|
1935
1975
|
}
|
|
1936
1976
|
|
|
1937
1977
|
return envelope;
|
|
@@ -1960,9 +2000,13 @@ export class BlockInputSync {
|
|
|
1960
2000
|
const requestedColumnsSet = new Set(requestedColumns);
|
|
1961
2001
|
const extraColumns = columnSidecars.filter((columnSidecar) => !requestedColumnsSet.has(columnSidecar.index));
|
|
1962
2002
|
if (extraColumns.length > 0) {
|
|
1963
|
-
throw new
|
|
1964
|
-
|
|
1965
|
-
|
|
2003
|
+
throw new DownloadByRootError({
|
|
2004
|
+
code: DownloadByRootErrorCode.EXTRA_SIDECAR_RECEIVED,
|
|
2005
|
+
peer: prettyPrintPeerIdStr(peerIdStr),
|
|
2006
|
+
slot: payloadInput.slot,
|
|
2007
|
+
blockRoot: payloadInput.blockRootHex,
|
|
2008
|
+
invalidIndices: prettyPrintIndices(extraColumns.map((column) => column.index)),
|
|
2009
|
+
});
|
|
1966
2010
|
}
|
|
1967
2011
|
|
|
1968
2012
|
// PayloadEnvelopeInput already carries the block slot, root, and commitments, so reuse the
|
|
@@ -485,6 +485,25 @@ export async function validateResponses({
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
if (!columnsRequest) {
|
|
488
|
+
// Same as the 0-block check below, for a post-Gloas batch outside the DA window where no columns are requested
|
|
489
|
+
const payloadEnvelopeCount = payloadEnvelopes?.length ?? 0;
|
|
490
|
+
if (
|
|
491
|
+
payloadEnvelopeCount > 0 &&
|
|
492
|
+
parentPayload === undefined &&
|
|
493
|
+
!validatedResponses.validatedBlocks?.length &&
|
|
494
|
+
!batchBlocks?.length
|
|
495
|
+
) {
|
|
496
|
+
throw new DownloadByRangeError(
|
|
497
|
+
{
|
|
498
|
+
code: DownloadByRangeErrorCode.DATA_WITHOUT_BLOCKS,
|
|
499
|
+
...requestsLogMeta({blocksRequest}),
|
|
500
|
+
columnSidecarCount: 0,
|
|
501
|
+
payloadEnvelopeCount,
|
|
502
|
+
},
|
|
503
|
+
"Envelopes returned without blocks in BeaconBlocksByRange response"
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
488
507
|
// Only envelope and/or parent-by-root validation needed
|
|
489
508
|
if (parentPayload !== undefined) {
|
|
490
509
|
const parentValidated = await validateParentPayloadColumns(parentPayload, columnSidecars ?? [], peerDasMetrics);
|
|
@@ -507,14 +526,27 @@ export async function validateResponses({
|
|
|
507
526
|
validatedResponses.validatedBlocks?.length ? validatedResponses.validatedBlocks : undefined
|
|
508
527
|
);
|
|
509
528
|
|
|
529
|
+
// Epoch with 0 blocks: columns and envelopes only exist for a block, so data here means the peer withheld blocks or
|
|
530
|
+
// served junk. The parent payload is not requested either, Batch only does once it has blocks
|
|
510
531
|
if (!blocksForDataValidation.length) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
532
|
+
const columnSidecarCount = columnSidecars?.length ?? 0;
|
|
533
|
+
const payloadEnvelopeCount = payloadEnvelopes?.length ?? 0;
|
|
534
|
+
if (columnSidecarCount > 0 || payloadEnvelopeCount > 0) {
|
|
535
|
+
throw new DownloadByRangeError(
|
|
536
|
+
{
|
|
537
|
+
code: DownloadByRangeErrorCode.DATA_WITHOUT_BLOCKS,
|
|
538
|
+
...requestsLogMeta({blocksRequest}),
|
|
539
|
+
columnSidecarCount,
|
|
540
|
+
payloadEnvelopeCount,
|
|
541
|
+
},
|
|
542
|
+
"Columns or envelopes returned without blocks in BeaconBlocksByRange response"
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return {
|
|
547
|
+
result: {responses: validatedResponses, payloadEnvelopes: needsEnvelopeValidation ? new Map() : null},
|
|
548
|
+
warnings,
|
|
549
|
+
};
|
|
518
550
|
}
|
|
519
551
|
|
|
520
552
|
if (!columnSidecars) {
|
|
@@ -606,26 +638,19 @@ export function validateBlockByRangeResponse(
|
|
|
606
638
|
): WarnResult<ValidatedBlock[], DownloadByRangeError> {
|
|
607
639
|
const {startSlot, count} = blocksRequest;
|
|
608
640
|
|
|
609
|
-
//
|
|
610
|
-
//
|
|
611
|
-
//
|
|
612
|
-
// if what the correct behavior should be
|
|
641
|
+
// A 0-block response is accepted as correct, epochs with 0 blocks happen on devnets with poor liveness.
|
|
642
|
+
// If it was wrong, the next batch fails with an unknown parent and SyncChain handles it,
|
|
643
|
+
// see classifyProcessingFault()
|
|
613
644
|
if (!blocks.length) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
// new DownloadByRangeError({
|
|
624
|
-
// code: DownloadByRangeErrorCode.MISSING_BLOCKS_RESPONSE,
|
|
625
|
-
// ...requestsLogMeta({blocksRequest}),
|
|
626
|
-
// }),
|
|
627
|
-
// ],
|
|
628
|
-
// };
|
|
645
|
+
return {
|
|
646
|
+
result: [],
|
|
647
|
+
warnings: [
|
|
648
|
+
new DownloadByRangeError({
|
|
649
|
+
code: DownloadByRangeErrorCode.MISSING_BLOCKS_RESPONSE,
|
|
650
|
+
...requestsLogMeta({blocksRequest}),
|
|
651
|
+
}),
|
|
652
|
+
],
|
|
653
|
+
};
|
|
629
654
|
}
|
|
630
655
|
|
|
631
656
|
if (blocks.length > count) {
|
|
@@ -995,6 +1020,8 @@ function requestsLogMeta({blocksRequest, columnsRequest}: DownloadByRangeRequest
|
|
|
995
1020
|
export enum DownloadByRangeErrorCode {
|
|
996
1021
|
MISSING_BLOCKS_RESPONSE = "DOWNLOAD_BY_RANGE_ERROR_MISSING_BLOCK_RESPONSE",
|
|
997
1022
|
MISSING_COLUMNS_RESPONSE = "DOWNLOAD_BY_RANGE_ERROR_MISSING_COLUMNS_RESPONSE",
|
|
1023
|
+
/** Columns or envelopes were returned for a range with no blocks */
|
|
1024
|
+
DATA_WITHOUT_BLOCKS = "DOWNLOAD_BY_RANGE_ERROR_DATA_WITHOUT_BLOCKS",
|
|
998
1025
|
|
|
999
1026
|
/** Error at the reqresp layer */
|
|
1000
1027
|
REQ_RESP_ERROR = "DOWNLOAD_BY_RANGE_ERROR_REQ_RESP_ERROR",
|
|
@@ -1038,6 +1065,13 @@ export type DownloadByRangeErrorType =
|
|
|
1038
1065
|
columnStartSlot?: number;
|
|
1039
1066
|
columnCount?: number;
|
|
1040
1067
|
}
|
|
1068
|
+
| {
|
|
1069
|
+
code: DownloadByRangeErrorCode.DATA_WITHOUT_BLOCKS;
|
|
1070
|
+
blockStartSlot?: number;
|
|
1071
|
+
blockCount?: number;
|
|
1072
|
+
columnSidecarCount: number;
|
|
1073
|
+
payloadEnvelopeCount: number;
|
|
1074
|
+
}
|
|
1041
1075
|
| {
|
|
1042
1076
|
code: DownloadByRangeErrorCode.OUT_OF_RANGE_BLOCKS;
|
|
1043
1077
|
slot: number;
|
package/src/util/dataColumns.ts
CHANGED
|
@@ -288,7 +288,7 @@ export function getBlobKzgCommitments(
|
|
|
288
288
|
* each blob in the block, assemble the sidecars which can be distributed to peers.
|
|
289
289
|
*
|
|
290
290
|
* SPEC FUNCTION
|
|
291
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.
|
|
291
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-beta.5/specs/fulu/validator.md#get_data_column_sidecars
|
|
292
292
|
*/
|
|
293
293
|
export function getFuluDataColumnSidecars(
|
|
294
294
|
signedBlockHeader: SignedBeaconBlockHeader,
|
|
@@ -299,6 +299,9 @@ export function getFuluDataColumnSidecars(
|
|
|
299
299
|
if (cellsAndKzgProofs.length !== kzgCommitments.length) {
|
|
300
300
|
throw Error("Invalid cellsAndKzgProofs length for getDataColumnSidecars");
|
|
301
301
|
}
|
|
302
|
+
if (kzgCommitments.length === 0) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
302
305
|
|
|
303
306
|
const sidecars: fulu.DataColumnSidecar[] = [];
|
|
304
307
|
for (let columnIndex = 0; columnIndex < NUMBER_OF_COLUMNS; columnIndex++) {
|