@lodestar/beacon-node 1.43.0-dev.180030f946 → 1.43.0-dev.1a52372103
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 +15 -4
- 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 +45 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +0 -1
- 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 +68 -2
- 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 +23 -22
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +5 -3
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +25 -14
- 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 +36 -21
- 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 +5 -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/types.d.ts +2 -1
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +8 -0
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +2 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +30 -12
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -2
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +7 -4
- 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 +2 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +5 -1
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +0 -11
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +0 -4
- package/lib/chain/emitter.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 +40 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/errors/proposerPreferences.js +14 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -0
- package/lib/chain/interface.d.ts +2 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +26 -4
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +15 -17
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +12 -3
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +35 -17
- 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/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +1 -4
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +1 -4
- package/lib/chain/regen/regen.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 +20 -4
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
- package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
- package/lib/chain/seenCache/seenProposerPreferences.js +31 -0
- package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
- package/lib/chain/validation/executionPayloadBid.js +11 -8
- package/lib/chain/validation/executionPayloadBid.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 +91 -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 +29 -766
- 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/interface.d.ts +1 -0
- package/lib/network/interface.d.ts.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 +5 -0
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +24 -16
- 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 +6 -5
- package/lib/network/processor/index.js.map +1 -1
- package/lib/node/nodejs.js +2 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.js +1 -7
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/range/batch.d.ts +11 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +29 -4
- 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 +23 -5
- package/lib/sync/range/chain.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 +22 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +602 -53
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +36 -19
- 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 +16 -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/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +8 -6
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +20 -4
- package/src/api/impl/beacon/pool/index.ts +83 -1
- package/src/api/impl/debug/index.ts +0 -1
- package/src/api/impl/validator/index.ts +82 -1
- package/src/chain/blocks/importBlock.ts +23 -39
- package/src/chain/blocks/importExecutionPayload.ts +33 -14
- package/src/chain/blocks/index.ts +34 -15
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +6 -1
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
- package/src/chain/blocks/types.ts +2 -1
- package/src/chain/blocks/utils/chainSegment.ts +8 -0
- package/src/chain/blocks/verifyBlock.ts +45 -13
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +9 -4
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
- package/src/chain/chain.ts +5 -0
- package/src/chain/emitter.ts +0 -11
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/proposerPreferences.ts +47 -0
- package/src/chain/interface.ts +2 -0
- package/src/chain/opPools/payloadAttestationPool.ts +29 -8
- package/src/chain/prepareNextSlot.ts +20 -28
- package/src/chain/produceBlock/produceBlockBody.ts +46 -22
- package/src/chain/regen/interface.ts +1 -0
- package/src/chain/regen/queued.ts +2 -7
- package/src/chain/regen/regen.ts +2 -7
- package/src/chain/seenCache/index.ts +1 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +25 -5
- package/src/chain/seenCache/seenProposerPreferences.ts +37 -0
- package/src/chain/validation/executionPayloadBid.ts +11 -8
- package/src/chain/validation/proposerPreferences.ts +110 -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/interface.ts +1 -0
- package/src/network/network.ts +11 -0
- package/src/network/processor/gossipHandlers.ts +35 -17
- package/src/network/processor/gossipQueues/index.ts +5 -0
- package/src/network/processor/index.ts +6 -5
- package/src/node/nodejs.ts +2 -2
- package/src/node/notifier.ts +1 -8
- package/src/sync/range/batch.ts +54 -5
- package/src/sync/range/chain.ts +25 -5
- package/src/sync/types.ts +72 -0
- package/src/sync/unknownBlock.ts +760 -57
- package/src/sync/utils/downloadByRange.ts +36 -18
- package/src/sync/utils/downloadByRoot.ts +24 -2
- package/src/sync/utils/pendingBlocksTree.ts +0 -15
- package/src/util/sszBytes.ts +8 -6
|
@@ -41,6 +41,7 @@ export enum GossipType {
|
|
|
41
41
|
execution_payload = "execution_payload",
|
|
42
42
|
payload_attestation_message = "payload_attestation_message",
|
|
43
43
|
execution_payload_bid = "execution_payload_bid",
|
|
44
|
+
proposer_preferences = "proposer_preferences",
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export type SequentialGossipType = Exclude<GossipType, GossipType.beacon_attestation>;
|
|
@@ -78,6 +79,7 @@ export type GossipTopicTypeMap = {
|
|
|
78
79
|
[GossipType.execution_payload]: {type: GossipType.execution_payload};
|
|
79
80
|
[GossipType.payload_attestation_message]: {type: GossipType.payload_attestation_message};
|
|
80
81
|
[GossipType.execution_payload_bid]: {type: GossipType.execution_payload_bid};
|
|
82
|
+
[GossipType.proposer_preferences]: {type: GossipType.proposer_preferences};
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
export type GossipTopicMap = {
|
|
@@ -110,6 +112,7 @@ export type GossipTypeMap = {
|
|
|
110
112
|
[GossipType.execution_payload]: gloas.SignedExecutionPayloadEnvelope;
|
|
111
113
|
[GossipType.payload_attestation_message]: gloas.PayloadAttestationMessage;
|
|
112
114
|
[GossipType.execution_payload_bid]: gloas.SignedExecutionPayloadBid;
|
|
115
|
+
[GossipType.proposer_preferences]: gloas.SignedProposerPreferences;
|
|
113
116
|
};
|
|
114
117
|
|
|
115
118
|
export type GossipFnByType = {
|
|
@@ -141,6 +144,9 @@ export type GossipFnByType = {
|
|
|
141
144
|
payloadAttestationMessage: gloas.PayloadAttestationMessage
|
|
142
145
|
) => Promise<void> | void;
|
|
143
146
|
[GossipType.execution_payload_bid]: (executionPayloadBid: gloas.SignedExecutionPayloadBid) => Promise<void> | void;
|
|
147
|
+
[GossipType.proposer_preferences]: (
|
|
148
|
+
signedProposerPreferences: gloas.SignedProposerPreferences
|
|
149
|
+
) => Promise<void> | void;
|
|
144
150
|
};
|
|
145
151
|
|
|
146
152
|
export type GossipFn = GossipFnByType[keyof GossipFnByType];
|
|
@@ -27,6 +27,7 @@ const BLS_TO_EXECUTION_CHANGE_WEIGHT = 0.05;
|
|
|
27
27
|
const EXECUTION_PAYLOAD_WEIGHT = 0.5;
|
|
28
28
|
const PAYLOAD_ATTESTATION_WEIGHT = 0.05;
|
|
29
29
|
const EXECUTION_PAYLOAD_BID_WEIGHT = 0.05;
|
|
30
|
+
const PROPOSER_PREFERENCES_WEIGHT = 0.05;
|
|
30
31
|
|
|
31
32
|
const beaconAttestationSubnetWeight = 1 / ATTESTATION_SUBNET_COUNT;
|
|
32
33
|
const maxPositiveScore =
|
|
@@ -40,7 +41,8 @@ const maxPositiveScore =
|
|
|
40
41
|
BLS_TO_EXECUTION_CHANGE_WEIGHT +
|
|
41
42
|
EXECUTION_PAYLOAD_WEIGHT +
|
|
42
43
|
PAYLOAD_ATTESTATION_WEIGHT +
|
|
43
|
-
EXECUTION_PAYLOAD_BID_WEIGHT
|
|
44
|
+
EXECUTION_PAYLOAD_BID_WEIGHT +
|
|
45
|
+
PROPOSER_PREFERENCES_WEIGHT);
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
48
|
* The following params is implemented by Lighthouse at
|
|
@@ -198,6 +200,17 @@ function getAllTopicsScoreParams(
|
|
|
198
200
|
expectedMessageRate: 1024, // TODO GLOAS: Need an estimate for this
|
|
199
201
|
firstMessageDecayTime: epochDurationMs * 100,
|
|
200
202
|
});
|
|
203
|
+
topicsParams[
|
|
204
|
+
stringifyGossipTopic(config, {
|
|
205
|
+
type: GossipType.proposer_preferences,
|
|
206
|
+
boundary,
|
|
207
|
+
})
|
|
208
|
+
] = getTopicScoreParams(config, precomputedParams, {
|
|
209
|
+
topicWeight: PROPOSER_PREFERENCES_WEIGHT,
|
|
210
|
+
// Upper bound ~64 messages per epoch: one per proposer across the current + next epoch.
|
|
211
|
+
expectedMessageRate: 64 / SLOTS_PER_EPOCH,
|
|
212
|
+
firstMessageDecayTime: epochDurationMs * 100,
|
|
213
|
+
});
|
|
201
214
|
|
|
202
215
|
// other topics
|
|
203
216
|
topicsParams[
|
|
@@ -73,6 +73,7 @@ function stringifyGossipTopicType(topic: GossipTopic): string {
|
|
|
73
73
|
case GossipType.execution_payload:
|
|
74
74
|
case GossipType.payload_attestation_message:
|
|
75
75
|
case GossipType.execution_payload_bid:
|
|
76
|
+
case GossipType.proposer_preferences:
|
|
76
77
|
return topic.type;
|
|
77
78
|
case GossipType.beacon_attestation:
|
|
78
79
|
case GossipType.sync_committee:
|
|
@@ -124,6 +125,8 @@ export function getGossipSSZType(topic: GossipTopic) {
|
|
|
124
125
|
return ssz.gloas.PayloadAttestationMessage;
|
|
125
126
|
case GossipType.execution_payload_bid:
|
|
126
127
|
return ssz.gloas.SignedExecutionPayloadBid;
|
|
128
|
+
case GossipType.proposer_preferences:
|
|
129
|
+
return ssz.gloas.SignedProposerPreferences;
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
|
|
@@ -203,6 +206,7 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr:
|
|
|
203
206
|
case GossipType.execution_payload:
|
|
204
207
|
case GossipType.payload_attestation_message:
|
|
205
208
|
case GossipType.execution_payload_bid:
|
|
209
|
+
case GossipType.proposer_preferences:
|
|
206
210
|
return {type: gossipTypeStr, boundary, encoding};
|
|
207
211
|
}
|
|
208
212
|
|
|
@@ -257,6 +261,7 @@ export function getCoreTopicsAtFork(
|
|
|
257
261
|
topics.push({type: GossipType.execution_payload});
|
|
258
262
|
topics.push({type: GossipType.payload_attestation_message});
|
|
259
263
|
topics.push({type: GossipType.execution_payload_bid});
|
|
264
|
+
topics.push({type: GossipType.proposer_preferences});
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
// After fulu also track data_column_sidecar_{index}
|
|
@@ -351,4 +356,5 @@ export const gossipTopicIgnoreDuplicatePublishError: Record<GossipType, boolean>
|
|
|
351
356
|
[GossipType.execution_payload]: true,
|
|
352
357
|
[GossipType.payload_attestation_message]: true,
|
|
353
358
|
[GossipType.execution_payload_bid]: true,
|
|
359
|
+
[GossipType.proposer_preferences]: true,
|
|
354
360
|
};
|
package/src/network/interface.ts
CHANGED
|
@@ -112,6 +112,7 @@ export interface INetwork extends INetworkCorePublic {
|
|
|
112
112
|
publishLightClientFinalityUpdate(update: LightClientFinalityUpdate): Promise<number>;
|
|
113
113
|
publishLightClientOptimisticUpdate(update: LightClientOptimisticUpdate): Promise<number>;
|
|
114
114
|
publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number>;
|
|
115
|
+
publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number>;
|
|
115
116
|
|
|
116
117
|
// Debug
|
|
117
118
|
dumpGossipQueue(gossipType: GossipType): Promise<PendingGossipsubMessage[]>;
|
package/src/network/network.ts
CHANGED
|
@@ -515,6 +515,17 @@ export class Network implements INetwork {
|
|
|
515
515
|
);
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
async publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number> {
|
|
519
|
+
const epoch = computeEpochAtSlot(payloadAttestationMessage.data.slot);
|
|
520
|
+
const boundary = this.config.getForkBoundaryAtEpoch(epoch);
|
|
521
|
+
|
|
522
|
+
return this.publishGossip<GossipType.payload_attestation_message>(
|
|
523
|
+
{type: GossipType.payload_attestation_message, boundary},
|
|
524
|
+
payloadAttestationMessage,
|
|
525
|
+
{ignoreDuplicatePublishError: true}
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
|
|
518
529
|
private async publishGossip<K extends GossipType>(
|
|
519
530
|
topic: GossipTopicMap[K],
|
|
520
531
|
object: GossipTypeMap[K],
|
|
@@ -52,6 +52,8 @@ import {
|
|
|
52
52
|
ExecutionPayloadEnvelopeErrorCode,
|
|
53
53
|
GossipAction,
|
|
54
54
|
GossipActionError,
|
|
55
|
+
PayloadAttestationError,
|
|
56
|
+
PayloadAttestationErrorCode,
|
|
55
57
|
SyncCommitteeError,
|
|
56
58
|
} from "../../chain/errors/index.js";
|
|
57
59
|
import {IBeaconChain} from "../../chain/interface.js";
|
|
@@ -79,6 +81,7 @@ import {
|
|
|
79
81
|
import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js";
|
|
80
82
|
import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js";
|
|
81
83
|
import {validateGossipPayloadAttestationMessage} from "../../chain/validation/payloadAttestationMessage.js";
|
|
84
|
+
import {validateGossipProposerPreferences} from "../../chain/validation/proposerPreferences.js";
|
|
82
85
|
import {OpSource} from "../../chain/validatorMonitor.js";
|
|
83
86
|
import {Metrics} from "../../metrics/index.js";
|
|
84
87
|
import {kzgCommitmentToVersionedHash} from "../../util/blobs.js";
|
|
@@ -182,6 +185,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
182
185
|
});
|
|
183
186
|
try {
|
|
184
187
|
await validateGossipBlock(config, chain, signedBlock, fork);
|
|
188
|
+
|
|
189
|
+
if (isForkPostGloas(fork)) {
|
|
190
|
+
chain.seenPayloadEnvelopeInputCache.add({
|
|
191
|
+
blockRootHex,
|
|
192
|
+
block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
|
|
193
|
+
forkName: fork,
|
|
194
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
195
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
196
|
+
timeCreatedSec: seenTimestampSec,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
185
200
|
const blockInputMeta = blockInput.getLogMeta();
|
|
186
201
|
|
|
187
202
|
const recvToValidation = Date.now() / 1000 - seenTimestampSec;
|
|
@@ -198,7 +213,10 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
198
213
|
} catch (e) {
|
|
199
214
|
if (e instanceof BlockGossipError) {
|
|
200
215
|
logger.debug("Gossip block has error", {slot, root: blockShortHex, code: e.type.code});
|
|
201
|
-
if (
|
|
216
|
+
if (
|
|
217
|
+
(e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
|
|
218
|
+
blockInput
|
|
219
|
+
) {
|
|
202
220
|
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
203
221
|
blockInput,
|
|
204
222
|
peer: peerIdStr,
|
|
@@ -1057,10 +1075,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1057
1075
|
const signedEnvelope = sszDeserialize(topic, serializedData);
|
|
1058
1076
|
const envelope = signedEnvelope.message;
|
|
1059
1077
|
|
|
1060
|
-
//
|
|
1061
|
-
//
|
|
1062
|
-
// the problem now is we cannot create a PayloadEnvelopeInput without the beacon block being known, we need at least the proposer index
|
|
1063
|
-
// we can achieve that by looking into the EpochCache
|
|
1078
|
+
// unlike BlockInput, we send the envelope into UnknownBlockInput sync
|
|
1079
|
+
// inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
|
|
1064
1080
|
try {
|
|
1065
1081
|
await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
|
|
1066
1082
|
} catch (e) {
|
|
@@ -1068,14 +1084,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1068
1084
|
const {beaconBlockRoot} = signedEnvelope.message;
|
|
1069
1085
|
const slot = signedEnvelope.message.payload.slotNumber;
|
|
1070
1086
|
logger.debug("Gossip envelope has error", {slot, root: toRootHex(beaconBlockRoot), code: e.type.code});
|
|
1071
|
-
if (e.type.code === ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN) {
|
|
1072
|
-
// TODO GLOAS: UnknownBlockSync to handle this
|
|
1073
|
-
chain.emitter.emit(ChainEvent.envelopeUnknownBlock, {
|
|
1074
|
-
envelope: signedEnvelope,
|
|
1075
|
-
peer: peerIdStr,
|
|
1076
|
-
source: BlockInputSource.gossip,
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
1087
|
|
|
1080
1088
|
if (e.action === GossipAction.REJECT) {
|
|
1081
1089
|
chain.persistInvalidSszValue(
|
|
@@ -1170,6 +1178,14 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1170
1178
|
data: executionPayloadBid,
|
|
1171
1179
|
});
|
|
1172
1180
|
},
|
|
1181
|
+
[GossipType.proposer_preferences]: async ({
|
|
1182
|
+
gossipData,
|
|
1183
|
+
topic,
|
|
1184
|
+
}: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
|
|
1185
|
+
const {serializedData} = gossipData;
|
|
1186
|
+
const signedProposerPreferences = sszDeserialize(topic, serializedData);
|
|
1187
|
+
await validateGossipProposerPreferences(chain, signedProposerPreferences);
|
|
1188
|
+
},
|
|
1173
1189
|
};
|
|
1174
1190
|
}
|
|
1175
1191
|
|
|
@@ -1292,10 +1308,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
|
|
|
1292
1308
|
try {
|
|
1293
1309
|
return await fn();
|
|
1294
1310
|
} catch (e) {
|
|
1295
|
-
|
|
1296
|
-
e instanceof AttestationError &&
|
|
1297
|
-
|
|
1298
|
-
|
|
1311
|
+
const isUnknownAttestationRoot =
|
|
1312
|
+
e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
|
|
1313
|
+
const isUnknownPayloadAttestationRoot =
|
|
1314
|
+
e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
|
|
1315
|
+
|
|
1316
|
+
if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
|
|
1299
1317
|
if (unknownBlockRootRetries === 0) {
|
|
1300
1318
|
// Trigger unknown block root search here
|
|
1301
1319
|
const rootHex = toRootHex(blockRoot);
|
|
@@ -83,6 +83,11 @@ const linearGossipQueueOpts: {
|
|
|
83
83
|
type: QueueType.FIFO,
|
|
84
84
|
dropOpts: {type: DropType.count, count: 1},
|
|
85
85
|
},
|
|
86
|
+
[GossipType.proposer_preferences]: {
|
|
87
|
+
maxLength: 1024,
|
|
88
|
+
type: QueueType.FIFO,
|
|
89
|
+
dropOpts: {type: DropType.count, count: 1},
|
|
90
|
+
},
|
|
86
91
|
};
|
|
87
92
|
|
|
88
93
|
const indexedGossipQueueOpts: {
|
|
@@ -76,6 +76,7 @@ type WorkOpts = {
|
|
|
76
76
|
*/
|
|
77
77
|
const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
|
|
78
78
|
[GossipType.beacon_block]: {bypassQueue: true},
|
|
79
|
+
[GossipType.execution_payload]: {bypassQueue: true},
|
|
79
80
|
[GossipType.blob_sidecar]: {bypassQueue: true},
|
|
80
81
|
[GossipType.data_column_sidecar]: {bypassQueue: true},
|
|
81
82
|
[GossipType.beacon_aggregate_and_proof]: {},
|
|
@@ -88,9 +89,9 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
|
|
|
88
89
|
[GossipType.sync_committee]: {},
|
|
89
90
|
[GossipType.light_client_finality_update]: {},
|
|
90
91
|
[GossipType.light_client_optimistic_update]: {},
|
|
91
|
-
[GossipType.execution_payload]: {bypassQueue: true},
|
|
92
92
|
[GossipType.payload_attestation_message]: {},
|
|
93
93
|
[GossipType.execution_payload_bid]: {},
|
|
94
|
+
[GossipType.proposer_preferences]: {},
|
|
94
95
|
};
|
|
95
96
|
const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
|
|
96
97
|
|
|
@@ -443,8 +444,7 @@ export class NetworkProcessor {
|
|
|
443
444
|
}
|
|
444
445
|
case GossipType.execution_payload: {
|
|
445
446
|
// extractBlockSlotRootFn does not return a root for this topic.
|
|
446
|
-
// Extract beacon_block_root directly
|
|
447
|
-
// Do NOT await the block — the handler runs immediately; BlockInputSync handles recovery.
|
|
447
|
+
// Extract beacon_block_root directly
|
|
448
448
|
const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
|
|
449
449
|
if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
|
|
450
450
|
this.searchUnknownBlock(
|
|
@@ -452,9 +452,10 @@ export class NetworkProcessor {
|
|
|
452
452
|
BlockInputSource.network_processor,
|
|
453
453
|
message.propagationSource.toString()
|
|
454
454
|
);
|
|
455
|
+
// We always want to await the block
|
|
456
|
+
// This allows us to properly forward the payload envelope
|
|
457
|
+
preprocessResult = {action: PreprocessAction.AwaitBlock, root: blockRoot};
|
|
455
458
|
}
|
|
456
|
-
// do not await the block, we want UnknownBlockSync to handle it.
|
|
457
|
-
preprocessResult = {action: PreprocessAction.PushToQueue};
|
|
458
459
|
break;
|
|
459
460
|
}
|
|
460
461
|
case GossipType.execution_payload_bid: {
|
package/src/node/nodejs.ts
CHANGED
|
@@ -221,7 +221,7 @@ export class BeaconNode {
|
|
|
221
221
|
|
|
222
222
|
let executionEngineOpts = opts.executionEngine;
|
|
223
223
|
if (opts.executionEngine.mode === "mock") {
|
|
224
|
-
const
|
|
224
|
+
const latestEth1BlockHash =
|
|
225
225
|
isStatePostBellatrix(anchorState) && anchorState.isExecutionStateType
|
|
226
226
|
? isStatePostGloas(anchorState)
|
|
227
227
|
? toRootHex(anchorState.latestBlockHash)
|
|
@@ -230,7 +230,7 @@ export class BeaconNode {
|
|
|
230
230
|
executionEngineOpts = {
|
|
231
231
|
...opts.executionEngine,
|
|
232
232
|
genesisBlockHash: ZERO_HASH_HEX,
|
|
233
|
-
eth1BlockHash,
|
|
233
|
+
eth1BlockHash: opts.executionEngine.eth1BlockHash ?? latestEth1BlockHash,
|
|
234
234
|
genesisTime: anchorState.genesisTime,
|
|
235
235
|
config,
|
|
236
236
|
};
|
package/src/node/notifier.ts
CHANGED
|
@@ -167,14 +167,7 @@ function getHeadExecutionInfo(
|
|
|
167
167
|
return [];
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
// arrives, in that case the exec-block row surfaces the inherited parent anchor (from the
|
|
172
|
-
// bid), which is already validated. Normalize to "valid" to avoid leaking internal
|
|
173
|
-
// fork-choice bookkeeping into the log. Once the payload envelope arrives and the FULL
|
|
174
|
-
// variant becomes head, executionStatus is Valid/Syncing naturally.
|
|
175
|
-
// TODO GLOAS: revisit once optimistic sync is implemented
|
|
176
|
-
const executionStatusStr =
|
|
177
|
-
headInfo.executionStatus === ExecutionStatus.PayloadSeparated ? "valid" : headInfo.executionStatus.toLowerCase();
|
|
170
|
+
const executionStatusStr = headInfo.executionStatus.toLowerCase();
|
|
178
171
|
|
|
179
172
|
// Add execution status to notifier only if head is on/post bellatrix
|
|
180
173
|
if (isStatePostBellatrix(headState) && headState.isExecutionStateType) {
|
package/src/sync/range/batch.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ForkName, isForkPostDeneb, isForkPostFulu, isForkPostGloas} from "@lodestar/params";
|
|
3
3
|
import {Epoch, RootHex, Slot, phase0} from "@lodestar/types";
|
|
4
|
-
import {LodestarError} from "@lodestar/utils";
|
|
4
|
+
import {LodestarError, prettyPrintIndices} from "@lodestar/utils";
|
|
5
5
|
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
6
6
|
import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
7
7
|
import {isDaOutOfRange} from "../../chain/blocks/blockInput/utils.js";
|
|
@@ -79,10 +79,36 @@ export type BatchState =
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
export type BatchMetadata = {
|
|
82
|
+
// Batch-level slot window (always present)
|
|
82
83
|
startEpoch: Epoch;
|
|
84
|
+
startSlot: Slot;
|
|
85
|
+
count: number;
|
|
83
86
|
status: BatchStatus;
|
|
87
|
+
|
|
88
|
+
// Per-type outstanding request shapes; only present when that sub-request exists.
|
|
89
|
+
// Format: "startSlot=<n>,count=<n>" (plus ",cols=<indices>" for columns).
|
|
90
|
+
blocksReq?: string;
|
|
91
|
+
blobsReq?: string;
|
|
92
|
+
columnsReq?: string;
|
|
93
|
+
envelopesReq?: string;
|
|
94
|
+
|
|
95
|
+
// Retry counters
|
|
96
|
+
downloadAttempts: number;
|
|
97
|
+
processingAttempts: number;
|
|
98
|
+
|
|
99
|
+
// Cumulative peer attribution for failed attempts (only present when non-empty)
|
|
100
|
+
failedDownloadPeers?: string;
|
|
101
|
+
failedProcessingPeers?: string;
|
|
84
102
|
};
|
|
85
103
|
|
|
104
|
+
function formatRangeReq(req: {startSlot: Slot; count: number}): string {
|
|
105
|
+
return `startSlot=${req.startSlot},count=${req.count}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function formatColumnsReq(req: {startSlot: Slot; count: number; columns: number[]}): string {
|
|
109
|
+
return `startSlot=${req.startSlot},count=${req.count},cols=${prettyPrintIndices(req.columns)}`;
|
|
110
|
+
}
|
|
111
|
+
|
|
86
112
|
/**
|
|
87
113
|
* Batches are downloaded at the first block of the epoch.
|
|
88
114
|
*
|
|
@@ -286,7 +312,26 @@ export class Batch {
|
|
|
286
312
|
}
|
|
287
313
|
|
|
288
314
|
getMetadata(): BatchMetadata {
|
|
289
|
-
|
|
315
|
+
const {blocksRequest, blobsRequest, columnsRequest, envelopesRequest} = this.requests;
|
|
316
|
+
const failedProcessingPeerList = this.failedProcessingAttempts.flatMap((a) => a.peers);
|
|
317
|
+
return {
|
|
318
|
+
startEpoch: this.startEpoch,
|
|
319
|
+
startSlot: this.startSlot,
|
|
320
|
+
count: this.count,
|
|
321
|
+
status: this.state.status,
|
|
322
|
+
...(blocksRequest && {blocksReq: formatRangeReq(blocksRequest)}),
|
|
323
|
+
...(blobsRequest && {blobsReq: formatRangeReq(blobsRequest)}),
|
|
324
|
+
...(columnsRequest && {columnsReq: formatColumnsReq(columnsRequest)}),
|
|
325
|
+
...(envelopesRequest && {envelopesReq: formatRangeReq(envelopesRequest)}),
|
|
326
|
+
downloadAttempts: this.failedDownloadAttempts.length,
|
|
327
|
+
processingAttempts: this.failedProcessingAttempts.length,
|
|
328
|
+
...(this.failedDownloadAttempts.length > 0 && {
|
|
329
|
+
failedDownloadPeers: this.failedDownloadAttempts.join(","),
|
|
330
|
+
}),
|
|
331
|
+
...(failedProcessingPeerList.length > 0 && {
|
|
332
|
+
failedProcessingPeers: failedProcessingPeerList.join(","),
|
|
333
|
+
}),
|
|
334
|
+
};
|
|
290
335
|
}
|
|
291
336
|
|
|
292
337
|
getBlocks(): IBlockInput[] {
|
|
@@ -383,7 +428,11 @@ export class Batch {
|
|
|
383
428
|
/**
|
|
384
429
|
* AwaitingProcessing -> Processing
|
|
385
430
|
*/
|
|
386
|
-
startProcessing(): {
|
|
431
|
+
startProcessing(): {
|
|
432
|
+
blocks: IBlockInput[];
|
|
433
|
+
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null;
|
|
434
|
+
peers: PeerIdStr[];
|
|
435
|
+
} {
|
|
387
436
|
if (this.state.status !== BatchStatus.AwaitingProcessing) {
|
|
388
437
|
throw new BatchError(this.wrongStatusErrorType(BatchStatus.AwaitingProcessing));
|
|
389
438
|
}
|
|
@@ -396,7 +445,7 @@ export class Batch {
|
|
|
396
445
|
const peers = this.goodPeers;
|
|
397
446
|
this.goodPeers = [];
|
|
398
447
|
this.state = {status: BatchStatus.Processing, blocks, payloadEnvelopes, attempt: {peers, hash}};
|
|
399
|
-
return {blocks, payloadEnvelopes};
|
|
448
|
+
return {blocks, payloadEnvelopes, peers};
|
|
400
449
|
}
|
|
401
450
|
|
|
402
451
|
/**
|
|
@@ -479,7 +528,7 @@ export class Batch {
|
|
|
479
528
|
|
|
480
529
|
/** Helper to construct typed BatchError. Stack traces are correct as the error is thrown above */
|
|
481
530
|
private errorType(type: BatchErrorType): BatchErrorType & BatchErrorMetadata {
|
|
482
|
-
return {...type,
|
|
531
|
+
return {...type, startEpoch: this.startEpoch, status: this.state.status};
|
|
483
532
|
}
|
|
484
533
|
|
|
485
534
|
private wrongStatusErrorType(expectedStatus: BatchStatus): BatchErrorType & BatchErrorMetadata {
|
package/src/sync/range/chain.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {Epoch, Root, Slot} from "@lodestar/types";
|
|
3
|
-
import {ErrorAborted, LodestarError, Logger, toRootHex} from "@lodestar/utils";
|
|
3
|
+
import {ErrorAborted, LodestarError, Logger, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
4
4
|
import {isBlockInputBlobs, isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
5
5
|
import {BlockInputErrorCode} from "../../chain/blocks/blockInput/errors.js";
|
|
6
6
|
import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
@@ -222,12 +222,14 @@ export class SyncChain {
|
|
|
222
222
|
*/
|
|
223
223
|
stopSyncing(): void {
|
|
224
224
|
this.status = SyncChainStatus.Stopped;
|
|
225
|
+
this.logger.debug("SyncChain stopSyncing", {id: this.logId});
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
229
|
* Permanently remove this chain. Throws the main AsyncIterable
|
|
229
230
|
*/
|
|
230
231
|
remove(): void {
|
|
232
|
+
this.logger.debug("SyncChain remove", {id: this.logId});
|
|
231
233
|
this.batchProcessor.end(new ErrorAborted("SyncChain"));
|
|
232
234
|
}
|
|
233
235
|
|
|
@@ -534,7 +536,7 @@ export class SyncChain {
|
|
|
534
536
|
this.metrics?.syncRange.downloadByRange.warn.inc({client: peer.client, code: warning.type.code});
|
|
535
537
|
this.logger.debug(
|
|
536
538
|
"Batch downloaded with warning",
|
|
537
|
-
{id: this.logId,
|
|
539
|
+
{id: this.logId, ...batch.getMetadata(), ...logMeta, peer: prettyPrintPeerIdStr(peer.peerId)},
|
|
538
540
|
warning
|
|
539
541
|
);
|
|
540
542
|
}
|
|
@@ -560,10 +562,17 @@ export class SyncChain {
|
|
|
560
562
|
// the flow will continue to call triggerBatchDownloader() below
|
|
561
563
|
}
|
|
562
564
|
|
|
565
|
+
const blockSlots = downloadSuccessOutput.blocks.map((b) => b.slot);
|
|
566
|
+
const envelopeSlots = downloadSuccessOutput.payloadEnvelopes
|
|
567
|
+
? Array.from(downloadSuccessOutput.payloadEnvelopes.keys())
|
|
568
|
+
: null;
|
|
569
|
+
|
|
563
570
|
this.logger.debug(logMessage, {
|
|
564
571
|
id: this.logId,
|
|
565
|
-
|
|
572
|
+
...batch.getMetadata(),
|
|
566
573
|
...logMeta,
|
|
574
|
+
blockSlots: prettyPrintIndices(blockSlots),
|
|
575
|
+
...(envelopeSlots ? {envelopeSlots: prettyPrintIndices(envelopeSlots)} : {}),
|
|
567
576
|
peer: prettyPrintPeerIdStr(peer.peerId),
|
|
568
577
|
});
|
|
569
578
|
}
|
|
@@ -586,13 +595,24 @@ export class SyncChain {
|
|
|
586
595
|
* Sends `batch` to the processor. Note: batch may be empty
|
|
587
596
|
*/
|
|
588
597
|
private async processBatch(batch: Batch): Promise<void> {
|
|
589
|
-
const {blocks, payloadEnvelopes} = batch.startProcessing();
|
|
598
|
+
const {blocks, payloadEnvelopes, peers} = batch.startProcessing();
|
|
599
|
+
|
|
600
|
+
const logCtx = {
|
|
601
|
+
id: this.logId,
|
|
602
|
+
...batch.getMetadata(),
|
|
603
|
+
blockCount: blocks.length,
|
|
604
|
+
blockSlots: prettyPrintIndices(blocks.map((b) => b.slot)),
|
|
605
|
+
...(payloadEnvelopes ? {envelopeSlots: prettyPrintIndices(Array.from(payloadEnvelopes.keys()))} : {}),
|
|
606
|
+
peers: peers.map(prettyPrintPeerIdStr).join(","),
|
|
607
|
+
};
|
|
608
|
+
this.logger.verbose("Processing batch", logCtx);
|
|
590
609
|
|
|
591
610
|
// wrapError ensures to never call both batch success() and batch error()
|
|
592
611
|
const res = await wrapError(this.processChainSegment(blocks, payloadEnvelopes, this.syncType));
|
|
593
612
|
|
|
594
613
|
if (!res.err) {
|
|
595
614
|
batch.processingSuccess();
|
|
615
|
+
this.logger.verbose("Processed batch", {...logCtx, ...batch.getMetadata()});
|
|
596
616
|
|
|
597
617
|
// If the processed batch is not empty, validate previous AwaitingValidation blocks.
|
|
598
618
|
if (blocks.length > 0) {
|
|
@@ -602,7 +622,7 @@ export class SyncChain {
|
|
|
602
622
|
// Potentially process next AwaitingProcessing batch
|
|
603
623
|
this.triggerBatchProcessor();
|
|
604
624
|
} else {
|
|
605
|
-
this.logger.verbose("Batch process error",
|
|
625
|
+
this.logger.verbose("Batch process error", logCtx, res.err);
|
|
606
626
|
batch.processingError(res.err); // Throws after MAX_BATCH_PROCESSING_ATTEMPTS
|
|
607
627
|
|
|
608
628
|
// At least one block was successfully verified and imported, so we can be sure all
|
package/src/sync/types.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {RootHex, Slot} from "@lodestar/types";
|
|
2
|
+
import {SignedExecutionPayloadEnvelope} from "@lodestar/types/gloas";
|
|
3
|
+
import {toRootHex} from "@lodestar/utils";
|
|
2
4
|
import {IBlockInput} from "../chain/blocks/blockInput/index.js";
|
|
5
|
+
import {PayloadEnvelopeInput} from "../chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
3
6
|
|
|
4
7
|
export enum PendingBlockType {
|
|
5
8
|
/**
|
|
@@ -26,6 +29,14 @@ export enum PendingBlockInputStatus {
|
|
|
26
29
|
processing = "processing",
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
export enum PendingPayloadInputStatus {
|
|
33
|
+
pending = "pending",
|
|
34
|
+
fetching = "fetching",
|
|
35
|
+
waitingForBlock = "waiting_for_block",
|
|
36
|
+
downloaded = "downloaded",
|
|
37
|
+
processing = "processing",
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
export type PendingBlockInput = {
|
|
30
41
|
status: PendingBlockInputStatus;
|
|
31
42
|
blockInput: IBlockInput;
|
|
@@ -44,10 +55,47 @@ export type PendingRootHex = {
|
|
|
44
55
|
|
|
45
56
|
export type BlockInputSyncCacheItem = PendingBlockInput | PendingRootHex;
|
|
46
57
|
|
|
58
|
+
export type PendingPayloadInput = {
|
|
59
|
+
status:
|
|
60
|
+
| PendingPayloadInputStatus.pending
|
|
61
|
+
| PendingPayloadInputStatus.fetching
|
|
62
|
+
| PendingPayloadInputStatus.downloaded
|
|
63
|
+
| PendingPayloadInputStatus.processing;
|
|
64
|
+
payloadInput: PayloadEnvelopeInput;
|
|
65
|
+
timeAddedSec: number;
|
|
66
|
+
timeSyncedSec?: number;
|
|
67
|
+
peerIdStrings: Set<string>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type PendingPayloadRootHex = {
|
|
71
|
+
status: PendingPayloadInputStatus.pending | PendingPayloadInputStatus.fetching;
|
|
72
|
+
rootHex: RootHex;
|
|
73
|
+
timeAddedSec: number;
|
|
74
|
+
timeSyncedSec?: number;
|
|
75
|
+
peerIdStrings: Set<string>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type PendingPayloadEnvelope = {
|
|
79
|
+
status: PendingPayloadInputStatus.waitingForBlock;
|
|
80
|
+
envelope: SignedExecutionPayloadEnvelope;
|
|
81
|
+
timeAddedSec: number;
|
|
82
|
+
peerIdStrings: Set<string>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type PayloadSyncCacheItem = PendingPayloadInput | PendingPayloadRootHex | PendingPayloadEnvelope;
|
|
86
|
+
|
|
47
87
|
export function isPendingBlockInput(pending: BlockInputSyncCacheItem): pending is PendingBlockInput {
|
|
48
88
|
return "blockInput" in pending;
|
|
49
89
|
}
|
|
50
90
|
|
|
91
|
+
export function isPendingPayloadInput(pending: PayloadSyncCacheItem): pending is PendingPayloadInput {
|
|
92
|
+
return "payloadInput" in pending;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function isPendingPayloadEnvelope(pending: PayloadSyncCacheItem): pending is PendingPayloadEnvelope {
|
|
96
|
+
return "envelope" in pending;
|
|
97
|
+
}
|
|
98
|
+
|
|
51
99
|
export function getBlockInputSyncCacheItemRootHex(block: BlockInputSyncCacheItem): RootHex {
|
|
52
100
|
return isPendingBlockInput(block) ? block.blockInput.blockRootHex : block.rootHex;
|
|
53
101
|
}
|
|
@@ -55,3 +103,27 @@ export function getBlockInputSyncCacheItemRootHex(block: BlockInputSyncCacheItem
|
|
|
55
103
|
export function getBlockInputSyncCacheItemSlot(block: BlockInputSyncCacheItem): Slot | string {
|
|
56
104
|
return isPendingBlockInput(block) ? block.blockInput.slot : "unknown";
|
|
57
105
|
}
|
|
106
|
+
|
|
107
|
+
export function getPayloadSyncCacheItemRootHex(payload: PayloadSyncCacheItem): RootHex {
|
|
108
|
+
if (isPendingPayloadInput(payload)) {
|
|
109
|
+
return payload.payloadInput.blockRootHex;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (isPendingPayloadEnvelope(payload)) {
|
|
113
|
+
return toRootHex(payload.envelope.message.beaconBlockRoot);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return payload.rootHex;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function getPayloadSyncCacheItemSlot(payload: PayloadSyncCacheItem): Slot | string {
|
|
120
|
+
if (isPendingPayloadInput(payload)) {
|
|
121
|
+
return payload.payloadInput.slot;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (isPendingPayloadEnvelope(payload)) {
|
|
125
|
+
return payload.envelope.message.payload.slotNumber;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return "unknown";
|
|
129
|
+
}
|