@lodestar/beacon-node 1.49.0-dev.ee7c2aa8ee → 1.49.0-dev.f75a7365cc

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 (110) hide show
  1. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/pool/index.js +4 -2
  3. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  4. package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
  5. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  6. package/lib/chain/archiveStore/archiveStore.js +0 -5
  7. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  8. package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
  9. package/lib/chain/archiveStore/historicalState/metrics.js +2 -7
  10. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  11. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  12. package/lib/chain/blocks/importExecutionPayload.js +13 -0
  13. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  14. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  15. package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
  16. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  17. package/lib/db/beacon.d.ts +1 -2
  18. package/lib/db/beacon.d.ts.map +1 -1
  19. package/lib/db/beacon.js +1 -3
  20. package/lib/db/beacon.js.map +1 -1
  21. package/lib/db/buckets.d.ts +0 -1
  22. package/lib/db/buckets.d.ts.map +1 -1
  23. package/lib/db/buckets.js +1 -1
  24. package/lib/db/buckets.js.map +1 -1
  25. package/lib/db/interface.d.ts +1 -2
  26. package/lib/db/interface.d.ts.map +1 -1
  27. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  28. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  29. package/lib/db/repositories/index.d.ts +0 -1
  30. package/lib/db/repositories/index.d.ts.map +1 -1
  31. package/lib/db/repositories/index.js +0 -1
  32. package/lib/db/repositories/index.js.map +1 -1
  33. package/lib/metrics/metrics/lodestar.d.ts +12 -11
  34. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  35. package/lib/metrics/metrics/lodestar.js +25 -23
  36. package/lib/metrics/metrics/lodestar.js.map +1 -1
  37. package/lib/metrics/metrics.d.ts +3 -1
  38. package/lib/metrics/metrics.d.ts.map +1 -1
  39. package/lib/metrics/metrics.js +2 -2
  40. package/lib/metrics/metrics.js.map +1 -1
  41. package/lib/node/nodejs.d.ts +2 -7
  42. package/lib/node/nodejs.d.ts.map +1 -1
  43. package/lib/node/nodejs.js +2 -22
  44. package/lib/node/nodejs.js.map +1 -1
  45. package/lib/sync/interface.d.ts +1 -2
  46. package/lib/sync/interface.d.ts.map +1 -1
  47. package/lib/sync/options.d.ts +0 -6
  48. package/lib/sync/options.d.ts.map +1 -1
  49. package/lib/sync/options.js +0 -2
  50. package/lib/sync/options.js.map +1 -1
  51. package/lib/sync/types.d.ts +18 -3
  52. package/lib/sync/types.d.ts.map +1 -1
  53. package/lib/sync/types.js +19 -3
  54. package/lib/sync/types.js.map +1 -1
  55. package/lib/sync/unknownBlock.d.ts +19 -0
  56. package/lib/sync/unknownBlock.d.ts.map +1 -1
  57. package/lib/sync/unknownBlock.js +184 -15
  58. package/lib/sync/unknownBlock.js.map +1 -1
  59. package/lib/util/shuffle.d.ts +0 -4
  60. package/lib/util/shuffle.d.ts.map +1 -1
  61. package/lib/util/shuffle.js +0 -8
  62. package/lib/util/shuffle.js.map +1 -1
  63. package/package.json +15 -16
  64. package/src/api/impl/beacon/pool/index.ts +6 -2
  65. package/src/chain/archiveStore/archiveStore.ts +0 -6
  66. package/src/chain/archiveStore/historicalState/metrics.ts +3 -9
  67. package/src/chain/blocks/importExecutionPayload.ts +14 -0
  68. package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
  69. package/src/db/beacon.ts +0 -5
  70. package/src/db/buckets.ts +1 -1
  71. package/src/db/interface.ts +0 -3
  72. package/src/db/repositories/index.ts +0 -1
  73. package/src/metrics/metrics/lodestar.ts +34 -26
  74. package/src/metrics/metrics.ts +7 -2
  75. package/src/node/nodejs.ts +0 -27
  76. package/src/sync/interface.ts +1 -2
  77. package/src/sync/options.ts +0 -8
  78. package/src/sync/types.ts +19 -3
  79. package/src/sync/unknownBlock.ts +192 -14
  80. package/src/util/shuffle.ts +0 -9
  81. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
  82. package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
  83. package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
  84. package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
  85. package/lib/db/repositories/backfilledRanges.d.ts +0 -18
  86. package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
  87. package/lib/db/repositories/backfilledRanges.js +0 -26
  88. package/lib/db/repositories/backfilledRanges.js.map +0 -1
  89. package/lib/sync/backfill/backfill.d.ts +0 -169
  90. package/lib/sync/backfill/backfill.d.ts.map +0 -1
  91. package/lib/sync/backfill/backfill.js +0 -686
  92. package/lib/sync/backfill/backfill.js.map +0 -1
  93. package/lib/sync/backfill/errors.d.ts +0 -30
  94. package/lib/sync/backfill/errors.d.ts.map +0 -1
  95. package/lib/sync/backfill/errors.js +0 -15
  96. package/lib/sync/backfill/errors.js.map +0 -1
  97. package/lib/sync/backfill/index.d.ts +0 -2
  98. package/lib/sync/backfill/index.d.ts.map +0 -1
  99. package/lib/sync/backfill/index.js +0 -2
  100. package/lib/sync/backfill/index.js.map +0 -1
  101. package/lib/sync/backfill/verify.d.ts +0 -18
  102. package/lib/sync/backfill/verify.d.ts.map +0 -1
  103. package/lib/sync/backfill/verify.js +0 -36
  104. package/lib/sync/backfill/verify.js.map +0 -1
  105. package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
  106. package/src/db/repositories/backfilledRanges.ts +0 -29
  107. package/src/sync/backfill/backfill.ts +0 -916
  108. package/src/sync/backfill/errors.ts +0 -23
  109. package/src/sync/backfill/index.ts +0 -1
  110. package/src/sync/backfill/verify.ts +0 -58
