@lodestar/beacon-node 1.35.0-dev.fcf8d024ea → 1.35.0-rc.0
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/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -5
- package/lib/api/impl/validator/index.js.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/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -4
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +1 -8
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +7 -1
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +3 -2
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +3 -2
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +5 -3
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts +2 -3
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +5 -6
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/types.d.ts +1 -1
- package/lib/chain/opPools/types.d.ts.map +1 -1
- package/lib/chain/opPools/types.js +1 -1
- package/lib/chain/opPools/types.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +3 -3
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +8 -8
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +8 -9
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.d.ts.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.js +3 -4
- package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.d.ts +4 -6
- package/lib/chain/validation/lightClientOptimisticUpdate.d.ts.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.js +11 -11
- package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +14 -20
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -1
- package/lib/metrics/metrics/lodestar.js +3 -3
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/network.d.ts +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +9 -9
- package/lib/network/network.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +1 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +5 -5
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/clock.d.ts +0 -5
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +0 -3
- package/lib/util/clock.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/validator/index.ts +3 -5
- package/src/chain/archiveStore/historicalState/worker.ts +1 -1
- package/src/chain/blocks/blockInput/blockInput.ts +1 -2
- package/src/chain/blocks/importBlock.ts +10 -4
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +2 -10
- package/src/chain/blocks/writeBlockInputToDb.ts +9 -1
- package/src/chain/chain.ts +13 -2
- package/src/chain/opPools/attestationPool.ts +3 -2
- package/src/chain/opPools/syncCommitteeMessagePool.ts +3 -5
- package/src/chain/opPools/types.ts +1 -1
- package/src/chain/prepareNextSlot.ts +8 -8
- package/src/chain/stateCache/persistentCheckpointsCache.ts +8 -10
- package/src/chain/validation/lightClientFinalityUpdate.ts +3 -4
- package/src/chain/validation/lightClientOptimisticUpdate.ts +11 -12
- package/src/chain/validatorMonitor.ts +17 -27
- package/src/metrics/metrics/lodestar.ts +3 -3
- package/src/network/network.ts +9 -9
- package/src/sync/unknownBlock.ts +5 -5
- package/src/util/clock.ts +0 -8
package/lib/util/clock.d.ts
CHANGED
|
@@ -52,10 +52,6 @@ export type IClock = StrictEventEmitter<EventEmitter, ClockEvents> & {
|
|
|
52
52
|
* Return second from a slot to either toSec or now.
|
|
53
53
|
*/
|
|
54
54
|
secFromSlot(slot: Slot, toSec?: number): number;
|
|
55
|
-
/**
|
|
56
|
-
* Return milliseconds from a slot to either toMs or now.
|
|
57
|
-
*/
|
|
58
|
-
msFromSlot(slot: Slot, toMs?: number): number;
|
|
59
55
|
};
|
|
60
56
|
/**
|
|
61
57
|
* A local clock, the clock time is assumed to be trusted
|
|
@@ -88,7 +84,6 @@ export declare class Clock extends EventEmitter implements IClock {
|
|
|
88
84
|
isCurrentSlotGivenGossipDisparity(slot: Slot): boolean;
|
|
89
85
|
waitForSlot(slot: Slot): Promise<void>;
|
|
90
86
|
secFromSlot(slot: Slot, toSec?: number): number;
|
|
91
|
-
msFromSlot(slot: Slot, toMs?: number): number;
|
|
92
87
|
private onNextSlot;
|
|
93
88
|
private msUntilNextSlot;
|
|
94
89
|
}
|
package/lib/util/clock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../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K,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,qBAAa,KAAM,SAAQ,YAAa,YAAW,MAAM;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,YAAY,CAAS;gBAEjB,EAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAC,EAAE;QAAC,MAAM,EAAE,eAAe,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAC;IAW9G,IAAI,WAAW,IAAI,IAAI,CAOtB;IAED;;;OAGG;IACH,IAAI,8BAA8B,IAAI,IAAI,CAIzC;IAED,IAAI,YAAY,IAAI,KAAK,CAExB;IAED,8EAA8E;IAC9E,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAKnD,8EAA8E;IAC9E,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAKjD;;OAEG;IACH,iCAAiC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAkBhD,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC5C,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,SAAoB,GAAG,MAAM;IAI1D,OAAO,CAAC,UAAU,CAqBhB;IAEF,OAAO,CAAC,eAAe;CAKxB"}
|
package/lib/util/clock.js
CHANGED
|
@@ -112,9 +112,6 @@ export class Clock extends EventEmitter {
|
|
|
112
112
|
secFromSlot(slot, toSec = Date.now() / 1000) {
|
|
113
113
|
return toSec - (this.genesisTime + slot * this.config.SECONDS_PER_SLOT);
|
|
114
114
|
}
|
|
115
|
-
msFromSlot(slot, toMs = Date.now()) {
|
|
116
|
-
return toMs - (this.genesisTime * 1000 + slot * this.config.SLOT_DURATION_MS);
|
|
117
|
-
}
|
|
118
115
|
onNextSlot = (slot) => {
|
|
119
116
|
const clockSlot = slot ?? getCurrentSlot(this.config, this.genesisTime);
|
|
120
117
|
// process multiple clock slots in the case the main thread has been saturated for > SECONDS_PER_SLOT
|
package/lib/util/clock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/util/clock.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAEjG,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,8BAA8B,EAAC,MAAM,2BAA2B,CAAC;AAEzE,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB;;;OAGG;IACH,iCAAmB,CAAA;IACnB;;;OAGG;IACH,mCAAqB,CAAA;AACvB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB;
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/util/clock.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAEjG,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,8BAA8B,EAAC,MAAM,2BAA2B,CAAC;AAEzE,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB;;;OAGG;IACH,iCAAmB,CAAA;IACnB;;;OAGG;IACH,mCAAqB,CAAA;AACvB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB;AA2CD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,YAAY;IAC5B,WAAW,CAAS;IACZ,MAAM,CAAkB;I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
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.35.0-
|
|
14
|
+
"version": "1.35.0-rc.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -134,18 +134,18 @@
|
|
|
134
134
|
"@libp2p/peer-id": "^5.1.0",
|
|
135
135
|
"@libp2p/prometheus-metrics": "^4.3.15",
|
|
136
136
|
"@libp2p/tcp": "^10.1.8",
|
|
137
|
-
"@lodestar/api": "1.35.0-
|
|
138
|
-
"@lodestar/config": "1.35.0-
|
|
139
|
-
"@lodestar/db": "1.35.0-
|
|
140
|
-
"@lodestar/fork-choice": "1.35.0-
|
|
141
|
-
"@lodestar/light-client": "1.35.0-
|
|
142
|
-
"@lodestar/logger": "1.35.0-
|
|
143
|
-
"@lodestar/params": "1.35.0-
|
|
144
|
-
"@lodestar/reqresp": "1.35.0-
|
|
145
|
-
"@lodestar/state-transition": "1.35.0-
|
|
146
|
-
"@lodestar/types": "1.35.0-
|
|
147
|
-
"@lodestar/utils": "1.35.0-
|
|
148
|
-
"@lodestar/validator": "1.35.0-
|
|
137
|
+
"@lodestar/api": "1.35.0-rc.0",
|
|
138
|
+
"@lodestar/config": "1.35.0-rc.0",
|
|
139
|
+
"@lodestar/db": "1.35.0-rc.0",
|
|
140
|
+
"@lodestar/fork-choice": "1.35.0-rc.0",
|
|
141
|
+
"@lodestar/light-client": "1.35.0-rc.0",
|
|
142
|
+
"@lodestar/logger": "1.35.0-rc.0",
|
|
143
|
+
"@lodestar/params": "1.35.0-rc.0",
|
|
144
|
+
"@lodestar/reqresp": "1.35.0-rc.0",
|
|
145
|
+
"@lodestar/state-transition": "1.35.0-rc.0",
|
|
146
|
+
"@lodestar/types": "1.35.0-rc.0",
|
|
147
|
+
"@lodestar/utils": "1.35.0-rc.0",
|
|
148
|
+
"@lodestar/validator": "1.35.0-rc.0",
|
|
149
149
|
"@multiformats/multiaddr": "^12.1.3",
|
|
150
150
|
"datastore-core": "^10.0.2",
|
|
151
151
|
"datastore-fs": "^10.0.6",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
"beacon",
|
|
181
181
|
"blockchain"
|
|
182
182
|
],
|
|
183
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "54ad807aa5800d66681c2dd9cab2a0f9dd2861e6"
|
|
184
184
|
}
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
SyncCommitteeErrorCode,
|
|
67
67
|
} from "../../../chain/errors/index.js";
|
|
68
68
|
import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js";
|
|
69
|
-
import {
|
|
69
|
+
import {SCHEDULER_LOOKAHEAD_FACTOR} from "../../../chain/prepareNextSlot.js";
|
|
70
70
|
import {BlockType, ProduceFullDeneb} from "../../../chain/produceBlock/index.js";
|
|
71
71
|
import {RegenCaller} from "../../../chain/regen/index.js";
|
|
72
72
|
import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
|
|
@@ -108,8 +108,6 @@ export const SYNC_TOLERANCE_EPOCHS = 1;
|
|
|
108
108
|
* Empirically the builder block resolves in ~1 second, and execution block resolves in <500 ms.
|
|
109
109
|
* A cutoff of 2 seconds gives enough time and if there are unexpected delays it ensures we publish
|
|
110
110
|
* in time as proposals post 4 seconds into the slot will likely be orphaned due to proposer boost reorg.
|
|
111
|
-
*
|
|
112
|
-
* TODO GLOAS: re-evaluate cutoff timing
|
|
113
111
|
*/
|
|
114
112
|
const BLOCK_PRODUCTION_RACE_CUTOFF_MS = 2_000;
|
|
115
113
|
/** Overall timeout for execution and block production apis */
|
|
@@ -668,7 +666,7 @@ export function getValidatorApi(
|
|
|
668
666
|
: Promise.reject(new Error("Engine disabled"));
|
|
669
667
|
|
|
670
668
|
// Calculate cutoff time based on start of the slot
|
|
671
|
-
const cutoffMs = Math.max(0, BLOCK_PRODUCTION_RACE_CUTOFF_MS - chain.clock.
|
|
669
|
+
const cutoffMs = Math.max(0, BLOCK_PRODUCTION_RACE_CUTOFF_MS - Math.round(chain.clock.secFromSlot(slot) * 1000));
|
|
672
670
|
|
|
673
671
|
logger.verbose("Block production race (builder vs execution) starting", {
|
|
674
672
|
...loggerContext,
|
|
@@ -1019,7 +1017,7 @@ export function getValidatorApi(
|
|
|
1019
1017
|
let state: CachedBeaconStateAllForks | undefined = undefined;
|
|
1020
1018
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
1021
1019
|
const slotMs = config.SECONDS_PER_SLOT * 1000;
|
|
1022
|
-
const prepareNextSlotLookAheadMs = slotMs
|
|
1020
|
+
const prepareNextSlotLookAheadMs = slotMs / SCHEDULER_LOOKAHEAD_FACTOR;
|
|
1023
1021
|
const toNextEpochMs = msToNextEpoch();
|
|
1024
1022
|
// validators may request next epoch's duties when it's close to next epoch
|
|
1025
1023
|
// this is to avoid missed block proposal due to 0 epoch look ahead
|
|
@@ -2,7 +2,7 @@ import worker from "node:worker_threads";
|
|
|
2
2
|
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
3
3
|
import {Transfer, expose} from "@chainsafe/threads/worker";
|
|
4
4
|
import {chainConfigFromJson, createBeaconConfig} from "@lodestar/config";
|
|
5
|
-
import {LevelDbController} from "@lodestar/db
|
|
5
|
+
import {LevelDbController} from "@lodestar/db";
|
|
6
6
|
import {getNodeLogger} from "@lodestar/logger/node";
|
|
7
7
|
import {BeaconDb} from "../../../db/index.js";
|
|
8
8
|
import {RegistryMetricCreator, collectNodeJSMetrics} from "../../../metrics/index.js";
|
|
@@ -652,8 +652,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
652
652
|
static createFromColumn(
|
|
653
653
|
props: AddColumn & CreateBlockInputMeta & {sampledColumns: ColumnIndex[]; custodyColumns: ColumnIndex[]}
|
|
654
654
|
): BlockInputColumns {
|
|
655
|
-
const hasAllData =
|
|
656
|
-
props.daOutOfRange || props.columnSidecar.kzgCommitments.length === 0 || props.sampledColumns.length === 0;
|
|
655
|
+
const hasAllData = props.sampledColumns.length === 0;
|
|
657
656
|
const state: BlockInputColumnsState = {
|
|
658
657
|
hasBlock: false,
|
|
659
658
|
hasAllData,
|
|
@@ -7,7 +7,14 @@ import {
|
|
|
7
7
|
ForkChoiceErrorCode,
|
|
8
8
|
NotReorgedReason,
|
|
9
9
|
} from "@lodestar/fork-choice";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ForkPostAltair,
|
|
12
|
+
ForkPostElectra,
|
|
13
|
+
ForkSeq,
|
|
14
|
+
INTERVALS_PER_SLOT,
|
|
15
|
+
MAX_SEED_LOOKAHEAD,
|
|
16
|
+
SLOTS_PER_EPOCH,
|
|
17
|
+
} from "@lodestar/params";
|
|
11
18
|
import {
|
|
12
19
|
CachedBeaconStateAltair,
|
|
13
20
|
EpochCache,
|
|
@@ -260,9 +267,8 @@ export async function importBlock(
|
|
|
260
267
|
// We want to track recent blocks coming from gossip, unknown block sync, and API.
|
|
261
268
|
if (delaySec < SLOTS_PER_EPOCH * this.config.SECONDS_PER_SLOT) {
|
|
262
269
|
this.metrics.importBlock.elapsedTimeTillBecomeHead.observe(delaySec);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.metrics.importBlock.setHeadAfterCutoff.inc();
|
|
270
|
+
if (delaySec > this.config.SECONDS_PER_SLOT / INTERVALS_PER_SLOT) {
|
|
271
|
+
this.metrics.importBlock.setHeadAfterFirstInterval.inc();
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
274
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {DataAvailabilityStatus} from "@lodestar/state-transition";
|
|
2
|
-
import {
|
|
2
|
+
import {DAType, IBlockInput} from "./blockInput/index.js";
|
|
3
3
|
|
|
4
4
|
// we can now wait for full 12 seconds because unavailable block sync will try pulling
|
|
5
5
|
// the blobs from the network anyway after 500ms of seeing the block
|
|
@@ -18,15 +18,7 @@ export async function verifyBlocksDataAvailability(
|
|
|
18
18
|
dataAvailabilityStatuses: DataAvailabilityStatus[];
|
|
19
19
|
availableTime: number;
|
|
20
20
|
}> {
|
|
21
|
-
|
|
22
|
-
for (const blockInput of blocks) {
|
|
23
|
-
// block verification is triggered on a verified gossip block so we only need to wait for all data
|
|
24
|
-
if (!blockInput.hasAllData()) {
|
|
25
|
-
promises.push(blockInput.waitForAllData(BLOB_AVAILABILITY_TIMEOUT, signal));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
await Promise.all(promises);
|
|
29
|
-
|
|
21
|
+
await Promise.all(blocks.map((blockInput) => blockInput.waitForAllData(BLOB_AVAILABILITY_TIMEOUT, signal)));
|
|
30
22
|
const availableTime = Math.max(0, Math.max(...blocks.map((blockInput) => blockInput.getTimeComplete())));
|
|
31
23
|
const dataAvailabilityStatuses: DataAvailabilityStatus[] = blocks.map((blockInput) => {
|
|
32
24
|
if (blockInput.type === DAType.PreData) {
|
|
@@ -102,7 +102,15 @@ export async function removeEagerlyPersistedBlockInputs(this: BeaconChain, block
|
|
|
102
102
|
if (!this.forkChoice.hasBlockHex(blockRootHex)) {
|
|
103
103
|
blockToRemove.push(block);
|
|
104
104
|
|
|
105
|
-
if (isBlockInputColumns(blockInput)
|
|
105
|
+
if (isBlockInputColumns(blockInput)) {
|
|
106
|
+
const {custodyColumns} = this.custodyConfig;
|
|
107
|
+
const dataColumnsLen = custodyColumns.length;
|
|
108
|
+
const dataColumnSidecars = blockInput.getCustodyColumns();
|
|
109
|
+
if (dataColumnSidecars.length !== dataColumnsLen) {
|
|
110
|
+
throw Error(
|
|
111
|
+
`Invalid dataColumnSidecars=${dataColumnSidecars.length} for custody expected custodyColumnsLen=${dataColumnsLen}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
106
114
|
dataColumnsToRemove.push(blockRoot);
|
|
107
115
|
} else if (isBlockInputBlobs(blockInput)) {
|
|
108
116
|
const blobSidecars = blockInput.getBlobs();
|
package/src/chain/chain.ts
CHANGED
|
@@ -254,9 +254,20 @@ export class BeaconChain implements IBeaconChain {
|
|
|
254
254
|
if (!clock) clock = new Clock({config, genesisTime: this.genesisTime, signal});
|
|
255
255
|
|
|
256
256
|
this.blacklistedBlocks = new Map((opts.blacklistedBlocks ?? []).map((hex) => [hex, null]));
|
|
257
|
-
|
|
257
|
+
const preAggregateCutOffTime = (2 / 3) * this.config.SECONDS_PER_SLOT;
|
|
258
|
+
this.attestationPool = new AttestationPool(
|
|
259
|
+
config,
|
|
260
|
+
clock,
|
|
261
|
+
preAggregateCutOffTime,
|
|
262
|
+
this.opts?.preaggregateSlotDistance,
|
|
263
|
+
metrics
|
|
264
|
+
);
|
|
258
265
|
this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
|
|
259
|
-
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(
|
|
266
|
+
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(
|
|
267
|
+
clock,
|
|
268
|
+
preAggregateCutOffTime,
|
|
269
|
+
this.opts?.preaggregateSlotDistance
|
|
270
|
+
);
|
|
260
271
|
this.syncContributionAndProofPool = new SyncContributionAndProofPool(clock, metrics, logger);
|
|
261
272
|
|
|
262
273
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
@@ -74,6 +74,7 @@ export class AttestationPool {
|
|
|
74
74
|
constructor(
|
|
75
75
|
private readonly config: ChainForkConfig,
|
|
76
76
|
private readonly clock: IClock,
|
|
77
|
+
private readonly cutOffSecFromSlot: number,
|
|
77
78
|
private readonly preaggregateSlotDistance = 0,
|
|
78
79
|
private readonly metrics: Metrics | null = null
|
|
79
80
|
) {}
|
|
@@ -97,7 +98,7 @@ export class AttestationPool {
|
|
|
97
98
|
* `SignedAggregateAndProof`.
|
|
98
99
|
*
|
|
99
100
|
* If the attestation is too old (low slot) to be included in the pool it is simply dropped
|
|
100
|
-
* and no error is returned. Also if it's at clock slot but come to the pool later than
|
|
101
|
+
* and no error is returned. Also if it's at clock slot but come to the pool later than 2/3
|
|
101
102
|
* of slot time, it's dropped too since it's not helpful for the validator anymore
|
|
102
103
|
*
|
|
103
104
|
* Expects the attestation to be fully validated:
|
|
@@ -125,7 +126,7 @@ export class AttestationPool {
|
|
|
125
126
|
|
|
126
127
|
// Reject gossip attestations in the current slot but come to this pool very late
|
|
127
128
|
// for api attestations, we allow them to be added to the pool
|
|
128
|
-
if (!priority && this.clock.
|
|
129
|
+
if (!priority && this.clock.secFromSlot(slot) > this.cutOffSecFromSlot) {
|
|
129
130
|
return InsertOutcome.Late;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
|
-
import {ChainForkConfig} from "@lodestar/config";
|
|
4
3
|
import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params";
|
|
5
4
|
import {Root, Slot, SubcommitteeIndex, SubnetID, altair} from "@lodestar/types";
|
|
6
5
|
import {MapDef, toRootHex} from "@lodestar/utils";
|
|
@@ -45,8 +44,8 @@ export class SyncCommitteeMessagePool {
|
|
|
45
44
|
private lowestPermissibleSlot = 0;
|
|
46
45
|
|
|
47
46
|
constructor(
|
|
48
|
-
private readonly config: ChainForkConfig,
|
|
49
47
|
private readonly clock: IClock,
|
|
48
|
+
private readonly cutOffSecFromSlot: number,
|
|
50
49
|
private readonly preaggregateSlotDistance = 0
|
|
51
50
|
) {}
|
|
52
51
|
|
|
@@ -69,7 +68,6 @@ export class SyncCommitteeMessagePool {
|
|
|
69
68
|
priority?: boolean
|
|
70
69
|
): InsertOutcome {
|
|
71
70
|
const {slot, beaconBlockRoot} = signature;
|
|
72
|
-
const fork = this.config.getForkName(slot);
|
|
73
71
|
const rootHex = toRootHex(beaconBlockRoot);
|
|
74
72
|
const lowestPermissibleSlot = this.lowestPermissibleSlot;
|
|
75
73
|
|
|
@@ -78,8 +76,8 @@ export class SyncCommitteeMessagePool {
|
|
|
78
76
|
return InsertOutcome.Old;
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
// validator gets SyncCommitteeContribution at
|
|
82
|
-
if (!priority && this.clock.
|
|
79
|
+
// validator gets SyncCommitteeContribution at 2/3 of slot, it's no use to preaggregate later than that time
|
|
80
|
+
if (!priority && this.clock.secFromSlot(slot) > this.cutOffSecFromSlot) {
|
|
83
81
|
return InsertOutcome.Late;
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -13,7 +13,7 @@ export enum InsertOutcome {
|
|
|
13
13
|
Old = "Old",
|
|
14
14
|
/** The pool has reached its limit. No changes were made. */
|
|
15
15
|
ReachLimit = "ReachLimit",
|
|
16
|
-
/** Messages don't bring any value, for example attestations come to the pool at >
|
|
16
|
+
/** Messages don't bring any value, for example attestations come to the pool at > 2/3 of slot. No changes were made */
|
|
17
17
|
Late = "Late",
|
|
18
18
|
/** The data is know, and the new participants have been added to the aggregated signature */
|
|
19
19
|
Aggregated = "Aggregated",
|
|
@@ -22,18 +22,17 @@ import {IBeaconChain} from "./interface.js";
|
|
|
22
22
|
import {getPayloadAttributesForSSE, prepareExecutionPayload} from "./produceBlock/produceBlockBody.js";
|
|
23
23
|
import {RegenCaller} from "./regen/index.js";
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export const PREPARE_NEXT_SLOT_BPS = 6667;
|
|
25
|
+
/* With 12s slot times, this scheduler will run 4s before the start of each slot (`12 / 3 = 4`). */
|
|
26
|
+
export const SCHEDULER_LOOKAHEAD_FACTOR = 3;
|
|
28
27
|
|
|
29
28
|
/* We don't want to do more epoch transition than this */
|
|
30
29
|
const PREPARE_EPOCH_LIMIT = 1;
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* At Bellatrix, if we are responsible for proposing in next slot, we want to prepare payload
|
|
34
|
-
* 4s before the start of next slot
|
|
33
|
+
* 4s (1/3 slot) before the start of next slot
|
|
35
34
|
*
|
|
36
|
-
* For all forks, when clock
|
|
35
|
+
* For all forks, when clock is 1/3 slot before an epoch, we want to prepare for the next epoch
|
|
37
36
|
* transition from our head so that:
|
|
38
37
|
* + validators vote for block head on time through attestation
|
|
39
38
|
* + validators propose blocks on time
|
|
@@ -75,9 +74,10 @@ export class PrepareNextSlotScheduler {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
try {
|
|
78
|
-
// At
|
|
79
|
-
//
|
|
80
|
-
|
|
77
|
+
// At 1/3 slot time before the next slot, we either prepare payload or precompute
|
|
78
|
+
// epoch transition
|
|
79
|
+
const slotMs = this.config.SECONDS_PER_SLOT * 1000;
|
|
80
|
+
await sleep(slotMs - slotMs / SCHEDULER_LOOKAHEAD_FACTOR, this.signal);
|
|
81
81
|
|
|
82
82
|
// calling updateHead() here before we produce a block to reduce reorg possibility
|
|
83
83
|
const {slot: headSlot, blockRoot: headRoot} = this.chain.recomputeForkChoiceHead(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
|
+
import {INTERVALS_PER_SLOT} from "@lodestar/params";
|
|
2
3
|
import {
|
|
3
4
|
CachedBeaconStateAllForks,
|
|
4
5
|
computeStartSlotAtEpoch,
|
|
@@ -58,9 +59,6 @@ type LoadedStateBytesData = {persistedKey: DatastoreKey; stateBytes: Uint8Array}
|
|
|
58
59
|
*/
|
|
59
60
|
export const DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY = 3;
|
|
60
61
|
|
|
61
|
-
// TODO GLOAS: re-evaluate this timing
|
|
62
|
-
const PROCESS_CHECKPOINT_STATES_BPS = 6667;
|
|
63
|
-
|
|
64
62
|
/**
|
|
65
63
|
* An implementation of CheckpointStateCache that keep up to n epoch checkpoint states in memory and persist the rest to disk
|
|
66
64
|
* - If it's more than `maxEpochsInMemory` epochs old, it will persist n last epochs to disk based on the view of the block
|
|
@@ -466,14 +464,14 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
466
464
|
}
|
|
467
465
|
|
|
468
466
|
const blockSlot = state.slot;
|
|
469
|
-
const
|
|
467
|
+
const twoThirdsSlot = (2 * state.config.SECONDS_PER_SLOT) / INTERVALS_PER_SLOT;
|
|
470
468
|
// we always have clock in production, fallback value is only for test
|
|
471
|
-
const
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
474
|
-
//
|
|
475
|
-
// normally it should only persist checkpoint states at
|
|
476
|
-
await sleep(
|
|
469
|
+
const secFromSlot = this.clock?.secFromSlot(blockSlot) ?? twoThirdsSlot;
|
|
470
|
+
const secToTwoThirdsSlot = twoThirdsSlot - secFromSlot;
|
|
471
|
+
if (secToTwoThirdsSlot > 0) {
|
|
472
|
+
// 2/3 of slot is the most free time of every slot, take that chance to persist checkpoint states
|
|
473
|
+
// normally it should only persist checkpoint states at 2/3 of slot 0 of epoch
|
|
474
|
+
await sleep(secToTwoThirdsSlot * 1000, this.signal);
|
|
477
475
|
}
|
|
478
476
|
// at syncing time, it's critical to persist checkpoint states as soon as possible to avoid OOM during unfinality time
|
|
479
477
|
// if node is synced this is not a hot time because block comes late, we'll likely miss attestation already, or the block is orphaned
|
|
@@ -25,10 +25,9 @@ export function validateLightClientFinalityUpdate(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// [IGNORE] The finality_update is received after the block at signature_slot was given enough time to propagate
|
|
28
|
-
// through the network -- i.e. validate that
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
if (updateReceivedTooEarly(config, chain.clock, gossipedFinalityUpdate)) {
|
|
28
|
+
// through the network -- i.e. validate that one-third of finality_update.signature_slot has transpired
|
|
29
|
+
// (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance)
|
|
30
|
+
if (updateReceivedTooEarly(config, chain.genesisTime, gossipedFinalityUpdate)) {
|
|
32
31
|
throw new LightClientError(GossipAction.IGNORE, {
|
|
33
32
|
code: LightClientErrorCode.FINALITY_UPDATE_RECEIVED_TOO_EARLY,
|
|
34
33
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
2
3
|
import {LightClientOptimisticUpdate} from "@lodestar/types";
|
|
3
4
|
import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../../constants/index.js";
|
|
4
5
|
import {assertLightClientServer} from "../../node/utils/lightclient.js";
|
|
5
|
-
import {IClock} from "../../util/clock.js";
|
|
6
6
|
import {GossipAction} from "../errors/index.js";
|
|
7
7
|
import {LightClientError, LightClientErrorCode} from "../errors/lightClientError.js";
|
|
8
8
|
import {IBeaconChain} from "../interface.js";
|
|
@@ -26,10 +26,9 @@ export function validateLightClientOptimisticUpdate(
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// [IGNORE] The optimistic_update is received after the block at signature_slot was given enough time to propagate
|
|
29
|
-
// through the network -- i.e. validate that
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
if (updateReceivedTooEarly(config, chain.clock, gossipedOptimisticUpdate)) {
|
|
29
|
+
// through the network -- i.e. validate that one-third of optimistic_update.signature_slot has transpired
|
|
30
|
+
// (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance)
|
|
31
|
+
if (updateReceivedTooEarly(config, chain.genesisTime, gossipedOptimisticUpdate)) {
|
|
33
32
|
throw new LightClientError(GossipAction.IGNORE, {
|
|
34
33
|
code: LightClientErrorCode.OPTIMISTIC_UPDATE_RECEIVED_TOO_EARLY,
|
|
35
34
|
});
|
|
@@ -49,20 +48,20 @@ export function validateLightClientOptimisticUpdate(
|
|
|
49
48
|
/**
|
|
50
49
|
* Returns true, if the spec condition below triggers an IGNORE.
|
|
51
50
|
*
|
|
52
|
-
* Sig +
|
|
51
|
+
* Sig +1/3 time
|
|
53
52
|
* -----|-----
|
|
54
53
|
* xxx|------- (x is not okay)
|
|
55
54
|
*
|
|
56
55
|
* [IGNORE] The *update is received after the block at signature_slot was given enough time to propagate
|
|
57
|
-
* through the network -- i.e. validate that
|
|
58
|
-
*
|
|
59
|
-
* transpired since the start of `signature_slot`.
|
|
56
|
+
* through the network -- i.e. validate that one-third of *update.signature_slot has transpired
|
|
57
|
+
* (SECONDS_PER_SLOT / INTERVALS_PER_SLOT seconds after the start of the slot, with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance)
|
|
60
58
|
*/
|
|
61
59
|
export function updateReceivedTooEarly(
|
|
62
60
|
config: ChainForkConfig,
|
|
63
|
-
|
|
61
|
+
genesisTime: number,
|
|
64
62
|
update: Pick<LightClientOptimisticUpdate, "signatureSlot">
|
|
65
63
|
): boolean {
|
|
66
|
-
const
|
|
67
|
-
|
|
64
|
+
const signatureSlot13TimestampMs = computeTimeAtSlot(config, update.signatureSlot + 1 / 3, genesisTime) * 1000;
|
|
65
|
+
const earliestAllowedTimestampMs = signatureSlot13TimestampMs - MAXIMUM_GOSSIP_CLOCK_DISPARITY;
|
|
66
|
+
return Date.now() < earliestAllowedTimestampMs;
|
|
68
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {ForkSeq, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
1
|
+
import {ChainConfig, ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {ForkSeq, INTERVALS_PER_SLOT, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
4
|
CachedBeaconStateAllForks,
|
|
5
5
|
CachedBeaconStateAltair,
|
|
@@ -34,9 +34,8 @@ const MAX_CACHED_EPOCHS = 4;
|
|
|
34
34
|
|
|
35
35
|
const MAX_CACHED_DISTINCT_TARGETS = 4;
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const LATE_BLOCK_SUBMISSION_BPS = 2500;
|
|
37
|
+
const INTERVALS_LATE_ATTESTATION_SUBMISSION = 1.5;
|
|
38
|
+
const INTERVALS_LATE_BLOCK_SUBMISSION = 0.75;
|
|
40
39
|
|
|
41
40
|
const RETAIN_REGISTERED_VALIDATORS_MS = 1 * 3600 * 1000; // 1 hour
|
|
42
41
|
|
|
@@ -451,11 +450,8 @@ export function createValidatorMonitor(
|
|
|
451
450
|
|
|
452
451
|
onPoolSubmitUnaggregatedAttestation(seenTimestampSec, indexedAttestation, subnet, sentPeers) {
|
|
453
452
|
const data = indexedAttestation.data;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const delaySec =
|
|
457
|
-
seenTimestampSec -
|
|
458
|
-
(genesisTime + data.slot * config.SECONDS_PER_SLOT + config.getAttestationDueMs(fork) / 1000);
|
|
453
|
+
// Returns the duration between when the attestation `data` could be produced (1/3rd through the slot) and `seenTimestamp`.
|
|
454
|
+
const delaySec = seenTimestampSec - (genesisTime + (data.slot + 1 / 3) * config.SECONDS_PER_SLOT);
|
|
459
455
|
for (const index of indexedAttestation.attestingIndices) {
|
|
460
456
|
const validator = validators.get(index);
|
|
461
457
|
if (validator) {
|
|
@@ -487,11 +483,8 @@ export function createValidatorMonitor(
|
|
|
487
483
|
const src = OpSource.gossip;
|
|
488
484
|
const data = indexedAttestation.data;
|
|
489
485
|
const epoch = computeEpochAtSlot(data.slot);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
const delaySec =
|
|
493
|
-
seenTimestampSec -
|
|
494
|
-
(genesisTime + data.slot * config.SECONDS_PER_SLOT + config.getAttestationDueMs(fork) / 1000);
|
|
486
|
+
// Returns the duration between when the attestation `data` could be produced (1/3rd through the slot) and `seenTimestamp`.
|
|
487
|
+
const delaySec = seenTimestampSec - (genesisTime + (data.slot + 1 / 3) * config.SECONDS_PER_SLOT);
|
|
495
488
|
|
|
496
489
|
for (const index of indexedAttestation.attestingIndices) {
|
|
497
490
|
const validator = validators.get(index);
|
|
@@ -507,10 +500,8 @@ export function createValidatorMonitor(
|
|
|
507
500
|
|
|
508
501
|
onPoolSubmitAggregatedAttestation(seenTimestampSec, indexedAttestation, sentPeers) {
|
|
509
502
|
const data = indexedAttestation.data;
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const delaySec =
|
|
513
|
-
seenTimestampSec - (genesisTime + data.slot * config.SECONDS_PER_SLOT + config.getAggregateDueMs(fork) / 1000);
|
|
503
|
+
// Returns the duration between when a `AggregateAndproof` with `data` could be produced (2/3rd through the slot) and `seenTimestamp`.
|
|
504
|
+
const delaySec = seenTimestampSec - (genesisTime + (data.slot + 2 / 3) * config.SECONDS_PER_SLOT);
|
|
514
505
|
|
|
515
506
|
for (const index of indexedAttestation.attestingIndices) {
|
|
516
507
|
const validator = validators.get(index);
|
|
@@ -536,10 +527,8 @@ export function createValidatorMonitor(
|
|
|
536
527
|
const src = OpSource.gossip;
|
|
537
528
|
const data = indexedAttestation.data;
|
|
538
529
|
const epoch = computeEpochAtSlot(data.slot);
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const delaySec =
|
|
542
|
-
seenTimestampSec - (genesisTime + data.slot * config.SECONDS_PER_SLOT + config.getAggregateDueMs(fork) / 1000);
|
|
530
|
+
// Returns the duration between when a `AggregateAndProof` with `data` could be produced (2/3rd through the slot) and `seenTimestamp`.
|
|
531
|
+
const delaySec = seenTimestampSec - (genesisTime + (data.slot + 2 / 3) * config.SECONDS_PER_SLOT);
|
|
543
532
|
|
|
544
533
|
const aggregatorIndex = signedAggregateAndProof.message.aggregatorIndex;
|
|
545
534
|
const validatorAggregator = validators.get(aggregatorIndex);
|
|
@@ -833,7 +822,7 @@ export function createValidatorMonitor(
|
|
|
833
822
|
* - Was the attestation seen in a block?
|
|
834
823
|
*/
|
|
835
824
|
function renderAttestationSummary(
|
|
836
|
-
config:
|
|
825
|
+
config: ChainConfig,
|
|
837
826
|
rootCache: RootHexCache,
|
|
838
827
|
summary: AttestationSummary | undefined,
|
|
839
828
|
flags: ParticipationFlags
|
|
@@ -936,7 +925,8 @@ function renderAttestationSummary(
|
|
|
936
925
|
}
|
|
937
926
|
|
|
938
927
|
const submittedLate =
|
|
939
|
-
summary.poolSubmitDelayMinSec >
|
|
928
|
+
summary.poolSubmitDelayMinSec >
|
|
929
|
+
(INTERVALS_LATE_ATTESTATION_SUBMISSION * config.SECONDS_PER_SLOT) / INTERVALS_PER_SLOT;
|
|
940
930
|
|
|
941
931
|
const aggregateInclusion = summary.aggregateInclusionDelaysSec.length > 0;
|
|
942
932
|
|
|
@@ -1040,7 +1030,7 @@ function isMissedSlot(rootCache: RootHexCache, slot: Slot): boolean {
|
|
|
1040
1030
|
}
|
|
1041
1031
|
|
|
1042
1032
|
function renderBlockProposalSummary(
|
|
1043
|
-
config:
|
|
1033
|
+
config: ChainConfig,
|
|
1044
1034
|
rootCache: RootHexCache,
|
|
1045
1035
|
summary: EpochSummary | undefined,
|
|
1046
1036
|
proposalSlot: Slot
|
|
@@ -1063,7 +1053,7 @@ function renderBlockProposalSummary(
|
|
|
1063
1053
|
|
|
1064
1054
|
if (
|
|
1065
1055
|
proposal.poolSubmitDelaySec !== null &&
|
|
1066
|
-
proposal.poolSubmitDelaySec > config.
|
|
1056
|
+
proposal.poolSubmitDelaySec > (INTERVALS_LATE_BLOCK_SUBMISSION * config.SECONDS_PER_SLOT) / INTERVALS_PER_SLOT
|
|
1067
1057
|
) {
|
|
1068
1058
|
out += "_late";
|
|
1069
1059
|
}
|
|
@@ -862,9 +862,9 @@ export function createLodestarMetrics(
|
|
|
862
862
|
help: "Time elapsed between block slot time and the time block becomes head",
|
|
863
863
|
buckets: [0.5, 1, 2, 4, 6, 12],
|
|
864
864
|
}),
|
|
865
|
-
|
|
866
|
-
name: "
|
|
867
|
-
help: "Total times an imported block is set as head after
|
|
865
|
+
setHeadAfterFirstInterval: register.gauge({
|
|
866
|
+
name: "lodestar_import_block_set_head_after_first_interval_total",
|
|
867
|
+
help: "Total times an imported block is set as head after the first slot interval",
|
|
868
868
|
}),
|
|
869
869
|
bySource: register.gauge<{source: BlockInputSource}>({
|
|
870
870
|
name: "lodestar_import_block_by_source_total",
|