@lodestar/beacon-node 1.18.0-dev.e840ea0ea7 → 1.18.0-dev.eb84b49778

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 (88) hide show
  1. package/lib/api/impl/beacon/blocks/index.js +32 -13
  2. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  3. package/lib/api/impl/beacon/blocks/utils.d.ts +1 -0
  4. package/lib/api/impl/beacon/rewards/index.js +6 -6
  5. package/lib/api/impl/beacon/rewards/index.js.map +1 -1
  6. package/lib/api/impl/beacon/state/index.js +27 -9
  7. package/lib/api/impl/beacon/state/index.js.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts +2 -1
  9. package/lib/api/impl/beacon/state/utils.js +19 -19
  10. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  11. package/lib/api/impl/debug/index.js +4 -8
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/validator/index.js +27 -10
  14. package/lib/api/impl/validator/index.js.map +1 -1
  15. package/lib/api/impl/validator/utils.js +1 -0
  16. package/lib/api/impl/validator/utils.js.map +1 -1
  17. package/lib/api/rest/base.js +10 -6
  18. package/lib/api/rest/base.js.map +1 -1
  19. package/lib/chain/chain.d.ts +12 -2
  20. package/lib/chain/chain.js +63 -24
  21. package/lib/chain/chain.js.map +1 -1
  22. package/lib/chain/forkChoice/index.d.ts +6 -3
  23. package/lib/chain/forkChoice/index.js +7 -3
  24. package/lib/chain/forkChoice/index.js.map +1 -1
  25. package/lib/chain/interface.d.ts +12 -1
  26. package/lib/chain/opPools/attestationPool.d.ts +2 -2
  27. package/lib/chain/opPools/attestationPool.js +2 -4
  28. package/lib/chain/opPools/attestationPool.js.map +1 -1
  29. package/lib/chain/options.d.ts +5 -1
  30. package/lib/chain/options.js +6 -0
  31. package/lib/chain/options.js.map +1 -1
  32. package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -2
  33. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  34. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +6 -0
  35. package/lib/chain/stateCache/fifoBlockStateCache.js +15 -0
  36. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  37. package/lib/chain/stateCache/{stateContextCheckpointsCache.d.ts → inMemoryCheckpointsCache.d.ts} +9 -4
  38. package/lib/chain/stateCache/{stateContextCheckpointsCache.js → inMemoryCheckpointsCache.js} +6 -6
  39. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -0
  40. package/lib/chain/stateCache/index.d.ts +1 -1
  41. package/lib/chain/stateCache/index.js +1 -1
  42. package/lib/chain/stateCache/index.js.map +1 -1
  43. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +46 -14
  44. package/lib/chain/stateCache/persistentCheckpointsCache.js +71 -28
  45. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  46. package/lib/chain/stateCache/stateContextCache.d.ts +6 -0
  47. package/lib/chain/stateCache/stateContextCache.js +8 -0
  48. package/lib/chain/stateCache/stateContextCache.js.map +1 -1
  49. package/lib/chain/stateCache/types.d.ts +4 -0
  50. package/lib/chain/stateCache/types.js.map +1 -1
  51. package/lib/chain/validation/block.js +2 -2
  52. package/lib/chain/validation/block.js.map +1 -1
  53. package/lib/metrics/metrics/lodestar.d.ts +3 -3
  54. package/lib/metrics/metrics/lodestar.js +7 -7
  55. package/lib/metrics/metrics/lodestar.js.map +1 -1
  56. package/lib/network/core/metrics.d.ts +3 -3
  57. package/lib/network/core/metrics.js +4 -0
  58. package/lib/network/core/metrics.js.map +1 -1
  59. package/lib/network/core/networkCore.js +3 -6
  60. package/lib/network/core/networkCore.js.map +1 -1
  61. package/lib/network/gossip/gossipsub.js +5 -2
  62. package/lib/network/gossip/gossipsub.js.map +1 -1
  63. package/lib/network/network.js +2 -1
  64. package/lib/network/network.js.map +1 -1
  65. package/lib/network/options.js +2 -4
  66. package/lib/network/options.js.map +1 -1
  67. package/lib/network/peers/peerManager.js +2 -1
  68. package/lib/network/peers/peerManager.js.map +1 -1
  69. package/lib/network/processor/aggregatorTracker.d.ts +2 -0
  70. package/lib/network/processor/aggregatorTracker.js +11 -1
  71. package/lib/network/processor/aggregatorTracker.js.map +1 -1
  72. package/lib/network/subnets/attnetsService.d.ts +38 -44
  73. package/lib/network/subnets/attnetsService.js +160 -149
  74. package/lib/network/subnets/attnetsService.js.map +1 -1
  75. package/lib/network/subnets/index.d.ts +0 -1
  76. package/lib/network/subnets/index.js +0 -1
  77. package/lib/network/subnets/index.js.map +1 -1
  78. package/lib/network/subnets/interface.d.ts +0 -1
  79. package/lib/util/index.d.ts +2 -0
  80. package/lib/util/index.js +3 -0
  81. package/lib/util/index.js.map +1 -0
  82. package/lib/util/profile.js +4 -1
  83. package/lib/util/profile.js.map +1 -1
  84. package/package.json +18 -16
  85. package/lib/chain/stateCache/stateContextCheckpointsCache.js.map +0 -1
  86. package/lib/network/subnets/dllAttnetsService.d.ts +0 -112
  87. package/lib/network/subnets/dllAttnetsService.js +0 -336
  88. package/lib/network/subnets/dllAttnetsService.js.map +0 -1