@@ -10,12 +10,4 @@ export function shuffle(arr) {
10
10
  }
11
11
  return _arr;
12
12
  }
13
- /**
14
- * Return one random item from array
15
- */
16
- export function shuffleOne(arr) {
17
- if (arr.length === 0)
18
- return undefined;
19
- return arr[Math.floor(Math.random() * arr.length)];
20
- }
21
13
  //# sourceMappingURL=shuffle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shuffle.js","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAI,GAAQ;IACjC,MAAM,IAAI,GAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAI,GAAQ;IACpC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAEvC,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"shuffle.js","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAI,GAAQ;IACjC,MAAM,IAAI,GAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ChainSafe/lodestar/issues"
13
13
  },
14
- "version": "1.49.0-dev.ee7c2aa8ee",
14
+ "version": "1.49.0-dev.f75a7365cc",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -118,7 +118,7 @@
118
118
  "@fastify/swagger-ui": "^5.0.1",
119
119
  "@libp2p/bootstrap": "^12.0.30",
120
120
  "@libp2p/crypto": "^5.1.23",
121
- "@libp2p/gossipsub": "^17.1.0",
121
+ "@libp2p/gossipsub": "^17.1.2",
122
122
  "@libp2p/identify": "^4.1.13",
123
123
  "@libp2p/interface": "^3.3.0",
124
124
  "@libp2p/mdns": "^12.0.30",
@@ -127,17 +127,17 @@
127
127
  "@libp2p/prometheus-metrics": "^5.0.28",
128
128
  "@libp2p/tcp": "^11.0.27",
129
129
  "@libp2p/utils": "^7.4.0",
130
- "@lodestar/api": "^1.49.0-dev.ee7c2aa8ee",
131
- "@lodestar/config": "^1.49.0-dev.ee7c2aa8ee",
132
- "@lodestar/db": "^1.49.0-dev.ee7c2aa8ee",
133
- "@lodestar/fork-choice": "^1.49.0-dev.ee7c2aa8ee",
134
- "@lodestar/logger": "^1.49.0-dev.ee7c2aa8ee",
135
- "@lodestar/params": "^1.49.0-dev.ee7c2aa8ee",
136
- "@lodestar/reqresp": "^1.49.0-dev.ee7c2aa8ee",
137
- "@lodestar/state-transition": "^1.49.0-dev.ee7c2aa8ee",
138
- "@lodestar/types": "^1.49.0-dev.ee7c2aa8ee",
139
- "@lodestar/utils": "^1.49.0-dev.ee7c2aa8ee",
140
- "@lodestar/validator": "^1.49.0-dev.ee7c2aa8ee",
130
+ "@lodestar/api": "^1.49.0-dev.f75a7365cc",
131
+ "@lodestar/config": "^1.49.0-dev.f75a7365cc",
132
+ "@lodestar/db": "^1.49.0-dev.f75a7365cc",
133
+ "@lodestar/fork-choice": "^1.49.0-dev.f75a7365cc",
134
+ "@lodestar/logger": "^1.49.0-dev.f75a7365cc",
135
+ "@lodestar/params": "^1.49.0-dev.f75a7365cc",
136
+ "@lodestar/reqresp": "^1.49.0-dev.f75a7365cc",
137
+ "@lodestar/state-transition": "^1.49.0-dev.f75a7365cc",
138
+ "@lodestar/types": "^1.49.0-dev.f75a7365cc",
139
+ "@lodestar/utils": "^1.49.0-dev.f75a7365cc",
140
+ "@lodestar/validator": "^1.49.0-dev.f75a7365cc",
141
141
  "@multiformats/multiaddr": "^13.0.1",
142
142
  "datastore-core": "^12.0.1",
143
143
  "datastore-level": "^13.0.1",
@@ -156,10 +156,9 @@
156
156
  "xxhash-wasm": "1.0.2"
