@lodestar/validator 1.51.0-dev.2593063a82 → 1.51.0-dev.2b933d3b9a

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 (45) hide show
  1. package/lib/services/chainHeaderTracker.d.ts.map +1 -1
  2. package/lib/services/chainHeaderTracker.js +6 -1
  3. package/lib/services/chainHeaderTracker.js.map +1 -1
  4. package/lib/services/emitter.d.ts +10 -1
  5. package/lib/services/emitter.d.ts.map +1 -1
  6. package/lib/services/emitter.js +4 -0
  7. package/lib/services/emitter.js.map +1 -1
  8. package/lib/services/inclusionList.d.ts +25 -0
  9. package/lib/services/inclusionList.d.ts.map +1 -0
  10. package/lib/services/inclusionList.js +101 -0
  11. package/lib/services/inclusionList.js.map +1 -0
  12. package/lib/services/inclusionListDuties.d.ts +59 -0
  13. package/lib/services/inclusionListDuties.d.ts.map +1 -0
  14. package/lib/services/inclusionListDuties.js +252 -0
  15. package/lib/services/inclusionListDuties.js.map +1 -0
  16. package/lib/services/validatorStore.d.ts +7 -1
  17. package/lib/services/validatorStore.d.ts.map +1 -1
  18. package/lib/services/validatorStore.js +27 -2
  19. package/lib/services/validatorStore.js.map +1 -1
  20. package/lib/slashingProtection/attestation/index.d.ts +1 -0
  21. package/lib/slashingProtection/attestation/index.d.ts.map +1 -1
  22. package/lib/slashingProtection/attestation/index.js +77 -44
  23. package/lib/slashingProtection/attestation/index.js.map +1 -1
  24. package/lib/slashingProtection/index.d.ts +2 -0
  25. package/lib/slashingProtection/index.d.ts.map +1 -1
  26. package/lib/slashingProtection/index.js +48 -5
  27. package/lib/slashingProtection/index.js.map +1 -1
  28. package/lib/util/externalSignerClient.d.ts +6 -2
  29. package/lib/util/externalSignerClient.d.ts.map +1 -1
  30. package/lib/util/externalSignerClient.js +4 -0
  31. package/lib/util/externalSignerClient.js.map +1 -1
  32. package/lib/validator.d.ts +4 -1
  33. package/lib/validator.d.ts.map +1 -1
  34. package/lib/validator.js +11 -4
  35. package/lib/validator.js.map +1 -1
  36. package/package.json +12 -12
  37. package/src/services/chainHeaderTracker.ts +8 -1
  38. package/src/services/emitter.ts +10 -0
  39. package/src/services/inclusionList.ts +140 -0
  40. package/src/services/inclusionListDuties.ts +306 -0
  41. package/src/services/validatorStore.ts +41 -2
  42. package/src/slashingProtection/attestation/index.ts +81 -46
  43. package/src/slashingProtection/index.ts +50 -6
  44. package/src/util/externalSignerClient.ts +8 -1
  45. package/src/validator.ts +31 -3
package/src/validator.ts CHANGED
@@ -6,7 +6,14 @@ import {
6
6
  assertEqualParams,
7
7
  createBeaconConfig,
8
8
  } from "@lodestar/config";
9
- import {Clock, ClockOptions, IClock, computeEpochAtSlot, getCurrentSlot} from "@lodestar/state-transition";
9
+ import {
10
+ Clock,
11
+ ClockOptions,
12
+ IClock,
13
+ computeEpochAtSlot,
14
+ getCurrentSlot,
15
+ getSlotDurations,
16
+ } from "@lodestar/state-transition";
10
17
  import {BLSPubkey, phase0, ssz} from "@lodestar/types";
11
18
  import {Genesis} from "@lodestar/types/phase0";
12
19
  import {Logger, prettyGweiToEth, toPrintableUrl, toRootHex} from "@lodestar/utils";
@@ -20,6 +27,7 @@ import {ChainHeaderTracker} from "./services/chainHeaderTracker.js";
20
27
  import {DoppelgangerService} from "./services/doppelgangerService.js";
21
28
  import {ValidatorEventEmitter} from "./services/emitter.js";
22
29
  import {ExternalSignerOptions, pollExternalSignerPubkeys} from "./services/externalSignerSync.js";
