@lodestar/beacon-node 1.46.0-dev.4c86702f24 → 1.46.0-dev.74a3175f1e
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/config/constants.d.ts +1 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +2 -1
- package/lib/api/impl/config/constants.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/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +17 -3
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +11 -4
- 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/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +2 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +1 -1
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +4 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +6 -5
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +16 -8
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +0 -5
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +70 -24
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validatorMonitor.js +1 -1
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -1
- package/lib/execution/engine/types.js +1 -1
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +5 -5
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +2 -1
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +5 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
- package/lib/sync/constants.d.ts +6 -5
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +6 -5
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/range/batch.d.ts +10 -1
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +28 -10
- 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 +30 -15
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +18 -0
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +39 -0
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/package.json +14 -14
- package/src/api/impl/config/constants.ts +2 -0
- package/src/api/impl/validator/index.ts +1 -1
- package/src/chain/archiveStore/archiveStore.ts +20 -3
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -1
- package/src/chain/errors/executionPayloadBid.ts +12 -4
- package/src/chain/opPools/aggregatedAttestationPool.ts +3 -1
- package/src/chain/prepareNextSlot.ts +1 -1
- package/src/chain/produceBlock/produceBlockBody.ts +5 -5
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +22 -9
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +87 -26
- package/src/chain/validatorMonitor.ts +1 -1
- package/src/execution/engine/interface.ts +1 -1
- package/src/execution/engine/types.ts +1 -1
- package/src/network/processor/index.ts +2 -1
- package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +5 -1
- package/src/sync/constants.ts +6 -5
- package/src/sync/range/batch.ts +31 -10
- package/src/sync/range/chain.ts +36 -16
- package/src/sync/range/utils/batches.ts +44 -0
- package/src/util/sszBytes.ts +1 -1
package/src/sync/range/chain.ts
CHANGED
|
@@ -23,7 +23,9 @@ import {Batch, BatchError, BatchErrorCode, BatchMetadata, BatchStatus} from "./b
|
|
|
23
23
|
import {
|
|
24
24
|
ChainPeersBalancer,
|
|
25
25
|
PeerSyncInfo,
|
|
26
|
+
ProcessingFaultKind,
|
|
26
27
|
batchStartEpochIsAfterSlot,
|
|
28
|
+
classifyProcessingFault,
|
|
27
29
|
computeHighestTarget,
|
|
28
30
|
getBatchSlotRange,
|
|
29
31
|
getNextBatchToProcess,
|
|
@@ -708,23 +710,41 @@ export class SyncChain {
|
|
|
708
710
|
this.triggerBatchProcessor();
|
|
709
711
|
} else {
|
|
710
712
|
this.logger.verbose("Batch process error", logCtx, res.err);
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
for (const pendingBatch of this.batches.values()) {
|
|
724
|
-
if (pendingBatch.startEpoch < batch.startEpoch) {
|
|
725
|
-
this.logger.verbose("Batch validation error", {id: this.logId, ...pendingBatch.getMetadata()});
|
|
726
|
-
pendingBatch.validationError(res.err); // Throws after MAX_BATCH_PROCESSING_ATTEMPTS
|
|
713
|
+
|
|
714
|
+
const invalidatePreviousBatches = (): number => {
|
|
715
|
+
let invalidatedCount = 0;
|
|
716
|
+
for (const pendingBatch of this.batches.values()) {
|
|
717
|
+
if (
|
|
718
|
+
pendingBatch.startEpoch < batch.startEpoch &&
|
|
719
|
+
pendingBatch.state.status === BatchStatus.AwaitingValidation
|
|
720
|
+
) {
|
|
721
|
+
this.logger.verbose("Batch validation error", {id: this.logId, ...pendingBatch.getMetadata()});
|
|
722
|
+
pendingBatch.validationError(res.err);
|
|
723
|
+
invalidatedCount++;
|
|
724
|
+
}
|
|
727
725
|
}
|
|
726
|
+
return invalidatedCount;
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
const prevBatch = this.batches.get(batch.startEpoch - EPOCHS_PER_BATCH);
|
|
730
|
+
switch (classifyProcessingFault(res.err, batch, prevBatch)) {
|
|
731
|
+
case ProcessingFaultKind.CurrentBatch:
|
|
732
|
+
batch.processingError(res.err);
|
|
733
|
+
break;
|
|
734
|
+
|
|
735
|
+
case ProcessingFaultKind.PreviousBatch:
|
|
736
|
+
// If no previous batch was invalidated, it means the error is on this batch
|
|
737
|
+
if (invalidatePreviousBatches() === 0) {
|
|
738
|
+
batch.processingError(res.err);
|
|
739
|
+
} else {
|
|
740
|
+
batch.retainForReprocessing();
|
|
741
|
+
}
|
|
742
|
+
break;
|
|
743
|
+
|
|
744
|
+
case ProcessingFaultKind.Ambiguous:
|
|
745
|
+
batch.processingError(res.err);
|
|
746
|
+
invalidatePreviousBatches();
|
|
747
|
+
break;
|
|
728
748
|
}
|
|
729
749
|
}
|
|
730
750
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
2
2
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
3
3
|
import {Epoch, Slot} from "@lodestar/types";
|
|
4
|
+
import {BlockError, BlockErrorCode} from "../../../chain/errors/index.js";
|
|
4
5
|
import {BATCH_SLOT_OFFSET, EPOCHS_PER_BATCH} from "../../constants.js";
|
|
5
6
|
import {Batch, BatchStatus} from "../batch.js";
|
|
6
7
|
|
|
@@ -117,3 +118,46 @@ export function isSyncChainDone(batches: Batch[], lastEpochWithProcessBlocks: Ep
|
|
|
117
118
|
|
|
118
119
|
return batchStartEpochIsAfterSlot(lastEpochWithProcessBlocks, targetSlot);
|
|
119
120
|
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Where a batch processing error should be attributed.
|
|
124
|
+
*/
|
|
125
|
+
export enum ProcessingFaultKind {
|
|
126
|
+
/** This batch's own blocks are bad or incomplete, so redownload this batch. */
|
|
127
|
+
CurrentBatch = "CurrentBatch",
|
|
128
|
+
/** This batch is valid, but a previous batch did not deliver the parent. */
|
|
129
|
+
PreviousBatch = "PreviousBatch",
|
|
130
|
+
/** The fault could be in this batch or a previous batch, so hedge both ways. */
|
|
131
|
+
Ambiguous = "Ambiguous",
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Classify a processChainSegment error for a batch so range sync only redownloads
|
|
136
|
+
* the batch or batches that could actually be at fault.
|
|
137
|
+
* Note that range sync is supposed to only handle linear chain, for forky condition we'll handle it via backward sync
|
|
138
|
+
* in BlockInputSync or the upcoming/TODO beacon_blocks_by_head req/resp.
|
|
139
|
+
*/
|
|
140
|
+
export function classifyProcessingFault(err: Error, batch: Batch, prevBatch: Batch | undefined): ProcessingFaultKind {
|
|
141
|
+
if (!(err instanceof BlockError)) {
|
|
142
|
+
return ProcessingFaultKind.CurrentBatch;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const {code} = err.type;
|
|
146
|
+
if (code !== BlockErrorCode.PARENT_BLOCK_UNKNOWN && code !== BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) {
|
|
147
|
+
return ProcessingFaultKind.CurrentBatch;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const firstErrorSlot = err.signedBlock.message.slot;
|
|
151
|
+
if (firstErrorSlot === batch.startSlot) {
|
|
152
|
+
// note that range sync is for linear chain, so this is clearly an issue of the previous batch
|
|
153
|
+
return prevBatch === undefined ? ProcessingFaultKind.CurrentBatch : ProcessingFaultKind.PreviousBatch;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const prevTailSlot = batch.startSlot - 1;
|
|
157
|
+
const prevHasFullTail =
|
|
158
|
+
code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN
|
|
159
|
+
? (prevBatch?.getPayloadEnvelopes()?.get(prevTailSlot)?.hasPayloadEnvelope() ?? false)
|
|
160
|
+
: (prevBatch?.getBlocks().some((b) => b.slot === prevTailSlot) ?? false);
|
|
161
|
+
|
|
162
|
+
return prevHasFullTail ? ProcessingFaultKind.CurrentBatch : ProcessingFaultKind.Ambiguous;
|
|
163
|
+
}
|
package/src/util/sszBytes.ts
CHANGED
|
@@ -706,7 +706,7 @@ export function getBlockRootFromPayloadAttestationMessageSerialized(data: Uint8A
|
|
|
706
706
|
* blockHash: Bytes32 (32 bytes)
|
|
707
707
|
* prevRandao: Bytes32 (32 bytes)
|
|
708
708
|
* feeRecipient: ExecutionAddress(20 bytes)
|
|
709
|
-
* gasLimit:
|
|
709
|
+
* gasLimit: UintBn64 (8 bytes)
|
|
710
710
|
* builderIndex: BuilderIndex (8 bytes)
|
|
711
711
|
* slot: Slot (8 bytes) ← absolute offset 264
|
|
712
712
|
*/
|