@lodestar/beacon-node 1.50.0-dev.040a952dd7 → 1.50.0-dev.0edec865c8

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 (82) hide show
  1. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/index.js +13 -0
  3. package/lib/api/impl/beacon/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/state/index.js +23 -3
  6. package/lib/api/impl/beacon/state/index.js.map +1 -1
  7. package/lib/api/impl/debug/index.d.ts.map +1 -1
  8. package/lib/api/impl/debug/index.js +26 -18
  9. package/lib/api/impl/debug/index.js.map +1 -1
  10. package/lib/api/impl/validator/index.d.ts +1 -0
  11. package/lib/api/impl/validator/index.d.ts.map +1 -1
  12. package/lib/api/impl/validator/index.js +23 -1
  13. package/lib/api/impl/validator/index.js.map +1 -1
  14. package/lib/chain/archiveStore/archiveStore.d.ts +5 -0
  15. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  16. package/lib/chain/archiveStore/archiveStore.js +13 -23
  17. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  18. package/lib/chain/archiveStore/utils/pruneHistory.d.ts +1 -1
  19. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  20. package/lib/chain/archiveStore/utils/pruneHistory.js +2 -1
  21. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  22. package/lib/chain/chain.d.ts +4 -1
  23. package/lib/chain/chain.d.ts.map +1 -1
  24. package/lib/chain/chain.js +20 -3
  25. package/lib/chain/chain.js.map +1 -1
  26. package/lib/chain/emitter.d.ts +7 -1
  27. package/lib/chain/emitter.d.ts.map +1 -1
  28. package/lib/chain/emitter.js +5 -0
  29. package/lib/chain/emitter.js.map +1 -1
  30. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  31. package/lib/chain/forkChoice/index.js +2 -0
  32. package/lib/chain/forkChoice/index.js.map +1 -1
  33. package/lib/chain/interface.d.ts +1 -0
  34. package/lib/chain/interface.d.ts.map +1 -1
  35. package/lib/chain/opPools/proposerPreferencesPool.d.ts +4 -4
  36. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
  37. package/lib/chain/opPools/proposerPreferencesPool.js +14 -11
  38. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
  39. package/lib/chain/options.d.ts +1 -0
  40. package/lib/chain/options.d.ts.map +1 -1
  41. package/lib/db/beacon.d.ts +2 -0
  42. package/lib/db/beacon.d.ts.map +1 -1
  43. package/lib/db/beacon.js +3 -0
  44. package/lib/db/beacon.js.map +1 -1
  45. package/lib/db/buckets.d.ts +2 -1
  46. package/lib/db/buckets.d.ts.map +1 -1
  47. package/lib/db/buckets.js +1 -0
  48. package/lib/db/buckets.js.map +1 -1
  49. package/lib/db/interface.d.ts +2 -0
  50. package/lib/db/interface.d.ts.map +1 -1
  51. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  52. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  53. package/lib/db/repositories/earliestAvailableSlot.d.ts +11 -0
  54. package/lib/db/repositories/earliestAvailableSlot.d.ts.map +1 -0
  55. package/lib/db/repositories/earliestAvailableSlot.js +19 -0
  56. package/lib/db/repositories/earliestAvailableSlot.js.map +1 -0
  57. package/lib/node/nodejs.d.ts +3 -1
  58. package/lib/node/nodejs.d.ts.map +1 -1
  59. package/lib/node/nodejs.js +2 -1
  60. package/lib/node/nodejs.js.map +1 -1
  61. package/lib/sync/range/chain.d.ts.map +1 -1
  62. package/lib/sync/range/chain.js +5 -1
  63. package/lib/sync/range/chain.js.map +1 -1
  64. package/package.json +17 -17
  65. package/src/api/impl/beacon/index.ts +15 -0
  66. package/src/api/impl/beacon/state/index.ts +31 -3
  67. package/src/api/impl/debug/index.ts +28 -19
  68. package/src/api/impl/validator/index.ts +24 -2
  69. package/src/chain/archiveStore/archiveStore.ts +18 -24
  70. package/src/chain/archiveStore/utils/pruneHistory.ts +4 -1
  71. package/src/chain/chain.ts +32 -2
  72. package/src/chain/emitter.ts +7 -1
  73. package/src/chain/forkChoice/index.ts +2 -0
  74. package/src/chain/interface.ts +1 -0
  75. package/src/chain/opPools/proposerPreferencesPool.ts +14 -10
  76. package/src/chain/options.ts +1 -1
  77. package/src/db/beacon.ts +3 -0
  78. package/src/db/buckets.ts +1 -0
  79. package/src/db/interface.ts +2 -0
  80. package/src/db/repositories/earliestAvailableSlot.ts +19 -0
  81. package/src/node/nodejs.ts +4 -0
  82. package/src/sync/range/chain.ts +6 -1
