@lodestar/beacon-node 1.43.0-dev.a142c56215 → 1.43.0-dev.a6d8600051

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.
Files changed (137) hide show
  1. package/lib/api/impl/beacon/blocks/index.js +3 -3
  2. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  3. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.js +45 -2
  5. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  6. package/lib/api/impl/validator/index.d.ts.map +1 -1
  7. package/lib/api/impl/validator/index.js +66 -1
  8. package/lib/api/impl/validator/index.js.map +1 -1
  9. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  10. package/lib/chain/blocks/importBlock.js +1 -3
  11. package/lib/chain/blocks/importBlock.js.map +1 -1
  12. package/lib/chain/blocks/importExecutionPayload.d.ts +5 -3
  13. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  14. package/lib/chain/blocks/importExecutionPayload.js +23 -10
  15. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  16. package/lib/chain/blocks/index.d.ts.map +1 -1
  17. package/lib/chain/blocks/index.js +7 -5
  18. package/lib/chain/blocks/index.js.map +1 -1
  19. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +1 -0
  20. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
  21. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +4 -1
  22. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  23. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
  24. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  25. package/lib/chain/blocks/verifyBlock.d.ts +2 -1
  26. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  27. package/lib/chain/blocks/verifyBlock.js +26 -7
  28. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  29. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  30. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  31. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  32. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +8 -3
  33. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  34. package/lib/chain/chain.d.ts +2 -1
  35. package/lib/chain/chain.d.ts.map +1 -1
  36. package/lib/chain/chain.js +5 -1
  37. package/lib/chain/chain.js.map +1 -1
  38. package/lib/chain/errors/index.d.ts +1 -0
  39. package/lib/chain/errors/index.d.ts.map +1 -1
  40. package/lib/chain/errors/index.js +1 -0
  41. package/lib/chain/errors/index.js.map +1 -1
  42. package/lib/chain/errors/proposerPreferences.d.ts +33 -0
  43. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
  44. package/lib/chain/errors/proposerPreferences.js +13 -0
  45. package/lib/chain/errors/proposerPreferences.js.map +1 -0
  46. package/lib/chain/interface.d.ts +2 -1
  47. package/lib/chain/interface.d.ts.map +1 -1
  48. package/lib/chain/interface.js.map +1 -1
  49. package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
  50. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  51. package/lib/chain/opPools/payloadAttestationPool.js +26 -4
  52. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  53. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  54. package/lib/chain/prepareNextSlot.js +15 -17
  55. package/lib/chain/prepareNextSlot.js.map +1 -1
  56. package/lib/chain/produceBlock/produceBlockBody.d.ts +11 -3
  57. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  58. package/lib/chain/produceBlock/produceBlockBody.js +38 -21
  59. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  60. package/lib/chain/regen/interface.d.ts +1 -0
  61. package/lib/chain/regen/interface.d.ts.map +1 -1
  62. package/lib/chain/regen/interface.js +1 -0
  63. package/lib/chain/regen/interface.js.map +1 -1
  64. package/lib/chain/seenCache/index.d.ts +1 -0
  65. package/lib/chain/seenCache/index.d.ts.map +1 -1
  66. package/lib/chain/seenCache/index.js +1 -0
  67. package/lib/chain/seenCache/index.js.map +1 -1
  68. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +8 -2
  69. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  70. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +8 -2
  71. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  72. package/lib/chain/seenCache/seenProposerPreferences.d.ts +15 -0
  73. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
  74. package/lib/chain/seenCache/seenProposerPreferences.js +25 -0
  75. package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
  76. package/lib/chain/validation/proposerPreferences.d.ts +8 -0
  77. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
  78. package/lib/chain/validation/proposerPreferences.js +69 -0
  79. package/lib/chain/validation/proposerPreferences.js.map +1 -0
  80. package/lib/network/gossip/interface.d.ts +7 -1
  81. package/lib/network/gossip/interface.d.ts.map +1 -1
  82. package/lib/network/gossip/interface.js +1 -0
  83. package/lib/network/gossip/interface.js.map +1 -1
  84. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  85. package/lib/network/gossip/scoringParameters.js +12 -1
  86. package/lib/network/gossip/scoringParameters.js.map +1 -1
  87. package/lib/network/gossip/topic.d.ts +27 -766
  88. package/lib/network/gossip/topic.d.ts.map +1 -1
  89. package/lib/network/gossip/topic.js +6 -0
  90. package/lib/network/gossip/topic.js.map +1 -1
  91. package/lib/network/interface.d.ts +1 -0
  92. package/lib/network/interface.d.ts.map +1 -1
  93. package/lib/network/network.d.ts +1 -0
  94. package/lib/network/network.d.ts.map +1 -1
  95. package/lib/network/network.js +5 -0
  96. package/lib/network/network.js.map +1 -1
  97. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  98. package/lib/network/processor/gossipHandlers.js +12 -8
  99. package/lib/network/processor/gossipHandlers.js.map +1 -1
  100. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  101. package/lib/network/processor/gossipQueues/index.js +5 -0
  102. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  103. package/lib/network/processor/index.d.ts.map +1 -1
  104. package/lib/network/processor/index.js +1 -0
  105. package/lib/network/processor/index.js.map +1 -1
  106. package/package.json +15 -15
  107. package/src/api/impl/beacon/blocks/index.ts +3 -3
  108. package/src/api/impl/beacon/pool/index.ts +83 -1
  109. package/src/api/impl/validator/index.ts +80 -0
  110. package/src/chain/blocks/importBlock.ts +0 -1
  111. package/src/chain/blocks/importExecutionPayload.ts +31 -10
  112. package/src/chain/blocks/index.ts +14 -6
  113. package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +5 -1
  114. package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
  115. package/src/chain/blocks/verifyBlock.ts +39 -9
  116. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +2 -2
  117. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +7 -4
  118. package/src/chain/chain.ts +5 -0
  119. package/src/chain/errors/index.ts +1 -0
  120. package/src/chain/errors/proposerPreferences.ts +39 -0
  121. package/src/chain/interface.ts +2 -0
  122. package/src/chain/opPools/payloadAttestationPool.ts +29 -8
  123. package/src/chain/prepareNextSlot.ts +20 -28
  124. package/src/chain/produceBlock/produceBlockBody.ts +48 -26
  125. package/src/chain/regen/interface.ts +1 -0
  126. package/src/chain/seenCache/index.ts +1 -0
  127. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +13 -3
  128. package/src/chain/seenCache/seenProposerPreferences.ts +29 -0
  129. package/src/chain/validation/proposerPreferences.ts +91 -0
  130. package/src/network/gossip/interface.ts +6 -0
  131. package/src/network/gossip/scoringParameters.ts +14 -1
  132. package/src/network/gossip/topic.ts +6 -0
  133. package/src/network/interface.ts +1 -0
  134. package/src/network/network.ts +11 -0
  135. package/src/network/processor/gossipHandlers.ts +19 -9
  136. package/src/network/processor/gossipQueues/index.ts +5 -0
  137. package/src/network/processor/index.ts +1 -0
