@lodestar/beacon-node 1.52.0-dev.0ac7778d70 → 1.52.0-dev.11f1fb4b6d
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.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +63 -39
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +3 -1
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +2 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +6 -2
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +17 -7
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +4 -0
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +8 -4
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +3 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +25 -5
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +3 -17
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +21 -17
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +3 -3
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +7 -5
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +2 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +2 -2
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +3 -3
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
- package/lib/chain/bls/utils.js +1 -1
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +6 -5
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +74 -26
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/attestationError.d.ts +15 -1
- package/lib/chain/errors/attestationError.d.ts.map +1 -1
- package/lib/chain/errors/attestationError.js +8 -0
- package/lib/chain/errors/attestationError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -1
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +7 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +1 -4
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +1 -4
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.d.ts +5 -3
- package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.js +34 -11
- package/lib/chain/forkChoiceExecutionEngine.js.map +1 -1
- package/lib/chain/interface.d.ts +1 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/opPools/inclusionListStore.d.ts +4 -1
- package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
- package/lib/chain/opPools/inclusionListStore.js +5 -2
- package/lib/chain/opPools/inclusionListStore.js.map +1 -1
- package/lib/chain/opPools/opPool.js +6 -6
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +1 -1
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
- package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
- package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +5 -0
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +39 -1
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +37 -9
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +32 -16
- 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 +9 -1
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +8 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +30 -40
- 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 +79 -4
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +9 -0
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validatorMonitor.js +43 -43
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +4 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +9 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +2 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +9 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/gossipsub.js +2 -2
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +1 -7
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +0 -13
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/network.d.ts +1 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +20 -11
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +19 -6
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +4 -1
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +4 -2
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/utils/collect.d.ts +4 -4
- package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
- package/lib/network/reqresp/utils/collect.js +9 -8
- package/lib/network/reqresp/utils/collect.js.map +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
- package/lib/sync/range/batch.d.ts +6 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +17 -0
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +8 -1
- 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 +43 -3
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/types.d.ts +12 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +2 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +28 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +256 -24
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +14 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +12 -2
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +24 -2
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +43 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/eventLoop.d.ts +3 -3
- package/lib/util/eventLoop.d.ts.map +1 -1
- package/lib/util/eventLoop.js +3 -3
- package/lib/util/eventLoop.js.map +1 -1
- package/package.json +18 -18
- package/src/api/impl/beacon/blocks/index.ts +74 -47
- package/src/api/impl/beacon/pool/index.ts +9 -7
- package/src/api/impl/beacon/state/utils.ts +2 -1
- package/src/api/impl/debug/index.ts +6 -2
- package/src/api/impl/validator/index.ts +19 -7
- package/src/chain/ColumnReconstructionTracker.ts +5 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
- package/src/chain/archiveStore/utils/pruneHistory.ts +9 -4
- package/src/chain/blocks/blockInput/blockInput.ts +4 -1
- package/src/chain/blocks/importExecutionPayload.ts +30 -4
- package/src/chain/blocks/index.ts +3 -31
- package/src/chain/blocks/verifyBlock.ts +24 -17
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +4 -4
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +7 -4
- package/src/chain/blocks/verifyBlocksSignatures.ts +3 -0
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +5 -4
- package/src/chain/bls/utils.ts +1 -1
- package/src/chain/chain.ts +107 -43
- package/src/chain/errors/attestationError.ts +11 -1
- package/src/chain/errors/executionPayloadBid.ts +3 -2
- package/src/chain/errors/executionPayloadEnvelope.ts +50 -0
- package/src/chain/forkChoice/index.ts +1 -4
- package/src/chain/forkChoiceExecutionEngine.ts +48 -15
- package/src/chain/interface.ts +1 -1
- package/src/chain/opPools/inclusionListStore.ts +5 -2
- package/src/chain/opPools/opPool.ts +6 -6
- package/src/chain/options.ts +1 -1
- package/src/chain/seenCache/seenAttesters.ts +1 -1
- package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
- package/src/chain/shufflingCache.ts +40 -1
- package/src/chain/validation/aggregateAndProof.ts +43 -14
- package/src/chain/validation/attestation.ts +31 -20
- package/src/chain/validation/block.ts +9 -1
- package/src/chain/validation/dataColumnSidecar.ts +7 -1
- package/src/chain/validation/executionPayloadBid.ts +40 -42
- package/src/chain/validation/executionPayloadEnvelope.ts +87 -3
- package/src/chain/validation/payloadAttestationMessage.ts +10 -0
- package/src/chain/validatorMonitor.ts +43 -43
- package/src/metrics/metrics/beacon.ts +9 -0
- package/src/metrics/metrics/lodestar.ts +9 -0
- package/src/network/gossip/gossipsub.ts +2 -2
- package/src/network/gossip/topic.ts +1 -14
- package/src/network/network.ts +33 -11
- package/src/network/processor/gossipHandlers.ts +25 -13
- package/src/network/processor/gossipValidatorFn.ts +4 -0
- package/src/network/processor/index.ts +7 -2
- package/src/network/reqresp/utils/collect.ts +16 -8
- package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
- package/src/sync/range/batch.ts +20 -0
- package/src/sync/range/chain.ts +8 -0
- package/src/sync/range/range.ts +56 -3
- package/src/sync/types.ts +11 -0
- package/src/sync/unknownBlock.ts +295 -24
- package/src/sync/utils/downloadByRange.ts +29 -3
- package/src/sync/utils/downloadByRoot.ts +68 -2
- package/src/util/eventLoop.ts +3 -3
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ForkPreDeneb,
|
|
10
10
|
ForkPreGloas,
|
|
11
11
|
ForkSeq,
|
|
12
|
+
GENESIS_EPOCH,
|
|
12
13
|
GENESIS_SLOT,
|
|
13
14
|
SLOTS_PER_EPOCH,
|
|
14
15
|
SLOTS_PER_HISTORICAL_ROOT,
|
|
@@ -408,7 +409,7 @@ export function getValidatorApi(
|
|
|
408
409
|
* Both the above scenarios could be problematic and hence validator shouldn't participate
|
|
409
410
|
* or weigh its vote on a head till it resolves to a Valid execution status.
|
|
410
411
|
* Following activities should be skipped on an Optimistic head (with Syncing status):
|
|
411
|
-
* 1. Attestation if targetRoot is optimistic
|
|
412
|
+
* 1. Attestation if the head block voted for (post-gloas the variant voted for) or the targetRoot is optimistic
|
|
412
413
|
* 2. SyncCommitteeContribution if if the root for which to produce contribution is Optimistic.
|
|
413
414
|
* 3. ProduceBlock if the parentRoot (chain's current head) is optimistic. Must be checked
|
|
414
415
|
* explicitly as only local payload production consults the EL, blinded blocks from an
|
|
@@ -1396,10 +1397,18 @@ export function getValidatorApi(
|
|
|
1396
1397
|
// After Gloas, attestation.data.index signals payload status in fork-choice:
|
|
1397
1398
|
// - 0 = EMPTY / not present, 1 = FULL / present
|
|
1398
1399
|
// - same-slot attestations must always use index = 0
|
|
1400
|
+
// Validator shouldn't vote on an optimistic head, post-gloas that is the variant voted for
|
|
1399
1401
|
if (canonicalBlock.slot !== slot) {
|
|
1400
1402
|
index = canonicalBlock.payloadStatus === PayloadStatus.FULL ? 1 : 0;
|
|
1403
|
+
if (isOptimisticBlock(canonicalBlock)) {
|
|
1404
|
+
throw new NodeIsSyncing(
|
|
1405
|
+
`Head block's execution payload not yet validated, executionPayloadBlockHash=${canonicalBlock.executionPayloadBlockHash}`
|
|
1406
|
+
);
|
|
1407
|
+
}
|
|
1401
1408
|
} else {
|
|
1402
1409
|
index = 0;
|
|
1410
|
+
// Same-slot votes support the PENDING variant, which does not depend on the block's own payload
|
|
1411
|
+
notOnOptimisticBlockRoot(beaconBlockRoot);
|
|
1403
1412
|
}
|
|
1404
1413
|
} else if (isForkPostElectra(fork)) {
|
|
1405
1414
|
index = 0;
|
|
@@ -1417,8 +1426,11 @@ export function getValidatorApi(
|
|
|
1417
1426
|
headBlockRoot
|
|
1418
1427
|
: headState.getBlockRootAtSlot(targetSlot);
|
|
1419
1428
|
|
|
1420
|
-
// Check the execution status as validator shouldn't vote on an optimistic head
|
|
1421
|
-
//
|
|
1429
|
+
// Check the execution status as validator shouldn't vote on an optimistic head, post-gloas the
|
|
1430
|
+
// variant voted for is checked above. Check on target is sufficient for a valid source
|
|
1431
|
+
if (!isForkPostGloas(fork)) {
|
|
1432
|
+
notOnOptimisticBlockRoot(beaconBlockRoot);
|
|
1433
|
+
}
|
|
1422
1434
|
notOnOptimisticBlockRoot(targetRoot);
|
|
1423
1435
|
notOnOutOfRangeData(targetRoot);
|
|
1424
1436
|
|
|
@@ -1684,7 +1696,8 @@ export function getValidatorApi(
|
|
|
1684
1696
|
|
|
1685
1697
|
// should not compare to headEpoch in order to handle skipped slots
|
|
1686
1698
|
// Check if the epoch is in the future after waiting for requested slot
|
|
1687
|
-
|
|
1699
|
+
// Before genesis the clock epoch is negative, treat it as GENESIS_EPOCH so the next epoch can be requested
|
|
1700
|
+
if (epoch > Math.max(chain.clock.currentEpoch, GENESIS_EPOCH) + 1) {
|
|
1688
1701
|
throw new ApiError(400, "Cannot get duties for epoch more than one ahead");
|
|
1689
1702
|
}
|
|
1690
1703
|
|
|
@@ -1747,7 +1760,7 @@ export function getValidatorApi(
|
|
|
1747
1760
|
|
|
1748
1761
|
await waitForNextClosestEpoch();
|
|
1749
1762
|
|
|
1750
|
-
if (epoch > chain.clock.currentEpoch + 1) {
|
|
1763
|
+
if (epoch > Math.max(chain.clock.currentEpoch, GENESIS_EPOCH) + 1) {
|
|
1751
1764
|
throw new ApiError(400, "Cannot get PTC duties for epoch more than one ahead");
|
|
1752
1765
|
}
|
|
1753
1766
|
|
|
@@ -2324,8 +2337,7 @@ export function getValidatorApi(
|
|
|
2324
2337
|
metrics?.inclusionListsValid.inc({source: InclusionListSource.api});
|
|
2325
2338
|
metrics?.inclusionListsValidSize.inc(totalBytes);
|
|
2326
2339
|
|
|
2327
|
-
const isTimely =
|
|
2328
|
-
secFromSlot >= 0 && secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
|
|
2340
|
+
const isTimely = secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
|
|
2329
2341
|
chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
|
|
2330
2342
|
|
|
2331
2343
|
chain.emitter.emit(routes.events.EventType.inclusionList, {
|
|
@@ -19,6 +19,11 @@ const RECONSTRUCTION_DELAY_MIN_BPS = 667;
|
|
|
19
19
|
*/
|
|
20
20
|
const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Maximum time a column request waits for a pending reconstruction, covers the delay and the recovery itself
|
|
24
|
+
*/
|
|
25
|
+
export const RECONSTRUCTED_COLUMNS_WAIT_BPS = 2500;
|
|
26
|
+
|
|
22
27
|
const QUEUE_MAX_LENGTH = 16;
|
|
23
28
|
|
|
24
29
|
export type ColumnReconstructionInput = BlockInputColumns | PayloadEnvelopeInput;
|
|
@@ -50,6 +50,15 @@ export async function getHistoricalState(
|
|
|
50
50
|
const transitionTimer = metrics?.stateTransitionTime.startTimer();
|
|
51
51
|
let blockCount = 0;
|
|
52
52
|
for await (const block of db.blockArchive.valuesStream({gt: state.slot, lte: slot})) {
|
|
53
|
+
// Pruned history keeps the genesis state but not the blocks after it, without this check the
|
|
54
|
+
// first block would only be rejected after processing every slot in between
|
|
55
|
+
if (
|
|
56
|
+
blockCount === 0 &&
|
|
57
|
+
!byteArrayEquals(block.message.parentRoot, state.computeAnchorCheckpoint().checkpoint.root)
|
|
58
|
+
) {
|
|
59
|
+
metrics?.regenErrorCount.inc({reason: RegenErrorType.blockProcessing});
|
|
60
|
+
throw Error(`Archived blocks do not extend nearest state slot=${state.slot} blockSlot=${block.message.slot}`);
|
|
61
|
+
}
|
|
53
62
|
try {
|
|
54
63
|
state = state.stateTransition(
|
|
55
64
|
{block},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {GENESIS_SLOT} from "@lodestar/params";
|
|
2
3
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
3
4
|
import {Epoch, Slot} from "@lodestar/types";
|
|
4
5
|
import {Logger, prettyPrintIndices} from "@lodestar/utils";
|
|
@@ -13,6 +14,9 @@ import {Metrics} from "../../../metrics/index.js";
|
|
|
13
14
|
*/
|
|
14
15
|
export const MAX_PRUNE_BLOCK_SLOTS_PER_RUN = 4096;
|
|
15
16
|
|
|
17
|
+
// Genesis is kept so the block and state stay available via the API, e.g. for checkpoint providers
|
|
18
|
+
const FIRST_PRUNABLE_SLOT = GENESIS_SLOT + 1;
|
|
19
|
+
|
|
16
20
|
export async function pruneHistory(
|
|
17
21
|
config: ChainForkConfig,
|
|
18
22
|
db: IBeaconDb,
|
|
@@ -30,11 +34,12 @@ export async function pruneHistory(
|
|
|
30
34
|
// ensure that during (extremely lol) long periods of non-finality we don't delete unfinalized epoch data
|
|
31
35
|
finalizedEpoch
|
|
32
36
|
);
|
|
33
|
-
const firstBlockSlot =
|
|
37
|
+
const [firstBlockSlot = FIRST_PRUNABLE_SLOT] = await db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, limit: 1});
|
|
34
38
|
const blockCutoffSlot = Math.min(computeStartSlotAtEpoch(blockCutoffEpoch), firstBlockSlot + maxBlockSlots);
|
|
35
39
|
// The latest archived state is the anchor on restart and can trail finalization by a few epochs
|
|
36
40
|
const lastArchivedStateSlot = (await db.stateArchive.lastKey()) ?? 0;
|
|
37
41
|
const stateCutoffSlot = Math.min(computeStartSlotAtEpoch(finalizedEpoch), lastArchivedStateSlot);
|
|
42
|
+
const stateStartSlot = Math.max(statePruneFromSlot, FIRST_PRUNABLE_SLOT);
|
|
38
43
|
|
|
39
44
|
logger.debug("Preparing to prune history", {
|
|
40
45
|
currentEpoch,
|
|
@@ -46,9 +51,9 @@ export async function pruneHistory(
|
|
|
46
51
|
|
|
47
52
|
const step0 = metrics?.pruneHistory.fetchKeys.startTimer();
|
|
48
53
|
const [blocks, envelopes, states] = await Promise.all([
|
|
49
|
-
db.blockArchive.keys({gte:
|
|
50
|
-
db.executionPayloadEnvelopeArchive.keys({gte:
|
|
51
|
-
stateCutoffSlot >
|
|
54
|
+
db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
|
|
55
|
+
db.executionPayloadEnvelopeArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
|
|
56
|
+
stateCutoffSlot > stateStartSlot ? db.stateArchive.keys({gte: stateStartSlot, lt: stateCutoffSlot}) : [],
|
|
52
57
|
]);
|
|
53
58
|
step0?.();
|
|
54
59
|
|
|
@@ -493,12 +493,15 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
493
493
|
const hasComputedAllData =
|
|
494
494
|
// has all sampled columns
|
|
495
495
|
sampledColumns.length === this.sampledColumns.length;
|
|
496
|
+
// A column after the block and its data were complete does not move the completion time
|
|
497
|
+
const timeCompleteSec =
|
|
498
|
+
this.state.hasBlock && this.state.hasAllData ? this.state.timeCompleteSec : seenTimestampSec;
|
|
496
499
|
|
|
497
500
|
this.state = {
|
|
498
501
|
...this.state,
|
|
499
502
|
hasAllData: hasAllData || this.state.hasAllData,
|
|
500
503
|
hasComputedAllData: hasComputedAllData || this.state.hasComputedAllData,
|
|
501
|
-
timeCompleteSec: hasAllData ?
|
|
504
|
+
timeCompleteSec: hasAllData ? timeCompleteSec : undefined,
|
|
502
505
|
} as BlockInputColumnsState;
|
|
503
506
|
|
|
504
507
|
if (hasAllData && sampledColumns !== null) {
|
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
ForkChoiceError,
|
|
6
6
|
ForkChoiceErrorCode,
|
|
7
7
|
InvalidBlockCode,
|
|
8
|
+
LVHInvalidJudged,
|
|
8
9
|
PayloadExecutionStatus,
|
|
10
|
+
PayloadStatus,
|
|
9
11
|
getFinalizedExecutionBlockHash,
|
|
10
12
|
getSafeExecutionBlockHash,
|
|
11
13
|
} from "@lodestar/fork-choice";
|
|
@@ -16,11 +18,12 @@ import {
|
|
|
16
18
|
isStatePostHeze,
|
|
17
19
|
} from "@lodestar/state-transition";
|
|
18
20
|
import {RootHex, bellatrix} from "@lodestar/types";
|
|
19
|
-
import {isErrorAborted} from "@lodestar/utils";
|
|
21
|
+
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
20
22
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
21
23
|
import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
|
|
22
24
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
23
25
|
import {BeaconChain} from "../chain.js";
|
|
26
|
+
import {ExecutionInvalidSource} from "../forkChoice/index.js";
|
|
24
27
|
import {RegenCaller} from "../regen/interface.js";
|
|
25
28
|
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
26
29
|
import {PayloadEnvelopeInputSource} from "./payloadEnvelopeInput/index.js";
|
|
@@ -115,7 +118,7 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
115
118
|
* 3. Regenerate state for envelope verification
|
|
116
119
|
* 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
|
|
117
120
|
* 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
|
|
118
|
-
* 6. Update fork choice (transitions the block's PENDING variant to FULL)
|
|
121
|
+
* 6. Update fork choice (transitions the block's PENDING variant to FULL) and emit head events if the head changed
|
|
119
122
|
* 7. Queue notifyForkchoiceUpdate to engine api
|
|
120
123
|
* 8. Record metrics for payload envelope and column sources
|
|
121
124
|
* 9. Emit `execution_payload` event
|
|
@@ -267,12 +270,29 @@ export async function importExecutionPayload(
|
|
|
267
270
|
case ExecutionPayloadStatus.VALID:
|
|
268
271
|
break;
|
|
269
272
|
|
|
270
|
-
case ExecutionPayloadStatus.INVALID:
|
|
273
|
+
case ExecutionPayloadStatus.INVALID: {
|
|
274
|
+
// An LVH above the parent means the payload chain this block builds on is invalid too. The rejected payload
|
|
275
|
+
// itself never enters fork choice, so an LVH equal to the parent hash changes nothing
|
|
276
|
+
const parentHashHex = toRootHex(envelope.payload.parentHash);
|
|
277
|
+
if (execResult.latestValidHash !== null && execResult.latestValidHash !== parentHashHex) {
|
|
278
|
+
this.executionEngine.invalidateExecutionPayloads(
|
|
279
|
+
{
|
|
280
|
+
executionStatus: ExecutionStatus.Invalid,
|
|
281
|
+
latestValidExecHash: execResult.latestValidHash,
|
|
282
|
+
invalidateFromBlockRoot: protoBlock.parentRoot,
|
|
283
|
+
invalidateFromBlockHash: parentHashHex,
|
|
284
|
+
judged: LVHInvalidJudged.ChildPayload,
|
|
285
|
+
},
|
|
286
|
+
ExecutionInvalidSource.newPayload,
|
|
287
|
+
{slot, root: blockRootHex, payloadBlockHash: blockHashHex}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
271
290
|
throw new PayloadError(payloadInput, {
|
|
272
291
|
code: PayloadErrorCode.EXECUTION_ENGINE_INVALID,
|
|
273
292
|
execStatus: execResult.status,
|
|
274
293
|
errorMessage: execResult.validationError ?? "",
|
|
275
294
|
});
|
|
295
|
+
}
|
|
276
296
|
|
|
277
297
|
case ExecutionPayloadStatus.ACCEPTED:
|
|
278
298
|
case ExecutionPayloadStatus.SYNCING:
|
|
@@ -337,6 +357,7 @@ export async function importExecutionPayload(
|
|
|
337
357
|
|
|
338
358
|
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
339
359
|
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
360
|
+
const prevHead = this.forkChoice.getHead();
|
|
340
361
|
try {
|
|
341
362
|
this.forkChoice.onExecutionPayload(
|
|
342
363
|
blockRootHex,
|
|
@@ -357,12 +378,17 @@ export async function importExecutionPayload(
|
|
|
357
378
|
}
|
|
358
379
|
throw e;
|
|
359
380
|
}
|
|
381
|
+
const head = this.forkChoice.getHead();
|
|
382
|
+
this.emitHeadEvents(prevHead, head);
|
|
383
|
+
if (head.blockRoot !== prevHead.blockRoot) {
|
|
384
|
+
this.onHeadChanged(prevHead, head);
|
|
385
|
+
}
|
|
360
386
|
|
|
361
387
|
// 7. Queue notifyForkchoiceUpdate to engine api
|
|
362
|
-
const head = this.forkChoice.getHead();
|
|
363
388
|
if (
|
|
364
389
|
!this.opts.disableImportExecutionFcU &&
|
|
365
390
|
blockRootHex === head.blockRoot &&
|
|
391
|
+
head.payloadStatus === PayloadStatus.FULL &&
|
|
366
392
|
// Skip a payload that does not satisfy the inclusion list constraints, fork choice keeps the EMPTY
|
|
367
393
|
// variant as head and the next prepare fcU keeps the engine on the parent payload
|
|
368
394
|
this.forkChoice.isPayloadInclusionListSatisfied(blockRootHex)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
2
2
|
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
3
3
|
import {SignedBeaconBlock, Slot} from "@lodestar/types";
|
|
4
|
-
import {isErrorAborted
|
|
4
|
+
import {isErrorAborted} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/metrics.js";
|
|
6
6
|
import {nextEventLoop} from "../../util/eventLoop.js";
|
|
7
7
|
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
|
|
@@ -208,36 +208,9 @@ export async function processBlocks(
|
|
|
208
208
|
this.logger.debug("Block error", {slot: err.signedBlock.message.slot}, err);
|
|
209
209
|
|
|
210
210
|
if (err.type.code === BlockErrorCode.INVALID_SIGNATURE) {
|
|
211
|
-
|
|
212
|
-
const blockSlot = signedBlock.message.slot;
|
|
213
|
-
const {state} = err.type;
|
|
214
|
-
const forkTypes = this.config.getForkTypes(blockSlot);
|
|
215
|
-
const blockRootHex = toRootHex(forkTypes.BeaconBlock.hashTreeRoot(signedBlock.message));
|
|
216
|
-
this.persistInvalidSszValue(
|
|
217
|
-
forkTypes.SignedBeaconBlock,
|
|
218
|
-
signedBlock,
|
|
219
|
-
`${blockSlot}_invalid_signature`,
|
|
220
|
-
blockRootHex
|
|
221
|
-
);
|
|
222
|
-
this.persistInvalidSszBytes(
|
|
223
|
-
"BeaconState",
|
|
224
|
-
state.serialize(),
|
|
225
|
-
toRootHex(state.hashTreeRoot()),
|
|
226
|
-
`${state.slot}_invalid_signature`
|
|
227
|
-
);
|
|
211
|
+
void this.persistInvalidSignature(err.type.state, err.signedBlock);
|
|
228
212
|
} else if (err.type.code === BlockErrorCode.INVALID_STATE_ROOT) {
|
|
229
|
-
|
|
230
|
-
const blockSlot = signedBlock.message.slot;
|
|
231
|
-
const {preState, postState} = err.type;
|
|
232
|
-
const preRoot = preState.hashTreeRoot();
|
|
233
|
-
const postRoot = postState.hashTreeRoot();
|
|
234
|
-
this.persistInvalidStateRoot(preState, postState, signedBlock).catch((e) => {
|
|
235
|
-
this.logger.error(
|
|
236
|
-
"Error persisting invalid state root objects",
|
|
237
|
-
{slot: blockSlot, preStateRoot: toRootHex(preRoot), postStateRoot: toRootHex(postRoot)},
|
|
238
|
-
e
|
|
239
|
-
);
|
|
240
|
-
});
|
|
213
|
+
void this.persistInvalidStateRoot(err.type.preState, err.type.postState, err.signedBlock);
|
|
241
214
|
}
|
|
242
215
|
}
|
|
243
216
|
|
|
@@ -307,7 +280,6 @@ async function importPayloadEnvelopesOfKnownBlocks(
|
|
|
307
280
|
});
|
|
308
281
|
await importExecutionPayload.call(this, payloadInputs[i], dataAvailabilityStatuses[i], {validSignature: false});
|
|
309
282
|
}
|
|
310
|
-
// the new FULL variants are not seen by the head cached from the last block import
|
|
311
283
|
this.recomputeForkChoiceHead(ForkchoiceCaller.importBlock);
|
|
312
284
|
|
|
313
285
|
return result;
|
|
@@ -2,6 +2,7 @@ import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
|
2
2
|
import {ForkName, ForkSeq, isForkPostFulu} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
4
|
DataAvailabilityStatus,
|
|
5
|
+
EpochShuffling,
|
|
5
6
|
IBeaconStateView,
|
|
6
7
|
computeEpochAtSlot,
|
|
7
8
|
getAttestingIndices,
|
|
@@ -111,22 +112,24 @@ export async function verifyBlocksInEpoch(
|
|
|
111
112
|
|
|
112
113
|
// Store indexed attestations for each block to avoid recomputing them during import
|
|
113
114
|
const indexedAttestationsByBlock: IndexedAttestation[][] = [];
|
|
115
|
+
const attestationShufflingsByBlock: EpochShuffling[][] = [];
|
|
114
116
|
for (const [i, block] of blocks.entries()) {
|
|
115
|
-
|
|
117
|
+
attestationShufflingsByBlock[i] = block.message.body.attestations.map((attestation) => {
|
|
116
118
|
const attEpoch = computeEpochAtSlot(attestation.data.slot);
|
|
117
119
|
// calling getShufflingAtEpoch may take some time for NativeBeaconStateView
|
|
118
120
|
// we should have the shuffling inside ShufflingCache most of the time
|
|
119
|
-
|
|
121
|
+
return (
|
|
120
122
|
this.shufflingCache.getSync(attEpoch, preState0.getShufflingDecisionRoot(attEpoch)) ??
|
|
121
|
-
preState0.getShufflingAtEpoch(attEpoch)
|
|
122
|
-
|
|
123
|
-
// these on mainnet blocks. See FullyVerifiedBlock.indexedAttestations.
|
|
124
|
-
return {
|
|
125
|
-
attestingIndices: getAttestingIndices(shuffling, fork, attestation),
|
|
126
|
-
data: attestation.data,
|
|
127
|
-
signature: attestation.signature,
|
|
128
|
-
};
|
|
123
|
+
preState0.getShufflingAtEpoch(attEpoch)
|
|
124
|
+
);
|
|
129
125
|
});
|
|
126
|
+
// Unlike getIndexedAttestation, keep attestingIndices in committee order: sorting them dominates building
|
|
127
|
+
// these on mainnet blocks. See FullyVerifiedBlock.indexedAttestations.
|
|
128
|
+
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation, j) => ({
|
|
129
|
+
attestingIndices: getAttestingIndices(attestationShufflingsByBlock[i][j], fork, attestation),
|
|
130
|
+
data: attestation.data,
|
|
131
|
+
signature: attestation.signature,
|
|
132
|
+
}));
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
// Pick the data-availability source by fork:
|
|
@@ -135,7 +138,7 @@ export async function verifyBlocksInEpoch(
|
|
|
135
138
|
const daAvailabilityPromise: Promise<{
|
|
136
139
|
blockDAStatuses: DataAvailabilityStatus[];
|
|
137
140
|
payloadDAStatuses: Map<Slot, DataAvailabilityStatus>;
|
|
138
|
-
|
|
141
|
+
availableTimeMs: number;
|
|
139
142
|
}> =
|
|
140
143
|
fork >= ForkSeq.gloas
|
|
141
144
|
? (async () => {
|
|
@@ -148,7 +151,7 @@ export async function verifyBlocksInEpoch(
|
|
|
148
151
|
payloadEnvelopes !== null
|
|
149
152
|
? Array.from(payloadEnvelopes.values()).filter((payloadInput) => payloadInput.hasPayloadEnvelope())
|
|
150
153
|
: [];
|
|
151
|
-
const {dataAvailabilityStatuses,
|
|
154
|
+
const {dataAvailabilityStatuses, availableTimeMs} = await verifyPayloadsDataAvailability(
|
|
152
155
|
this.config,
|
|
153
156
|
payloadInputsForDa,
|
|
154
157
|
abortController.signal
|
|
@@ -162,25 +165,25 @@ export async function verifyBlocksInEpoch(
|
|
|
162
165
|
// post-gloas, DataAvailabilityStatus is NotRequired for forkChoice.onBlock() ProtoBlock
|
|
163
166
|
blockDAStatuses: blockInputs.map(() => DataAvailabilityStatus.NotRequired),
|
|
164
167
|
payloadDAStatuses,
|
|
165
|
-
|
|
168
|
+
availableTimeMs,
|
|
166
169
|
};
|
|
167
170
|
})()
|
|
168
171
|
: (async () => {
|
|
169
|
-
const {dataAvailabilityStatuses,
|
|
172
|
+
const {dataAvailabilityStatuses, availableTimeMs} = await verifyBlocksDataAvailability(
|
|
170
173
|
blockInputs,
|
|
171
174
|
abortController.signal
|
|
172
175
|
);
|
|
173
176
|
return {
|
|
174
177
|
blockDAStatuses: dataAvailabilityStatuses,
|
|
175
178
|
payloadDAStatuses: new Map<Slot, DataAvailabilityStatus>(),
|
|
176
|
-
|
|
179
|
+
availableTimeMs,
|
|
177
180
|
};
|
|
178
181
|
})();
|
|
179
182
|
|
|
180
183
|
// batch all I/O operations to reduce overhead
|
|
181
184
|
const [
|
|
182
185
|
segmentExecStatus,
|
|
183
|
-
{blockDAStatuses, payloadDAStatuses,
|
|
186
|
+
{blockDAStatuses, payloadDAStatuses, availableTimeMs},
|
|
184
187
|
{verifySignaturesTime},
|
|
185
188
|
{postStates, proposerBalanceDeltas, verifyStateTime},
|
|
186
189
|
] = await Promise.all([
|
|
@@ -200,6 +203,7 @@ export async function verifyBlocksInEpoch(
|
|
|
200
203
|
preState0,
|
|
201
204
|
blocks,
|
|
202
205
|
indexedAttestationsByBlock,
|
|
206
|
+
attestationShufflingsByBlock,
|
|
203
207
|
opts
|
|
204
208
|
),
|
|
205
209
|
|
|
@@ -304,15 +308,18 @@ export async function verifyBlocksInEpoch(
|
|
|
304
308
|
const recvTofullyVerifedTime = fullyVerifiedTime / 1000 - opts.seenTimestampSec;
|
|
305
309
|
this.metrics?.gossipBlock.receivedToFullyVerifiedTime.observe(recvTofullyVerifedTime);
|
|
306
310
|
|
|
307
|
-
const verifiedToBlobsAvailabiltyTime = Math.max(
|
|
311
|
+
const verifiedToBlobsAvailabiltyTime = Math.max(availableTimeMs - fullyVerifiedTime, 0) / 1000;
|
|
312
|
+
const receivedToBlobsAvailabilityTime = Math.max(availableTimeMs / 1000 - opts.seenTimestampSec, 0);
|
|
308
313
|
const block = blockInputs[0].getBlock();
|
|
309
314
|
const numBlobs = getBlobKzgCommitments(blockInputs[0].forkName, block as deneb.SignedBeaconBlock).length;
|
|
310
315
|
|
|
311
316
|
this.metrics?.gossipBlock.verifiedToBlobsAvailabiltyTime.observe({numBlobs}, verifiedToBlobsAvailabiltyTime);
|
|
317
|
+
this.metrics?.gossipBlock.receivedToBlobsAvailabilityTime.observe({numBlobs}, receivedToBlobsAvailabilityTime);
|
|
312
318
|
this.logger.verbose("Verified blockInput fully with blobs availability", {
|
|
313
319
|
slot: block.message.slot,
|
|
314
320
|
recvTofullyVerifedTime,
|
|
315
321
|
verifiedToBlobsAvailabiltyTime,
|
|
322
|
+
receivedToBlobsAvailabilityTime,
|
|
316
323
|
type: blockInputs[0].type,
|
|
317
324
|
numBlobs,
|
|
318
325
|
});
|
|
@@ -11,7 +11,7 @@ export const BLOB_AVAILABILITY_TIMEOUT = 12_000;
|
|
|
11
11
|
/**
|
|
12
12
|
* Verifies that all block inputs have data available.
|
|
13
13
|
* - Waits a max of BLOB_AVAILABILITY_TIMEOUT for all data to be available
|
|
14
|
-
* - Returns the time at which all data was available
|
|
14
|
+
* - Returns the time at which all data was available, in Unix milliseconds
|
|
15
15
|
* - Returns the data availability status for each block input
|
|
16
16
|
*/
|
|
17
17
|
export async function verifyBlocksDataAvailability(
|
|
@@ -19,7 +19,7 @@ export async function verifyBlocksDataAvailability(
|
|
|
19
19
|
signal: AbortSignal
|
|
20
20
|
): Promise<{
|
|
21
21
|
dataAvailabilityStatuses: DataAvailabilityStatus[];
|
|
22
|
-
|
|
22
|
+
availableTimeMs: number;
|
|
23
23
|
}> {
|
|
24
24
|
const promises: Promise<DAData>[] = [];
|
|
25
25
|
for (const blockInput of blocks) {
|
|
@@ -37,7 +37,7 @@ export async function verifyBlocksDataAvailability(
|
|
|
37
37
|
}
|
|
38
38
|
await Promise.all(promises);
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const availableTimeMs = Math.max(0, Math.max(...blocks.map((blockInput) => blockInput.getTimeComplete()))) * 1000;
|
|
41
41
|
const dataAvailabilityStatuses: DataAvailabilityStatus[] = blocks.map((blockInput) => {
|
|
42
42
|
if (blockInput.type === DAType.NoData) {
|
|
43
43
|
return DataAvailabilityStatus.NotRequired;
|
|
@@ -55,5 +55,5 @@ export async function verifyBlocksDataAvailability(
|
|
|
55
55
|
return DataAvailabilityStatus.Available;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
return {dataAvailabilityStatuses,
|
|
58
|
+
return {dataAvailabilityStatuses, availableTimeMs};
|
|
59
59
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
BlockExecutionStatus,
|
|
4
4
|
ExecutionStatus,
|
|
5
5
|
IForkChoice,
|
|
6
|
+
LVHInvalidJudged,
|
|
6
7
|
LVHInvalidResponse,
|
|
7
8
|
LVHValidResponse,
|
|
8
9
|
ProtoBlock,
|
|
@@ -200,8 +201,9 @@ export async function verifyBlockExecutionPayload(
|
|
|
200
201
|
const lvhResponse = {
|
|
201
202
|
executionStatus,
|
|
202
203
|
latestValidExecHash: execResult.latestValidHash,
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
invalidateFromBlockRoot: blockInput.parentRootHex,
|
|
205
|
+
invalidateFromBlockHash: toRootHex(executionPayloadEnabled.parentHash),
|
|
206
|
+
judged: LVHInvalidJudged.ChildPayload,
|
|
205
207
|
};
|
|
206
208
|
const execError = new BlockError(block, {
|
|
207
209
|
code: BlockErrorCode.EXECUTION_ENGINE_INVALID,
|
|
@@ -284,8 +286,9 @@ function getSegmentErrorResponse(
|
|
|
284
286
|
invalidSegmentLVH = {
|
|
285
287
|
executionStatus: ExecutionStatus.Invalid,
|
|
286
288
|
latestValidExecHash: lvhResponse.latestValidExecHash,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
invalidateFromBlockRoot: parentBlock.blockRoot,
|
|
290
|
+
invalidateFromBlockHash: parentBlock.executionPayloadBlockHash,
|
|
291
|
+
judged: LVHInvalidJudged.ChildPayload,
|
|
289
292
|
};
|
|
290
293
|
}
|
|
291
294
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {
|
|
3
|
+
EpochShuffling,
|
|
3
4
|
IBeaconStateView,
|
|
4
5
|
SyncCommitteeCacheEmpty,
|
|
5
6
|
getBlockSignatureSets,
|
|
@@ -28,6 +29,7 @@ export async function verifyBlocksSignatures(
|
|
|
28
29
|
preState0: IBeaconStateView,
|
|
29
30
|
blocks: SignedBeaconBlock[],
|
|
30
31
|
indexedAttestationsByBlock: IndexedAttestation[][],
|
|
32
|
+
attestationShufflingsByBlock: EpochShuffling[][],
|
|
31
33
|
opts: ImportBlockOpts
|
|
32
34
|
): Promise<{verifySignaturesTime: number}> {
|
|
33
35
|
const isValidPromises: Promise<boolean>[] = [];
|
|
@@ -49,6 +51,7 @@ export async function verifyBlocksSignatures(
|
|
|
49
51
|
bls.verifySignatureSets(
|
|
50
52
|
getBlockSignatureSets(config, currentSyncCommitteeIndexed, preState0, block, indexedAttestationsByBlock[i], {
|
|
51
53
|
skipProposerSignature: opts.validProposerSignature,
|
|
54
|
+
attestationShufflings: attestationShufflingsByBlock[i],
|
|
52
55
|
}),
|
|
53
56
|
// Prioritize block verification over attestations, since
|
|
54
57
|
// attestations already buffer up to `MAX_BUFFER_WAIT_MS`
|
|
@@ -8,7 +8,7 @@ import {PayloadError, PayloadErrorCode} from "./importExecutionPayload.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Verifies that all payload envelope inputs have their data columns available.
|
|
10
10
|
* - Waits a max of one slot duration of the payload's fork for all data to be available
|
|
11
|
-
* - Returns the time at which all data was available
|
|
11
|
+
* - Returns the time at which all data was available, in Unix milliseconds
|
|
12
12
|
* - Returns the data availability status for each payload input
|
|
13
13
|
*/
|
|
14
14
|
export async function verifyPayloadsDataAvailability(
|
|
@@ -17,7 +17,7 @@ export async function verifyPayloadsDataAvailability(
|
|
|
17
17
|
signal: AbortSignal
|
|
18
18
|
): Promise<{
|
|
19
19
|
dataAvailabilityStatuses: DataAvailabilityStatus[];
|
|
20
|
-
|
|
20
|
+
availableTimeMs: number;
|
|
21
21
|
}> {
|
|
22
22
|
const promises: Promise<gloas.DataColumnSidecar[]>[] = [];
|
|
23
23
|
for (const payloadInput of payloadInputs) {
|
|
@@ -35,7 +35,8 @@ export async function verifyPayloadsDataAvailability(
|
|
|
35
35
|
}
|
|
36
36
|
await Promise.all(promises);
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const availableTimeMs =
|
|
39
|
+
Math.max(0, Math.max(...payloadInputs.map((payloadInput) => payloadInput.getTimeComplete()))) * 1000;
|
|
39
40
|
const dataAvailabilityStatuses: DataAvailabilityStatus[] = payloadInputs.map((payloadInput) => {
|
|
40
41
|
if (payloadInput.daOutOfRange) {
|
|
41
42
|
return DataAvailabilityStatus.OutOfRange;
|
|
@@ -45,5 +46,5 @@ export async function verifyPayloadsDataAvailability(
|
|
|
45
46
|
: DataAvailabilityStatus.Available;
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
return {dataAvailabilityStatuses,
|
|
49
|
+
return {dataAvailabilityStatuses, availableTimeMs};
|
|
49
50
|
}
|
package/src/chain/bls/utils.ts
CHANGED
|
@@ -32,7 +32,7 @@ export function chunkSameMessageSignatureSets(sets: SameMessageSignatureSet[]):
|
|
|
32
32
|
export function getAggregatedPubkeysCount(signatureSets: ISignatureSet[]): number {
|
|
33
33
|
let pubkeysCount = 0;
|
|
34
34
|
for (const set of signatureSets) {
|
|
35
|
-
if (set.type === SignatureSetType.aggregate) {
|
|
35
|
+
if (set.type === SignatureSetType.aggregate || set.type === SignatureSetType.committee) {
|
|
36
36
|
pubkeysCount += set.indices.length;
|
|
37
37
|
}
|
|
38
38
|
}
|