@lodestar/beacon-node 1.43.0-dev.4358217e12 → 1.43.0-dev.4451fec75a
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 +10 -0
- 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/blockInput/blockInput.d.ts +3 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +4 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +16 -31
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +6 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +19 -10
- 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 +35 -21
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +12 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +28 -2
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +17 -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 +1 -3
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +34 -23
- 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 +16 -7
- 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 +10 -6
- 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.map +1 -1
- package/lib/chain/chain.js +25 -8
- 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/proposerPreferences.d.ts +8 -1
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/errors/proposerPreferences.js +1 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -1
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +6 -1
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +1 -1
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +2 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +52 -10
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +16 -18
- 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 +33 -20
- package/lib/chain/produceBlock/produceBlockBody.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/seenPayloadEnvelopeInput.d.ts +21 -11
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +70 -20
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.d.ts +8 -7
- package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.js +11 -10
- package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +11 -8
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +5 -3
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +39 -17
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +4 -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 +751 -2
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/interface.d.ts +2 -0
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/network.d.ts +2 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +8 -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 +61 -13
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.js +5 -5
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByHead.d.ts +9 -0
- package/lib/network/reqresp/handlers/beaconBlocksByHead.d.ts.map +1 -0
- package/lib/network/reqresp/handlers/beaconBlocksByHead.js +61 -0
- package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -0
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +5 -0
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/interface.d.ts +1 -1
- package/lib/network/reqresp/interface.js +1 -1
- package/lib/network/reqresp/protocols.d.ts +1 -0
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +5 -0
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
- package/lib/network/reqresp/rateLimit.js +4 -0
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +1 -0
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +3 -0
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +3 -0
- package/lib/network/reqresp/types.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/constants.d.ts +7 -1
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +7 -4
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/range/batch.d.ts +43 -6
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +243 -44
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +16 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +100 -9
- 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 +54 -5
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts +2 -1
- package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
- package/lib/sync/range/utils/peerBalancer.js +8 -4
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/sync.d.ts.map +1 -1
- package/lib/sync/sync.js +13 -0
- package/lib/sync/sync.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +7 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +127 -57
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +36 -9
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +106 -42
- 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 +10 -0
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/rateLimit.d.ts +2 -0
- package/lib/sync/utils/rateLimit.d.ts.map +1 -0
- package/lib/sync/utils/rateLimit.js +15 -0
- package/lib/sync/utils/rateLimit.js.map +1 -0
- 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 -16
- package/src/api/impl/beacon/blocks/index.ts +13 -0
- 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/blockInput/blockInput.ts +4 -1
- package/src/chain/blocks/importBlock.ts +16 -50
- package/src/chain/blocks/importExecutionPayload.ts +32 -15
- package/src/chain/blocks/index.ts +32 -15
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +37 -3
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +18 -0
- package/src/chain/blocks/types.ts +2 -1
- package/src/chain/blocks/utils/chainSegment.ts +35 -24
- package/src/chain/blocks/verifyBlock.ts +45 -13
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +16 -6
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +14 -6
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
- package/src/chain/chain.ts +29 -7
- package/src/chain/emitter.ts +0 -11
- package/src/chain/errors/proposerPreferences.ts +9 -1
- package/src/chain/initState.ts +9 -1
- package/src/chain/lightClient/index.ts +6 -6
- package/src/chain/opPools/payloadAttestationPool.ts +59 -10
- package/src/chain/prepareNextSlot.ts +21 -29
- package/src/chain/produceBlock/produceBlockBody.ts +41 -25
- package/src/chain/regen/queued.ts +2 -7
- package/src/chain/regen/regen.ts +2 -7
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +90 -24
- package/src/chain/seenCache/seenProposerPreferences.ts +14 -11
- package/src/chain/validation/executionPayloadBid.ts +11 -8
- package/src/chain/validation/payloadAttestationMessage.ts +6 -4
- package/src/chain/validation/proposerPreferences.ts +37 -18
- package/src/metrics/metrics/lodestar.ts +6 -0
- package/src/network/interface.ts +2 -0
- package/src/network/network.ts +23 -0
- package/src/network/processor/gossipHandlers.ts +75 -14
- package/src/network/processor/index.ts +5 -5
- package/src/network/reqresp/ReqRespBeaconNode.ts +1 -0
- package/src/network/reqresp/handlers/beaconBlocksByHead.ts +91 -0
- package/src/network/reqresp/handlers/index.ts +5 -0
- package/src/network/reqresp/interface.ts +1 -1
- package/src/network/reqresp/protocols.ts +6 -0
- package/src/network/reqresp/rateLimit.ts +4 -0
- package/src/network/reqresp/score.ts +1 -0
- package/src/network/reqresp/types.ts +5 -0
- package/src/node/nodejs.ts +2 -2
- package/src/node/notifier.ts +1 -8
- package/src/sync/constants.ts +8 -4
- package/src/sync/range/batch.ts +309 -51
- package/src/sync/range/chain.ts +119 -10
- package/src/sync/range/range.ts +68 -5
- package/src/sync/range/utils/peerBalancer.ts +9 -3
- package/src/sync/sync.ts +13 -1
- package/src/sync/unknownBlock.ts +157 -60
- package/src/sync/utils/downloadByRange.ts +174 -44
- package/src/sync/utils/downloadByRoot.ts +12 -0
- package/src/sync/utils/rateLimit.ts +16 -0
- package/src/util/sszBytes.ts +8 -6
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
2
3
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
3
|
-
import {RootHex
|
|
4
|
+
import {RootHex} from "@lodestar/types";
|
|
4
5
|
import {Logger} from "@lodestar/utils";
|
|
5
6
|
import {Metrics} from "../../metrics/metrics.js";
|
|
7
|
+
import {IClock} from "../../util/clock.js";
|
|
6
8
|
import {SerializedCache} from "../../util/serializedCache.js";
|
|
7
|
-
import {
|
|
9
|
+
import {isDaOutOfRange} from "../blocks/blockInput/index.js";
|
|
10
|
+
import {CreateFromBidProps, CreateFromBlockProps, PayloadEnvelopeInput} from "../blocks/payloadEnvelopeInput/index.js";
|
|
8
11
|
import {ChainEvent, ChainEventEmitter} from "../emitter.js";
|
|
9
12
|
|
|
10
13
|
export type {PayloadEnvelopeInputState} from "../blocks/payloadEnvelopeInput/index.js";
|
|
11
14
|
export {PayloadEnvelopeInput} from "../blocks/payloadEnvelopeInput/index.js";
|
|
12
15
|
|
|
13
16
|
export type SeenPayloadEnvelopeInputModules = {
|
|
17
|
+
config: ChainForkConfig;
|
|
18
|
+
clock: IClock;
|
|
19
|
+
forkChoice: IForkChoice;
|
|
14
20
|
chainEvents: ChainEventEmitter;
|
|
15
21
|
signal: AbortSignal;
|
|
16
22
|
serializedCache: SerializedCache;
|
|
@@ -21,17 +27,16 @@ export type SeenPayloadEnvelopeInputModules = {
|
|
|
21
27
|
/**
|
|
22
28
|
* Cache for tracking PayloadEnvelopeInput instances, keyed by beacon block root.
|
|
23
29
|
*
|
|
24
|
-
* Created
|
|
25
|
-
* - `prepareNextSlot` calls `pruneBelow(headParentSlot)` every slot once the head we'll build
|
|
26
|
-
* on is known.
|
|
27
|
-
* - `onFinalized` calls `pruneBelow(finalizedSlot)` on every finalization for bulk cleanup.
|
|
28
|
-
*
|
|
30
|
+
* Created whenever we have a block because it needs block bid.
|
|
29
31
|
* Steady state (linear chain, healthy progression): the cache holds ~2 entries — the head
|
|
30
32
|
* (parent for next-slot production) and its parent (proposer-boost-reorg fallback). It can
|
|
31
33
|
* transiently hold more during forks, range-sync bursts, or when `prepareNextSlot` skips
|
|
32
34
|
* ticks; subsequent ticks settle it back.
|
|
33
35
|
*/
|
|
34
36
|
export class SeenPayloadEnvelopeInput {
|
|
37
|
+
private readonly config: ChainForkConfig;
|
|
38
|
+
private readonly clock: IClock;
|
|
39
|
+
private readonly forkChoice: IForkChoice;
|
|
35
40
|
private readonly chainEvents: ChainEventEmitter;
|
|
36
41
|
private readonly signal: AbortSignal;
|
|
37
42
|
private readonly serializedCache: SerializedCache;
|
|
@@ -39,7 +44,19 @@ export class SeenPayloadEnvelopeInput {
|
|
|
39
44
|
private readonly logger?: Logger;
|
|
40
45
|
private payloadInputs = new Map<RootHex, PayloadEnvelopeInput>();
|
|
41
46
|
|
|
42
|
-
constructor({
|
|
47
|
+
constructor({
|
|
48
|
+
config,
|
|
49
|
+
clock,
|
|
50
|
+
forkChoice,
|
|
51
|
+
chainEvents,
|
|
52
|
+
signal,
|
|
53
|
+
serializedCache,
|
|
54
|
+
metrics,
|
|
55
|
+
logger,
|
|
56
|
+
}: SeenPayloadEnvelopeInputModules) {
|
|
57
|
+
this.config = config;
|
|
58
|
+
this.clock = clock;
|
|
59
|
+
this.forkChoice = forkChoice;
|
|
43
60
|
this.chainEvents = chainEvents;
|
|
44
61
|
this.signal = signal;
|
|
45
62
|
this.serializedCache = serializedCache;
|
|
@@ -58,23 +75,68 @@ export class SeenPayloadEnvelopeInput {
|
|
|
58
75
|
});
|
|
59
76
|
}
|
|
60
77
|
|
|
61
|
-
this.chainEvents.on(ChainEvent.forkChoiceFinalized, this.
|
|
78
|
+
this.chainEvents.on(ChainEvent.forkChoiceFinalized, this.pruneFinalized);
|
|
62
79
|
this.signal.addEventListener("abort", () => {
|
|
63
|
-
this.chainEvents.off(ChainEvent.forkChoiceFinalized, this.
|
|
80
|
+
this.chainEvents.off(ChainEvent.forkChoiceFinalized, this.pruneFinalized);
|
|
64
81
|
});
|
|
65
82
|
}
|
|
66
83
|
|
|
67
|
-
private
|
|
68
|
-
|
|
84
|
+
private pruneFinalized = (checkpoint: CheckpointWithHex): void => {
|
|
85
|
+
const finalizedSlot = computeStartSlotAtEpoch(checkpoint.epoch);
|
|
86
|
+
let deletedCount = 0;
|
|
87
|
+
for (const [, input] of this.payloadInputs) {
|
|
88
|
+
if (input.slot < finalizedSlot) {
|
|
89
|
+
this.evictPayloadInput(input);
|
|
90
|
+
deletedCount++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.logger?.debug("SeenPayloadEnvelopeInput.pruneFinalized deleted entries", {
|
|
95
|
+
finalizedSlot,
|
|
96
|
+
finalizedRoot: checkpoint.rootHex,
|
|
97
|
+
deletedCount,
|
|
98
|
+
});
|
|
69
99
|
};
|
|
70
100
|
|
|
71
|
-
add(props: CreateFromBlockProps): PayloadEnvelopeInput {
|
|
72
|
-
|
|
73
|
-
|
|
101
|
+
add(props: Omit<CreateFromBlockProps, "daOutOfRange">): PayloadEnvelopeInput {
|
|
102
|
+
const existing = this.payloadInputs.get(props.blockRootHex);
|
|
103
|
+
if (existing !== undefined) {
|
|
104
|
+
this.logger?.verbose("SeenPayloadEnvelopeInput.add reused existing entry", {
|
|
105
|
+
slot: existing.slot,
|
|
106
|
+
root: props.blockRootHex,
|
|
107
|
+
});
|
|
108
|
+
return existing;
|
|
109
|
+
}
|
|
110
|
+
const daOutOfRange = isDaOutOfRange(this.config, props.forkName, props.block.message.slot, this.clock.currentEpoch);
|
|
111
|
+
const input = PayloadEnvelopeInput.createFromBlock({...props, daOutOfRange});
|
|
112
|
+
this.payloadInputs.set(props.blockRootHex, input);
|
|
113
|
+
this.metrics?.seenCache.payloadEnvelopeInput.created.inc();
|
|
114
|
+
this.logger?.verbose("SeenPayloadEnvelopeInput.add created new entry", {
|
|
115
|
+
slot: input.slot,
|
|
116
|
+
root: props.blockRootHex,
|
|
117
|
+
daOutOfRange,
|
|
118
|
+
});
|
|
119
|
+
return input;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Used at chain initialization to seed the anchor block's PayloadEnvelopeInput from
|
|
124
|
+
* `state.latestExecutionPayloadBid`.
|
|
125
|
+
*/
|
|
126
|
+
addFromBid(props: Omit<CreateFromBidProps, "daOutOfRange">): PayloadEnvelopeInput {
|
|
127
|
+
const existing = this.payloadInputs.get(props.blockRootHex);
|
|
128
|
+
if (existing !== undefined) {
|
|
129
|
+
return existing;
|
|
74
130
|
}
|
|
75
|
-
const
|
|
131
|
+
const daOutOfRange = isDaOutOfRange(this.config, props.forkName, props.slot, this.clock.currentEpoch);
|
|
132
|
+
const input = PayloadEnvelopeInput.createFromBid({...props, daOutOfRange});
|
|
76
133
|
this.payloadInputs.set(props.blockRootHex, input);
|
|
77
134
|
this.metrics?.seenCache.payloadEnvelopeInput.created.inc();
|
|
135
|
+
this.logger?.verbose("SeenPayloadEnvelopeInput.addFromBid created new entry", {
|
|
136
|
+
slot: input.slot,
|
|
137
|
+
root: props.blockRootHex,
|
|
138
|
+
daOutOfRange,
|
|
139
|
+
});
|
|
78
140
|
return input;
|
|
79
141
|
}
|
|
80
142
|
|
|
@@ -90,15 +152,19 @@ export class SeenPayloadEnvelopeInput {
|
|
|
90
152
|
return this.payloadInputs.size;
|
|
91
153
|
}
|
|
92
154
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
155
|
+
pruneBelowParent(parentBlock: ProtoBlock): void {
|
|
156
|
+
for (const block of this.forkChoice.getAllAncestorBlocks(parentBlock.blockRoot, parentBlock.payloadStatus)) {
|
|
157
|
+
if (block.slot < parentBlock.slot) {
|
|
158
|
+
const input = this.payloadInputs.get(block.blockRoot);
|
|
159
|
+
if (input) {
|
|
160
|
+
this.evictPayloadInput(input);
|
|
161
|
+
this.logger?.verbose("SeenPayloadEnvelopeInput.pruneBelowParent deleted", {
|
|
162
|
+
slot: block.slot,
|
|
163
|
+
root: block.blockRoot,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
99
166
|
}
|
|
100
167
|
}
|
|
101
|
-
this.logger?.debug("SeenPayloadEnvelopeInput.pruneBelow deleted entries", {slot, deletedCount});
|
|
102
168
|
}
|
|
103
169
|
|
|
104
170
|
private evictPayloadInput(payloadInput: PayloadEnvelopeInput): void {
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import {Slot, ValidatorIndex} from "@lodestar/types";
|
|
1
|
+
import {RootHex, Slot, ValidatorIndex} from "@lodestar/types";
|
|
2
2
|
import {MapDef} from "@lodestar/utils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Tracks signed proposer preferences we've already seen per (proposal_slot, validator_index).
|
|
5
|
+
* Tracks signed proposer preferences we've already seen per (dependent_root, proposal_slot, validator_index).
|
|
6
6
|
*/
|
|
7
7
|
export class SeenProposerPreferences {
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly validatorByDependentRootBySlot = new MapDef<Slot, Map<RootHex, ValidatorIndex>>(
|
|
9
|
+
() => new Map<RootHex, ValidatorIndex>()
|
|
10
|
+
);
|
|
9
11
|
|
|
10
|
-
isKnown(proposalSlot: Slot, validatorIndex: ValidatorIndex): boolean {
|
|
11
|
-
return this.
|
|
12
|
+
isKnown(dependentRoot: RootHex, proposalSlot: Slot, validatorIndex: ValidatorIndex): boolean {
|
|
13
|
+
return this.validatorByDependentRootBySlot.get(proposalSlot)?.get(dependentRoot) === validatorIndex;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
add(proposalSlot: Slot, validatorIndex: ValidatorIndex): void {
|
|
15
|
-
this.
|
|
16
|
+
add(dependentRoot: RootHex, proposalSlot: Slot, validatorIndex: ValidatorIndex): void {
|
|
17
|
+
this.validatorByDependentRootBySlot.getOrDefault(proposalSlot).set(dependentRoot, validatorIndex);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
* Entries are only load-bearing while `proposal_slot >
|
|
20
|
-
* `[IGNORE] proposal_slot >
|
|
21
|
+
* Entries are only load-bearing while `proposal_slot > current_slot`. Once the slot has
|
|
22
|
+
* passed the `[IGNORE] proposal_slot > current_slot` gossip rule takes over, so drop them
|
|
23
|
+
* on each slot tick.
|
|
21
24
|
*/
|
|
22
25
|
prune(currentSlot: Slot): void {
|
|
23
|
-
for (const slot of this.
|
|
26
|
+
for (const slot of this.validatorByDependentRootBySlot.keys()) {
|
|
24
27
|
if (slot < currentSlot) {
|
|
25
|
-
this.
|
|
28
|
+
this.validatorByDependentRootBySlot.delete(slot);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -48,9 +48,12 @@ async function validateExecutionPayloadBid(
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// [IGNORE]
|
|
52
|
-
//
|
|
53
|
-
//
|
|
51
|
+
// [IGNORE] A `SignedProposerPreferences` matching `bid.slot` and the bid's branch has been
|
|
52
|
+
// seen — i.e. `proposal_slot == bid.slot` AND `dependent_root ==
|
|
53
|
+
// get_proposer_dependent_root(parent_state, compute_epoch_at_slot(bid.slot))`,
|
|
54
|
+
// where `parent_state` is the post-state of `bid.parent_block_root`.
|
|
55
|
+
// This is the message referenced as `proposer_preferences` in the following REJECT rules.
|
|
56
|
+
// TODO GLOAS: Implement once a ProposerPreferencesPool exists.
|
|
54
57
|
|
|
55
58
|
// [REJECT] `bid.builder_index` is a valid/active builder index -- i.e.
|
|
56
59
|
// `is_active_builder(state, bid.builder_index)` returns `True`.
|
|
@@ -71,11 +74,11 @@ async function validateExecutionPayloadBid(
|
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
// [REJECT] `bid.fee_recipient
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
// TODO GLOAS: Implement
|
|
77
|
+
// [REJECT] `bid.fee_recipient == proposer_preferences.fee_recipient`.
|
|
78
|
+
// [REJECT] `bid.gas_limit == proposer_preferences.gas_limit`.
|
|
79
|
+
// Both compared against the matching `proposer_preferences` defined above (same branch
|
|
80
|
+
// via dependent_root, same proposal_slot).
|
|
81
|
+
// TODO GLOAS: Implement once a ProposerPreferencesPool exists.
|
|
79
82
|
|
|
80
83
|
// [REJECT] The length of KZG commitments is less than or equal to the limitation defined in the
|
|
81
84
|
// consensus layer -- i.e. validate that
|
|
@@ -11,7 +11,7 @@ import {IBeaconChain} from "../index.js";
|
|
|
11
11
|
|
|
12
12
|
export type PayloadAttestationValidationResult = {
|
|
13
13
|
attDataRootHex: RootHex;
|
|
14
|
-
|
|
14
|
+
validatorCommitteeIndices: number[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export async function validateApiPayloadAttestationMessage(
|
|
@@ -80,9 +80,11 @@ async function validatePayloadAttestationMessage(
|
|
|
80
80
|
// [REJECT] The message's validator index is within the payload committee in
|
|
81
81
|
// `get_ptc(state, data.slot)`. The `state` is the head state corresponding to
|
|
82
82
|
// processing the block up to the current slot as determined by the fork choice.
|
|
83
|
-
|
|
83
|
+
// The validator may occupy multiple PTC positions because `compute_ptc` samples
|
|
84
|
+
// by effective balance — collect all of them so duplicate votes are counted.
|
|
85
|
+
const validatorCommitteeIndices = state.getIndicesInPayloadTimelinessCommittee(validatorIndex, data.slot);
|
|
84
86
|
|
|
85
|
-
if (
|
|
87
|
+
if (validatorCommitteeIndices.length === 0) {
|
|
86
88
|
throw new PayloadAttestationError(GossipAction.REJECT, {
|
|
87
89
|
code: PayloadAttestationErrorCode.INVALID_ATTESTER,
|
|
88
90
|
attesterIndex: validatorIndex,
|
|
@@ -115,6 +117,6 @@ async function validatePayloadAttestationMessage(
|
|
|
115
117
|
|
|
116
118
|
return {
|
|
117
119
|
attDataRootHex: toRootHex(ssz.gloas.PayloadAttestationData.hashTreeRoot(data)),
|
|
118
|
-
|
|
120
|
+
validatorCommitteeIndices,
|
|
119
121
|
};
|
|
120
122
|
}
|
|
@@ -3,12 +3,11 @@ import {
|
|
|
3
3
|
computeEpochAtSlot,
|
|
4
4
|
createSingleSignatureSetFromComponents,
|
|
5
5
|
getProposerPreferencesSigningRoot,
|
|
6
|
-
isStatePostGloas,
|
|
7
6
|
} from "@lodestar/state-transition";
|
|
8
|
-
import {gloas} from "@lodestar/types";
|
|
7
|
+
import {ValidatorIndex, gloas} from "@lodestar/types";
|
|
8
|
+
import {toRootHex} from "@lodestar/utils";
|
|
9
9
|
import {GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode} from "../errors/index.js";
|
|
10
10
|
import {IBeaconChain} from "../index.js";
|
|
11
|
-
import {RegenCaller} from "../regen/index.js";
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Validates a gossiped `SignedProposerPreferences` per
|
|
@@ -19,7 +18,8 @@ export async function validateGossipProposerPreferences(
|
|
|
19
18
|
signedProposerPreferences: gloas.SignedProposerPreferences
|
|
20
19
|
): Promise<void> {
|
|
21
20
|
const preferences = signedProposerPreferences.message;
|
|
22
|
-
const {proposalSlot, validatorIndex} = preferences;
|
|
21
|
+
const {proposalSlot, validatorIndex, dependentRoot} = preferences;
|
|
22
|
+
const dependentRootHex = toRootHex(dependentRoot);
|
|
23
23
|
const proposalEpoch = computeEpochAtSlot(proposalSlot);
|
|
24
24
|
|
|
25
25
|
// [IGNORE] `preferences.proposal_slot` is in the current or next epoch.
|
|
@@ -42,32 +42,51 @@ export async function validateGossipProposerPreferences(
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// [IGNORE] The block with root `dependent_root` has been seen by the node.
|
|
46
|
+
// Resolve the proposer lookahead for the message's branch via head state (fast path) or
|
|
47
|
+
// the previous-root checkpoint state (populated by `processSlotsToNearestCheckpoint` for
|
|
48
|
+
// any imported branch crossing into `proposalEpoch - 1`). The head-state path also handles
|
|
49
|
+
// narrow timing windows where the checkpoint state isn't yet populated.
|
|
50
|
+
const headState = chain.getHeadState();
|
|
51
|
+
let proposers: ValidatorIndex[] | null = null;
|
|
52
|
+
if (headState.epoch === proposalEpoch && headState.currentDecisionRoot === dependentRootHex) {
|
|
53
|
+
proposers = headState.currentProposers;
|
|
54
|
+
} else if (headState.epoch === proposalEpoch - 1 && headState.nextDecisionRoot === dependentRootHex) {
|
|
55
|
+
proposers = headState.nextProposers;
|
|
56
|
+
} else {
|
|
57
|
+
// Sync lookup only to not trigger disk reload from gossip input.
|
|
58
|
+
const checkpointState = chain.regen.getCheckpointStateSync({epoch: proposalEpoch - 1, rootHex: dependentRootHex});
|
|
59
|
+
if (checkpointState !== null) {
|
|
60
|
+
// State is at `proposalEpoch - 1`, so proposers for `proposalSlot` (next epoch from
|
|
61
|
+
// the state's perspective) live in `nextProposers`.
|
|
62
|
+
proposers = checkpointState.nextProposers;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (proposers === null) {
|
|
66
|
+
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
67
|
+
code: ProposerPreferencesErrorCode.UNKNOWN_DEPENDENT_ROOT,
|
|
68
|
+
proposalSlot,
|
|
69
|
+
dependentRoot: dependentRootHex,
|
|
70
|
+
});
|
|
48
71
|
}
|
|
49
72
|
|
|
50
|
-
// [REJECT] `preferences
|
|
51
|
-
|
|
52
|
-
// returns True.
|
|
53
|
-
const epochOffset = proposalEpoch - state.epoch;
|
|
54
|
-
const proposers = epochOffset === 0 ? state.currentProposers : state.nextProposers;
|
|
55
|
-
const expectedProposer = proposers[proposalSlot % SLOTS_PER_EPOCH];
|
|
56
|
-
if (epochOffset < 0 || epochOffset > 1 || expectedProposer !== validatorIndex) {
|
|
73
|
+
// [REJECT] `is_valid_proposal_slot(state, preferences)` returns True.
|
|
74
|
+
if (proposers[proposalSlot % SLOTS_PER_EPOCH] !== validatorIndex) {
|
|
57
75
|
throw new ProposerPreferencesError(GossipAction.REJECT, {
|
|
58
76
|
code: ProposerPreferencesErrorCode.INVALID_PROPOSER,
|
|
59
77
|
proposalSlot,
|
|
60
78
|
validatorIndex,
|
|
79
|
+
dependentRoot: dependentRootHex,
|
|
61
80
|
});
|
|
62
81
|
}
|
|
63
82
|
|
|
64
|
-
// [IGNORE]
|
|
65
|
-
|
|
66
|
-
if (chain.seenProposerPreferences.isKnown(proposalSlot, validatorIndex)) {
|
|
83
|
+
// [IGNORE] First valid message for (dependent_root, proposal_slot, validator_index).
|
|
84
|
+
if (chain.seenProposerPreferences.isKnown(dependentRootHex, proposalSlot, validatorIndex)) {
|
|
67
85
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
68
86
|
code: ProposerPreferencesErrorCode.ALREADY_KNOWN,
|
|
69
87
|
proposalSlot,
|
|
70
88
|
validatorIndex,
|
|
89
|
+
dependentRoot: dependentRootHex,
|
|
71
90
|
});
|
|
72
91
|
}
|
|
73
92
|
|
|
@@ -87,5 +106,5 @@ export async function validateGossipProposerPreferences(
|
|
|
87
106
|
}
|
|
88
107
|
|
|
89
108
|
// Valid
|
|
90
|
-
chain.seenProposerPreferences.add(proposalSlot, validatorIndex);
|
|
109
|
+
chain.seenProposerPreferences.add(dependentRootHex, proposalSlot, validatorIndex);
|
|
91
110
|
}
|
|
@@ -3,6 +3,7 @@ import {NotReorgedReason} from "@lodestar/fork-choice";
|
|
|
3
3
|
import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
|
|
4
4
|
import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
|
|
5
5
|
import {BlockInputSource} from "../../chain/blocks/blockInput/index.js";
|
|
6
|
+
import {PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
6
7
|
import {PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
7
8
|
import {JobQueueItemType} from "../../chain/bls/index.js";
|
|
8
9
|
import {AttestationErrorCode, BlockErrorCode} from "../../chain/errors/index.js";
|
|
@@ -890,6 +891,11 @@ export function createLodestarMetrics(
|
|
|
890
891
|
labelNames: ["source"],
|
|
891
892
|
buckets: [0.5, 1, 2, 4, 6, 12],
|
|
892
893
|
}),
|
|
894
|
+
processPayloadErrors: register.gauge<{error: PayloadErrorCode | "NOT_PAYLOAD_ERROR"}>({
|
|
895
|
+
name: "lodestar_gossip_execution_payload_envelope_process_payload_errors",
|
|
896
|
+
help: "Count of errors, by error type, while processing execution payload envelopes",
|
|
897
|
+
labelNames: ["error"],
|
|
898
|
+
}),
|
|
893
899
|
},
|
|
894
900
|
// recovery in the case of specific blob rows required
|
|
895
901
|
recoverBlobSidecars: {
|
package/src/network/interface.ts
CHANGED
|
@@ -78,6 +78,7 @@ export interface INetwork extends INetworkCorePublic {
|
|
|
78
78
|
// ReqResp
|
|
79
79
|
sendBeaconBlocksByRange(peerId: PeerIdStr, request: phase0.BeaconBlocksByRangeRequest): Promise<SignedBeaconBlock[]>;
|
|
80
80
|
sendBeaconBlocksByRoot(peerId: PeerIdStr, request: BeaconBlocksByRootRequest): Promise<SignedBeaconBlock[]>;
|
|
81
|
+
sendBeaconBlocksByHead(peerId: PeerIdStr, request: fulu.BeaconBlocksByHeadRequest): Promise<SignedBeaconBlock[]>;
|
|
81
82
|
sendBlobSidecarsByRange(peerId: PeerIdStr, request: deneb.BlobSidecarsByRangeRequest): Promise<deneb.BlobSidecar[]>;
|
|
82
83
|
sendBlobSidecarsByRoot(peerId: PeerIdStr, request: BlobSidecarsByRootRequest): Promise<deneb.BlobSidecar[]>;
|
|
83
84
|
sendDataColumnSidecarsByRange(
|
|
@@ -112,6 +113,7 @@ export interface INetwork extends INetworkCorePublic {
|
|
|
112
113
|
publishLightClientFinalityUpdate(update: LightClientFinalityUpdate): Promise<number>;
|
|
113
114
|
publishLightClientOptimisticUpdate(update: LightClientOptimisticUpdate): Promise<number>;
|
|
114
115
|
publishSignedExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope): Promise<number>;
|
|
116
|
+
publishPayloadAttestationMessage(payloadAttestationMessage: gloas.PayloadAttestationMessage): Promise<number>;
|
|
115
117
|
|
|
116
118
|
// Debug
|
|
117
119
|
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],
|
|
@@ -567,6 +578,18 @@ export class Network implements INetwork {
|
|
|
567
578
|
);
|
|
568
579
|
}
|
|
569
580
|
|
|
581
|
+
async sendBeaconBlocksByHead(
|
|
582
|
+
peerId: PeerIdStr,
|
|
583
|
+
request: fulu.BeaconBlocksByHeadRequest
|
|
584
|
+
): Promise<SignedBeaconBlock[]> {
|
|
585
|
+
return collectMaxResponseTypedWithBytes(
|
|
586
|
+
this.sendReqRespRequest(peerId, ReqRespMethod.BeaconBlocksByHead, [Version.V1], request),
|
|
587
|
+
Math.min(request.count, this.config.MAX_REQUEST_BLOCKS_DENEB),
|
|
588
|
+
responseSszTypeByMethod[ReqRespMethod.BeaconBlocksByHead],
|
|
589
|
+
this.chain.serializedCache
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
|
|
570
593
|
async sendLightClientBootstrap(peerId: PeerIdStr, request: Root): Promise<LightClientBootstrap> {
|
|
571
594
|
return collectExactOneTyped(
|
|
572
595
|
this.sendReqRespRequest(peerId, ReqRespMethod.LightClientBootstrap, [Version.V1], request),
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
IBlockInput,
|
|
36
36
|
isBlockInputColumns,
|
|
37
37
|
} from "../../chain/blocks/blockInput/index.js";
|
|
38
|
+
import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
38
39
|
import {PayloadEnvelopeInput, PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
39
40
|
import {BlobSidecarValidation} from "../../chain/blocks/types.js";
|
|
40
41
|
import {ChainEvent} from "../../chain/emitter.js";
|
|
@@ -52,6 +53,8 @@ import {
|
|
|
52
53
|
ExecutionPayloadEnvelopeErrorCode,
|
|
53
54
|
GossipAction,
|
|
54
55
|
GossipActionError,
|
|
56
|
+
PayloadAttestationError,
|
|
57
|
+
PayloadAttestationErrorCode,
|
|
55
58
|
SyncCommitteeError,
|
|
56
59
|
} from "../../chain/errors/index.js";
|
|
57
60
|
import {IBeaconChain} from "../../chain/interface.js";
|
|
@@ -183,6 +186,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
183
186
|
});
|
|
184
187
|
try {
|
|
185
188
|
await validateGossipBlock(config, chain, signedBlock, fork);
|
|
189
|
+
|
|
190
|
+
if (isForkPostGloas(fork)) {
|
|
191
|
+
chain.seenPayloadEnvelopeInputCache.add({
|
|
192
|
+
blockRootHex,
|
|
193
|
+
block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
|
|
194
|
+
forkName: fork,
|
|
195
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
196
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
197
|
+
timeCreatedSec: seenTimestampSec,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
186
201
|
const blockInputMeta = blockInput.getLogMeta();
|
|
187
202
|
|
|
188
203
|
const recvToValidation = Date.now() / 1000 - seenTimestampSec;
|
|
@@ -593,6 +608,24 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
593
608
|
// Returns the delay between the start of `block.slot` and `current time`
|
|
594
609
|
const delaySec = chain.clock.secFromSlot(slot);
|
|
595
610
|
metrics?.gossipBlock.elapsedTimeTillProcessed.observe(delaySec);
|
|
611
|
+
|
|
612
|
+
if (isForkPostGloas(blockInput.forkName)) {
|
|
613
|
+
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockInput.blockRootHex);
|
|
614
|
+
// This payloadInput should have been created just after gossip validation
|
|
615
|
+
if (!payloadInput) {
|
|
616
|
+
throw Error(
|
|
617
|
+
`PayloadEnvelopeInput not seeded for block ${blockInput.blockRootHex} during gossip processing`
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
|
|
622
|
+
// which is all the information we need so there is no reason to delay until execution payload arrives
|
|
623
|
+
// TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
|
|
624
|
+
// (for example later in the slot). Do not couple retries to incoming gossip columns.
|
|
625
|
+
// Columns fetched here feed payloadInput.addColumn, which resolves waitForAllData for any
|
|
626
|
+
// in-flight importExecutionPayload. No processExecutionPayload trigger needed from this path.
|
|
627
|
+
chain.getBlobsTracker.triggerGetBlobs(payloadInput);
|
|
628
|
+
}
|
|
596
629
|
})
|
|
597
630
|
.catch((e) => {
|
|
598
631
|
// Adjust verbosity based on error type
|
|
@@ -1070,13 +1103,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1070
1103
|
const {beaconBlockRoot} = signedEnvelope.message;
|
|
1071
1104
|
const slot = signedEnvelope.message.payload.slotNumber;
|
|
1072
1105
|
logger.debug("Gossip envelope has error", {slot, root: toRootHex(beaconBlockRoot), code: e.type.code});
|
|
1073
|
-
if (e.type.code === ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN) {
|
|
1074
|
-
chain.emitter.emit(ChainEvent.envelopeUnknownBlock, {
|
|
1075
|
-
envelope: signedEnvelope,
|
|
1076
|
-
peer: peerIdStr,
|
|
1077
|
-
source: BlockInputSource.gossip,
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
1106
|
|
|
1081
1107
|
if (e.action === GossipAction.REJECT) {
|
|
1082
1108
|
chain.persistInvalidSszValue(
|
|
@@ -1123,7 +1149,40 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1123
1149
|
});
|
|
1124
1150
|
|
|
1125
1151
|
chain.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
|
|
1126
|
-
|
|
1152
|
+
// Adjust verbosity based on error type
|
|
1153
|
+
let logLevel: LogLevel;
|
|
1154
|
+
|
|
1155
|
+
if (e instanceof PayloadError) {
|
|
1156
|
+
switch (e.type.code) {
|
|
1157
|
+
// BLOCK_NOT_IN_FORK_CHOICE should not happen, validateGossipExecutionPayloadEnvelope above
|
|
1158
|
+
// already verified the block is in fork choice
|
|
1159
|
+
case PayloadErrorCode.BLOCK_NOT_IN_FORK_CHOICE:
|
|
1160
|
+
case PayloadErrorCode.MISS_BLOCK_STATE:
|
|
1161
|
+
case PayloadErrorCode.EXECUTION_ENGINE_ERROR:
|
|
1162
|
+
// Errors might indicate an issue with our node or the connected EL client
|
|
1163
|
+
logLevel = LogLevel.error;
|
|
1164
|
+
break;
|
|
1165
|
+
// INVALID_SIGNATURE should not happen, signature is verified during gossip validation
|
|
1166
|
+
case PayloadErrorCode.INVALID_SIGNATURE:
|
|
1167
|
+
case PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR:
|
|
1168
|
+
case PayloadErrorCode.EXECUTION_ENGINE_INVALID:
|
|
1169
|
+
core.reportPeer(peerIdStr, PeerAction.LowToleranceError, "BadGossipPayload");
|
|
1170
|
+
// Misbehaving peer, but could highlight an issue in another client
|
|
1171
|
+
logLevel = LogLevel.warn;
|
|
1172
|
+
break;
|
|
1173
|
+
}
|
|
1174
|
+
} else {
|
|
1175
|
+
// Any unexpected error
|
|
1176
|
+
logLevel = LogLevel.error;
|
|
1177
|
+
}
|
|
1178
|
+
metrics?.gossipExecutionPayloadEnvelope.processPayloadErrors.inc({
|
|
1179
|
+
error: e instanceof PayloadError ? e.type.code : "NOT_PAYLOAD_ERROR",
|
|
1180
|
+
});
|
|
1181
|
+
chain.logger[logLevel](
|
|
1182
|
+
"Error processing execution payload from gossip",
|
|
1183
|
+
{slot, peer: peerIdStr, root: blockRootHex},
|
|
1184
|
+
e as Error
|
|
1185
|
+
);
|
|
1127
1186
|
});
|
|
1128
1187
|
},
|
|
1129
1188
|
[GossipType.payload_attestation_message]: async ({
|
|
@@ -1138,7 +1197,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1138
1197
|
const insertOutcome = chain.payloadAttestationPool.add(
|
|
1139
1198
|
payloadAttestationMessage,
|
|
1140
1199
|
validationResult.attDataRootHex,
|
|
1141
|
-
validationResult.
|
|
1200
|
+
validationResult.validatorCommitteeIndices
|
|
1142
1201
|
);
|
|
1143
1202
|
metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
|
|
1144
1203
|
} catch (e) {
|
|
@@ -1146,7 +1205,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1146
1205
|
}
|
|
1147
1206
|
chain.forkChoice.notifyPtcMessages(
|
|
1148
1207
|
toRootHex(payloadAttestationMessage.data.beaconBlockRoot),
|
|
1149
|
-
|
|
1208
|
+
validationResult.validatorCommitteeIndices,
|
|
1150
1209
|
payloadAttestationMessage.data.payloadPresent
|
|
1151
1210
|
);
|
|
1152
1211
|
},
|
|
@@ -1301,10 +1360,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
|
|
|
1301
1360
|
try {
|
|
1302
1361
|
return await fn();
|
|
1303
1362
|
} catch (e) {
|
|
1304
|
-
|
|
1305
|
-
e instanceof AttestationError &&
|
|
1306
|
-
|
|
1307
|
-
|
|
1363
|
+
const isUnknownAttestationRoot =
|
|
1364
|
+
e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
|
|
1365
|
+
const isUnknownPayloadAttestationRoot =
|
|
1366
|
+
e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
|
|
1367
|
+
|
|
1368
|
+
if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
|
|
1308
1369
|
if (unknownBlockRootRetries === 0) {
|
|
1309
1370
|
// Trigger unknown block root search here
|
|
1310
1371
|
const rootHex = toRootHex(blockRoot);
|
|
@@ -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,7 +89,6 @@ 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
94
|
[GossipType.proposer_preferences]: {},
|
|
@@ -444,8 +444,7 @@ export class NetworkProcessor {
|
|
|
444
444
|
}
|
|
445
445
|
case GossipType.execution_payload: {
|
|
446
446
|
// extractBlockSlotRootFn does not return a root for this topic.
|
|
447
|
-
// Extract beacon_block_root directly
|
|
448
|
-
// Do NOT await the block — the handler runs immediately; BlockInputSync handles recovery.
|
|
447
|
+
// Extract beacon_block_root directly
|
|
449
448
|
const blockRoot = getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized(message.msg.data);
|
|
450
449
|
if (blockRoot && !this.chain.forkChoice.hasBlockHexUnsafe(blockRoot)) {
|
|
451
450
|
this.searchUnknownBlock(
|
|
@@ -453,9 +452,10 @@ export class NetworkProcessor {
|
|
|
453
452
|
BlockInputSource.network_processor,
|
|
454
453
|
message.propagationSource.toString()
|
|
455
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};
|
|
456
458
|
}
|
|
457
|
-
// do not await the block, we want UnknownBlockSync to handle it.
|
|
458
|
-
preprocessResult = {action: PreprocessAction.PushToQueue};
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
case GossipType.execution_payload_bid: {
|
|
@@ -286,6 +286,7 @@ export class ReqRespBeaconNode extends ReqResp {
|
|
|
286
286
|
// instead of protocol version. This is not easily fixable with our current architecture.
|
|
287
287
|
// See https://github.com/ChainSafe/lodestar/pull/8168 for more details.
|
|
288
288
|
[protocols.StatusV2(fork, this.config), this.onStatus.bind(this)],
|
|
289
|
+
[protocols.BeaconBlocksByHead(fork, this.config), this.getHandler(ReqRespMethod.BeaconBlocksByHead)],
|
|
289
290
|
[
|
|
290
291
|
protocols.DataColumnSidecarsByRoot(fork, this.config),
|
|
291
292
|
this.getHandler(ReqRespMethod.DataColumnSidecarsByRoot),
|