@@ -1,37 +1,38 @@
1
- import { computeStartSlotAtEpoch } from "@lodestar/state-transition";
2
- import { ATTESTATION_SUBNET_COUNT, EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, RANDOM_SUBNETS_PER_VALIDATOR, SLOTS_PER_EPOCH, } from "@lodestar/params";
1
+ import { ATTESTATION_SUBNET_COUNT, EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, SLOTS_PER_EPOCH, } from "@lodestar/params";
3
2
  import { ssz } from "@lodestar/types";
4
- import { MapDef, randBetween } from "@lodestar/utils";
5
- import { shuffle } from "../../util/shuffle.js";
3
+ import { MapDef } from "@lodestar/utils";
6
4
  import { ClockEvent } from "../../util/clock.js";
7
5
  import { GossipType } from "../gossip/index.js";
8
6
  import { SubnetMap } from "../peers/utils/index.js";
9
7
  import { getActiveForks } from "../forks.js";
10
- /**
11
- * The time (in slots) before a last seen validator is considered absent and we unsubscribe from the random
12
- * gossip topics that we subscribed to due to the validator connection.
13
- */
14
- const LAST_SEEN_VALIDATOR_TIMEOUT = 150;
8
+ import { stringifyGossipTopic } from "../gossip/topic.js";
9
+ import { GOSSIP_D_LOW } from "../gossip/scoringParameters.js";
10
+ import { computeSubscribedSubnet } from "./util.js";
15
11
  const gossipType = GossipType.beacon_attestation;
16
12
  export var SubnetSource;
17
13
  (function (SubnetSource) {
18
14
  SubnetSource["committee"] = "committee";
19
- SubnetSource["random"] = "random";
15
+ SubnetSource["longLived"] = "long_lived";
20
16
  })(SubnetSource || (SubnetSource = {}));
21
17
  /**
22
- * Manage random (long lived) subnets and committee (short lived) subnets.
23
- * - PeerManager uses attnetsService to know which peers are required for duties
18
+ * This value means node is not able to form stable mesh.
19
+ */
20
+ const NOT_ABLE_TO_FORM_STABLE_MESH_SEC = -1;
21
+ /**
22
+ * Manage deleterministic long lived (DLL) subnets and short lived subnets.
23
+ * - PeerManager uses attnetsService to know which peers are required for duties and long lived subscriptions
24
24
  * - Network call addCommitteeSubscriptions() from API calls
25
25
  * - Gossip handler checks shouldProcess to know if validator is aggregator
26
26
  */
