@lodestar/beacon-node 1.46.0-dev.4191d8e353 → 1.46.0-dev.5aeaa12d3c
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/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 +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/produceBlock/produceBlockBody.js +2 -2
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/executionPayloadBid.js +2 -2
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +8 -8
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validatorMonitor.js +1 -1
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +4 -4
- 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/chain/archiveStore/archiveStore.ts +20 -3
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -1
- package/src/chain/errors/executionPayloadBid.ts +1 -1
- package/src/chain/opPools/aggregatedAttestationPool.ts +3 -1
- package/src/chain/produceBlock/produceBlockBody.ts +2 -2
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +2 -2
- package/src/chain/validation/proposerPreferences.ts +8 -8
- package/src/chain/validatorMonitor.ts +1 -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
|
@@ -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
|
*/
|