@lodestar/beacon-node 1.29.0-dev.87d367d9f7 → 1.29.0-dev.8aa1ad8d30

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 (68) hide show
  1. package/lib/api/impl/beacon/pool/index.js +1 -1
  2. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  3. package/lib/api/impl/validator/index.js +5 -4
  4. package/lib/api/impl/validator/index.js.map +1 -1
  5. package/lib/chain/archiveStore/historicalState/worker.js +12 -0
  6. package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
  7. package/lib/chain/chain.js +5 -7
  8. package/lib/chain/chain.js.map +1 -1
  9. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +32 -14
  10. package/lib/chain/opPools/aggregatedAttestationPool.js +235 -97
  11. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  12. package/lib/chain/opPools/attestationPool.d.ts +4 -2
  13. package/lib/chain/opPools/attestationPool.js +4 -3
  14. package/lib/chain/opPools/attestationPool.js.map +1 -1
  15. package/lib/metrics/metrics/beacon.js +1 -1
  16. package/lib/metrics/metrics/beacon.js.map +1 -1
  17. package/lib/metrics/metrics/lodestar.d.ts +62 -10
  18. package/lib/metrics/metrics/lodestar.js +141 -28
  19. package/lib/metrics/metrics/lodestar.js.map +1 -1
  20. package/lib/metrics/options.d.ts +1 -1
  21. package/lib/metrics/validatorMonitor.js +1 -1
  22. package/lib/metrics/validatorMonitor.js.map +1 -1
  23. package/lib/network/core/networkCore.d.ts +3 -3
  24. package/lib/network/core/networkCore.js +9 -4
  25. package/lib/network/core/networkCore.js.map +1 -1
  26. package/lib/network/core/networkCoreWorker.js +5 -3
  27. package/lib/network/core/networkCoreWorker.js.map +1 -1
  28. package/lib/network/core/networkCoreWorkerHandler.d.ts +2 -2
  29. package/lib/network/core/networkCoreWorkerHandler.js +3 -3
  30. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  31. package/lib/network/core/types.d.ts +1 -1
  32. package/lib/network/discv5/index.d.ts +2 -3
  33. package/lib/network/discv5/index.js +4 -5
  34. package/lib/network/discv5/index.js.map +1 -1
  35. package/lib/network/discv5/types.d.ts +1 -1
  36. package/lib/network/discv5/worker.js +7 -6
  37. package/lib/network/discv5/worker.js.map +1 -1
  38. package/lib/network/gossip/gossipsub.js +4 -0
  39. package/lib/network/gossip/gossipsub.js.map +1 -1
  40. package/lib/network/interface.d.ts +3 -2
  41. package/lib/network/libp2p/index.d.ts +2 -2
  42. package/lib/network/libp2p/index.js +9 -9
  43. package/lib/network/libp2p/index.js.map +1 -1
  44. package/lib/network/network.d.ts +4 -4
  45. package/lib/network/network.js +7 -5
  46. package/lib/network/network.js.map +1 -1
  47. package/lib/network/peers/datastore.d.ts +2 -1
  48. package/lib/network/peers/datastore.js +1 -1
  49. package/lib/network/peers/datastore.js.map +1 -1
  50. package/lib/network/peers/discover.d.ts +2 -0
  51. package/lib/network/peers/discover.js +3 -4
  52. package/lib/network/peers/discover.js.map +1 -1
  53. package/lib/network/peers/peerManager.d.ts +2 -1
  54. package/lib/network/peers/peerManager.js +1 -1
  55. package/lib/network/peers/peerManager.js.map +1 -1
  56. package/lib/network/peers/utils/getConnectedPeerIds.js +2 -2
  57. package/lib/network/peers/utils/getConnectedPeerIds.js.map +1 -1
  58. package/lib/network/processor/gossipHandlers.js +3 -2
  59. package/lib/network/processor/gossipHandlers.js.map +1 -1
  60. package/lib/network/util.d.ts +4 -1
  61. package/lib/network/util.js +2 -2
  62. package/lib/network/util.js.map +1 -1
  63. package/lib/node/nodejs.d.ts +3 -3
  64. package/lib/node/nodejs.js +2 -2
  65. package/lib/node/nodejs.js.map +1 -1
  66. package/lib/util/peerId.js +1 -1
  67. package/lib/util/peerId.js.map +1 -1
  68. package/package.json +31 -32
@@ -1,8 +1,9 @@
1
1
  import { ChainForkConfig } from "@lodestar/config";
2
2
  import { IForkChoice } from "@lodestar/fork-choice";
3
3
  import { ForkName } from "@lodestar/params";
4
- import { CachedBeaconStateAllForks } from "@lodestar/state-transition";
4
+ import { CachedBeaconStateAllForks, EffectiveBalanceIncrements } from "@lodestar/state-transition";
5
5
  import { Attestation, Epoch, RootHex, Slot, ValidatorIndex, electra, phase0 } from "@lodestar/types";
6
+ import { Metrics } from "../../metrics/metrics.js";
6
7
  import { InsertOutcome } from "./types.js";
7
8
  type CommitteeIndex = number;