@@ -0,0 +1,91 @@
1
+ import {SLOTS_PER_EPOCH} from "@lodestar/params";
2
+ import {
3
+ computeEpochAtSlot,
4
+ createSingleSignatureSetFromComponents,
5
+ getProposerPreferencesSigningRoot,
6
+ isStatePostGloas,
7
+ } from "@lodestar/state-transition";
8
+ import {gloas} from "@lodestar/types";
9
+ import {GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode} from "../errors/index.js";
10
+ import {IBeaconChain} from "../index.js";
11
+ import {RegenCaller} from "../regen/index.js";
12
+
13
+ /**
14
+ * Validates a gossiped `SignedProposerPreferences` per
15
+ * https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#proposer_preferences
16
+ */
17
+ export async function validateGossipProposerPreferences(
18
+ chain: IBeaconChain,
19
+ signedProposerPreferences: gloas.SignedProposerPreferences
20
+ ): Promise<void> {
21
+ const preferences = signedProposerPreferences.message;
22
+ const {proposalSlot, validatorIndex} = preferences;
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
+ const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.validateGossipProposerPreferences);
46
+ if (!isStatePostGloas(state)) {
47
+ throw new Error(`Expected gloas+ state for proposer preferences validation, got fork=${state.forkName}`);
48
+ }
49
+
50
+ // [REJECT] `preferences.validator_index` is present at the correct slot in the current or next
51
+ // epoch's portion of `state.proposer_lookahead` — i.e. `is_valid_proposal_slot(state, preferences)`
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) {
57
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
58
+ code: ProposerPreferencesErrorCode.INVALID_PROPOSER,
59
+ proposalSlot,
60
+ validatorIndex,
61
+ });
62
+ }
63
+
64
+ // [IGNORE] The `signed_proposer_preferences` is the first valid message received from the validator
65
+ // with index `preferences.validator_index` and the given slot `preferences.proposal_slot`.
66
+ if (chain.seenProposerPreferences.isKnown(proposalSlot, validatorIndex)) {
67
+ throw new ProposerPreferencesError(GossipAction.IGNORE, {
68
+ code: ProposerPreferencesErrorCode.ALREADY_KNOWN,
69
+ proposalSlot,
70
+ validatorIndex,
71
+ });
72
+ }
73
+
74
+ // [REJECT] `signed_proposer_preferences.signature` is valid with respect to the validator's public key.
75
+ const signatureSet = createSingleSignatureSetFromComponents(
76
+ chain.pubkeyCache.getOrThrow(validatorIndex),
77
+ getProposerPreferencesSigningRoot(chain.config, preferences),
78
+ signedProposerPreferences.signature
79
+ );
80
+
81
+ if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true}))) {
82
+ throw new ProposerPreferencesError(GossipAction.REJECT, {
83
+ code: ProposerPreferencesErrorCode.INVALID_SIGNATURE,
84
+ proposalSlot,
85
+ validatorIndex,
86
+ });
87
+ }
88
+
89
+ // Valid
90
+ chain.seenProposerPreferences.add(proposalSlot, validatorIndex);
91
+ }
@@ -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
  };