@@ -14,6 +14,7 @@ import {BeaconConfig} from "@lodestar/config";
14
14
  import type {LoggerNode} from "@lodestar/logger/node";
15
15
  import {ZERO_HASH_HEX} from "@lodestar/params";
16
16
  import {IBeaconStateView, isStatePostBellatrix, isStatePostGloas} from "@lodestar/state-transition";
17
+ import {Slot} from "@lodestar/types";
17
18
  import {sleep, toRootHex} from "@lodestar/utils";
18
19
  import {ProcessShutdownCallback} from "@lodestar/validator";
19
20
  import {BeaconRestApiServer, getApi} from "../api/index.js";
@@ -61,6 +62,7 @@ export type BeaconNodeInitModules = {
61
62
  peerStoreDir?: string;
62
63
  anchorState: IBeaconStateView;
63
64
  isAnchorStateFinalized: boolean;
65
+ earliestAvailableSlot: Slot;
64
66
  metricsRegistries?: Registry[];
65
67
  };
66
68
 
@@ -159,6 +161,7 @@ export class BeaconNode {
159
161
  peerStoreDir,
160
162
  anchorState,
161
163
  isAnchorStateFinalized,
164
+ earliestAvailableSlot,
162
165
  metricsRegistries = [],
163
166
  }: BeaconNodeInitModules): Promise<T> {
164
167
  if (hasher.name !== "hashtree") {
@@ -266,6 +269,7 @@ export class BeaconNode {
266
269
  validatorMonitor,
267
270
  anchorState,
268
271
  isAnchorStateFinalized,
272
+ earliestAvailableSlot,
269
273
  executionEngine: initializeExecutionEngine(executionEngineOpts, {
270
274
  metrics,
271
275
  signal,
@@ -225,6 +225,9 @@ export class SyncChain {
225
225
  Math.floor((localFinalizedEpoch - this.lastEpochWithProcessBlocks) / EPOCHS_PER_BATCH) * EPOCHS_PER_BATCH;
226
226
  this.advanceChain(lastEpochWithProcessBlocksAligned);
227
227
 
228
+ // stopSyncing() cleared the retry timer, but peers can still be in rate limit backoff
229
+ this.scheduleRateLimitBackoffRetry();
230
+
228
231
  // Potentially download new batches and process pending
229
232
  this.triggerBatchDownloader();
230
233
  this.triggerBatchProcessor();
@@ -417,8 +420,10 @@ export class SyncChain {
417
420
  this.rateLimitBackoffTimeout = setTimeout(
418
421
  () => {
419
422
  this.rateLimitBackoffTimeout = undefined;
420
- this.triggerBatchDownloader();
423
+ // Must run before the downloader, it drops expired peers without triggering a download. If it ran
424
+ // after, a backoff expiring in between would leave the peer idle with no retry scheduled.
421
425
  this.scheduleRateLimitBackoffRetry();
426
+ this.triggerBatchDownloader();
422
427
  },
423
428
  Math.max(0, retryAt - now)
424
429
  );