@lodestar/beacon-node 1.44.0-rc.0 → 1.44.0-rc.2
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 +23 -28
- 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 +0 -25
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +20 -27
- package/lib/api/impl/validator/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/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +6 -0
- 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/produceBlock/produceBlockBody.js +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +12 -1
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +3 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +5 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +20 -767
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/processor/index.js +1 -1
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -2
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/sync/types.d.ts +9 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +9 -2
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +40 -11
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/package.json +14 -14
- package/src/api/impl/beacon/blocks/index.ts +27 -37
- package/src/api/impl/beacon/pool/index.ts +1 -41
- package/src/api/impl/validator/index.ts +29 -39
- package/src/chain/blocks/importBlock.ts +7 -5
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +2 -4
- package/src/chain/emitter.ts +3 -2
- package/src/chain/errors/executionPayloadBid.ts +7 -0
- package/src/chain/produceBlock/produceBlockBody.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +13 -1
- package/src/metrics/metrics/lodestar.ts +5 -0
- package/src/network/processor/index.ts +1 -1
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -2
- package/src/sync/types.ts +11 -2
- package/src/sync/unknownBlock.ts +43 -12
- package/src/util/sszBytes.ts +1 -1
|
@@ -61,10 +61,8 @@ export function verifyExecutionPayloadEnvelope(
|
|
|
61
61
|
`Prev randao mismatch between bid and payload bid=${toHex(bid.prevRandao)} payload=${toHex(payload.prevRandao)}`
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${Number(bid.gasLimit)}`
|
|
67
|
-
);
|
|
64
|
+
if (bid.gasLimit !== payload.gasLimit) {
|
|
65
|
+
throw new Error(`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${bid.gasLimit}`);
|
|
68
66
|
}
|
|
69
67
|
if (!byteArrayEquals(bid.blockHash, payload.blockHash)) {
|
|
70
68
|
throw new Error(
|
package/src/chain/emitter.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {StrictEventEmitter} from "strict-event-emitter-types";
|
|
|
3
3
|
import {routes} from "@lodestar/api";
|
|
4
4
|
import {CheckpointWithHex} from "@lodestar/fork-choice";
|
|
5
5
|
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
6
|
-
import {DataColumnSidecar, RootHex, deneb, phase0} from "@lodestar/types";
|
|
6
|
+
import {DataColumnSidecar, RootHex, Slot, deneb, phase0} from "@lodestar/types";
|
|
7
7
|
import {PeerIdStr} from "../util/peerId.js";
|
|
8
8
|
import {BlockInputSource, IBlockInput} from "./blocks/blockInput/types.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
@@ -94,7 +94,8 @@ export type ChainEventData = {
|
|
|
94
94
|
peer: PeerIdStr;
|
|
95
95
|
source: BlockInputSource;
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
// slot is the message slot, not necessarily the envelope's slot, but useful as a logging/prune hint
|
|
98
|
+
[ChainEvent.unknownEnvelopeBlockRoot]: {rootHex: RootHex; slot: Slot; peer?: PeerIdStr; source: BlockInputSource};
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export type IChainEvents = ApiEvents & {
|
|
@@ -12,6 +12,7 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
12
12
|
UNKNOWN_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_PARENT_BLOCK_HASH",
|
|
13
13
|
INVALID_SLOT = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SLOT",
|
|
14
14
|
NOT_LATER_THAN_PARENT = "EXECUTION_PAYLOAD_BID_ERROR_NOT_LATER_THAN_PARENT",
|
|
15
|
+
INVALID_PREV_RANDAO = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_PREV_RANDAO",
|
|
15
16
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SIGNATURE",
|
|
16
17
|
NO_MATCHING_PROPOSER_PREFERENCES = "EXECUTION_PAYLOAD_BID_ERROR_NO_MATCHING_PROPOSER_PREFERENCES",
|
|
17
18
|
PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH",
|
|
@@ -43,6 +44,12 @@ export type ExecutionPayloadBidErrorType =
|
|
|
43
44
|
| {code: ExecutionPayloadBidErrorCode.UNKNOWN_PARENT_BLOCK_HASH; parentBlockHash: RootHex}
|
|
44
45
|
| {code: ExecutionPayloadBidErrorCode.INVALID_SLOT; builderIndex: BuilderIndex; slot: Slot}
|
|
45
46
|
| {code: ExecutionPayloadBidErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot}
|
|
47
|
+
| {
|
|
48
|
+
code: ExecutionPayloadBidErrorCode.INVALID_PREV_RANDAO;
|
|
49
|
+
builderIndex: BuilderIndex;
|
|
50
|
+
bidPrevRandao: string;
|
|
51
|
+
expectedPrevRandao: string;
|
|
52
|
+
}
|
|
46
53
|
| {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot}
|
|
47
54
|
| {
|
|
48
55
|
code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES;
|
|
@@ -344,7 +344,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
344
344
|
blockHash: executionPayload.blockHash,
|
|
345
345
|
prevRandao: currentState.getRandaoMix(currentState.epoch),
|
|
346
346
|
feeRecipient: executionPayload.feeRecipient,
|
|
347
|
-
gasLimit:
|
|
347
|
+
gasLimit: executionPayload.gasLimit,
|
|
348
348
|
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
349
349
|
slot: blockSlot,
|
|
350
350
|
value: 0,
|
|
@@ -175,7 +175,7 @@ async function validateExecutionPayloadBid(
|
|
|
175
175
|
// [IGNORE] `is_gas_limit_target_compatible(parent_gas_limit, bid.gas_limit, target_gas_limit)`,
|
|
176
176
|
// where `parent_gas_limit` is the `gas_limit` of the parent execution payload and
|
|
177
177
|
// `target_gas_limit` is `proposer_preferences.target_gas_limit`.
|
|
178
|
-
const bidGasLimit =
|
|
178
|
+
const bidGasLimit = bid.gasLimit;
|
|
179
179
|
const parentGasLimit = parentPayloadVariant.executionPayloadGasLimit;
|
|
180
180
|
const targetGasLimit = proposerPreferences.message.targetGasLimit;
|
|
181
181
|
if (!isGasLimitTargetCompatible(parentGasLimit, bidGasLimit, targetGasLimit)) {
|
|
@@ -232,6 +232,18 @@ async function validateExecutionPayloadBid(
|
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
// [REJECT] `bid.prev_randao` is the correct RANDAO mix -- i.e. validate that
|
|
236
|
+
// `bid.prev_randao == get_randao_mix(parent_state, get_current_epoch(parent_state))`.
|
|
237
|
+
const randaoMix = state.getRandaoMix(computeEpochAtSlot(state.slot));
|
|
238
|
+
if (!byteArrayEquals(bid.prevRandao, randaoMix)) {
|
|
239
|
+
throw new ExecutionPayloadBidError(GossipAction.REJECT, {
|
|
240
|
+
code: ExecutionPayloadBidErrorCode.INVALID_PREV_RANDAO,
|
|
241
|
+
builderIndex: bid.builderIndex,
|
|
242
|
+
bidPrevRandao: toHex(bid.prevRandao),
|
|
243
|
+
expectedPrevRandao: toHex(randaoMix),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
235
247
|
// [REJECT] `signed_execution_payload_bid.signature` is valid with respect to the `bid.builder_index`.
|
|
236
248
|
const signatureSet = createSingleSignatureSetFromComponents(
|
|
237
249
|
PublicKey.fromBytes(builder.pubkey),
|
|
@@ -610,6 +610,11 @@ export function createLodestarMetrics(
|
|
|
610
610
|
help: "The origination source of one of the BlockInputSync triggers",
|
|
611
611
|
labelNames: ["source"],
|
|
612
612
|
}),
|
|
613
|
+
payloadSource: register.counter<{source: BlockInputSource}>({
|
|
614
|
+
name: "lodestar_payload_input_sync_source_total",
|
|
615
|
+
help: "Count of payload (execution payload envelope) sync triggers, labeled by their source",
|
|
616
|
+
labelNames: ["source"],
|
|
617
|
+
}),
|
|
613
618
|
pendingBlocks: register.gauge({
|
|
614
619
|
name: "lodestar_sync_unknown_block_pending_blocks_size",
|
|
615
620
|
help: "Current size of UnknownBlockSync pending blocks cache",
|
|
@@ -299,7 +299,7 @@ export class NetworkProcessor {
|
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
this.unknownEnvelopesBySlot.getOrDefault(slot).add(root);
|
|
302
|
-
this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, {rootHex: root, peer, source});
|
|
302
|
+
this.chain.emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, {rootHex: root, slot, peer, source});
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
private onPendingGossipsubMessage = (message: PendingGossipsubMessage): void => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {LogData} from "@lodestar/logger";
|
|
2
2
|
import {ForkSeq} from "@lodestar/params";
|
|
3
|
-
import {RespStatus, ResponseError} from "@lodestar/reqresp";
|
|
4
3
|
import {ColumnIndex, Slot} from "@lodestar/types";
|
|
5
4
|
import {prettyBytes, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
6
5
|
import {IBeaconChain} from "../../../chain/interface.js";
|
|
@@ -76,7 +75,7 @@ export async function handleColumnSidecarUnavailability({
|
|
|
76
75
|
|
|
77
76
|
export function validateRequestedDataColumns(chain: IBeaconChain, requestedColumns: ColumnIndex[]): ColumnIndex[] {
|
|
78
77
|
if (requestedColumns.length === 0) {
|
|
79
|
-
|
|
78
|
+
return [];
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
const {custodyColumns, custodyColumnsIndex} = chain.custodyConfig;
|
package/src/sync/types.ts
CHANGED
|
@@ -19,7 +19,14 @@ export enum PendingBlockType {
|
|
|
19
19
|
*/
|
|
20
20
|
INCOMPLETE_BLOCK_INPUT = "IncompleteBlockInput",
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Payload analog of UNKNOWN_BLOCK_ROOT: we have a beacon block root but not its execution payload envelope.
|
|
24
|
+
*/
|
|
25
|
+
UNKNOWN_PAYLOAD_BLOCK_ROOT = "unknown_payload_block_root",
|
|
26
|
+
/**
|
|
27
|
+
* Payload analog of INCOMPLETE_BLOCK_INPUT: we have a partial payload input that did not complete in time.
|
|
28
|
+
*/
|
|
29
|
+
INCOMPLETE_PAYLOAD_ENVELOPE = "incomplete_payload_envelope",
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
export enum PendingBlockInputStatus {
|
|
@@ -70,6 +77,8 @@ export type PendingPayloadInput = {
|
|
|
70
77
|
export type PendingPayloadRootHex = {
|
|
71
78
|
status: PendingPayloadInputStatus.pending | PendingPayloadInputStatus.fetching;
|
|
72
79
|
rootHex: RootHex;
|
|
80
|
+
// message slot hint, may be missing when resolving a parent payload
|
|
81
|
+
slot?: Slot;
|
|
73
82
|
timeAddedSec: number;
|
|
74
83
|
timeSyncedSec?: number;
|
|
75
84
|
peerIdStrings: Set<string>;
|
|
@@ -125,5 +134,5 @@ export function getPayloadSyncCacheItemSlot(payload: PayloadSyncCacheItem): Slot
|
|
|
125
134
|
return payload.envelope.message.payload.slotNumber;
|
|
126
135
|
}
|
|
127
136
|
|
|
128
|
-
return "unknown";
|
|
137
|
+
return payload.slot ?? "unknown";
|
|
129
138
|
}
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {ChainForkConfig} from "@lodestar/config";
|
|
|
3
3
|
import {ForkSeq} from "@lodestar/params";
|
|
4
4
|
import {RequestError, RequestErrorCode} from "@lodestar/reqresp";
|
|
5
5
|
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
6
|
-
import {RootHex, gloas} from "@lodestar/types";
|
|
6
|
+
import {RootHex, Slot, gloas} from "@lodestar/types";
|
|
7
7
|
import {Logger, fromHex, prettyPrintIndices, pruneSetToMax, sleep, toRootHex} from "@lodestar/utils";
|
|
8
8
|
import {isBlockInputBlobs, isBlockInputColumns} from "../chain/blocks/blockInput/blockInput.js";
|
|
9
9
|
import {BlockInputSource, IBlockInput} from "../chain/blocks/blockInput/types.js";
|
|
@@ -215,10 +215,10 @@ export class BlockInputSync {
|
|
|
215
215
|
|
|
216
216
|
private onUnknownEnvelopeBlockRoot = (data: ChainEventData[ChainEvent.unknownEnvelopeBlockRoot]): void => {
|
|
217
217
|
try {
|
|
218
|
-
this.addByPayloadRootHex(data.rootHex, data.peer);
|
|
218
|
+
this.addByPayloadRootHex(data.rootHex, data.peer, data.slot);
|
|
219
219
|
this.triggerUnknownBlockSearch();
|
|
220
|
-
this.metrics?.blockInputSync.requests.inc({type: PendingBlockType.
|
|
221
|
-
this.metrics?.blockInputSync.
|
|
220
|
+
this.metrics?.blockInputSync.requests.inc({type: PendingBlockType.UNKNOWN_PAYLOAD_BLOCK_ROOT});
|
|
221
|
+
this.metrics?.blockInputSync.payloadSource.inc({source: data.source});
|
|
222
222
|
} catch (e) {
|
|
223
223
|
this.logger.debug("Error handling unknownEnvelopeBlockRoot event", {}, e as Error);
|
|
224
224
|
}
|
|
@@ -228,8 +228,8 @@ export class BlockInputSync {
|
|
|
228
228
|
try {
|
|
229
229
|
this.addByPayloadInput(data.payloadInput, data.peer);
|
|
230
230
|
this.triggerUnknownBlockSearch();
|
|
231
|
-
this.metrics?.blockInputSync.requests.inc({type: PendingBlockType.
|
|
232
|
-
this.metrics?.blockInputSync.
|
|
231
|
+
this.metrics?.blockInputSync.requests.inc({type: PendingBlockType.INCOMPLETE_PAYLOAD_ENVELOPE});
|
|
232
|
+
this.metrics?.blockInputSync.payloadSource.inc({source: data.source});
|
|
233
233
|
} catch (e) {
|
|
234
234
|
this.logger.debug("Error handling incompletePayloadEnvelope event", {}, e as Error);
|
|
235
235
|
}
|
|
@@ -331,7 +331,10 @@ export class BlockInputSync {
|
|
|
331
331
|
};
|
|
332
332
|
this.pendingBlocks.set(blockInput.blockRootHex, pendingBlock);
|
|
333
333
|
|
|
334
|
-
this.logger.verbose("Added blockInput to BlockInputSync.pendingBlocks",
|
|
334
|
+
this.logger.verbose("Added blockInput to BlockInputSync.pendingBlocks", {
|
|
335
|
+
...pendingBlock.blockInput.getLogMeta(),
|
|
336
|
+
delaySec: this.chain.clock.secFromSlot(blockInput.slot),
|
|
337
|
+
});
|
|
335
338
|
}
|
|
336
339
|
|
|
337
340
|
if (peerIdStr) {
|
|
@@ -346,13 +349,14 @@ export class BlockInputSync {
|
|
|
346
349
|
}
|
|
347
350
|
};
|
|
348
351
|
|
|
349
|
-
private addByPayloadRootHex = (rootHex: RootHex, peerIdStr?: PeerIdStr): boolean => {
|
|
352
|
+
private addByPayloadRootHex = (rootHex: RootHex, peerIdStr?: PeerIdStr, slot?: Slot): boolean => {
|
|
350
353
|
let pendingPayload = this.pendingPayloads.get(rootHex);
|
|
351
354
|
let added = false;
|
|
352
355
|
if (!pendingPayload) {
|
|
353
356
|
pendingPayload = {
|
|
354
357
|
status: PendingPayloadInputStatus.pending,
|
|
355
358
|
rootHex,
|
|
359
|
+
slot,
|
|
356
360
|
peerIdStrings: new Set(),
|
|
357
361
|
timeAddedSec: Date.now() / 1000,
|
|
358
362
|
};
|
|
@@ -360,6 +364,8 @@ export class BlockInputSync {
|
|
|
360
364
|
added = true;
|
|
361
365
|
|
|
362
366
|
this.logger.verbose("Added new payload rootHex to BlockInputSync.pendingPayloads", {
|
|
367
|
+
slot: slot ?? "unknown",
|
|
368
|
+
delaySec: slot != null ? this.chain.clock.secFromSlot(slot) : "unknown",
|
|
363
369
|
root: rootHex,
|
|
364
370
|
peerIdStr: peerIdStr ?? "unknown peer",
|
|
365
371
|
});
|
|
@@ -392,6 +398,13 @@ export class BlockInputSync {
|
|
|
392
398
|
}
|
|
393
399
|
|
|
394
400
|
this.pendingPayloads.set(payloadInput.blockRootHex, pendingPayload);
|
|
401
|
+
|
|
402
|
+
this.logger.verbose("Added payloadInput to BlockInputSync.pendingPayloads", {
|
|
403
|
+
slot: payloadInput.slot,
|
|
404
|
+
root: payloadInput.blockRootHex,
|
|
405
|
+
delaySec: this.chain.clock.secFromSlot(payloadInput.slot),
|
|
406
|
+
});
|
|
407
|
+
|
|
395
408
|
const prunedItemCount = pruneSetToMax(this.pendingPayloads, this.maxPendingBlocks);
|
|
396
409
|
if (prunedItemCount > 0) {
|
|
397
410
|
this.logger.verbose(`Pruned ${prunedItemCount} items from BlockInputSync.pendingPayloads`);
|
|
@@ -654,10 +667,12 @@ export class BlockInputSync {
|
|
|
654
667
|
}
|
|
655
668
|
|
|
656
669
|
const rootHex = getBlockInputSyncCacheItemRootHex(block);
|
|
670
|
+
const blockSlot = getBlockInputSyncCacheItemSlot(block);
|
|
657
671
|
const logCtx = {
|
|
658
|
-
slot:
|
|
672
|
+
slot: blockSlot,
|
|
659
673
|
root: rootHex,
|
|
660
674
|
pendingBlocks: this.pendingBlocks.size,
|
|
675
|
+
...(typeof blockSlot === "number" && {delaySec: this.chain.clock.secFromSlot(blockSlot)}),
|
|
661
676
|
};
|
|
662
677
|
|
|
663
678
|
this.logger.verbose("BlockInputSync.downloadBlock()", logCtx);
|
|
@@ -679,6 +694,7 @@ export class BlockInputSync {
|
|
|
679
694
|
const logCtx2 = {
|
|
680
695
|
...logCtx,
|
|
681
696
|
slot: blockSlot,
|
|
697
|
+
delaySec,
|
|
682
698
|
parentInForkChoice,
|
|
683
699
|
};
|
|
684
700
|
this.logger.verbose("Downloaded unknown block", logCtx2);
|
|
@@ -748,6 +764,12 @@ export class BlockInputSync {
|
|
|
748
764
|
// this prevents unbundling attack
|
|
749
765
|
// see https://lighthouse-blog.sigmaprime.io/mev-unbundling-rpc.html
|
|
750
766
|
const {slot: blockSlot, proposerIndex} = pendingBlock.blockInput.getBlock().message;
|
|
767
|
+
const logCtx = {
|
|
768
|
+
slot: blockSlot,
|
|
769
|
+
root: pendingBlock.blockInput.blockRootHex,
|
|
770
|
+
delaySec: this.chain.clock.secFromSlot(blockSlot),
|
|
771
|
+
};
|
|
772
|
+
this.logger.verbose("Processing downloaded block", logCtx);
|
|
751
773
|
const fork = this.config.getForkName(blockSlot);
|
|
752
774
|
const proposerBoostWindowMs = this.config.getAttestationDueMs(fork);
|
|
753
775
|
if (
|
|
@@ -783,6 +805,7 @@ export class BlockInputSync {
|
|
|
783
805
|
else this.metrics?.blockInputSync.processedBlocksSuccess.inc();
|
|
784
806
|
|
|
785
807
|
if (!res.err) {
|
|
808
|
+
this.logger.verbose("Processed block from unknown sync", logCtx);
|
|
786
809
|
// no need to update status to "processed", delete anyway
|
|
787
810
|
this.pendingBlocks.delete(pendingBlock.blockInput.blockRootHex);
|
|
788
811
|
// Re-enter the scheduler so descendants blocked on either parent blocks or parent payloads
|
|
@@ -925,10 +948,12 @@ export class BlockInputSync {
|
|
|
925
948
|
return;
|
|
926
949
|
}
|
|
927
950
|
|
|
951
|
+
const payloadSlot = getPayloadSyncCacheItemSlot(payload);
|
|
928
952
|
const logCtx = {
|
|
929
|
-
slot:
|
|
953
|
+
slot: payloadSlot,
|
|
930
954
|
root: rootHex,
|
|
931
955
|
pendingPayloads: this.pendingPayloads.size,
|
|
956
|
+
...(typeof payloadSlot === "number" && {delaySec: this.chain.clock.secFromSlot(payloadSlot)}),
|
|
932
957
|
};
|
|
933
958
|
|
|
934
959
|
this.logger.verbose("BlockInputSync.downloadPayload()", logCtx);
|
|
@@ -956,7 +981,11 @@ export class BlockInputSync {
|
|
|
956
981
|
|
|
957
982
|
private async processPayload(pendingPayload: PendingPayloadInput): Promise<void> {
|
|
958
983
|
const rootHex = pendingPayload.payloadInput.blockRootHex;
|
|
959
|
-
const logCtx = {
|
|
984
|
+
const logCtx = {
|
|
985
|
+
slot: pendingPayload.payloadInput.slot,
|
|
986
|
+
root: rootHex,
|
|
987
|
+
delaySec: this.chain.clock.secFromSlot(pendingPayload.payloadInput.slot),
|
|
988
|
+
};
|
|
960
989
|
|
|
961
990
|
if (pendingPayload.status !== PendingPayloadInputStatus.downloaded) {
|
|
962
991
|
this.logger.debug("Skipping payload processing before payload input is downloaded", {
|
|
@@ -983,6 +1012,7 @@ export class BlockInputSync {
|
|
|
983
1012
|
}
|
|
984
1013
|
|
|
985
1014
|
pendingPayload.status = PendingPayloadInputStatus.processing;
|
|
1015
|
+
this.logger.debug("Processing downloaded payload", logCtx);
|
|
986
1016
|
|
|
987
1017
|
const res = await wrapError(this.chain.processExecutionPayload(pendingPayload.payloadInput));
|
|
988
1018
|
if (!res.err) {
|
|
@@ -1125,6 +1155,7 @@ export class BlockInputSync {
|
|
|
1125
1155
|
rootHex,
|
|
1126
1156
|
peerId,
|
|
1127
1157
|
peerClient,
|
|
1158
|
+
...(typeof slot === "number" && {delaySec: this.chain.clock.secFromSlot(slot)}),
|
|
1128
1159
|
hasPayload: pendingPayload.payloadInput.hasPayloadEnvelope(),
|
|
1129
1160
|
hasAllData: pendingPayload.payloadInput.hasAllData(),
|
|
1130
1161
|
});
|
|
@@ -1296,7 +1327,7 @@ export class BlockInputSync {
|
|
|
1296
1327
|
this.metrics?.blockInputSync.fetchBegin.observe(this.chain.clock.secFromSlot(slot, fetchStartSec));
|
|
1297
1328
|
}
|
|
1298
1329
|
|
|
1299
|
-
const logCtx = {slot, rootHex, peerId, peerClient};
|
|
1330
|
+
const logCtx = {slot, rootHex, peerId, peerClient, delaySec: this.chain.clock.secFromSlot(slot)};
|
|
1300
1331
|
this.logger.verbose("BlockInputSync.fetchBlockInput: successful download", logCtx);
|
|
1301
1332
|
this.metrics?.blockInputSync.downloadByRoot.success.inc();
|
|
1302
1333
|
const warnings = downloadResult.warnings;
|
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: UintNum64 (8 bytes)
|
|
710
710
|
* builderIndex: BuilderIndex (8 bytes)
|
|
711
711
|
* slot: Slot (8 bytes) ← absolute offset 264
|
|
712
712
|
*/
|