@lodestar/beacon-node 1.50.0-dev.f0b11f836e → 1.50.0-dev.f23b93e9eb
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.
- package/lib/chain/archiveStore/archiveStore.js +1 -1
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -7
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +1 -1
- package/lib/chain/archiveStore/interface.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +1 -1
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +5 -4
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +18 -0
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +7 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -0
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +2 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/options.d.ts +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +2 -0
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +10 -4
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +3 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +13 -13
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +5 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +64 -54
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/disabled.d.ts +0 -2
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +0 -6
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +1 -3
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +2 -17
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -4
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/mock.d.ts +0 -2
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +0 -8
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +0 -8
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics.d.ts +7 -3
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +4 -4
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +25 -3
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/range/batch.d.ts +6 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +10 -0
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +3 -1
- package/lib/sync/range/chain.js.map +1 -1
- package/package.json +16 -16
- package/src/chain/archiveStore/archiveStore.ts +1 -1
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -7
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +1 -1
- package/src/chain/archiveStore/historicalState/types.ts +2 -2
- package/src/chain/archiveStore/historicalState/worker.ts +1 -2
- package/src/chain/archiveStore/interface.ts +1 -1
- package/src/chain/blocks/verifyBlock.ts +1 -0
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -3
- package/src/chain/chain.ts +21 -0
- package/src/chain/emitter.ts +7 -1
- package/src/chain/forkChoice/index.ts +2 -0
- package/src/chain/options.ts +2 -2
- package/src/chain/produceBlock/computeNewStateRoot.ts +1 -1
- package/src/chain/regen/regen.ts +12 -4
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +20 -13
- package/src/chain/validatorMonitor.ts +75 -57
- package/src/execution/engine/disabled.ts +0 -8
- package/src/execution/engine/http.ts +1 -30
- package/src/execution/engine/interface.ts +2 -6
- package/src/execution/engine/mock.ts +1 -19
- package/src/execution/engine/types.ts +0 -10
- package/src/metrics/metrics.ts +21 -6
- package/src/node/nodejs.ts +31 -3
- package/src/sync/range/batch.ts +11 -0
- package/src/sync/range/chain.ts +3 -1
package/src/node/nodejs.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import {setMaxListeners} from "node:events";
|
|
2
2
|
import {PrivateKey} from "@libp2p/interface";
|
|
3
3
|
import {Registry} from "prom-client";
|
|
4
|
+
import {
|
|
5
|
+
init as initNativeMetrics,
|
|
6
|
+
registerLocalValidator as registerNativeLocalValidator,
|
|
7
|
+
scrapeMetrics as scrapeNativeMetrics,
|
|
8
|
+
unregisterLocalValidator as unregisterNativeLocalValidator,
|
|
9
|
+
} from "@chainsafe/lodestar-z/metrics";
|
|
4
10
|
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
5
11
|
import {hasher} from "@chainsafe/persistent-merkle-tree";
|
|
6
12
|
import {BeaconApiMethods} from "@lodestar/api/beacon/server";
|
|
@@ -171,7 +177,13 @@ export class BeaconNode {
|
|
|
171
177
|
// monitoring relies on metrics data
|
|
172
178
|
opts.monitoring.endpoint
|
|
173
179
|
) {
|
|
174
|
-
|
|
180
|
+
if (opts.chain.nativeStateTransition) {
|
|
181
|
+
initNativeMetrics();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
metrics = createMetrics(opts.metrics, anchorState.genesisTime, metricsRegistries, {
|
|
185
|
+
includeStateTransitionMetrics: !opts.chain.nativeStateTransition,
|
|
186
|
+
});
|
|
175
187
|
initBeaconMetrics(metrics, anchorState);
|
|
176
188
|
// Since the db is instantiated before this, metrics must be injected manually afterwards
|
|
177
189
|
db.setMetrics(metrics.db, metrics.flatFileStore);
|
|
@@ -185,7 +197,13 @@ export class BeaconNode {
|
|
|
185
197
|
config,
|
|
186
198
|
anchorState.genesisTime,
|
|
187
199
|
logger.child({module: LoggerModule.vmon}),
|
|
188
|
-
opts.validatorMonitor
|
|
200
|
+
opts.validatorMonitor,
|
|
201
|
+
opts.chain.nativeStateTransition
|
|
202
|
+
? {
|
|
203
|
+
registerLocalValidator: registerNativeLocalValidator,
|
|
204
|
+
unregisterLocalValidator: unregisterNativeLocalValidator,
|
|
205
|
+
}
|
|
206
|
+
: null
|
|
189
207
|
)
|
|
190
208
|
: null;
|
|
191
209
|
|
|
@@ -303,7 +321,17 @@ export class BeaconNode {
|
|
|
303
321
|
const metricsServer = opts.metrics.enabled
|
|
304
322
|
? await getHttpMetricsServer(opts.metrics, {
|
|
305
323
|
register: (metrics as Metrics).register,
|
|
306
|
-
getOtherMetrics: async () =>
|
|
324
|
+
getOtherMetrics: async () => {
|
|
325
|
+
const otherMetrics = await Promise.all([network.scrapeMetrics(), chain.archiveStore.scrapeMetrics()]);
|
|
326
|
+
if (opts.chain.nativeStateTransition) {
|
|
327
|
+
try {
|
|
328
|
+
otherMetrics.push(scrapeNativeMetrics());
|
|
329
|
+
} catch (e) {
|
|
330
|
+
logger.warn("Failed to scrape native state-transition metrics", {}, e as Error);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return otherMetrics;
|
|
334
|
+
},
|
|
307
335
|
logger: logger.child({module: LoggerModule.metrics}),
|
|
308
336
|
})
|
|
309
337
|
: null;
|
package/src/sync/range/batch.ts
CHANGED
|
@@ -773,6 +773,7 @@ export class Batch {
|
|
|
773
773
|
// remove any downloaded blocks and re-attempt
|
|
774
774
|
// TODO(fulu): need to remove the bad blocks from the SeenBlockInputCache
|
|
775
775
|
this.state = {status: BatchStatus.AwaitingDownload, blocks: [], payloadEnvelopes: null};
|
|
776
|
+
this.resetRequests();
|
|
776
777
|
}
|
|
777
778
|
|
|
778
779
|
private onProcessingError(attempt: FailedAttempt): void {
|
|
@@ -784,6 +785,16 @@ export class Batch {
|
|
|
784
785
|
// remove any downloaded blocks and re-attempt
|
|
785
786
|
// TODO(fulu): need to remove the bad blocks from the SeenBlockInputCache
|
|
786
787
|
this.state = {status: BatchStatus.AwaitingDownload, blocks: [], payloadEnvelopes: null};
|
|
788
|
+
this.resetRequests();
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* After a partial download `requests` only cover the data still missing from the downloaded blocks,
|
|
793
|
+
* e.g. a single column. Once those blocks are dropped, request the whole batch again, otherwise
|
|
794
|
+
* every peer fails the retry for lack of blocks to validate the data against.
|
|
795
|
+
*/
|
|
796
|
+
private resetRequests(): void {
|
|
797
|
+
this.requests = this.getRequests([]);
|
|
787
798
|
}
|
|
788
799
|
|
|
789
800
|
/** Helper to construct typed BatchError. Stack traces are correct as the error is thrown above */
|
package/src/sync/range/chain.ts
CHANGED
|
@@ -417,8 +417,10 @@ export class SyncChain {
|
|
|
417
417
|
this.rateLimitBackoffTimeout = setTimeout(
|
|
418
418
|
() => {
|
|
419
419
|
this.rateLimitBackoffTimeout = undefined;
|
|
420
|
-
|
|
420
|
+
// Must run before the downloader, it drops expired peers without triggering a download. If it ran
|
|
421
|
+
// after, a backoff expiring in between would leave the peer idle with no retry scheduled.
|
|
421
422
|
this.scheduleRateLimitBackoffRetry();
|
|
423
|
+
this.triggerBatchDownloader();
|
|
422
424
|
},
|
|
423
425
|
Math.max(0, retryAt - now)
|
|
424
426
|
);
|