30
+ import {InclusionListService} from "./services/inclusionList.js";
23
31
  import {IndicesService} from "./services/indices.js";
24
32
  import {pollBuilderValidatorRegistration, pollPrepareBeaconProposer} from "./services/prepareBeaconProposer.js";
25
33
  import {ProposalPreferencesService} from "./services/proposalPreferences.js";
@@ -46,6 +54,7 @@ export type ValidatorModules = {
46
54
  blockProposingService: BlockProposingService;
47
55
  attestationService: AttestationService;
48
56
  ptcService: PtcService;
57
+ inclusionListService: InclusionListService;
49
58
  syncCommitteeService: SyncCommitteeService;
50
59
  config: BeaconConfig;
51
60
  api: ApiClient;
@@ -102,6 +111,7 @@ export class Validator {
102
111
  private readonly blockProposingService: BlockProposingService;
103
112
  private readonly attestationService: AttestationService;
104
113
  private readonly ptcService: PtcService;
114
+ private readonly inclusionListService: InclusionListService;
105
115
  private readonly syncCommitteeService: SyncCommitteeService;
106
116
  private readonly config: BeaconConfig;
107
117
  private readonly api: ApiClient;
@@ -121,6 +131,7 @@ export class Validator {
121
131
  blockProposingService,
122
132
  attestationService,
123
133
  ptcService,
134
+ inclusionListService,
124
135
  syncCommitteeService,
125
136
  config,
126
137
  api,
@@ -138,6 +149,7 @@ export class Validator {
138
149
  this.blockProposingService = blockProposingService;
139
150
  this.attestationService = attestationService;
140
151
  this.ptcService = ptcService;
152
+ this.inclusionListService = inclusionListService;
141
153
  this.syncCommitteeService = syncCommitteeService;
142
154
  this.config = config;
143
155
  this.api = api;
@@ -202,7 +214,9 @@ export class Validator {
202
214
  globalInit: {
203
215
  signal: controller.signal,
204
216
  ...globalInit,
205
- timeoutMs: globalInit?.timeoutMs ?? config.SLOT_DURATION_MS,
217
+ timeoutMs:
218
+ globalInit?.timeoutMs ??
219
+ Math.min(...getSlotDurations(config).map(([, slotDurationMs]) => slotDurationMs)),
206
220
  },
207
221
  },
208
222
  {config, logger, metrics: metrics?.restApiClient}
@@ -303,6 +317,17 @@ export class Validator {
303
317
  metrics
304
318
  );
305
319
 
320
+ const inclusionListService = new InclusionListService(
321
+ config,
322
+ loggerVc,
323
+ api,
324
+ clock,
325
+ validatorStore,
326
+ chainHeaderTracker,
327
+ syncingStatusTracker,
328
+ emitter
329
+ );
330
+
306
331
  const syncCommitteeService = new SyncCommitteeService(
307
332
  config,
308
333
  loggerVc,
@@ -338,6 +363,7 @@ export class Validator {
338
363
  blockProposingService,
339
364
  attestationService,
340
365
  ptcService,
366
+ inclusionListService,
341
367
  syncCommitteeService,
342
368
  config,
343
369
  api,
@@ -366,7 +392,8 @@ export class Validator {
366
392
  urls: urls.map(toPrintableUrl).toString(),
367
393
  requestWireFormat: globalInit?.requestWireFormat ?? defaultInit.requestWireFormat,
368
394
  responseWireFormat: globalInit?.responseWireFormat ?? defaultInit.responseWireFormat,
369
- requestTimeoutMs: globalInit?.timeoutMs ?? config.SLOT_DURATION_MS,
395
+ requestTimeoutMs:
396
+ globalInit?.timeoutMs ?? Math.min(...getSlotDurations(config).map(([, slotDurationMs]) => slotDurationMs)),
370
397
  });
371
398
  } else {
372
399
  api = clientOrUrls;
@@ -423,6 +450,7 @@ export class Validator {
423
450
  this.blockProposingService.removeDutiesForKey(pubkey);
424
451
  this.attestationService.removeDutiesForKey(pubkey);
425
452
  this.ptcService.removeDutiesForKey(pubkey);
453
+ this.inclusionListService.removeDutiesForKey(pubkey);
426
454
  this.syncCommitteeService.removeDutiesForKey(pubkey);
427
455
  }
428
456