@lodestar/beacon-node 1.43.0 → 1.44.0-dev.552cdce8d0

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 (70) hide show
  1. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/pool/index.js +46 -5
  3. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  4. package/lib/api/impl/validator/index.d.ts.map +1 -1
  5. package/lib/api/impl/validator/index.js +18 -11
  6. package/lib/api/impl/validator/index.js.map +1 -1
  7. package/lib/chain/chain.d.ts +2 -1
  8. package/lib/chain/chain.d.ts.map +1 -1
  9. package/lib/chain/chain.js +3 -1
  10. package/lib/chain/chain.js.map +1 -1
  11. package/lib/chain/errors/executionPayloadBid.d.ts +19 -1
  12. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  13. package/lib/chain/errors/executionPayloadBid.js +3 -0
  14. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  15. package/lib/chain/interface.d.ts +2 -1
  16. package/lib/chain/interface.d.ts.map +1 -1
  17. package/lib/chain/interface.js.map +1 -1
  18. package/lib/chain/lightClient/index.d.ts.map +1 -1
  19. package/lib/chain/lightClient/index.js +1 -1
  20. package/lib/chain/lightClient/index.js.map +1 -1
  21. package/lib/chain/opPools/index.d.ts +1 -0
  22. package/lib/chain/opPools/index.d.ts.map +1 -1
  23. package/lib/chain/opPools/index.js +1 -0
  24. package/lib/chain/opPools/index.js.map +1 -1
  25. package/lib/chain/opPools/payloadAttestationPool.d.ts +1 -1
  26. package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
  27. package/lib/chain/opPools/payloadAttestationPool.js +30 -10
  28. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  29. package/lib/chain/opPools/proposerPreferencesPool.d.ts +29 -0
  30. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -0
  31. package/lib/chain/opPools/proposerPreferencesPool.js +56 -0
  32. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -0
  33. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  34. package/lib/chain/validation/executionPayloadBid.js +64 -16
  35. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  36. package/lib/chain/validation/payloadAttestationMessage.d.ts +1 -1
  37. package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
  38. package/lib/chain/validation/payloadAttestationMessage.js +5 -3
  39. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  40. package/lib/network/gossip/topic.d.ts +19 -766
  41. package/lib/network/gossip/topic.d.ts.map +1 -1
  42. package/lib/network/interface.d.ts +1 -0
  43. package/lib/network/interface.d.ts.map +1 -1
  44. package/lib/network/network.d.ts +1 -0
  45. package/lib/network/network.d.ts.map +1 -1
  46. package/lib/network/network.js +5 -0
  47. package/lib/network/network.js.map +1 -1
  48. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  49. package/lib/network/processor/gossipHandlers.js +8 -3
  50. package/lib/network/processor/gossipHandlers.js.map +1 -1
  51. package/lib/util/dependentRoot.d.ts +6 -2
  52. package/lib/util/dependentRoot.d.ts.map +1 -1
  53. package/lib/util/dependentRoot.js +20 -16
  54. package/lib/util/dependentRoot.js.map +1 -1
  55. package/package.json +14 -15
  56. package/src/api/impl/beacon/pool/index.ts +56 -3
  57. package/src/api/impl/validator/index.ts +19 -11
  58. package/src/chain/chain.ts +3 -0
  59. package/src/chain/errors/executionPayloadBid.ts +22 -1
  60. package/src/chain/interface.ts +2 -0
  61. package/src/chain/lightClient/index.ts +6 -6
  62. package/src/chain/opPools/index.ts +1 -0
  63. package/src/chain/opPools/payloadAttestationPool.ts +34 -10
  64. package/src/chain/opPools/proposerPreferencesPool.ts +59 -0
  65. package/src/chain/validation/executionPayloadBid.ts +67 -17
  66. package/src/chain/validation/payloadAttestationMessage.ts +6 -4
  67. package/src/network/interface.ts +1 -0
  68. package/src/network/network.ts +11 -0
  69. package/src/network/processor/gossipHandlers.ts +8 -2
  70. package/src/util/dependentRoot.ts +22 -18
@@ -1197,7 +1197,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1197
1197
  const insertOutcome = chain.payloadAttestationPool.add(
1198
1198
  payloadAttestationMessage,
1199
1199
  validationResult.attDataRootHex,
1200
- validationResult.validatorCommitteeIndex
1200
+ validationResult.validatorCommitteeIndices
1201
1201
  );
1202
1202
  metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
1203
1203
  } catch (e) {
@@ -1205,7 +1205,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1205
1205
  }
1206
1206
  chain.forkChoice.notifyPtcMessages(
1207
1207
  toRootHex(payloadAttestationMessage.data.beaconBlockRoot),
1208
- [validationResult.validatorCommitteeIndex],
1208
+ validationResult.validatorCommitteeIndices,
1209
1209
  payloadAttestationMessage.data.payloadPresent
1210
1210
  );
