@lodestar/beacon-node 1.43.0-dev.921c57528b → 1.43.0-dev.958956d6ba
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 +6 -5
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.js +1 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -2
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +19 -6
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +43 -19
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts +5 -3
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +31 -10
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +4 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +2 -2
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +2 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +81 -12
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +5 -3
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +51 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js +15 -4
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +8 -3
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -3
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +19 -4
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +8 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/index.d.ts +1 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +1 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/proposerPreferences.d.ts +33 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/errors/proposerPreferences.js +13 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -0
- package/lib/chain/interface.d.ts +5 -3
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +2 -2
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +4 -4
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +14 -2
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +35 -16
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +1 -0
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +1 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +1 -0
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +1 -0
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +8 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +8 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.d.ts +15 -0
- package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
- package/lib/chain/seenCache/seenProposerPreferences.js +25 -0
- package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +1 -0
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts +8 -0
- package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/validation/proposerPreferences.js +69 -0
- package/lib/chain/validation/proposerPreferences.js.map +1 -0
- 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 +4 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +7 -1
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +1 -0
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +12 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +8 -0
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +6 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +10 -6
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/index.js +5 -0
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +1 -0
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/node/notifier.js +7 -1
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/range/batch.d.ts +12 -2
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +56 -30
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +6 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +4 -3
- 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 +17 -6
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/types.d.ts +34 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +34 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +24 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +649 -53
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +46 -10
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +147 -24
- 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 +6 -2
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js +0 -9
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/package.json +16 -15
- package/src/api/impl/beacon/blocks/index.ts +8 -5
- package/src/api/impl/lodestar/index.ts +1 -1
- package/src/chain/blocks/importBlock.ts +3 -2
- package/src/chain/blocks/importExecutionPayload.ts +57 -21
- package/src/chain/blocks/index.ts +54 -14
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +5 -1
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +2 -2
- package/src/chain/blocks/types.ts +2 -2
- package/src/chain/blocks/utils/chainSegment.ts +106 -17
- package/src/chain/blocks/verifyBlock.ts +68 -9
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +16 -7
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +2 -2
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
- package/src/chain/chain.ts +28 -3
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/proposerPreferences.ts +39 -0
- package/src/chain/interface.ts +9 -1
- package/src/chain/opPools/payloadAttestationPool.ts +4 -8
- package/src/chain/prepareNextSlot.ts +24 -3
- package/src/chain/produceBlock/produceBlockBody.ts +41 -14
- package/src/chain/regen/interface.ts +1 -0
- package/src/chain/seenCache/index.ts +1 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +13 -3
- package/src/chain/seenCache/seenProposerPreferences.ts +29 -0
- package/src/chain/validation/block.ts +1 -0
- package/src/chain/validation/proposerPreferences.ts +91 -0
- package/src/metrics/metrics/lodestar.ts +4 -0
- package/src/network/gossip/interface.ts +6 -0
- package/src/network/gossip/scoringParameters.ts +14 -1
- package/src/network/gossip/topic.ts +6 -0
- package/src/network/processor/gossipHandlers.ts +15 -6
- package/src/network/processor/gossipQueues/index.ts +5 -0
- package/src/network/processor/index.ts +1 -0
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
- package/src/node/notifier.ts +8 -1
- package/src/sync/range/batch.ts +90 -35
- package/src/sync/range/chain.ts +13 -5
- package/src/sync/range/range.ts +18 -6
- package/src/sync/types.ts +72 -0
- package/src/sync/unknownBlock.ts +810 -57
- package/src/sync/utils/downloadByRange.ts +256 -39
- package/src/sync/utils/downloadByRoot.ts +12 -2
- package/src/sync/utils/pendingBlocksTree.ts +0 -15
|
@@ -234,7 +234,7 @@ export function getBeaconBlockApi({
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
try {
|
|
237
|
-
await verifyBlocksInEpoch.call(chain as BeaconChain, parentBlock, [blockForImport], {
|
|
237
|
+
await verifyBlocksInEpoch.call(chain as BeaconChain, parentBlock, [blockForImport], null, {
|
|
238
238
|
...opts,
|
|
239
239
|
verifyOnly: true,
|
|
240
240
|
skipVerifyBlockSignatures: true,
|
|
@@ -311,7 +311,10 @@ export function getBeaconBlockApi({
|
|
|
311
311
|
chain
|
|
312
312
|
.processBlock(blockForImport, opts)
|
|
313
313
|
.catch((e) => {
|
|
314
|
-
if (
|
|
314
|
+
if (
|
|
315
|
+
e instanceof BlockError &&
|
|
316
|
+
(e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN)
|
|
317
|
+
) {
|
|
315
318
|
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
316
319
|
blockInput: blockForImport,
|
|
317
320
|
peer: IDENTITY_PEER_ID,
|
|
@@ -773,9 +776,9 @@ export function getBeaconBlockApi({
|
|
|
773
776
|
// Track metrics for data column publishing
|
|
774
777
|
if (dataColumnSidecars.length > 0) {
|
|
775
778
|
let columnsPublishedWithZeroPeers = 0;
|
|
776
|
-
// Skip first entry (envelope),
|
|
777
|
-
for (let i =
|
|
778
|
-
const sentPeers = sentPeersArr[i] as number;
|
|
779
|
+
// Skip first entry (envelope); the final entry is processExecutionPayload(), which returns void.
|
|
780
|
+
for (let i = 0; i < dataColumnSidecars.length; i++) {
|
|
781
|
+
const sentPeers = sentPeersArr[i + 1] as number;
|
|
779
782
|
metrics?.dataColumns.sentPeersPerSubnet.observe(sentPeers);
|
|
780
783
|
if (sentPeers === 0) {
|
|
781
784
|
columnsPublishedWithZeroPeers++;
|
|
@@ -118,7 +118,7 @@ export function getLodestarApi({
|
|
|
118
118
|
return {
|
|
119
119
|
// biome-ignore lint/complexity/useLiteralKeys: The `blockProcessor` is a protected attribute
|
|
120
120
|
data: (chain as BeaconChain)["blockProcessor"].jobQueue.getItems().map((item) => {
|
|
121
|
-
const [blockInputs, opts] = item.args;
|
|
121
|
+
const [blockInputs, _payloadEnvelopes, opts] = item.args;
|
|
122
122
|
return {
|
|
123
123
|
blockSlots: blockInputs.map((blockInput) => blockInput.slot),
|
|
124
124
|
jobOpts: opts,
|
|
@@ -135,8 +135,9 @@ export async function importBlock(
|
|
|
135
135
|
// Some block event handlers require state being in state cache so need to do this before emitting EventType.block
|
|
136
136
|
this.regen.processState(blockRootHex, postState);
|
|
137
137
|
|
|
138
|
-
// For
|
|
139
|
-
|
|
138
|
+
// For range sync, PayloadEnvelope is created before reaching this
|
|
139
|
+
// we also don't need to trigger getBlobs() in that case
|
|
140
|
+
if (fork >= ForkSeq.gloas && !opts.fromRangeSync) {
|
|
140
141
|
const payloadInput = this.seenPayloadEnvelopeInputCache.add({
|
|
141
142
|
blockRootHex,
|
|
142
143
|
block: block as SignedBeaconBlock<ForkPostGloas>,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
|
-
import {ExecutionStatus, PayloadExecutionStatus} from "@lodestar/fork-choice";
|
|
3
|
-
import {isStatePostGloas} from "@lodestar/state-transition";
|
|
4
|
-
import {fromHex} from "@lodestar/utils";
|
|
2
|
+
import {ExecutionStatus, PayloadExecutionStatus, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
|
+
import {DataAvailabilityStatus, isStatePostGloas} from "@lodestar/state-transition";
|
|
4
|
+
import {fromHex, isErrorAborted} from "@lodestar/utils";
|
|
5
|
+
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
5
6
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
6
7
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
7
8
|
import {BeaconChain} from "../chain.js";
|
|
@@ -75,21 +76,24 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
75
76
|
* The envelope is only verified here, no state mutation. State effects from the payload
|
|
76
77
|
* are applied on the next block via processParentExecutionPayload.
|
|
77
78
|
*
|
|
79
|
+
* The DA wait must have run upstream (range sync awaits DA in `verifyBlocksInEpoch` for the
|
|
80
|
+
* whole segment; gossip / API path uses the `processExecutionPayload` wrapper below).
|
|
81
|
+
*
|
|
78
82
|
* Steps:
|
|
79
83
|
* 1. Emit `execution_payload_available` event for payload attestation
|
|
80
84
|
* 2. Get the ProtoBlock from fork choice
|
|
81
|
-
* 3.
|
|
82
|
-
* 4.
|
|
83
|
-
* 5.
|
|
84
|
-
* 6.
|
|
85
|
-
* 7.
|
|
85
|
+
* 3. Regenerate state for envelope verification
|
|
86
|
+
* 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
|
|
87
|
+
* 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
|
|
88
|
+
* 6. Update fork choice (transitions the block's PENDING variant to FULL)
|
|
89
|
+
* 7. Queue notifyForkchoiceUpdate to engine api
|
|
86
90
|
* 8. Record metrics for payload envelope and column sources
|
|
87
91
|
* 9. Emit `execution_payload` event
|
|
88
92
|
*/
|
|
89
93
|
export async function importExecutionPayload(
|
|
90
94
|
this: BeaconChain,
|
|
91
95
|
payloadInput: PayloadEnvelopeInput,
|
|
92
|
-
|
|
96
|
+
dataAvailabilityStatus: DataAvailabilityStatus,
|
|
93
97
|
opts: ImportPayloadOpts = {}
|
|
94
98
|
): Promise<void> {
|
|
95
99
|
const signedEnvelope = payloadInput.getPayloadEnvelope();
|
|
@@ -119,11 +123,7 @@ export async function importExecutionPayload(
|
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
// 3.
|
|
123
|
-
// The helper is shared with future gloas sync services; take the single-item batch form here.
|
|
124
|
-
await verifyPayloadsDataAvailability([payloadInput], signal);
|
|
125
|
-
|
|
126
|
-
// 4. Regenerate state for envelope verification
|
|
126
|
+
// 3. Regenerate state for envelope verification
|
|
127
127
|
const blockState = await this.regen.getBlockSlotState(
|
|
128
128
|
protoBlock,
|
|
129
129
|
protoBlock.slot,
|
|
@@ -137,7 +137,7 @@ export async function importExecutionPayload(
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
//
|
|
140
|
+
// 4. Verify envelope fields against state first to fail fast before the EL + BLS work.
|
|
141
141
|
// When validSignature is true, gossip/API has already verified both the signature and the
|
|
142
142
|
// executionRequestsRoot, so we skip those checks here.
|
|
143
143
|
try {
|
|
@@ -154,7 +154,7 @@ export async function importExecutionPayload(
|
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
//
|
|
157
|
+
// 4a. Run EL and signature verification in parallel
|
|
158
158
|
const [execResult, signatureValid] = await Promise.all([
|
|
159
159
|
this.executionEngine.notifyNewPayload(
|
|
160
160
|
fork,
|
|
@@ -176,12 +176,12 @@ export async function importExecutionPayload(
|
|
|
176
176
|
),
|
|
177
177
|
]);
|
|
178
178
|
|
|
179
|
-
//
|
|
179
|
+
// 4b. Check signature verification result
|
|
180
180
|
if (!signatureValid) {
|
|
181
181
|
throw new PayloadError({code: PayloadErrorCode.INVALID_SIGNATURE});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
//
|
|
184
|
+
// 4c. Handle EL response
|
|
185
185
|
switch (execResult.status) {
|
|
186
186
|
case ExecutionPayloadStatus.VALID:
|
|
187
187
|
break;
|
|
@@ -207,7 +207,7 @@ export async function importExecutionPayload(
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
//
|
|
210
|
+
// 5. Persist payload envelope to hot DB. Wait for write-queue space here to apply backpressure
|
|
211
211
|
// on the import pipeline during sync, then perform the write asynchronously to avoid blocking.
|
|
212
212
|
await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
|
|
213
213
|
this.unfinalizedPayloadEnvelopeWrites.push(payloadInput).catch((e) => {
|
|
@@ -220,9 +220,27 @@ export async function importExecutionPayload(
|
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
-
//
|
|
223
|
+
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
224
224
|
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
225
|
-
this.forkChoice.onExecutionPayload(
|
|
225
|
+
this.forkChoice.onExecutionPayload(
|
|
226
|
+
blockRootHex,
|
|
227
|
+
blockHashHex,
|
|
228
|
+
envelope.payload.blockNumber,
|
|
229
|
+
execStatus,
|
|
230
|
+
dataAvailabilityStatus
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
// 7. Queue notifyForkchoiceUpdate to engine api
|
|
234
|
+
const head = this.forkChoice.getHead();
|
|
235
|
+
if (!this.opts.disableImportExecutionFcU && blockRootHex === head.blockRoot) {
|
|
236
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
237
|
+
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
238
|
+
this.executionEngine.notifyForkchoiceUpdate(fork, blockHashHex, safeBlockHash, finalizedBlockHash).catch((e) => {
|
|
239
|
+
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
|
|
240
|
+
this.logger.error("Error pushing notifyForkchoiceUpdate()", {blockHashHex, finalizedBlockHash}, e);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
226
244
|
|
|
227
245
|
// 8. Record metrics for payload envelope and column sources
|
|
228
246
|
this.metrics?.importPayload.bySource.inc({source: payloadInput.getPayloadEnvelopeSource().source});
|
|
@@ -249,3 +267,21 @@ export async function importExecutionPayload(
|
|
|
249
267
|
blockHash: blockHashHex,
|
|
250
268
|
});
|
|
251
269
|
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Process an execution payload envelope end-to-end: wait for DA, then import.
|
|
273
|
+
*
|
|
274
|
+
* Used by the PayloadEnvelopeProcessor queue (gossip / API / unknown-payload sync) — i.e.
|
|
275
|
+
* callers that have NOT already awaited DA themselves. Range sync's inline dispatch in
|
|
276
|
+
* processBlocks skips this wrapper and calls `importExecutionPayload` directly, since
|
|
277
|
+
* `verifyBlocksInEpoch` already awaited DA for the segment.
|
|
278
|
+
*/
|
|
279
|
+
export async function processExecutionPayload(
|
|
280
|
+
this: BeaconChain,
|
|
281
|
+
payloadInput: PayloadEnvelopeInput,
|
|
282
|
+
signal: AbortSignal,
|
|
283
|
+
opts: ImportPayloadOpts = {}
|
|
284
|
+
): Promise<void> {
|
|
285
|
+
const {dataAvailabilityStatuses} = await verifyPayloadsDataAvailability([payloadInput], signal);
|
|
286
|
+
await importExecutionPayload.call(this, payloadInput, dataAvailabilityStatuses[0], opts);
|
|
287
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {SignedBeaconBlock} from "@lodestar/types";
|
|
1
|
+
import {SignedBeaconBlock, Slot} from "@lodestar/types";
|
|
2
2
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
3
3
|
import {Metrics} from "../../metrics/metrics.js";
|
|
4
4
|
import {nextEventLoop} from "../../util/eventLoop.js";
|
|
@@ -8,6 +8,8 @@ import {BlockError, BlockErrorCode, isBlockErrorAborted} from "../errors/index.j
|
|
|
8
8
|
import {BlockProcessOpts} from "../options.js";
|
|
9
9
|
import {IBlockInput} from "./blockInput/types.js";
|
|
10
10
|
import {importBlock} from "./importBlock.js";
|
|
11
|
+
import {importExecutionPayload} from "./importExecutionPayload.js";
|
|
12
|
+
import {PayloadEnvelopeInput} from "./payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
11
13
|
import {FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
|
|
12
14
|
import {assertLinearChainSegment} from "./utils/chainSegment.js";
|
|
13
15
|
import {verifyBlocksInEpoch} from "./verifyBlock.js";
|
|
@@ -21,20 +23,24 @@ const QUEUE_MAX_LENGTH = 256;
|
|
|
21
23
|
* BlockProcessor processes block jobs in a queued fashion, one after the other.
|
|
22
24
|
*/
|
|
23
25
|
export class BlockProcessor {
|
|
24
|
-
readonly jobQueue: JobItemQueue<[IBlockInput[], ImportBlockOpts], void>;
|
|
26
|
+
readonly jobQueue: JobItemQueue<[IBlockInput[], Map<Slot, PayloadEnvelopeInput> | null, ImportBlockOpts], void>;
|
|
25
27
|
|
|
26
28
|
constructor(chain: BeaconChain, metrics: Metrics | null, opts: BlockProcessOpts, signal: AbortSignal) {
|
|
27
|
-
this.jobQueue = new JobItemQueue<[IBlockInput[], ImportBlockOpts], void>(
|
|
28
|
-
(job, importOpts) => {
|
|
29
|
-
return processBlocks.call(chain, job, {...opts, ...importOpts});
|
|
29
|
+
this.jobQueue = new JobItemQueue<[IBlockInput[], Map<Slot, PayloadEnvelopeInput> | null, ImportBlockOpts], void>(
|
|
30
|
+
(job, payloadEnvelopes, importOpts) => {
|
|
31
|
+
return processBlocks.call(chain, job, payloadEnvelopes, {...opts, ...importOpts});
|
|
30
32
|
},
|
|
31
33
|
{maxLength: QUEUE_MAX_LENGTH, noYieldIfOneItem: true, signal},
|
|
32
34
|
metrics?.blockProcessorQueue ?? undefined
|
|
33
35
|
);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
async processBlocksJob(
|
|
37
|
-
|
|
38
|
+
async processBlocksJob(
|
|
39
|
+
job: IBlockInput[],
|
|
40
|
+
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null,
|
|
41
|
+
opts: ImportBlockOpts = {}
|
|
42
|
+
): Promise<void> {
|
|
43
|
+
await this.jobQueue.push(job, payloadEnvelopes, opts);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
|
|
@@ -51,16 +57,13 @@ export class BlockProcessor {
|
|
|
51
57
|
export async function processBlocks(
|
|
52
58
|
this: BeaconChain,
|
|
53
59
|
blocks: IBlockInput[],
|
|
60
|
+
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null,
|
|
54
61
|
opts: BlockProcessOpts & ImportBlockOpts
|
|
55
62
|
): Promise<void> {
|
|
56
63
|
if (blocks.length === 0) {
|
|
57
64
|
return; // TODO: or throw?
|
|
58
65
|
}
|
|
59
66
|
|
|
60
|
-
if (blocks.length > 1) {
|
|
61
|
-
assertLinearChainSegment(this.config, blocks);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
67
|
try {
|
|
65
68
|
const {relevantBlocks, parentSlots, parentBlock} = verifyBlocksSanityChecks(this, blocks, opts);
|
|
66
69
|
|
|
@@ -70,10 +73,31 @@ export async function processBlocks(
|
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
const {warnings: orphanedPayloads} = assertLinearChainSegment(
|
|
77
|
+
this.config,
|
|
78
|
+
relevantBlocks,
|
|
79
|
+
payloadEnvelopes,
|
|
80
|
+
parentBlock
|
|
81
|
+
);
|
|
82
|
+
if (orphanedPayloads != null) {
|
|
83
|
+
for (const orphaned of orphanedPayloads) {
|
|
84
|
+
this.logger.debug("Orphaned payload envelope in chain segment", {
|
|
85
|
+
slot: orphaned.slot,
|
|
86
|
+
blockRoot: orphaned.payloadEnvelopeInput.blockRootHex,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
73
91
|
// Fully verify a block to be imported immediately after. Does not produce any side-effects besides adding intermediate
|
|
74
92
|
// states in the state cache through regen.
|
|
75
|
-
const {
|
|
76
|
-
|
|
93
|
+
const {
|
|
94
|
+
postStates,
|
|
95
|
+
blockDAStatuses,
|
|
96
|
+
payloadDAStatuses,
|
|
97
|
+
proposerBalanceDeltas,
|
|
98
|
+
segmentExecStatus,
|
|
99
|
+
indexedAttestationsByBlock,
|
|
100
|
+
} = await verifyBlocksInEpoch.call(this, parentBlock, relevantBlocks, payloadEnvelopes, opts);
|
|
77
101
|
|
|
78
102
|
// If segmentExecStatus has lvhForkchoice then, the entire segment should be invalid
|
|
79
103
|
// and we need to further propagate
|
|
@@ -92,7 +116,7 @@ export async function processBlocks(
|
|
|
92
116
|
parentBlockSlot: parentSlots[i],
|
|
93
117
|
executionStatus: executionStatuses[i],
|
|
94
118
|
// start supporting optimistic syncing/processing
|
|
95
|
-
dataAvailabilityStatus:
|
|
119
|
+
dataAvailabilityStatus: blockDAStatuses[i],
|
|
96
120
|
proposerBalanceDelta: proposerBalanceDeltas[i],
|
|
97
121
|
indexedAttestations: indexedAttestationsByBlock[i],
|
|
98
122
|
// TODO: Make this param mandatory and capture in gossip
|
|
@@ -103,6 +127,22 @@ export async function processBlocks(
|
|
|
103
127
|
for (const fullyVerifiedBlock of fullyVerifiedBlocks) {
|
|
104
128
|
// TODO: Consider batching importBlock too if it takes significant time
|
|
105
129
|
await importBlock.call(this, fullyVerifiedBlock, opts);
|
|
130
|
+
|
|
131
|
+
const slot = fullyVerifiedBlock.blockInput.getBlock().message.slot;
|
|
132
|
+
const payloadInput = payloadEnvelopes?.get(slot);
|
|
133
|
+
if (payloadInput?.hasPayloadEnvelope()) {
|
|
134
|
+
if (!payloadInput.isComplete()) {
|
|
135
|
+
// we validated DA before reaching this
|
|
136
|
+
throw new Error(`Payload envelope for slot ${slot} not complete after DA verification`);
|
|
137
|
+
}
|
|
138
|
+
// we already awaited DA in verifyBlocksInEpoch for this segment
|
|
139
|
+
const payloadDA = payloadDAStatuses.get(slot);
|
|
140
|
+
if (payloadDA === undefined) {
|
|
141
|
+
throw new Error(`Missing payload DA status for slot ${slot}`);
|
|
142
|
+
}
|
|
143
|
+
await importExecutionPayload.call(this, payloadInput, payloadDA, {validSignature: false});
|
|
144
|
+
}
|
|
145
|
+
|
|
106
146
|
await nextEventLoop();
|
|
107
147
|
}
|
|
108
148
|
} catch (e) {
|
|
@@ -64,6 +64,7 @@ export class PayloadEnvelopeInput {
|
|
|
64
64
|
readonly proposerIndex: ValidatorIndex;
|
|
65
65
|
readonly bid: gloas.ExecutionPayloadBid;
|
|
66
66
|
readonly versionedHashes: VersionedHashes;
|
|
67
|
+
readonly daOutOfRange: boolean;
|
|
67
68
|
|
|
68
69
|
private columnsCache = new Map<ColumnIndex, ColumnWithSource>();
|
|
69
70
|
|
|
@@ -87,6 +88,7 @@ export class PayloadEnvelopeInput {
|
|
|
87
88
|
sampledColumns: ColumnIndex[];
|
|
88
89
|
custodyColumns: ColumnIndex[];
|
|
89
90
|
timeCreatedSec: number;
|
|
91
|
+
daOutOfRange: boolean;
|
|
90
92
|
}) {
|
|
91
93
|
this.blockRootHex = props.blockRootHex;
|
|
92
94
|
this.slot = props.slot;
|
|
@@ -97,13 +99,14 @@ export class PayloadEnvelopeInput {
|
|
|
97
99
|
this.sampledColumns = props.sampledColumns;
|
|
98
100
|
this.custodyColumns = props.custodyColumns;
|
|
99
101
|
this.timeCreatedSec = props.timeCreatedSec;
|
|
102
|
+
this.daOutOfRange = props.daOutOfRange;
|
|
100
103
|
this.payloadEnvelopeDataPromise = createPromise();
|
|
101
104
|
this.allDataPromise = createPromise();
|
|
102
105
|
this.columnsDataPromise = createPromise();
|
|
103
106
|
|
|
104
107
|
const noBlobs = props.bid.blobKzgCommitments.length === 0;
|
|
105
108
|
const noSampledColumns = props.sampledColumns.length === 0;
|
|
106
|
-
const hasAllData = noBlobs || noSampledColumns;
|
|
109
|
+
const hasAllData = props.daOutOfRange || noBlobs || noSampledColumns;
|
|
107
110
|
|
|
108
111
|
if (hasAllData) {
|
|
109
112
|
this.state = {hasPayload: false, hasAllData: true, hasComputedAllData: true};
|
|
@@ -125,6 +128,7 @@ export class PayloadEnvelopeInput {
|
|
|
125
128
|
sampledColumns: props.sampledColumns,
|
|
126
129
|
custodyColumns: props.custodyColumns,
|
|
127
130
|
timeCreatedSec: props.timeCreatedSec,
|
|
131
|
+
daOutOfRange: props.daOutOfRange,
|
|
128
132
|
});
|
|
129
133
|
}
|
|
130
134
|
|
|
@@ -2,7 +2,7 @@ import {Metrics} from "../../metrics/metrics.js";
|
|
|
2
2
|
import {JobItemQueue} from "../../util/queue/index.js";
|
|
3
3
|
import type {BeaconChain} from "../chain.js";
|
|
4
4
|
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
5
|
-
import {
|
|
5
|
+
import {processExecutionPayload} from "./importExecutionPayload.js";
|
|
6
6
|
import {ImportPayloadOpts} from "./types.js";
|
|
7
7
|
|
|
8
8
|
// TODO GLOAS: Set to be equal to DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES for now
|
|
@@ -30,7 +30,7 @@ export class PayloadEnvelopeProcessor {
|
|
|
30
30
|
this.jobQueue = new JobItemQueue<[PayloadEnvelopeInput, ImportPayloadOpts], void>(
|
|
31
31
|
(payloadInput, opts) => {
|
|
32
32
|
this.importStatus.set(payloadInput, PayloadEnvelopeImportStatus.importing);
|
|
33
|
-
return
|
|
33
|
+
return processExecutionPayload.call(chain, payloadInput, signal, opts);
|
|
34
34
|
},
|
|
35
35
|
{maxLength: QUEUE_MAX_LENGTH, noYieldIfOneItem: true, signal},
|
|
36
36
|
metrics?.payloadEnvelopeProcessorQueue ?? undefined
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {BlockExecutionStatus} from "@lodestar/fork-choice";
|
|
2
|
+
import type {BlockExecutionStatus, PayloadExecutionStatus} from "@lodestar/fork-choice";
|
|
3
3
|
import {ForkSeq} from "@lodestar/params";
|
|
4
4
|
import {DataAvailabilityStatus, IBeaconStateView, computeEpochAtSlot} from "@lodestar/state-transition";
|
|
5
5
|
import type {IndexedAttestation, Slot, fulu} from "@lodestar/types";
|
|
@@ -107,5 +107,5 @@ export type FullyVerifiedBlock = {
|
|
|
107
107
|
/** Seen timestamp seconds */
|
|
108
108
|
seenTimestampSec: number;
|
|
109
109
|
/** If the execution payload couldn't be verified because of EL syncing status, used in optimistic sync */
|
|
110
|
-
executionStatus: BlockExecutionStatus;
|
|
110
|
+
executionStatus: BlockExecutionStatus | PayloadExecutionStatus;
|
|
111
111
|
};
|
|
@@ -1,29 +1,118 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {ProtoBlock} from "@lodestar/fork-choice";
|
|
3
|
+
import {Slot, isGloasBeaconBlock, ssz} from "@lodestar/types";
|
|
4
|
+
import {toRootHex} from "@lodestar/utils";
|
|
3
5
|
import {BlockError, BlockErrorCode} from "../../errors/index.js";
|
|
4
6
|
import {IBlockInput} from "../blockInput/types.js";
|
|
7
|
+
import {PayloadEnvelopeInput} from "../payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
8
|
+
|
|
9
|
+
export type OrphanedPayloadEnvelope = {
|
|
10
|
+
slot: Slot;
|
|
11
|
+
payloadEnvelopeInput: PayloadEnvelopeInput;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ChainSegmentResult = {warnings: OrphanedPayloadEnvelope[] | null};
|
|
5
15
|
|
|
6
16
|
/**
|
|
7
|
-
* Assert this chain segment of blocks is linear with slot numbers and hashes
|
|
17
|
+
* Assert this chain segment of blocks is linear with slot numbers and hashes,
|
|
18
|
+
* and that the provided envelopes are consistent with their respective blocks.
|
|
19
|
+
*
|
|
20
|
+
* Must be called after verifyBlocksSanityChecks so that parentBlock (from forkchoice)
|
|
21
|
+
* is available to seed the execution hash chain.
|
|
22
|
+
*
|
|
23
|
+
* For each block:
|
|
24
|
+
* - Verifies parent root + slot linearity
|
|
25
|
+
* - For gloas: verifies bid.parentBlockHash matches the tracked execution hash; if not, the
|
|
26
|
+
* previous FULL envelope is treated as orphaned (segment continues as if previous slot was EMPTY)
|
|
27
|
+
* - If an envelope exists for this slot: verifies it references this block's root
|
|
28
|
+
* - Advances the tracked execution hash (FULL if envelope present, EMPTY if not)
|
|
8
29
|
*/
|
|
30
|
+
export function assertLinearChainSegment(
|
|
31
|
+
config: ChainForkConfig,
|
|
32
|
+
blocks: IBlockInput[],
|
|
33
|
+
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null,
|
|
34
|
+
parentBlock: ProtoBlock
|
|
35
|
+
): ChainSegmentResult {
|
|
36
|
+
const warnings: OrphanedPayloadEnvelope[] = [];
|
|
9
37
|
|
|
10
|
-
|
|
11
|
-
|
|
38
|
+
// Track the expected execution payload block hash through the segment.
|
|
39
|
+
// Starts from the known forkchoice parent's execution hash.
|
|
40
|
+
// - FULL variant (envelope present for slot): advances to envelope.payload.blockHash
|
|
41
|
+
// - EMPTY variant (no envelope for slot): execution hash is unchanged
|
|
42
|
+
// null only for pre-merge parents, which cannot precede gloas blocks.
|
|
43
|
+
let currentExecHash: string | null = parentBlock.executionPayloadBlockHash;
|
|
44
|
+
// Track the execution hash before the last FULL advancement so we can recover
|
|
45
|
+
// if the next block reveals that envelope was orphaned.
|
|
46
|
+
let prevExecHash: string | null = currentExecHash;
|
|
47
|
+
// The slot whose envelope last advanced currentExecHash (for warning context).
|
|
48
|
+
let lastFullSlot: Slot | null = null;
|
|
49
|
+
|
|
50
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
12
51
|
const block = blocks[i].getBlock();
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
52
|
+
const slot = block.message.slot;
|
|
53
|
+
|
|
54
|
+
if (i > 0) {
|
|
55
|
+
const prevBlock = blocks[i - 1].getBlock();
|
|
56
|
+
// Ensure parent root matches the previous block's root
|
|
57
|
+
if (
|
|
58
|
+
!ssz.Root.equals(
|
|
59
|
+
config.getForkTypes(prevBlock.message.slot).BeaconBlock.hashTreeRoot(prevBlock.message),
|
|
60
|
+
block.message.parentRoot
|
|
61
|
+
)
|
|
62
|
+
) {
|
|
63
|
+
throw new BlockError(block, {code: BlockErrorCode.NON_LINEAR_PARENT_ROOTS});
|
|
64
|
+
}
|
|
65
|
+
// Ensure slots are strictly increasing
|
|
66
|
+
if (slot <= prevBlock.message.slot) {
|
|
67
|
+
throw new BlockError(block, {code: BlockErrorCode.NON_LINEAR_SLOTS});
|
|
68
|
+
}
|
|
23
69
|
}
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
70
|
+
|
|
71
|
+
if (isGloasBeaconBlock(block.message) && currentExecHash !== null) {
|
|
72
|
+
// Verify the bid's parentBlockHash matches the tracked execution hash.
|
|
73
|
+
// This ensures the block was built on the correct FULL or EMPTY variant of its parent.
|
|
74
|
+
const bidParentHash = toRootHex(block.message.body.signedExecutionPayloadBid.message.parentBlockHash);
|
|
75
|
+
if (bidParentHash !== currentExecHash) {
|
|
76
|
+
// Maybe the previous slot's FULL envelope was orphaned — try falling back.
|
|
77
|
+
// If even prevExecHash doesn't match, the segment is non-linear.
|
|
78
|
+
if (bidParentHash !== prevExecHash) {
|
|
79
|
+
throw new BlockError(block, {
|
|
80
|
+
code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
|
|
81
|
+
parentRoot: toRootHex(block.message.parentRoot),
|
|
82
|
+
parentBlockHash: bidParentHash,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (lastFullSlot !== null && payloadEnvelopes !== null) {
|
|
86
|
+
const orphanedInput = payloadEnvelopes.get(lastFullSlot);
|
|
87
|
+
if (orphanedInput != null) {
|
|
88
|
+
warnings.push({slot: lastFullSlot, payloadEnvelopeInput: orphanedInput});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
currentExecHash = prevExecHash;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const payloadInput = payloadEnvelopes?.get(slot) ?? null;
|
|
95
|
+
const payloadEnvelope = payloadInput?.hasPayloadEnvelope() ? payloadInput.getPayloadEnvelope() : null;
|
|
96
|
+
if (payloadEnvelope !== null) {
|
|
97
|
+
// Verify the envelope references this block's root
|
|
98
|
+
const blockRoot = toRootHex(config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block.message));
|
|
99
|
+
const envelopeBlockRoot = toRootHex(payloadEnvelope.message.beaconBlockRoot);
|
|
100
|
+
if (blockRoot !== envelopeBlockRoot) {
|
|
101
|
+
throw new BlockError(block, {
|
|
102
|
+
code: BlockErrorCode.ENVELOPE_BLOCK_ROOT_MISMATCH,
|
|
103
|
+
envelopeBlockRoot,
|
|
104
|
+
blockRoot,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// FULL variant: save state before advancing, then advance
|
|
109
|
+
prevExecHash = currentExecHash;
|
|
110
|
+
lastFullSlot = slot;
|
|
111
|
+
currentExecHash = toRootHex(payloadEnvelope.message.payload.blockHash);
|
|
112
|
+
}
|
|
113
|
+
// EMPTY variant: currentExecHash unchanged
|
|
27
114
|
}
|
|
28
115
|
}
|
|
116
|
+
|
|
117
|
+
return {warnings: warnings.length > 0 ? warnings : null};
|
|
29
118
|
}
|