@lodestar/beacon-node 1.43.0-dev.6b7eebbf6d → 1.43.0-dev.6f485b1b61
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 +16 -5
- 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/lodestar/index.js +1 -1
- package/lib/api/impl/lodestar/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 -28
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +23 -6
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +57 -24
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts +5 -3
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +58 -25
- 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/payloadEnvelopeProcessor.js +2 -2
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +4 -3
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +89 -12
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +5 -3
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +50 -7
- 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 +12 -8
- 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/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +1 -10
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -3
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +42 -12
- 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/blockError.d.ts +8 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +5 -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/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/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +6 -1
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +5 -3
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +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 +31 -13
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +11 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +47 -15
- 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 +24 -7
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +69 -17
- 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 +26 -0
- package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +1 -0
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +24 -9
- 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 +10 -0
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +6 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/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 +38 -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/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +14 -6
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +11 -5
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +17 -5
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +7 -4
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/node/nodejs.js +2 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/constants.d.ts +3 -1
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +3 -4
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/range/batch.d.ts +35 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +240 -59
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +19 -4
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +64 -11
- 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 +31 -9
- package/lib/sync/range/range.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/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 +29 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +738 -61
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +67 -10
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +211 -26
- 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 +16 -15
- package/src/api/impl/beacon/blocks/index.ts +21 -5
- package/src/api/impl/beacon/pool/index.ts +83 -1
- package/src/api/impl/debug/index.ts +0 -1
- package/src/api/impl/lodestar/index.ts +1 -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 -48
- package/src/chain/blocks/importExecutionPayload.ts +76 -30
- package/src/chain/blocks/index.ts +71 -22
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +37 -3
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +18 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +2 -2
- package/src/chain/blocks/types.ts +4 -3
- package/src/chain/blocks/utils/chainSegment.ts +114 -17
- package/src/chain/blocks/verifyBlock.ts +70 -9
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -4
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +16 -8
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +8 -17
- package/src/chain/chain.ts +55 -10
- package/src/chain/emitter.ts +0 -11
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/errors/executionPayloadBid.ts +6 -0
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/proposerPreferences.ts +47 -0
- package/src/chain/initState.ts +9 -1
- package/src/chain/interface.ts +9 -1
- package/src/chain/opPools/payloadAttestationPool.ts +29 -8
- package/src/chain/prepareNextSlot.ts +36 -14
- package/src/chain/produceBlock/produceBlockBody.ts +57 -14
- 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 +89 -21
- package/src/chain/seenCache/seenProposerPreferences.ts +32 -0
- package/src/chain/validation/block.ts +1 -0
- package/src/chain/validation/executionPayloadBid.ts +25 -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 +53 -17
- package/src/network/processor/gossipQueues/index.ts +5 -0
- package/src/network/processor/index.ts +6 -5
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +14 -6
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +11 -5
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +17 -5
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +7 -4
- package/src/node/nodejs.ts +2 -2
- package/src/sync/constants.ts +4 -4
- package/src/sync/range/batch.ts +320 -67
- package/src/sync/range/chain.ts +89 -14
- package/src/sync/range/range.ts +34 -9
- package/src/sync/sync.ts +13 -1
- package/src/sync/types.ts +72 -0
- package/src/sync/unknownBlock.ts +928 -65
- package/src/sync/utils/downloadByRange.ts +378 -39
- package/src/sync/utils/downloadByRoot.ts +24 -2
- package/src/sync/utils/pendingBlocksTree.ts +0 -15
- 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
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,10 +27,16 @@ export type SeenPayloadEnvelopeInputModules = {
|
|
|
21
27
|
/**
|
|
22
28
|
* Cache for tracking PayloadEnvelopeInput instances, keyed by beacon block root.
|
|
23
29
|
*
|
|
24
|
-
* Created
|
|
25
|
-
*
|
|
30
|
+
* Created whenever we have a block because it needs block bid.
|
|
31
|
+
* Steady state (linear chain, healthy progression): the cache holds ~2 entries — the head
|
|
32
|
+
* (parent for next-slot production) and its parent (proposer-boost-reorg fallback). It can
|
|
33
|
+
* transiently hold more during forks, range-sync bursts, or when `prepareNextSlot` skips
|
|
34
|
+
* ticks; subsequent ticks settle it back.
|
|
26
35
|
*/
|
|
27
36
|
export class SeenPayloadEnvelopeInput {
|
|
37
|
+
private readonly config: ChainForkConfig;
|
|
38
|
+
private readonly clock: IClock;
|
|
39
|
+
private readonly forkChoice: IForkChoice;
|
|
28
40
|
private readonly chainEvents: ChainEventEmitter;
|
|
29
41
|
private readonly signal: AbortSignal;
|
|
30
42
|
private readonly serializedCache: SerializedCache;
|
|
@@ -32,7 +44,19 @@ export class SeenPayloadEnvelopeInput {
|
|
|
32
44
|
private readonly logger?: Logger;
|
|
33
45
|
private payloadInputs = new Map<RootHex, PayloadEnvelopeInput>();
|
|
34
46
|
|
|
35
|
-
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;
|
|
36
60
|
this.chainEvents = chainEvents;
|
|
37
61
|
this.signal = signal;
|
|
38
62
|
this.serializedCache = serializedCache;
|
|
@@ -51,14 +75,13 @@ export class SeenPayloadEnvelopeInput {
|
|
|
51
75
|
});
|
|
52
76
|
}
|
|
53
77
|
|
|
54
|
-
this.chainEvents.on(ChainEvent.forkChoiceFinalized, this.
|
|
78
|
+
this.chainEvents.on(ChainEvent.forkChoiceFinalized, this.pruneFinalized);
|
|
55
79
|
this.signal.addEventListener("abort", () => {
|
|
56
|
-
this.chainEvents.off(ChainEvent.forkChoiceFinalized, this.
|
|
80
|
+
this.chainEvents.off(ChainEvent.forkChoiceFinalized, this.pruneFinalized);
|
|
57
81
|
});
|
|
58
82
|
}
|
|
59
83
|
|
|
60
|
-
private
|
|
61
|
-
// Prune all entries with slot < finalized slot
|
|
84
|
+
private pruneFinalized = (checkpoint: CheckpointWithHex): void => {
|
|
62
85
|
const finalizedSlot = computeStartSlotAtEpoch(checkpoint.epoch);
|
|
63
86
|
let deletedCount = 0;
|
|
64
87
|
for (const [, input] of this.payloadInputs) {
|
|
@@ -67,16 +90,53 @@ export class SeenPayloadEnvelopeInput {
|
|
|
67
90
|
deletedCount++;
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
|
-
|
|
93
|
+
|
|
94
|
+
this.logger?.debug("SeenPayloadEnvelopeInput.pruneFinalized deleted entries", {
|
|
95
|
+
finalizedSlot,
|
|
96
|
+
finalizedRoot: checkpoint.rootHex,
|
|
97
|
+
deletedCount,
|
|
98
|
+
});
|
|
71
99
|
};
|
|
72
100
|
|
|
73
|
-
add(props: CreateFromBlockProps): PayloadEnvelopeInput {
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
76
130
|
}
|
|
77
|
-
const
|
|
131
|
+
const daOutOfRange = isDaOutOfRange(this.config, props.forkName, props.slot, this.clock.currentEpoch);
|
|
132
|
+
const input = PayloadEnvelopeInput.createFromBid({...props, daOutOfRange});
|
|
78
133
|
this.payloadInputs.set(props.blockRootHex, input);
|
|
79
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
|
+
});
|
|
80
140
|
return input;
|
|
81
141
|
}
|
|
82
142
|
|
|
@@ -88,17 +148,25 @@ export class SeenPayloadEnvelopeInput {
|
|
|
88
148
|
return this.payloadInputs.get(blockRootHex)?.hasPayloadEnvelope() ?? false;
|
|
89
149
|
}
|
|
90
150
|
|
|
91
|
-
prune(blockRootHex: RootHex): void {
|
|
92
|
-
const payloadInput = this.payloadInputs.get(blockRootHex);
|
|
93
|
-
if (payloadInput) {
|
|
94
|
-
this.evictPayloadInput(payloadInput);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
151
|
size(): number {
|
|
99
152
|
return this.payloadInputs.size;
|
|
100
153
|
}
|
|
101
154
|
|
|
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
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
102
170
|
private evictPayloadInput(payloadInput: PayloadEnvelopeInput): void {
|
|
103
171
|
this.serializedCache.delete(payloadInput.getSerializedCacheKeys());
|
|
104
172
|
this.payloadInputs.delete(payloadInput.blockRootHex);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {RootHex, Slot, ValidatorIndex} from "@lodestar/types";
|
|
2
|
+
import {MapDef} from "@lodestar/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tracks signed proposer preferences we've already seen per (dependent_root, proposal_slot, validator_index).
|
|
6
|
+
*/
|
|
7
|
+
export class SeenProposerPreferences {
|
|
8
|
+
private readonly validatorByDependentRootBySlot = new MapDef<Slot, Map<RootHex, ValidatorIndex>>(
|
|
9
|
+
() => new Map<RootHex, ValidatorIndex>()
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
isKnown(dependentRoot: RootHex, proposalSlot: Slot, validatorIndex: ValidatorIndex): boolean {
|
|
13
|
+
return this.validatorByDependentRootBySlot.get(proposalSlot)?.get(dependentRoot) === validatorIndex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
add(dependentRoot: RootHex, proposalSlot: Slot, validatorIndex: ValidatorIndex): void {
|
|
17
|
+
this.validatorByDependentRootBySlot.getOrDefault(proposalSlot).set(dependentRoot, validatorIndex);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
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.
|
|
24
|
+
*/
|
|
25
|
+
prune(currentSlot: Slot): void {
|
|
26
|
+
for (const slot of this.validatorByDependentRootBySlot.keys()) {
|
|
27
|
+
if (slot < currentSlot) {
|
|
28
|
+
this.validatorByDependentRootBySlot.delete(slot);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -103,6 +103,7 @@ export async function validateGossipBlock(
|
|
|
103
103
|
if (chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHashHex) === null) {
|
|
104
104
|
throw new BlockGossipError(GossipAction.IGNORE, {
|
|
105
105
|
code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
|
|
106
|
+
parentRoot,
|
|
106
107
|
parentBlockHash: parentBlockHashHex,
|
|
107
108
|
});
|
|
108
109
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {PublicKey} from "@chainsafe/blst";
|
|
2
2
|
import {
|
|
3
|
+
computeEpochAtSlot,
|
|
3
4
|
createSingleSignatureSetFromComponents,
|
|
4
5
|
getExecutionPayloadBidSigningRoot,
|
|
5
6
|
isActiveBuilder,
|
|
@@ -47,9 +48,12 @@ async function validateExecutionPayloadBid(
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
// [IGNORE]
|
|
51
|
-
//
|
|
52
|
-
//
|
|
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.
|
|
53
57
|
|
|
54
58
|
// [REJECT] `bid.builder_index` is a valid/active builder index -- i.e.
|
|
55
59
|
// `is_active_builder(state, bid.builder_index)` returns `True`.
|
|
@@ -70,11 +74,24 @@ async function validateExecutionPayloadBid(
|
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
// [REJECT] `bid.fee_recipient
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
// 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.
|
|
82
|
+
|
|
83
|
+
// [REJECT] The length of KZG commitments is less than or equal to the limitation defined in the
|
|
84
|
+
// consensus layer -- i.e. validate that
|
|
85
|
+
// `len(bid.blob_kzg_commitments) <= get_blob_parameters(compute_epoch_at_slot(bid.slot)).max_blobs_per_block`.
|
|
86
|
+
const blobKzgCommitmentsLen = bid.blobKzgCommitments.length;
|
|
87
|
+
const maxBlobsPerBlock = chain.config.getMaxBlobsPerBlock(computeEpochAtSlot(bid.slot));
|
|
88
|
+
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
|
|
89
|
+
throw new ExecutionPayloadBidError(GossipAction.REJECT, {
|
|
90
|
+
code: ExecutionPayloadBidErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
91
|
+
blobKzgCommitmentsLen,
|
|
92
|
+
commitmentLimit: maxBlobsPerBlock,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
78
95
|
|
|
79
96
|
// [IGNORE] this is the first signed bid seen with a valid signature from the given builder for this slot.
|
|
80
97
|
if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex)) {
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
2
|
+
import {
|
|
3
|
+
computeEpochAtSlot,
|
|
4
|
+
createSingleSignatureSetFromComponents,
|
|
5
|
+
getProposerPreferencesSigningRoot,
|
|
6
|
+
} from "@lodestar/state-transition";
|
|
7
|
+
import {ValidatorIndex, gloas} from "@lodestar/types";
|
|
8
|
+
import {toRootHex} from "@lodestar/utils";
|
|
9
|
+
import {GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode} from "../errors/index.js";
|
|
10
|
+
import {IBeaconChain} from "../index.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validates a gossiped `SignedProposerPreferences` per
|
|
14
|
+
* https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#proposer_preferences
|
|
15
|
+
*/
|
|
16
|
+
export async function validateGossipProposerPreferences(
|
|
17
|
+
chain: IBeaconChain,
|
|
18
|
+
signedProposerPreferences: gloas.SignedProposerPreferences
|
|
19
|
+
): Promise<void> {
|
|
20
|
+
const preferences = signedProposerPreferences.message;
|
|
21
|
+
const {proposalSlot, validatorIndex, dependentRoot} = preferences;
|
|
22
|
+
const dependentRootHex = toRootHex(dependentRoot);
|
|
23
|
+
const proposalEpoch = computeEpochAtSlot(proposalSlot);
|
|
24
|
+
|
|
25
|
+
// [IGNORE] `preferences.proposal_slot` is in the current or next epoch.
|
|
26
|
+
const currentEpoch = chain.clock.currentEpoch;
|
|
27
|
+
if (proposalEpoch < currentEpoch || proposalEpoch > currentEpoch + 1) {
|
|
28
|
+
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
29
|
+
code: ProposerPreferencesErrorCode.INVALID_EPOCH,
|
|
30
|
+
proposalSlot,
|
|
31
|
+
currentEpoch,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// [IGNORE] `preferences.proposal_slot` has not already passed.
|
|
36
|
+
const currentSlot = chain.clock.currentSlot;
|
|
37
|
+
if (proposalSlot <= currentSlot) {
|
|
38
|
+
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
39
|
+
code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
|
|
40
|
+
proposalSlot,
|
|
41
|
+
currentSlot,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
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
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// [REJECT] `is_valid_proposal_slot(state, preferences)` returns True.
|
|
74
|
+
if (proposers[proposalSlot % SLOTS_PER_EPOCH] !== validatorIndex) {
|
|
75
|
+
throw new ProposerPreferencesError(GossipAction.REJECT, {
|
|
76
|
+
code: ProposerPreferencesErrorCode.INVALID_PROPOSER,
|
|
77
|
+
proposalSlot,
|
|
78
|
+
validatorIndex,
|
|
79
|
+
dependentRoot: dependentRootHex,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// [IGNORE] First valid message for (dependent_root, proposal_slot, validator_index).
|
|
84
|
+
if (chain.seenProposerPreferences.isKnown(dependentRootHex, proposalSlot, validatorIndex)) {
|
|
85
|
+
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
86
|
+
code: ProposerPreferencesErrorCode.ALREADY_KNOWN,
|
|
87
|
+
proposalSlot,
|
|
88
|
+
validatorIndex,
|
|
89
|
+
dependentRoot: dependentRootHex,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// [REJECT] `signed_proposer_preferences.signature` is valid with respect to the validator's public key.
|
|
94
|
+
const signatureSet = createSingleSignatureSetFromComponents(
|
|
95
|
+
chain.pubkeyCache.getOrThrow(validatorIndex),
|
|
96
|
+
getProposerPreferencesSigningRoot(chain.config, preferences),
|
|
97
|
+
signedProposerPreferences.signature
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true}))) {
|
|
101
|
+
throw new ProposerPreferencesError(GossipAction.REJECT, {
|
|
102
|
+
code: ProposerPreferencesErrorCode.INVALID_SIGNATURE,
|
|
103
|
+
proposalSlot,
|
|
104
|
+
validatorIndex,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Valid
|
|
109
|
+
chain.seenProposerPreferences.add(dependentRootHex, proposalSlot, validatorIndex);
|
|
110
|
+
}
|
|
@@ -613,6 +613,10 @@ export function createLodestarMetrics(
|
|
|
613
613
|
name: "lodestar_sync_unknown_block_pending_blocks_size",
|
|
614
614
|
help: "Current size of UnknownBlockSync pending blocks cache",
|
|
615
615
|
}),
|
|
616
|
+
pendingPayloads: register.gauge({
|
|
617
|
+
name: "lodestar_sync_unknown_block_pending_payloads_size",
|
|
618
|
+
help: "Current size of UnknownBlockSync pending payloads cache",
|
|
619
|
+
}),
|
|
616
620
|
knownBadBlocks: register.gauge({
|
|
617
621
|
name: "lodestar_sync_unknown_block_known_bad_blocks_size",
|
|
618
622
|
help: "Current size of UnknownBlockSync known bad blocks cache",
|
|
@@ -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,
|
|
@@ -589,6 +607,24 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
589
607
|
// Returns the delay between the start of `block.slot` and `current time`
|
|
590
608
|
const delaySec = chain.clock.secFromSlot(slot);
|
|
591
609
|
metrics?.gossipBlock.elapsedTimeTillProcessed.observe(delaySec);
|
|
610
|
+
|
|
611
|
+
if (isForkPostGloas(blockInput.forkName)) {
|
|
612
|
+
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockInput.blockRootHex);
|
|
613
|
+
// This payloadInput should have been created just after gossip validation
|
|
614
|
+
if (!payloadInput) {
|
|
615
|
+
throw Error(
|
|
616
|
+
`PayloadEnvelopeInput not seeded for block ${blockInput.blockRootHex} during gossip processing`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
|
|
621
|
+
// which is all the information we need so there is no reason to delay until execution payload arrives
|
|
622
|
+
// TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
|
|
623
|
+
// (for example later in the slot). Do not couple retries to incoming gossip columns.
|
|
624
|
+
// Columns fetched here feed payloadInput.addColumn, which resolves waitForAllData for any
|
|
625
|
+
// in-flight importExecutionPayload. No processExecutionPayload trigger needed from this path.
|
|
626
|
+
chain.getBlobsTracker.triggerGetBlobs(payloadInput);
|
|
627
|
+
}
|
|
592
628
|
})
|
|
593
629
|
.catch((e) => {
|
|
594
630
|
// Adjust verbosity based on error type
|
|
@@ -1057,10 +1093,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1057
1093
|
const signedEnvelope = sszDeserialize(topic, serializedData);
|
|
1058
1094
|
const envelope = signedEnvelope.message;
|
|
1059
1095
|
|
|
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
|
|
1096
|
+
// unlike BlockInput, we send the envelope into UnknownBlockInput sync
|
|
1097
|
+
// inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
|
|
1064
1098
|
try {
|
|
1065
1099
|
await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
|
|
1066
1100
|
} catch (e) {
|
|
@@ -1068,14 +1102,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1068
1102
|
const {beaconBlockRoot} = signedEnvelope.message;
|
|
1069
1103
|
const slot = signedEnvelope.message.payload.slotNumber;
|
|
1070
1104
|
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
1105
|
|
|
1080
1106
|
if (e.action === GossipAction.REJECT) {
|
|
1081
1107
|
chain.persistInvalidSszValue(
|
|
@@ -1170,6 +1196,14 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1170
1196
|
data: executionPayloadBid,
|
|
1171
1197
|
});
|
|
1172
1198
|
},
|
|
1199
|
+
[GossipType.proposer_preferences]: async ({
|
|
1200
|
+
gossipData,
|
|
1201
|
+
topic,
|
|
1202
|
+
}: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
|
|
1203
|
+
const {serializedData} = gossipData;
|
|
1204
|
+
const signedProposerPreferences = sszDeserialize(topic, serializedData);
|
|
1205
|
+
await validateGossipProposerPreferences(chain, signedProposerPreferences);
|
|
1206
|
+
},
|
|
1173
1207
|
};
|
|
1174
1208
|
}
|
|
1175
1209
|
|
|
@@ -1292,10 +1326,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
|
|
|
1292
1326
|
try {
|
|
1293
1327
|
return await fn();
|
|
1294
1328
|
} catch (e) {
|
|
1295
|
-
|
|
1296
|
-
e instanceof AttestationError &&
|
|
1297
|
-
|
|
1298
|
-
|
|
1329
|
+
const isUnknownAttestationRoot =
|
|
1330
|
+
e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
|
|
1331
|
+
const isUnknownPayloadAttestationRoot =
|
|
1332
|
+
e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
|
|
1333
|
+
|
|
1334
|
+
if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
|
|
1299
1335
|
if (unknownBlockRootRetries === 0) {
|
|
1300
1336
|
// Trigger unknown block root search here
|
|
1301
1337
|
const rootHex = toRootHex(blockRoot);
|