27
27
  export class AttnetsService {
28
- constructor(config, clock, gossip, metadata, logger, metrics, opts) {
28
+ constructor(config, clock, gossip, metadata, logger, metrics, nodeId, opts) {
29
29
  this.config = config;
30
30
  this.clock = clock;
31
31
  this.gossip = gossip;
32
32
  this.metadata = metadata;
33
33
  this.logger = logger;
34
34
  this.metrics = metrics;
35
+ this.nodeId = nodeId;
35
36
  this.opts = opts;
36
37
  /** Committee subnets - PeerManager must find peers for those */
37
38
  this.committeeSubnets = new SubnetMap();
@@ -40,55 +41,59 @@ export class AttnetsService {
40
41
  * This class will tell gossip to subscribe and un-subscribe
41
42
  * If a value exists for `SubscriptionId` it means that gossip subscription is active in network.gossip
42
43
  */
43
- this.subscriptionsCommittee = new SubnetMap();
44
- /** Same as `subscriptionsCommittee` but for long-lived subnets. May overlap with `subscriptionsCommittee` */
45
- this.subscriptionsRandom = new SubnetMap();
44
+ this.shortLivedSubscriptions = new SubnetMap();
45
+ /** ${SUBNETS_PER_NODE} long lived subscriptions, may overlap with `shortLivedSubscriptions` */
46
+ this.longLivedSubscriptions = new Set();
46
47
  /**
47
- * Map of an aggregator at a slot and subnet
48
+ * Map of an aggregator at a slot and AggregatorDutyInfo
48
49
  * Used to determine if we should process an attestation.
49
50
  */
50
- this.aggregatorSlotSubnet = new MapDef(() => new Set());
51
- /**
52
- * A collection of seen validators. These dictate how many random subnets we should be
53
- * subscribed to. As these time out, we unsubscribe from the required random subnets and update our ENR.
54
- * This is a map of validator index and its last active slot.
55
- */
56
- this.knownValidators = new Map();
51
+ this.aggregatorSlotSubnet = new MapDef(() => new Map());
57
52
  /**
58
53
  * Run per slot.
59
54
  * - Subscribe to gossip subnets 2 slots in advance
60
55
  * - Unsubscribe from expired subnets
56
+ * - Track time to stable mesh if not yet formed
61
57
  */
62
58
  this.onSlot = (clockSlot) => {
63
59
  try {
64
- for (const [dutiedSlot, subnets] of this.aggregatorSlotSubnet.entries()) {
60
+ setTimeout(() => {
61
+ this.onHalfSlot(clockSlot);
62
+ }, this.config.SECONDS_PER_SLOT * 0.5 * 1000);
63
+ for (const [dutiedSlot, dutiedInfo] of this.aggregatorSlotSubnet.entries()) {
65
64
  if (dutiedSlot === clockSlot + this.opts.slotsToSubscribeBeforeAggregatorDuty) {
66
65
  // Trigger gossip subscription first, in batch
67
- if (subnets.size > 0) {
68
- this.subscribeToSubnets(Array.from(subnets), SubnetSource.committee);
66
+ if (dutiedInfo.size > 0) {
67
+ this.subscribeToSubnets(Array.from(dutiedInfo.keys()), SubnetSource.committee);
69
68
  }
70
69
  // Then, register the subscriptions
71
- Array.from(subnets).map((subnet) => this.subscriptionsCommittee.request({ subnet, toSlot: dutiedSlot }));
70
+ for (const subnet of dutiedInfo.keys()) {
71
+ this.shortLivedSubscriptions.request({ subnet, toSlot: dutiedSlot });
72
+ }
72
73
  }
74
+ this.trackTimeToStableMesh(clockSlot, dutiedSlot, dutiedInfo);
73
75
  }
74
- // For node >= 64 validators, we should consistently subscribe to all subnets
75
- // it's important to check random subnets first
76
- // See https://github.com/ChainSafe/lodestar/issues/4929
77
- this.unsubscribeExpiredRandomSubnets(clockSlot);
78
76
  this.unsubscribeExpiredCommitteeSubnets(clockSlot);
77
+ this.pruneExpiredAggregator(clockSlot);
79
78
  }
80
79
  catch (e) {
81
80
  this.logger.error("Error on AttnetsService.onSlot", { slot: clockSlot }, e);
82
81
  }
83
82
  };
83
+ this.onHalfSlot = (clockSlot) => {
84
+ for (const [dutiedSlot, dutiedInfo] of this.aggregatorSlotSubnet.entries()) {
85
+ this.trackTimeToStableMesh(clockSlot, dutiedSlot, dutiedInfo);
86
+ }
87
+ };
84
88
  /**
85
89
  * Run per epoch, clean-up operations that are not urgent
90
+ * Subscribe to new random subnets every EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION epochs
86
91
  */
87
92
  this.onEpoch = (epoch) => {
88
93
  try {
89
- const slot = computeStartSlotAtEpoch(epoch);
90
- this.pruneExpiredKnownValidators(slot);
91
- this.pruneExpiredAggregator(slot);
94
+ if (epoch % EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION === 0) {
95
+ this.recomputeLongLivedSubnets();
96
+ }
92
97
  }
93
98
  catch (e) {
94
99
  this.logger.error("Error on AttnetsService.onEpoch", { epoch }, e);
@@ -101,11 +106,10 @@ export class AttnetsService {
101
106
  this.committeeSubnets.request({ subnet, toSlot: Infinity });
102
107
  }
103
108
  }
104
- this.randBetweenFn = this.opts.randBetweenFn ?? randBetween;
105
- this.shuffleFn = this.opts.shuffleFn ?? shuffle;
106
109
  if (metrics) {
107
- metrics.attnetsService.subscriptionsRandom.addCollect(() => this.onScrapeLodestarMetrics(metrics));
110
+ metrics.attnetsService.longLivedSubscriptions.addCollect(() => this.onScrapeLodestarMetrics(metrics));
108
111
  }
112
+ this.recomputeLongLivedSubnets();
109
113
  this.clock.on(ClockEvent.slot, this.onSlot);
110
114
  this.clock.on(ClockEvent.epoch, this.onEpoch);
111
115
  }
@@ -114,32 +118,34 @@ export class AttnetsService {
114
118
  this.clock.off(ClockEvent.epoch, this.onEpoch);
115
119
  }
116
120
  /**
117
- * Get all active subnets for the hearbeat.
121
+ * Get all active subnets for the hearbeat:
122
+ * - committeeSubnets so that submitted attestations can be spread to the network
123
+ * - longLivedSubscriptions because other peers based on this node's ENR for their submitted attestations
118
124
  */
119
125
  getActiveSubnets() {
120
- // Omit subscriptionsRandom, not necessary to force the network component to keep peers on that subnets
121
- return this.committeeSubnets.getActiveTtl(this.clock.currentSlot);
126
+ const shortLivedSubnets = this.committeeSubnets.getActiveTtl(this.clock.currentSlot);
127
+ const longLivedSubscriptionsToSlot = (Math.floor(this.clock.currentEpoch / EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION) + 1) *
128
+ EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION *
129
+ SLOTS_PER_EPOCH;
130
+ const longLivedSubnets = Array.from(this.longLivedSubscriptions).map((subnet) => ({
131
+ subnet,
132
+ toSlot: longLivedSubscriptionsToSlot,
133
+ }));
134
+ // could be overlap, PeerDiscovery will handle it
135
+ return [...shortLivedSubnets, ...longLivedSubnets];
122
136
  }
123
137
  /**
124
138
  * Called from the API when validator is a part of a committee.
125
139
  */
126
140
  addCommitteeSubscriptions(subscriptions) {
127
- const currentSlot = this.clock.currentSlot;
128
- let addedknownValidators = false;
129
- for (const { validatorIndex, subnet, slot, isAggregator } of subscriptions) {
130
- // Add known validator
131
- if (!this.knownValidators.has(validatorIndex))
132
- addedknownValidators = true;
133
- this.knownValidators.set(validatorIndex, currentSlot);
141
+ for (const { subnet, slot, isAggregator } of subscriptions) {
134
142
  // the peer-manager heartbeat will help find the subnet
135
143
  this.committeeSubnets.request({ subnet, toSlot: slot + 1 });
136
144
  if (isAggregator) {
137
145
  // need exact slot here
138
- this.aggregatorSlotSubnet.getOrDefault(slot).add(subnet);
146
+ this.aggregatorSlotSubnet.getOrDefault(slot).set(subnet, null);
139
147
  }
140
148
  }
141
- if (addedknownValidators)
142
- this.rebalanceRandomSubnets();
143
149
  }
144
150
  /**
145
151
  * Check if a subscription is still active before handling a gossip object
@@ -150,16 +156,25 @@ export class AttnetsService {
150
156
  }
151
157
  return this.aggregatorSlotSubnet.getOrDefault(slot).has(subnet);
152
158
  }
153
- /** Call ONLY ONCE: Two epoch before the fork, re-subscribe all existing random subscriptions to the new fork */
159
+ /**
160
+ * TODO-dll: clarify how many epochs before the fork we should subscribe to the new fork
161
+ * Call ONLY ONCE: Two epoch before the fork, re-subscribe all existing random subscriptions to the new fork
162
+ **/
154
163
  subscribeSubnetsToNextFork(nextFork) {
155
- this.logger.info("Subscribing to random attnets to next fork", { nextFork });
156
- for (const subnet of this.subscriptionsRandom.getAll()) {
164
+ this.logger.info("Subscribing to long lived attnets to next fork", {
165
+ nextFork,
166
+ subnets: Array.from(this.longLivedSubscriptions).join(","),
167
+ });
168
+ for (const subnet of this.longLivedSubscriptions) {
157
169
  this.gossip.subscribeTopic({ type: gossipType, fork: nextFork, subnet });
158
170
  }
159
171
  }
160
- /** Call ONLY ONCE: Two epochs after the fork, un-subscribe all subnets from the old fork */
172
+ /**
173
+ * TODO-dll: clarify how many epochs after the fork we should unsubscribe to the new fork
174
+ * Call ONLY ONCE: Two epochs after the fork, un-subscribe all subnets from the old fork
175
+ **/
161
176
  unsubscribeSubnetsFromPrevFork(prevFork) {
162
- this.logger.info("Unsubscribing to random attnets from prev fork", { prevFork });
177
+ this.logger.info("Unsubscribing to long lived attnets from prev fork", { prevFork });
163
178
  for (let subnet = 0; subnet < ATTESTATION_SUBNET_COUNT; subnet++) {
164
179
  if (!this.opts.subscribeAllSubnets) {
165
180
  this.gossip.unsubscribeTopic({ type: gossipType, fork: prevFork, subnet });
@@ -167,111 +182,95 @@ export class AttnetsService {
167
182
  }
168
183
  }
169
184
  /**
170
- * Unsubscribe to a committee subnet from subscribedCommitteeSubnets.
171
- * If a random subnet is present, we do not unsubscribe from it.
185
+ * Track time to form stable mesh if not yet formed
172
186
  */
173
- unsubscribeExpiredCommitteeSubnets(slot) {
174
- const expired = this.subscriptionsCommittee.getExpired(slot);
175
- if (expired.length > 0) {
176
- this.unsubscribeSubnets(expired, slot, SubnetSource.committee);
187
+ trackTimeToStableMesh(clockSlot, dutiedSlot, dutiedInfo) {
188
+ if (dutiedSlot < clockSlot) {
189
+ // aggregator duty is expired, set timeToStableMesh to some big value so we know this value is not good
190
+ for (const [subnet, timeToFormMesh] of dutiedInfo.entries()) {
191
+ if (timeToFormMesh === null) {
192
+ dutiedInfo.set(subnet, NOT_ABLE_TO_FORM_STABLE_MESH_SEC);
193
+ this.metrics?.attnetsService.subscriptionsCommitteeTimeToStableMesh.observe({ subnet }, NOT_ABLE_TO_FORM_STABLE_MESH_SEC);
194
+ }
195
+ }
196
+ }
197
+ else if (dutiedSlot <= clockSlot + this.opts.slotsToSubscribeBeforeAggregatorDuty) {
198
+ // aggregator duty is not expired, track time to stable mesh if this is the 1st time we see mesh peers>=Dlo (6)
199
+ for (const [subnet, timeToFormMesh] of dutiedInfo.entries()) {
200
+ if (timeToFormMesh === null) {
201
+ const topicStr = stringifyGossipTopic(this.config, {
202
+ type: gossipType,
203
+ fork: this.config.getForkName(dutiedSlot),
204
+ subnet,
205
+ });
206
+ const numMeshPeers = this.gossip.mesh.get(topicStr)?.size ?? 0;
207
+ if (numMeshPeers >= GOSSIP_D_LOW) {
208
+ const timeToStableMeshSec = this.clock.secFromSlot(dutiedSlot - this.opts.slotsToSubscribeBeforeAggregatorDuty);
209
+ // set to dutiedInfo so we'll not set to metrics again
210
+ dutiedInfo.set(subnet, timeToStableMeshSec);
211
+ this.metrics?.attnetsService.subscriptionsCommitteeTimeToStableMesh.observe({ subnet }, timeToStableMeshSec);
212
+ }
213
+ }
214
+ }
177
215
  }
178
216
  }
179
- /**
180
- * A random subnet has expired.
181
- * This function selects a new subnet to join, or extends the expiry if there are no more
182
- * available subnets to choose from.
183
- */
184
- unsubscribeExpiredRandomSubnets(slot) {
185
- const expired = this.subscriptionsRandom.getExpired(slot);
186
- const currentSlot = this.clock.currentSlot;
187
- if (expired.length === 0) {
217
+ recomputeLongLivedSubnets() {
218
+ if (this.nodeId === null) {
219
+ this.logger.verbose("Cannot recompute long-lived subscriptions, no nodeId");
188
220
  return;
189
221
  }
190
- if (this.knownValidators.size * RANDOM_SUBNETS_PER_VALIDATOR >= ATTESTATION_SUBNET_COUNT) {
191
- // Optimization: If we have to be subcribed to all subnets, no need to unsubscribe. Just extend the timeout
192
- for (const subnet of expired) {
193
- this.subscriptionsRandom.request({ subnet, toSlot: this.randomSubscriptionSlotLen() + currentSlot });
222
+ const oldSubnets = this.longLivedSubscriptions;
223
+ const newSubnets = computeSubscribedSubnet(this.nodeId, this.clock.currentEpoch);
224
+ this.logger.verbose("Recomputing long-lived subscriptions", {
225
+ epoch: this.clock.currentEpoch,
226
+ oldSubnets: Array.from(oldSubnets).join(","),
227
+ newSubnets: newSubnets.join(","),
228
+ });
229
+ const toRemoveSubnets = [];
230
+ for (const subnet of oldSubnets) {
231
+ if (!newSubnets.includes(subnet)) {
232
+ toRemoveSubnets.push(subnet);
194
233
  }
195
- return;
196
234
  }
197
- // Prune subnets and re-subcribe to new ones
198
- this.unsubscribeSubnets(expired, slot, SubnetSource.random);
199
- this.rebalanceRandomSubnets();
235
+ // First, tell gossip to subscribe to the subnets if not connected already
236
+ this.subscribeToSubnets(newSubnets, SubnetSource.longLived);
237
+ // then update longLivedSubscriptions
238
+ for (const subnet of toRemoveSubnets) {
239
+ this.longLivedSubscriptions.delete(subnet);
240
+ }
241
+ for (const subnet of newSubnets) {
242
+ // this.longLivedSubscriptions is a set so it'll handle duplicates
243
+ this.longLivedSubscriptions.add(subnet);
244
+ }
245
+ // Only tell gossip to unsubsribe last, longLivedSubscriptions has the latest state
246
+ this.unsubscribeSubnets(toRemoveSubnets, this.clock.currentSlot, SubnetSource.longLived);
247
+ this.updateMetadata();
200
248
  }
201
249
  /**
202
- * A known validator has not sent a subscription in a while. They are considered offline and the
203
- * beacon node no longer needs to be subscribed to the allocated random subnets.
204
- *
205
- * We don't keep track of a specific validator to random subnet, rather the ratio of active
206
- * validators to random subnets. So when a validator goes offline, we can simply remove the
207
- * allocated amount of random subnets.
250
+ * Unsubscribe to a committee subnet from subscribedCommitteeSubnets.
251
+ * If a random subnet is present, we do not unsubscribe from it.
208
252
  */
209
- pruneExpiredKnownValidators(currentSlot) {
210
- let deletedKnownValidators = false;
211
- for (const [index, slot] of this.knownValidators.entries()) {
212
- if (currentSlot > slot + LAST_SEEN_VALIDATOR_TIMEOUT) {
213
- const deleted = this.knownValidators.delete(index);
214
- if (deleted)
215
- deletedKnownValidators = true;
216
- }
253
+ unsubscribeExpiredCommitteeSubnets(slot) {
254
+ const expired = this.shortLivedSubscriptions.getExpired(slot);
255
+ if (expired.length > 0) {
256
+ this.unsubscribeSubnets(expired, slot, SubnetSource.committee);
217
257
  }
218
- if (deletedKnownValidators)
219
- this.rebalanceRandomSubnets();
220
258
  }
221
259
  /**
222
260
  * No need to track aggregator for past slots.
223
261
  * @param currentSlot
224
262
  */
225
263
  pruneExpiredAggregator(currentSlot) {
226
- for (const slot of this.aggregatorSlotSubnet.keys()) {
227
- if (currentSlot > slot) {
228
- this.aggregatorSlotSubnet.delete(slot);
229
- }
230
- }
231
- }
232
- /**
233
- * Called when we have new validators or expired validators.
234
- * knownValidators should be updated before this function.
235
- */
236
- rebalanceRandomSubnets() {
237
- const slot = this.clock.currentSlot;
238
- // By limiting to ATTESTATION_SUBNET_COUNT, if target is still over subnetDiff equals 0
239
- const targetRandomSubnetCount = Math.min(this.knownValidators.size * RANDOM_SUBNETS_PER_VALIDATOR, ATTESTATION_SUBNET_COUNT);
240
- const subnetDiff = targetRandomSubnetCount - this.subscriptionsRandom.size;
241
- // subscribe to more random subnets
242
- if (subnetDiff > 0) {
243
- const activeSubnets = new Set(this.subscriptionsRandom.getActive(slot));
244
- const allSubnets = Array.from({ length: ATTESTATION_SUBNET_COUNT }, (_, i) => i);
245
- const availableSubnets = allSubnets.filter((subnet) => !activeSubnets.has(subnet));
246
- const subnetsToConnect = this.shuffleFn(availableSubnets).slice(0, subnetDiff);
247
- // Tell gossip to connect to the subnets if not connected already
248
- this.subscribeToSubnets(subnetsToConnect, SubnetSource.random);
249
- // Register these new subnets until some future slot
250
- for (const subnet of subnetsToConnect) {
251
- // the heartbeat will help connect to respective peers
252
- this.subscriptionsRandom.request({ subnet, toSlot: this.randomSubscriptionSlotLen() + slot });
253
- }
254
- }
255
- // unsubscribe some random subnets
256
- if (subnetDiff < 0) {
257
- const activeRandomSubnets = this.subscriptionsRandom.getActive(slot);
258
- // TODO: Do we want to remove the oldest subnets or the newest subnets?
259
- // .slice(-2) will extract the last two items of the array
260
- const toRemoveSubnets = activeRandomSubnets.slice(subnetDiff);
261
- for (const subnet of toRemoveSubnets) {
262
- this.subscriptionsRandom.delete(subnet);
264
+ for (const dutiedSlot of this.aggregatorSlotSubnet.keys()) {
265
+ if (currentSlot > dutiedSlot) {
266
+ this.aggregatorSlotSubnet.delete(dutiedSlot);
263
267
  }
264
- this.unsubscribeSubnets(toRemoveSubnets, slot, SubnetSource.random);
265
- }
266
- // If there has been a change update the local ENR bitfield
267
- if (subnetDiff !== 0) {
268
- this.updateMetadata();
269
268
  }
270
269
  }
271
270
  /** Update ENR */
272
271
  updateMetadata() {
273
272
  const subnets = ssz.phase0.AttestationSubnets.defaultValue();
274
- for (const subnet of this.subscriptionsRandom.getAll()) {
273
+ for (const subnet of this.longLivedSubscriptions) {
275
274
  subnets.set(subnet, true);
276
275
  }
277
276
  // Only update metadata if necessary, setting `metadata.[key]` triggers a write to disk
@@ -279,11 +278,14 @@ export class AttnetsService {
279
278
  this.metadata.attnets = subnets;
280
279
  }
281
280
  }
282
- /** Tigger a gossip subcription only if not already subscribed */
281
+ /**
282
+ * Trigger a gossip subcription only if not already subscribed
283
+ * shortLivedSubscriptions or longLivedSubscriptions should be updated right AFTER this called
284
+ **/
283
285
  subscribeToSubnets(subnets, src) {
284
286
  const forks = getActiveForks(this.config, this.clock.currentEpoch);
285
287
  for (const subnet of subnets) {
286
- if (!this.subscriptionsCommittee.has(subnet) && !this.subscriptionsRandom.has(subnet)) {
288
+ if (!this.shortLivedSubscriptions.has(subnet) && !this.longLivedSubscriptions.has(subnet)) {
287
289
  for (const fork of forks) {
288
290
  this.gossip.subscribeTopic({ type: gossipType, fork, subnet });
289
291
  }
@@ -291,15 +293,17 @@ export class AttnetsService {
291
293
  }
292
294
  }
293
295
  }
294
- /** Trigger a gossip un-subscrition only if no-one is still subscribed */
296
+ /**
297
+ * Trigger a gossip un-subscription only if no-one is still subscribed
298
+ * If unsubscribe long lived subnets, longLivedSubscriptions should be updated right BEFORE this called
299
+ **/
295
300
  unsubscribeSubnets(subnets, slot, src) {
296
301
  // No need to unsubscribeTopic(). Return early to prevent repetitive extra work
297
302
  if (this.opts.subscribeAllSubnets)
298
303
  return;
299
304
  const forks = getActiveForks(this.config, this.clock.currentEpoch);
300
305
  for (const subnet of subnets) {
301
- if (!this.subscriptionsCommittee.isActiveAtSlot(subnet, slot) &&
302
- !this.subscriptionsRandom.isActiveAtSlot(subnet, slot)) {
306
+ if (!this.shortLivedSubscriptions.isActiveAtSlot(subnet, slot) && !this.longLivedSubscriptions.has(subnet)) {
303
307
  for (const fork of forks) {
304
308
  this.gossip.unsubscribeTopic({ type: gossipType, fork, subnet });
305
309
  }
@@ -307,14 +311,21 @@ export class AttnetsService {
307
311
  }
308
312
  }
309
313
  }
310
- randomSubscriptionSlotLen() {
311
- return (this.randBetweenFn(EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, 2 * EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION) *
312
- SLOTS_PER_EPOCH);
313
- }
314
314
  onScrapeLodestarMetrics(metrics) {
315
315
  metrics.attnetsService.committeeSubnets.set(this.committeeSubnets.size);
316
- metrics.attnetsService.subscriptionsCommittee.set(this.subscriptionsCommittee.size);
317
- metrics.attnetsService.subscriptionsRandom.set(this.subscriptionsRandom.size);
316
+ metrics.attnetsService.subscriptionsCommittee.set(this.shortLivedSubscriptions.size);
317
+ // track short lived subnet status, >= 6 (Dlo) means healthy, otherwise unhealthy
318
+ const currentSlot = this.clock.currentSlot;
319
+ for (const { subnet } of this.shortLivedSubscriptions.getActiveTtl(currentSlot)) {
320
+ const topicStr = stringifyGossipTopic(this.config, {
321
+ type: gossipType,
322
+ fork: this.config.getForkName(currentSlot),
323
+ subnet,
324
+ });
325
+ const numMeshPeers = this.gossip.mesh.get(topicStr)?.size ?? 0;
326
+ metrics.attnetsService.subscriptionsCommitteeMeshPeers.observe({ subnet }, numMeshPeers);
327
+ }
328
+ metrics.attnetsService.longLivedSubscriptions.set(this.longLivedSubscriptions.size);
318
329
  let aggregatorCount = 0;
319
330
  for (const subnets of this.aggregatorSlotSubnet.values()) {
320
331
  aggregatorCount += subnets.size;
@@ -1 +1 @@
1
- {"version":3,"file":"attnetsService.js","sourceRoot":"","sources":["../../../src/network/subnets/attnetsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,qCAAqC,EAErC,4BAA4B,EAC5B,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAc,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAS,MAAM,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAS,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAC,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAY3C;;;GAGG;A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,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACrF,iFAAiF;QACjF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC3C,KAAK,MAAM,EAAC,MAAM,EAAC,IAAI,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9E,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE;gBACjD,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;gBAC1C,MAAM;aACP,CAAC,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC;YAC/D,OAAO,CAAC,cAAc,CAAC,+BAA+B,CAAC,OAAO,CAAC,EAAC,MAAM,EAAC,EAAE,YAAY,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,CAAC,cAAc,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACpF,IAAI,eAAe,GAAG,CAAC,CAAC;QACxB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC;YACzD,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;QAClC,CAAC;QACD,OAAO,CAAC,cAAc,CAAC,yBAAyB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -1,4 +1,3 @@
1
1
  export * from "./interface.js";
2
- export * from "./attnetsService.js";
3
2
  export * from "./syncnetsService.js";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export * from "./interface.js";
2
- export * from "./attnetsService.js";
3
2
  export * from "./syncnetsService.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/network/subnets/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/network/subnets/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
@@ -22,7 +22,6 @@ export interface IAttnetsService extends SubnetsService {
22
22
  export type RandBetweenFn = (min: number, max: number) => number;
23
23
  export type ShuffleFn = <T>(arr: T[]) => T[];
24
24
  export type SubnetsServiceOpts = {
25
- deterministicLongLivedAttnets?: boolean;
26
25
  subscribeAllSubnets?: boolean;
27
26
  slotsToSubscribeBeforeAggregatorDuty: number;
28
27
  };
@@ -0,0 +1,2 @@
1
+ export * from "./kzg.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ // Only export the functions which are useful for external packages and difficult to reproduce or mock
2
+ export * from "./kzg.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,cAAc,UAAU,CAAC"}
@@ -37,7 +37,10 @@ export async function writeHeapSnapshot(prefix, dirpath) {
37
37
  const snapshotStream = v8.getHeapSnapshot();
38
38
  const filepath = `${dirpath}/${prefix}_${new Date().toISOString()}.heapsnapshot`;
39
39
  const fileStream = fs.createWriteStream(filepath);
40
- return new Promise((resolve) => {
40
+ return new Promise((resolve, reject) => {
41
+ fileStream.on("error", (err) => {
42
+ reject(err);
43
+ });
41
44
  snapshotStream.pipe(fileStream);
42
45
  snapshotStream.on("end", () => {
43
46
  resolve(filepath);
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/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