@@ -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[]>;
@@ -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";
@@ -1060,10 +1063,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1060
1063
  const signedEnvelope = sszDeserialize(topic, serializedData);
1061
1064
  const envelope = signedEnvelope.message;
1062
1065
 
1063
- // TODO GLOAS: consider optimistically create PayloadEnvelopeInput here similar to how we do that for beacon_block
1064
- // so that UnknownBlockSync can handle backward sync
1065
- // the problem now is we cannot create a PayloadEnvelopeInput without the beacon block being known, we need at least the proposer index
1066
- // we can achieve that by looking into the EpochCache
1066
+ // unlike BlockInput, we send the envelope into UnknownBlockInput sync
1067
+ // inside the sync it'll reconcile into PayloadEnvelopeInput and share the same cache with gossip
1067
1068
  try {
1068
1069
  await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
1069
1070
  } catch (e) {
@@ -1072,7 +1073,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1072
1073
  const slot = signedEnvelope.message.payload.slotNumber;
1073
1074
  logger.debug("Gossip envelope has error", {slot, root: toRootHex(beaconBlockRoot), code: e.type.code});
1074
1075
  if (e.type.code === ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN) {
1075
- // TODO GLOAS: UnknownBlockSync to handle this
1076
1076
  chain.emitter.emit(ChainEvent.envelopeUnknownBlock, {
1077
1077
  envelope: signedEnvelope,
1078
1078
  peer: peerIdStr,
@@ -1173,6 +1173,14 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1173
1173
  data: executionPayloadBid,
1174
1174
  });
1175
1175
  },
1176
+ [GossipType.proposer_preferences]: async ({
1177
+ gossipData,
1178
+ topic,
1179
+ }: GossipHandlerParamGeneric<GossipType.proposer_preferences>) => {
1180
+ const {serializedData} = gossipData;
1181
+ const signedProposerPreferences = sszDeserialize(topic, serializedData);
1182
+ await validateGossipProposerPreferences(chain, signedProposerPreferences);
1183
+ },
1176
1184
  };
1177
1185
  }
1178
1186
 
@@ -1295,10 +1303,12 @@ export async function validateGossipFnRetryUnknownRoot<T>(
1295
1303
  try {
1296
1304
  return await fn();
1297
1305
  } catch (e) {
1298
- if (
1299
- e instanceof AttestationError &&
1300
- e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT
1301
- ) {
1306
+ const isUnknownAttestationRoot =
1307
+ e instanceof AttestationError && e.type.code === AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT;
1308
+ const isUnknownPayloadAttestationRoot =
1309
+ e instanceof PayloadAttestationError && e.type.code === PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT;
1310
+
1311
+ if (isUnknownAttestationRoot || isUnknownPayloadAttestationRoot) {
1302
1312
  if (unknownBlockRootRetries === 0) {
1303
1313
  // Trigger unknown block root search here
1304
1314
  const rootHex = toRootHex(blockRoot);
@@ -83,6 +83,11 @@ const linearGossipQueueOpts: {
83
83
  type: QueueType.FIFO,
84
84
  dropOpts: {type: DropType.count, count: 1},
85
85
  },
86
+ [GossipType.proposer_preferences]: {
87
+ maxLength: 1024,
88
+ type: QueueType.FIFO,
89
+ dropOpts: {type: DropType.count, count: 1},
90
+ },
86
91
  };
87
92
 
88
93
  const indexedGossipQueueOpts: {
@@ -91,6 +91,7 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
91
91
  [GossipType.execution_payload]: {bypassQueue: true},
92
92
  [GossipType.payload_attestation_message]: {},
93
93
  [GossipType.execution_payload_bid]: {},
94
+ [GossipType.proposer_preferences]: {},
94
95
  };
95
96
  const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
96
97