157
157
  },
158
158
  "devDependencies": {
159
- "@chainsafe/swap-or-not-shuffle": "^1.2.1",
160
159
  "@libp2p/interface-internal": "^3.1.12",
161
160
  "@libp2p/logger": "^6.2.13",
162
- "@lodestar/spec-test-util": "^1.49.0-dev.ee7c2aa8ee",
161
+ "@lodestar/spec-test-util": "^1.49.0-dev.f75a7365cc",
163
162
  "@types/js-yaml": "^4.0.5",
164
163
  "@types/qs": "^6.9.7",
165
164
  "@types/tmp": "^0.2.3",
@@ -174,5 +173,5 @@
174
173
  "beacon",
175
174
  "blockchain"
176
175
  ],
177
- "gitHead": "bfee9060d7f18a25529dc12db0b8fe1fce65be8c"
176
+ "gitHead": "7ddb2476cacf7ace7bf17e9a6f20b01c352bb386"
178
177
  }
@@ -39,7 +39,7 @@ export function getBeaconPoolApi({
39
39
  return {
40
40
  async getPoolAttestationsV2({slot, committeeIndex}) {
41
41
  // Already filtered by slot
42
- let attestations = chain.aggregatedAttestationPool.getAll(slot);
42
+ let attestations = [...chain.aggregatedAttestationPool.getAll(slot), ...chain.attestationPool.getAll(slot)];
43
43
  const fork = chain.config.getForkName(slot ?? attestations[0]?.data.slot ?? chain.clock.currentSlot);
44
44
  const isPostElectra = isForkPostElectra(fork);
45
45
 
@@ -48,7 +48,11 @@ export function getBeaconPoolApi({
48
48
  );
49
49
 
50
50
  if (committeeIndex !== undefined) {
51
- attestations = attestations.filter((attestation) => committeeIndex === attestation.data.index);
51
+ attestations = attestations.filter((attestation) =>
52
+ isElectraAttestation(attestation)
53
+ ? attestation.committeeBits.get(committeeIndex)
54
+ : committeeIndex === attestation.data.index
55
+ );
52
56
  }
53
57
 
54
58
  return {data: attestations, meta: {version: fork}};
@@ -16,7 +16,6 @@ import {ArchiveMode, ArchiveStoreOpts, StateArchiveStrategy} from "./interface.j
16
16
  import {FrequencyStateArchiveStrategy} from "./strategies/frequencyStateArchiveStrategy.js";
17
17
  import {archiveBlocks} from "./utils/archiveBlocks.js";
18
18
  import {pruneHistory} from "./utils/pruneHistory.js";
19
- import {updateBackfillRange} from "./utils/updateBackfillRange.js";
20
19
 
21
20
  type ArchiveStoreModules = {
22
21
  chain: IBeaconChain;
@@ -37,7 +36,6 @@ export enum ArchiveStoreTask {
37
36
  OnFinalizedCheckpoint = "on_finalized_checkpoint",
38
37
  MaybeArchiveState = "maybe_archive_state",
39
38
  ForkchoicePrune = "forkchoice_prune",
40
- UpdateBackfillRange = "update_backfill_range",
41
39
  }
42
40
 
43
41
  /**
@@ -261,10 +259,6 @@ export class ArchiveStore {
261
259
  const prunedBlocks = this.chain.forkChoice.prune(finalized.rootHex);
262
260
  timer?.({source: ArchiveStoreTask.ForkchoicePrune});
263
261
 
264
- timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
265
- await updateBackfillRange({chain: this.chain, db: this.db, logger: this.logger}, finalized);
266
- timer?.({source: ArchiveStoreTask.UpdateBackfillRange});
267
-
268
262
  this.logger.verbose("Finish processing finalized checkpoint", {
269
263
  epoch: finalizedEpoch,
270
264
  rootHex: finalized.rootHex,
@@ -6,7 +6,6 @@ import {
6
6
  ProcessOperationsStep,
7
7
  ProposerRewardType,
8
8
  StateCloneSource,
9
- StateHashTreeRootSource,
10
9
  } from "@lodestar/state-transition";
11
10
  import {Gauge, Histogram} from "@lodestar/utils";
12
11
  import {RegistryMetricCreator} from "../../../metrics/index.js";
@@ -92,12 +91,6 @@ export function createHistoricalStateTransitionMetrics(
92
91
  help: "Time to call commit after process a single block in seconds",
93
92
  buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
94
93
  }),
95
- stateHashTreeRootTime: metricsRegister.histogram<{source: StateHashTreeRootSource}>({
96
- name: "lodestar_historical_state_stfn_hash_tree_root_seconds",
97
- help: "Time to compute the hash tree root of a post state in seconds",
98
- buckets: [0.05, 0.1, 0.2, 0.5, 1, 1.5],
99
- labelNames: ["source"],
100
- }),
101
94
  numEffectiveBalanceUpdates: metricsRegister.gauge({
102
95
  name: "lodestar_historical_state_stfn_num_effective_balance_updates_count",
103
96
  help: "Count of effective balance updates in epoch transition",
@@ -163,9 +156,10 @@ export function createHistoricalStateTransitionMetrics(
163
156
  name: "lodestar_historical_state_stfn_attestations_per_block_total",
164
157
  help: "Count of attestations per block",
165
158
  }),
166
- progressiveBalancesMismatches: metricsRegister.counter({
159
+ progressiveBalancesMismatches: metricsRegister.counter<{target: "current" | "previous"}>({
167
160
  name: "lodestar_historical_state_stfn_progressive_balances_mismatches_total",
168
- help: "Total count of progressive balance cache mismatches",
161
+ help: "Total count of progressive balance cache mismatches by target balance",
162
+ labelNames: ["target"],
169
163
  }),
170
164
  proposerRewards: metricsRegister.gauge<{type: ProposerRewardType}>({
171
165
  name: "lodestar_historical_state_stfn_proposer_rewards_total",
@@ -12,6 +12,7 @@ import {isQueueErrorAborted} from "../../util/queue/index.js";
12
12
  import {BeaconChain} from "../chain.js";
13
13
  import {RegenCaller} from "../regen/interface.js";
14
14
  import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
15
+ import {PayloadEnvelopeInputSource} from "./payloadEnvelopeInput/index.js";
15
16
  import {ImportPayloadOpts} from "./types.js";
16
17
  import {
17
18
  verifyExecutionPayloadEnvelope,
@@ -172,6 +173,9 @@ export async function importExecutionPayload(
172
173
  }
173
174
 
174
175
  // 4a. Run EL and signature verification in parallel
176
+ const logCtx = {slot, root: blockRootHex, executionBlock: envelope.payload.blockNumber};
177
+ this.logger.debug("Call engine api newPayload", logCtx);
178
+ const verifyStartSec = Date.now() / 1000;
175
179
  const [execResult, signatureValid] = await Promise.all([
176
180
  this.executionEngine.notifyNewPayload(
177
181
  fork,
@@ -191,6 +195,8 @@ export async function importExecutionPayload(
191
195
  this.bls
192
196
  ),
193
197
  ]);
198
+ this.logger.debug("Receive engine api newPayload result", {...logCtx, status: execResult.status});
199
+ this.metrics?.engineNotifyNewPayloadResult.inc({result: execResult.status});
194
200
 
195
201
  // 4b. Check signature verification result
196
202
  if (!signatureValid) {
@@ -223,6 +229,14 @@ export async function importExecutionPayload(
223
229
  });
224
230
  }
225
231
 
232
+ const {source, seenTimestampSec} = payloadInput.getPayloadEnvelopeSource();
233
+ if (execResult.status === ExecutionPayloadStatus.VALID && source === PayloadEnvelopeInputSource.gossip) {
234
+ const nowSec = Date.now() / 1000;
235
+ this.metrics?.gossipExecutionPayloadEnvelope.executionPayload.recvToValidation.observe(nowSec - seenTimestampSec);
236
+ // same metric as pre-gloas, it tracks EL verification time regardless of fork
237
+ this.metrics?.gossipBlock.executionPayload.validationTime.observe(nowSec - verifyStartSec);
238
+ }
239
+
226
240
  // 5. Persist payload envelope to hot DB. Wait for write-queue space here to apply backpressure
227
241
  // on the import pipeline during sync, then perform the write asynchronously to avoid blocking.
228
242
  await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
@@ -1,4 +1,4 @@
1
- import {EMPTY_SIGNATURE, IBeaconStateView} from "@lodestar/state-transition";
1
+ import {EMPTY_SIGNATURE, IBeaconStateView, StateHashTreeRootSource} from "@lodestar/state-transition";
2
2
  import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
3
3
  import {Metrics} from "../../metrics/index.js";
4
4
 
@@ -14,5 +14,12 @@ export function computeNewStateRoot(
14
14
  ): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
15
15
  // Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
16
16
  const signedBlock = {message: block, signature: EMPTY_SIGNATURE};
17
- return state.computeNewStateRoot({block: signedBlock}, {metrics});
17
+ const {newStateRoot, proposerReward, postState, hashTreeRootTime} = state.computeNewStateRoot(
18
+ {block: signedBlock},
19
+ {metrics}
20
+ );
21
+
22
+ metrics?.stateHashTreeRootTime.observe({source: StateHashTreeRootSource.computeNewStateRoot}, hashTreeRootTime);
23
+
24
+ return {newStateRoot, proposerReward, postState};
18
25
  }
package/src/db/beacon.ts CHANGED
@@ -11,7 +11,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
11
11
  import {
12
12
  AttesterSlashingRepository,
13
13
  BLSToExecutionChangeRepository,
14
- BackfilledRanges,
15
14
  BestLightClientUpdateRepository,
16
15
  BlobSidecarsArchiveRepository,
17
16
  BlobSidecarsRepository,
@@ -61,8 +60,6 @@ export class BeaconDb implements IBeaconDb {
61
60
  syncCommittee: SyncCommitteeRepository;
62
61
  syncCommitteeWitness: SyncCommitteeWitnessRepository;
63
62
 
64
- backfilledRanges: BackfilledRanges;
65
-
66
63
  readonly dataColumns: IDataColumnStore;
67
64
  lastLegacyArchiveSlot: Slot | null = null;
68
65
  private readonly flatFileStore: FlatFileStore;
@@ -97,8 +94,6 @@ export class BeaconDb implements IBeaconDb {
97
94
  this.syncCommittee = new SyncCommitteeRepository(config, db);
98
95
  this.syncCommitteeWitness = new SyncCommitteeWitnessRepository(config, db);
99
96
 
100
- this.backfilledRanges = new BackfilledRanges(config, db);
101
-
102
97
  this.flatFileStore = new FlatFileStore(opts.dataColumnDir, config, opts.logger, opts.metrics);
103
98
  this.dataColumns = new LegacyDataColumnStore(
104
99
  this.flatFileStore,
package/src/db/buckets.ts CHANGED
@@ -56,7 +56,7 @@ export enum Bucket {
56
56
  // altair_lightClientSyncCommitteeProof = 35, // DEPRECATED on v0.32.0
57
57
  // index_lightClientInitProof = 36, // DEPRECATED on v0.32.0
58
58
 
59
- backfilled_ranges = 42, // Backfilled From to To, inclusive of both From, To
59
+ // backfilled_ranges = 42, // DEPRECATED on v1.48.0
60
60
 
61
61
  // Buckets to support LightClient server v2
62
62
  lightClient_syncCommitteeWitness = 51, // BlockRoot -> SyncCommitteeWitness
@@ -6,7 +6,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
6
6
  import {
7
7
  AttesterSlashingRepository,
8
8
  BLSToExecutionChangeRepository,
9
- BackfilledRanges,
10
9
  BestLightClientUpdateRepository,
11
10
  BlobSidecarsArchiveRepository,
12
11
  BlobSidecarsRepository,
@@ -60,8 +59,6 @@ export interface IBeaconDb {
60
59
  syncCommittee: SyncCommitteeRepository;
61
60
  syncCommitteeWitness: SyncCommitteeWitnessRepository;
62
61
 
63
- backfilledRanges: BackfilledRanges;
64
-
65
62
  dataColumns: IDataColumnStore;
66
63
  /** Highest legacy column slot at startup; later archival writes the block-root index first. */
67
64
  readonly lastLegacyArchiveSlot: Slot | null;
@@ -1,5 +1,4 @@
1
1
  export {AttesterSlashingRepository} from "./attesterSlashing.js";
2
- export {BackfilledRanges} from "./backfilledRanges.js";
3
2
  export {BlobSidecarsRepository} from "./blobSidecars.js";
4
3
  export {BlobSidecarsArchiveRepository} from "./blobSidecarsArchive.js";
5
4
  export {BlockRepository} from "./block.js";
@@ -1,5 +1,6 @@
1
1
  /** biome-ignore-all lint/suspicious/noTemplateCurlyInString: The metric templates requires to have `${}` in a normal string */
2
2
  import {NotReorgedReason} from "@lodestar/fork-choice";
3
+ import {StateHashTreeRootSource} from "@lodestar/state-transition";
3
4
  import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
4
5
  import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
5
6
  import type {LateCanonicalBlockReason} from "../../chain/archiveStore/utils/archiveBlocks.js";
@@ -25,8 +26,13 @@ import type {FlatFileStoreOperation} from "../../db/flatFileStore/metrics.js";
25
26
  import {ExecutionPayloadStatus} from "../../execution/index.js";
26
27
  import {GossipType} from "../../network/index.js";
27
28
  import {CannotAcceptWorkReason, ReprocessRejectReason} from "../../network/processor/index.js";
28
- import {BackfillSyncMethod} from "../../sync/backfill/backfill.js";
29
- import {DownloadResult, DroppedItemReason, FetchResult, PendingBlockType} from "../../sync/types.js";
29
+ import {
30
+ DeferredPayloadResult,
31
+ DownloadResult,
32
+ DroppedItemReason,
33
+ FetchResult,
34
+ PendingBlockType,
35
+ } from "../../sync/types.js";
30
36
  import {PeerSyncType, RangeSyncType} from "../../sync/utils/remoteSyncType.js";
31
37
  import {AllocSource} from "../../util/bufferPool.js";
32
38
  import {DataColumnReconstructionCode} from "../../util/dataColumns.js";
@@ -403,6 +409,15 @@ export function createLodestarMetrics(
403
409
  labelNames: ["caller"],
404
410
  }),
405
411
 
412
+ // this metrics stay here instead of @lodestar/state-transition in order to prepare
413
+ // for the native zig state-transition in the future
414
+ stateHashTreeRootTime: register.histogram<{source: StateHashTreeRootSource}>({
415
+ name: "lodestar_stfn_hash_tree_root_seconds",
416
+ help: "Time to compute the hash tree root of a post state in seconds",
417
+ buckets: [0.01, 0.05, 0.1, 0.2, 0.3, 0.5],
418
+ labelNames: ["source"],
419
+ }),
420
+
406
421
  // BLS verifier thread pool and queue
407
422
 
408
423
  bls: {
@@ -655,6 +670,16 @@ export function createLodestarMetrics(
655
670
  help: "Count of payload (execution payload envelope) sync triggers, labeled by their source",
656
671
  labelNames: ["source"],
657
672
  }),
673
+ deferredPayloadResult: register.counter<{result: DeferredPayloadResult}>({
674
+ name: "lodestar_sync_deferred_payload_result_total",
675
+ help: "Outcome of a slot's deferred optimistic payload searches, by result",
676
+ labelNames: ["result"],
677
+ }),
678
+ deferredPayloadPolls: register.histogram({
679
+ name: "lodestar_sync_deferred_payload_polls_count",
680
+ help: "Poll ticks after PAYLOAD_DUE until a searched payload was imported",
681
+ buckets: [0, 1, 2, 3, 6],
682
+ }),
658
683
  pendingBlocks: register.gauge({
659
684
  name: "lodestar_sync_unknown_block_pending_blocks_size",
660
685
  help: "Current size of UnknownBlockSync pending blocks cache",
@@ -986,6 +1011,13 @@ export function createLodestarMetrics(
986
1011
  help: "Count of errors, by error type, while processing execution payload envelopes",
987
1012
  labelNames: ["error"],
988
1013
  }),
1014
+ executionPayload: {
1015
+ recvToValidation: register.histogram({
1016
+ name: "lodestar_gossip_execution_payload_envelope_received_to_execution_payload_verification_seconds",
1017
+ help: "Time elapsed between execution payload envelope received and execution payload verification",
1018
+ buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 3, 4, 6, 8],
1019
+ }),
1020
+ },
989
1021
  },
990
1022
  gossipExecutionPayloadBid: {
991
1023
  elapsedTimeTillReceived: register.histogram<{source: OpSource}>({
@@ -1120,30 +1152,6 @@ export function createLodestarMetrics(
1120
1152
  help: "The total result of calling notifyForkchoiceUpdate execution engine api",
1121
1153
  labelNames: ["result"],
1122
1154
  }),
1123
- backfillSync: {
1124
- backfilledTillSlot: register.gauge({
1125
- name: "lodestar_backfill_till_slot",
1126
- help: "Current lowest backfilled slot",
1127
- }),
1128
- prevFinOrWsSlot: register.gauge({
1129
- name: "lodestar_backfill_prev_fin_or_ws_slot",
1130
- help: "Slot of previous finalized or wsCheckpoint block to be validated",
1131
- }),
1132
- totalBlocks: register.gauge<{method: BackfillSyncMethod}>({
1133
- name: "lodestar_backfill_sync_blocks_total",
1134
- help: "Total amount of backfilled blocks",
1135
- labelNames: ["method"],
1136
- }),
1137
- errors: register.gauge({
1138
- name: "lodestar_backfill_sync_errors_total",
1139
- help: "Total number of errors while backfilling",
1140
- }),
1141
- status: register.gauge({
1142
- name: "lodestar_backfill_sync_status",
1143
- help: "Current backfill syncing status: [Aborted, Pending, Syncing, Completed]",
1144
- }),
1145
- },
1146
-
1147
1155
  opPool: {
1148
1156
  aggregatedAttestationPool: {
1149
1157
  size: register.gauge({
@@ -12,7 +12,12 @@ export type Metrics = BeaconMetrics &
12
12
  BeaconStateTransitionMetrics &
13
13
  LodestarMetrics & {register: RegistryMetricCreator; close: () => void};
14
14
 
15
- export function createMetrics(opts: MetricsOptions, genesisTime: number, externalRegistries: Registry[] = []): Metrics {
15
+ export function createMetrics(
16
+ opts: MetricsOptions,
17
+ genesisTime: number,
18
+ externalRegistries: Registry[] = [],
19
+ {collectNodeMetrics = true}: {collectNodeMetrics?: boolean} = {}
20
+ ): Metrics {
16
21
  const register = new RegistryMetricCreator();
17
22
  const beacon = createBeaconMetrics(register);
18
23
  const forkChoice = getForkChoiceMetrics(register);
@@ -24,7 +29,7 @@ export function createMetrics(opts: MetricsOptions, genesisTime: number, externa
24
29
  };
25
30
  process.on("unhandledRejection", onUnhandledRejection);
26
31
 
27
- const nodeJsMetricsClose = collectNodeJSMetrics(register);
32
+ const nodeJsMetricsClose = collectNodeMetrics ? collectNodeJSMetrics(register) : (): void => {};
28
33
  const close = (): void => {
29
34
  process.removeListener("unhandledRejection", onUnhandledRejection);
30
35
  nodeJsMetricsClose();
@@ -8,7 +8,6 @@ import {BeaconConfig} from "@lodestar/config";
8
8
  import type {LoggerNode} from "@lodestar/logger/node";
9
9
  import {ZERO_HASH_HEX} from "@lodestar/params";
10
10
  import {IBeaconStateView, isStatePostBellatrix, isStatePostGloas} from "@lodestar/state-transition";
11
- import {phase0} from "@lodestar/types";
12
11
  import {sleep, toRootHex} from "@lodestar/utils";
13
12
  import {ProcessShutdownCallback} from "@lodestar/validator";
14
13
  import {BeaconRestApiServer, getApi} from "../api/index.js";
@@ -19,7 +18,6 @@ import {initializeExecutionBuilder, initializeExecutionEngine} from "../executio
19
18
  import {HttpMetricsServer, Metrics, createMetrics, getHttpMetricsServer} from "../metrics/index.js";
20
19
  import {MonitoringService} from "../monitoring/index.js";
21
20
  import {Network, getReqRespHandlers} from "../network/index.js";
22
- import {BackfillSync} from "../sync/backfill/index.js";
23
21
  import {BeaconSync, IBeaconSync} from "../sync/index.js";
24
22
  import {Clock} from "../util/clock.js";
25
23
  import {startDeferredVoluntaryExitPublisher} from "./deferredVoluntaryExitPublisher.js";
@@ -38,7 +36,6 @@ export type BeaconNodeModules = {
38
36
  chain: IBeaconChain;
39
37
  api: BeaconApiMethods;
40
38
  sync: IBeaconSync;
41
- backfillSync: BackfillSync | null;
42
39
  metricsServer: HttpMetricsServer | null;
43
40
  monitoring: MonitoringService | null;
44
41
  restApi?: BeaconRestApiServer;
@@ -58,7 +55,6 @@ export type BeaconNodeInitModules = {
58
55
  peerStoreDir?: string;
59
56
  anchorState: IBeaconStateView;
60
57
  isAnchorStateFinalized: boolean;
61
- wsCheckpoint?: phase0.Checkpoint;
62
58
  metricsRegistries?: Registry[];
63
59
  };
64
60
 
@@ -70,7 +66,6 @@ export enum BeaconNodeStatus {
70
66
 
71
67
  enum LoggerModule {
72
68
  api = "api",
73
- backfill = "backfill",
74
69
  chain = "chain",
75
70
  execution = "execution",
76
71
  metrics = "metrics",
@@ -105,7 +100,6 @@ export class BeaconNode {
105
100
  api: BeaconApiMethods;
106
101
  restApi?: BeaconRestApiServer;
107
102
  sync: IBeaconSync;
108
- backfillSync: BackfillSync | null;
109
103
 
110
104
  status: BeaconNodeStatus;
111
105
  private controller?: AbortController;
@@ -123,7 +117,6 @@ export class BeaconNode {
123
117
  api,
124
118
  restApi,
125
119
  sync,
126
- backfillSync,
127
120
  controller,
128
121
  }: BeaconNodeModules) {
129
122
  this.opts = opts;
@@ -138,7 +131,6 @@ export class BeaconNode {
138
131
  this.restApi = restApi;
139
132
  this.network = network;
140
133
  this.sync = sync;
141
- this.backfillSync = backfillSync;
142
134
  this.controller = controller;
143
135
 
144
136
  this.status = BeaconNodeStatus.started;
@@ -161,7 +153,6 @@ export class BeaconNode {
161
153
  peerStoreDir,
162
154
  anchorState,
163
155
  isAnchorStateFinalized,
164
- wsCheckpoint,
165
156
  metricsRegistries = [],
166
157
  }: BeaconNodeInitModules): Promise<T> {
167
158
  if (hasher.name !== "hashtree") {
@@ -295,25 +286,9 @@ export class BeaconNode {
295
286
  chain,
296
287
  metrics,
297
288
  network,
298
- wsCheckpoint,
299
289
  logger: logger.child({module: LoggerModule.sync}),
300
290
  });
301
291
 
302
- const backfillSync =
303
- opts.sync.backfillBatchSize > 0
304
- ? await BackfillSync.init(opts.sync, {
305
- config,
306
- db,
307
- chain,
308
- metrics,
309
- network,
310
- wsCheckpoint,
311
- anchorState,
312
- logger: logger.child({module: LoggerModule.backfill}),
313
- signal,
314
- })
315
- : null;
316
-
317
292
  const api = getApi(opts.api, {
318
293
  config,
319
294
  logger: logger.child({module: LoggerModule.api}),
@@ -361,7 +336,6 @@ export class BeaconNode {
361
336
  api,
362
337
  restApi,
363
338
  sync,
364
- backfillSync,
365
339
  controller,
366
340
  }) as T;
367
341
  }
@@ -373,7 +347,6 @@ export class BeaconNode {
373
347
  if (this.status === BeaconNodeStatus.started) {
374
348
  this.status = BeaconNodeStatus.closing;
375
349
  this.sync.close();
376
- this.backfillSync?.close();
377
350
  if (this.restApi) await this.restApi.close();
378
351
  await this.network.close();
379
352
  if (this.metricsServer) await this.metricsServer.close();
@@ -1,6 +1,6 @@
1
1
  import {routes} from "@lodestar/api";
2
2
  import {BeaconConfig} from "@lodestar/config";
3
- import {Slot, phase0} from "@lodestar/types";
3
+ import {Slot} from "@lodestar/types";
4
4
  import {Logger} from "@lodestar/utils";
5
5
  import {IBeaconChain} from "../chain/index.js";
6
6
  import {IBeaconDb} from "../db/index.js";
@@ -51,5 +51,4 @@ export interface SyncModules {
51
51
  metrics: Metrics | null;
52
52
  logger: Logger;
53
53
  chain: IBeaconChain;
54
- wsCheckpoint?: phase0.Checkpoint;
55
54
  }
@@ -16,12 +16,6 @@ export type SyncOptions = {
16
16
  disableRangeSync?: boolean;
17
17
  /** USE FOR TESTING ONLY. Disable unknown block sync completely */
18
18
  disableBlockInputSync?: boolean;
19
- /**
20
- * The batch size of slots for backfill sync can attempt to sync/process before yielding
21
- * to sync loop. This number can be increased or decreased to make a suitable resource
22
- * allocation to backfill sync. The default of 0 would mean backfill sync will be skipped
23
- */
24
- backfillBatchSize: number;
25
19
  /** For testing only, MAX_PENDING_BLOCKS by default */
26
20
  maxPendingBlocks?: number;
27
21
 
@@ -39,7 +33,5 @@ export type SyncOptions = {
39
33
  export const defaultSyncOptions: SyncOptions = {
40
34
  isSingleNode: false,
41
35
  disableProcessAsChainSegment: false,
42
- /** By default skip the backfill sync */
43
- backfillBatchSize: 0,
44
36
  slotImportTolerance: SLOTS_PER_EPOCH,
45
37
  };
package/src/sync/types.ts CHANGED
@@ -24,9 +24,13 @@ export enum PendingBlockType {
24
24
  */
25
25
  UNKNOWN_PAYLOAD_BLOCK_ROOT = "unknown_payload_block_root",
26
26
  /**
27
- * Same as UNKNOWN_PAYLOAD_BLOCK_ROOT, but the trigger also carries the payload's slot.
27
+ * Same as UNKNOWN_PAYLOAD_BLOCK_ROOT, but the trigger also carries the payload's slot
28
28
  */
29
29
  UNKNOWN_PAYLOAD_BLOCK_ROOT_SLOT = "unknown_payload_block_root_slot",
30
+ /**
31
+ * Same as UNKNOWN_PAYLOAD_BLOCK_ROOT_SLOT for the current slot
32
+ */
33
+ DEFERRED_PAYLOAD_BLOCK_ROOT = "deferred_payload_block_root",
30
34
  /**
31
35
  * Payload analog of INCOMPLETE_BLOCK_INPUT: we have a partial payload input that did not complete in time.
32
36
  */
@@ -53,6 +57,20 @@ export enum FetchResult {
53
57
  FailureMaxAttempts = "failure_max_attempts",
54
58
  }
55
59
 
60
+ /**
61
+ * Outcome of a slot's deferred optimistic payload searches, recorded once when its poll loop ends.
62
+ */
63
+ export enum DeferredPayloadResult {
64
+ /** gossip delivered every watched payload before PAYLOAD_DUE, no search was needed */
65
+ ImportedBeforeSearch = "imported_before_search",
66
+ /** at least one was missing at PAYLOAD_DUE, we searched, and all were imported afterwards */
67
+ ImportedAfterSearch = "imported_after_search",
68
+ /** something was still not in fork choice when the slot ended */
69
+ Unresolved = "unresolved",
70
+ /** the slot had no optimistic search and no payload import at all, eg a skipped slot */
71
+ ResolvedNoRoot = "resolved_no_root",
72
+ }
73
+
56
74
  export enum PendingBlockInputStatus {
57
75
  pending = "pending",
58
76
  fetching = "fetching",
@@ -87,8 +105,6 @@ export enum DroppedItemReason {
87
105
  invalidEnvelope = "invalid_envelope",
88
106
  /** a payload had an invalid signature (INVALID_SIGNATURE) */
89
107
  invalidSignature = "invalid_signature",
90
- /** a block root was given up on after exhausting download attempts (data could not be fetched) */
91
- unavailable = "unavailable",
92
108
  /** an unexpected / unhandled error code led to removal */
93
109
  unknown = "unknown",
94
110
  }