1211
1211
  },
@@ -1237,6 +1237,12 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1237
1237
  const {serializedData} = gossipData;
1238
1238
  const signedProposerPreferences = sszDeserialize(topic, serializedData);
1239
1239
  await validateGossipProposerPreferences(chain, signedProposerPreferences);
1240
+
1241
+ chain.proposerPreferencesPool.add(signedProposerPreferences);
1242
+ chain.emitter.emit(routes.events.EventType.proposerPreferences, {
1243
+ version: ForkName.gloas,
1244
+ data: signedProposerPreferences,
1245
+ });
1240
1246
  },
1241
1247
  };
1242
1248
  }
@@ -2,45 +2,49 @@ import {EpochDifference, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
2
2
  import {Epoch, RootHex} from "@lodestar/types";
3
3
 
4
4
  /**
5
- * Get dependent root of a shuffling given attestation epoch and head block.
5
+ * Get dependent root of a shuffling given a message epoch and a proto block.
6
+ *
7
+ * Pre-gloas, this is used for attestation validation
8
+ * Post-gloas, this is also used for execution_payload_bid validation because post-fulu,
9
+ * a dependent root of a proposal duties is 1-epoch look ahead (instead of 0 as of pre-fulu)
6
10
  */
7
11
  export function getShufflingDependentRoot(
8
12
  forkChoice: IForkChoice,
9
- attEpoch: Epoch,
10
- blockEpoch: Epoch,
11
- attHeadBlock: ProtoBlock
13
+ msgEpoch: Epoch,
14
+ protoBlockEpoch: Epoch,
15
+ protoBlock: ProtoBlock
12
16
  ): RootHex {
13
17
  let shufflingDependentRoot: RootHex;
14
- if (blockEpoch === attEpoch) {
18
+ if (protoBlockEpoch === msgEpoch) {
15
19
  // current shuffling, this is equivalent to `headState.currentShuffling`
16
- // given blockEpoch = attEpoch = n
20
+ // given protoBlockEpoch = msgEpoch = n
17
21
  // epoch: (n-2) (n-1) n (n+1)
18
22
  // |-------|-------|-------|-------|
19
- // attHeadBlock ------------------------^
23
+ // protoBlock ------------------------^
20
24
  // shufflingDependentRoot ------^
21
- shufflingDependentRoot = forkChoice.getDependentRoot(attHeadBlock, EpochDifference.previous);
22
- } else if (blockEpoch === attEpoch - 1) {
25
+ shufflingDependentRoot = forkChoice.getDependentRoot(protoBlock, EpochDifference.previous);
26
+ } else if (protoBlockEpoch === msgEpoch - 1) {
23
27
  // next shuffling, this is equivalent to `headState.nextShuffling`
24
- // given blockEpoch = n-1, attEpoch = n
28
+ // given protoBlockEpoch = n-1, msgEpoch = n
25
29
  // epoch: (n-2) (n-1) n (n+1)
26
30
  // |-------|-------|-------|-------|
27
- // attHeadBlock -------------------^
31
+ // protoBlock -------------------^
28
32
  // shufflingDependentRoot ------^
29
- shufflingDependentRoot = forkChoice.getDependentRoot(attHeadBlock, EpochDifference.current);
30
- } else if (blockEpoch < attEpoch - 1) {
33
+ shufflingDependentRoot = forkChoice.getDependentRoot(protoBlock, EpochDifference.current);
34
+ } else if (protoBlockEpoch < msgEpoch - 1) {
31
35
  // this never happens with default chain option of maxSkipSlots = 32, however we still need to handle it
32
36
  // check the verifyHeadBlockAndTargetRoot() function above
33
- // given blockEpoch = n-2, attEpoch = n
37
+ // given protoBlockEpoch = n-2, msgEpoch = n
34
38
  // epoch: (n-2) (n-1) n (n+1)
35
39
  // |-------|-------|-------|-------|
36
- // attHeadBlock -----------^
40
+ // protoBlock -----------^
37
41
  // shufflingDependentRoot -----^
38
- shufflingDependentRoot = attHeadBlock.blockRoot;
42
+ shufflingDependentRoot = protoBlock.blockRoot;
39
43
  // use lodestar_gossip_attestation_head_slot_to_attestation_slot metric to track this case
40
44
  } else {
41
- // blockEpoch > attEpoch
45
+ // protoBlockEpoch > msgEpoch
42
46
  // should not happen, handled in verifyAttestationTargetRoot
43
- throw Error(`attestation epoch ${attEpoch} is before head block epoch ${blockEpoch}`);
47
+ throw Error(`message epoch ${msgEpoch} is before proto block epoch ${protoBlockEpoch}`);
44
48
  }
45
49
 
46
50
  return shufflingDependentRoot;