8
9
  /**
@@ -12,22 +13,32 @@ type CommitteeIndex = number;
12
13
  export type AttestationsConsolidation = {
13
14
  byCommittee: Map<CommitteeIndex, AttestationNonParticipant>;
14
15
  attData: phase0.AttestationData;
15
- totalNotSeenCount: number;
16
+ totalNewSeenEffectiveBalance: number;
17
+ newSeenAttesters: number;
18
+ notSeenAttesters: number;
19
+ /** total number of attesters across all committees in this consolidation */
20
+ totalAttesters: number;
16
21
  };
17
22
  /**
18
- * This function returns not seen participation for a given epoch and slot and committe index.
23
+ * This function returns not seen participation for a given epoch and slot and committee index.
19
24
  * Return null if all validators are seen or no info to check.
20
25
  */
21
26
  type GetNotSeenValidatorsFn = (epoch: Epoch, slot: Slot, committeeIndex: number) => Set<number> | null;
22
27
  type ValidateAttestationDataFn = (attData: phase0.AttestationData) => boolean;
28
+ export declare enum ScannedSlotsTerminationReason {
29
+ MaxConsolidationReached = "max_consolidation_reached",
30
+ ScannedAllSlots = "scanned_all_slots",
31
+ SlotBeforePreviousEpoch = "slot_before_previous_epoch"
32
+ }
23
33
  /**
24
34
  * Maintain a pool of aggregated attestations. Attestations can be retrieved for inclusion in a block
25
- * or api. The returned attestations are aggregated to maximise the number of validators that can be
35
+ * or api. The returned attestations are aggregated to maximize the number of validators that can be
26
36
  * included.
27
37
  * Note that we want to remove attestations with attesters that were included in the chain.
28
38
  */
29
39
  export declare class AggregatedAttestationPool {
30
40
  private readonly config;
41
+ private readonly metrics;
31
42
  /**
32
43
  * post electra, different committees could have the same AttData and we have to consolidate attestations of the same
33
44
  * data to be included in block, so we should group by data before index
@@ -35,12 +46,7 @@ export declare class AggregatedAttestationPool {
35
46
  */
36
47
  private readonly attestationGroupByIndexByDataHexBySlot;
37
48
  private lowestPermissibleSlot;
38
- constructor(config: ChainForkConfig);
39
- /** For metrics to track size of the pool */
40
- getAttestationCount(): {
41
- attestationCount: number;
42
- attestationDataCount: number;
43
- };
49
+ constructor(config: ChainForkConfig, metrics?: Metrics | null);
44
50
  add(attestation: Attestation, dataRootHex: RootHex, attestingIndicesCount: number, committee: Uint32Array): InsertOutcome;
45
51
  /** Remove attestations which are too old to be included in a block. */
46
52
  prune(clockSlot: Slot): void;
@@ -62,6 +68,7 @@ export declare class AggregatedAttestationPool {
62
68
  * @param bySlot slot to filter, `bySlot === attestation.data.slot`
63
69
  */
64
70
  getAll(bySlot?: Slot): Attestation[];
71
+ private onScrapeMetrics;
65
72
  }
66
73
  interface AttestationWithIndex {
67
74
  attestation: Attestation;
@@ -69,7 +76,13 @@ interface AttestationWithIndex {
69
76
  }
70
77
  type AttestationNonParticipant = {
71
78
  attestation: Attestation;
72
- notSeenAttesterCount: number;
79
+ newSeenEffectiveBalance: number;
80
+ newSeenAttesters: number;
81
+ notSeenCommitteeMembers: Set<number>;
82
+ };
83
+ type GetAttestationsGroupResult = {
84
+ result: AttestationNonParticipant[];
85
+ totalAttestations: number;
73
86
  };
74
87
  /**
75
88
  * Maintain a pool of AggregatedAttestation which all share the same AttestationData.
@@ -78,10 +91,11 @@ type AttestationNonParticipant = {
78
91
  * Use committee instead of aggregationBits to improve performance.
79
92
  */
80
93
  export declare class MatchingDataAttestationGroup {
94
+ private readonly config;
81
95
  readonly committee: Uint32Array;
82
96
  readonly data: phase0.AttestationData;
83
97
  private readonly attestations;
84
- constructor(committee: Uint32Array, data: phase0.AttestationData);
98
+ constructor(config: ChainForkConfig, committee: Uint32Array, data: phase0.AttestationData);
85
99
  getAttestationCount(): number;
86
100
  /**
87
101
  * Add an attestation.
@@ -92,10 +106,14 @@ export declare class MatchingDataAttestationGroup {
92
106
  add(attestation: AttestationWithIndex): InsertOutcome;
93
107
  /**
94
108
  * Get AttestationNonParticipant for this groups of same attestation data.
95
- * @param notSeenAttestingIndices not seen attestting indices, i.e. indices in the same committee
109
+ * @param notSeenCommitteeMembers not seen committee members, i.e. indices in the same committee (starting from 0 till (committee.size - 1))
96
110
  * @returns an array of AttestationNonParticipant
97
111
  */
98
- getAttestationsForBlock(fork: ForkName, notSeenAttestingIndices: Set<number>): AttestationNonParticipant[];
112
+ getAttestationsForBlock(fork: ForkName, effectiveBalanceIncrements: EffectiveBalanceIncrements, notSeenCommitteeMembers: Set<number>, maxAttestation: number): GetAttestationsGroupResult;
113
+ /**
114
+ * Select the attestation with the highest total effective balance of not seen validators.
115
+ */
116
+ private getMostValuableAttestation;
99
117
  /** Get attestations for API. */
100
118
  getAttestations(): Attestation[];
101
119
  }