@lodestar/beacon-node 1.39.0-dev.ad23ef56aa → 1.39.0-dev.addea91de2
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/beacon/state/utils.d.ts +2 -7
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +0 -12
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/lodestar/index.js +1 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/proof/index.d.ts.map +1 -1
- package/lib/api/impl/proof/index.js +1 -2
- package/lib/api/impl/proof/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +1 -3
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +8 -2
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/chain.d.ts +3 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +16 -6
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/lightClient/proofs.d.ts.map +1 -1
- package/lib/chain/lightClient/proofs.js +0 -2
- package/lib/chain/lightClient/proofs.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +2 -3
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +5 -130
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.js +5 -8
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +4 -7
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +1 -5
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/queued.d.ts +4 -7
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +15 -25
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +1 -1
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +13 -17
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +5 -12
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +12 -50
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
- package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -6
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +17 -17
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +5 -6
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/db/repositories/stateArchive.d.ts +1 -1
- package/lib/db/repositories/stateArchive.d.ts.map +1 -1
- package/lib/db/repositories/stateArchive.js +2 -2
- package/lib/db/repositories/stateArchive.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +9 -6
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +34 -7
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -6
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +3 -17
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +17 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/state/utils.ts +2 -22
- package/src/api/impl/lodestar/index.ts +1 -1
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +1 -3
- package/src/chain/blocks/importBlock.ts +9 -2
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
- package/src/chain/chain.ts +20 -9
- package/src/chain/interface.ts +2 -2
- package/src/chain/lightClient/proofs.ts +0 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +6 -181
- package/src/chain/opPools/opPool.ts +5 -7
- package/src/chain/prepareNextSlot.ts +2 -6
- package/src/chain/regen/interface.ts +1 -5
- package/src/chain/regen/queued.ts +15 -34
- package/src/chain/regen/regen.ts +12 -18
- package/src/chain/shufflingCache.ts +15 -61
- package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
- package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
- package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
- package/src/chain/stateCache/persistentCheckpointsCache.ts +17 -25
- package/src/chain/stateCache/types.ts +5 -10
- package/src/db/repositories/stateArchive.ts +2 -2
- package/src/execution/engine/mock.ts +40 -13
- package/src/metrics/metrics/lodestar.ts +3 -17
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
- package/src/node/nodejs.ts +18 -3
- package/src/util/sszBytes.ts +1 -1
package/src/chain/regen/regen.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// Otherwise, get the state normally.
|
|
81
|
-
return this.getState(parentBlock.stateRoot, regenCaller,
|
|
81
|
+
return this.getState(parentBlock.stateRoot, regenCaller, allowDiskReload);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -124,8 +124,8 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
124
124
|
const {checkpointStateCache} = this.modules;
|
|
125
125
|
const epoch = computeEpochAtSlot(slot);
|
|
126
126
|
const latestCheckpointStateCtx = allowDiskReload
|
|
127
|
-
? await checkpointStateCache.getOrReloadLatest(blockRoot, epoch
|
|
128
|
-
: checkpointStateCache.getLatest(blockRoot, epoch
|
|
127
|
+
? await checkpointStateCache.getOrReloadLatest(blockRoot, epoch)
|
|
128
|
+
: checkpointStateCache.getLatest(blockRoot, epoch);
|
|
129
129
|
|
|
130
130
|
// If a checkpoint state exists with the given checkpoint root, it either is in requested epoch
|
|
131
131
|
// or needs to have empty slots processed until the requested epoch
|
|
@@ -136,7 +136,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
136
136
|
// Otherwise, use the fork choice to get the stateRoot from block at the checkpoint root
|
|
137
137
|
// regenerate that state,
|
|
138
138
|
// then process empty slots until the requested epoch
|
|
139
|
-
const blockStateCtx = await this.getState(block.stateRoot, regenCaller,
|
|
139
|
+
const blockStateCtx = await this.getState(block.stateRoot, regenCaller, allowDiskReload);
|
|
140
140
|
return processSlotsByCheckpoint(this.modules, blockStateCtx, slot, regenCaller, opts);
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -148,23 +148,15 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
148
148
|
async getState(
|
|
149
149
|
stateRoot: RootHex,
|
|
150
150
|
caller: RegenCaller,
|
|
151
|
-
opts?: StateRegenerationOpts,
|
|
152
151
|
// internal option, don't want to expose to external caller
|
|
153
152
|
allowDiskReload = false
|
|
154
153
|
): Promise<CachedBeaconStateAllForks> {
|
|
155
154
|
// Trivial case, state at stateRoot is already cached
|
|
156
|
-
const cachedStateCtx = this.modules.blockStateCache.get(stateRoot
|
|
155
|
+
const cachedStateCtx = this.modules.blockStateCache.get(stateRoot);
|
|
157
156
|
if (cachedStateCtx) {
|
|
158
157
|
return cachedStateCtx;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
// in block gossip validation (getPreState() call), dontTransferCache is specified as true because we only want to transfer cache in verifyBlocksStateTransitionOnly()
|
|
162
|
-
// but here we want to process blocks as fast as possible so force to transfer cache in this case
|
|
163
|
-
if (opts && allowDiskReload) {
|
|
164
|
-
// if there is no `opts` specified, it already means "false"
|
|
165
|
-
opts.dontTransferCache = false;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
160
|
// Otherwise we have to use the fork choice to traverse backwards, block by block,
|
|
169
161
|
// searching the state caches
|
|
170
162
|
// then replay blocks forward to the desired stateRoot
|
|
@@ -179,7 +171,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
179
171
|
const getSeedStateTimer = this.modules.metrics?.regenGetState.getSeedState.startTimer({caller});
|
|
180
172
|
// iterateAncestorBlocks only returns ancestor blocks, not the block itself
|
|
181
173
|
for (const b of this.modules.forkChoice.iterateAncestorBlocks(block.blockRoot)) {
|
|
182
|
-
state = this.modules.blockStateCache.get(b.stateRoot
|
|
174
|
+
state = this.modules.blockStateCache.get(b.stateRoot);
|
|
183
175
|
if (state) {
|
|
184
176
|
break;
|
|
185
177
|
}
|
|
@@ -187,8 +179,8 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
187
179
|
if (!lastBlockToReplay) continue;
|
|
188
180
|
const epoch = computeEpochAtSlot(lastBlockToReplay.slot - 1);
|
|
189
181
|
state = allowDiskReload
|
|
190
|
-
? await checkpointStateCache.getOrReloadLatest(b.blockRoot, epoch
|
|
191
|
-
: checkpointStateCache.getLatest(b.blockRoot, epoch
|
|
182
|
+
? await checkpointStateCache.getOrReloadLatest(b.blockRoot, epoch)
|
|
183
|
+
: checkpointStateCache.getLatest(b.blockRoot, epoch);
|
|
192
184
|
if (state) {
|
|
193
185
|
break;
|
|
194
186
|
}
|
|
@@ -255,6 +247,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
255
247
|
try {
|
|
256
248
|
// Only advances state trusting block's signture and hashes.
|
|
257
249
|
// We are only running the state transition to get a specific state's data.
|
|
250
|
+
// stateTransition() does the clone() inside, transfer cache to make the regen faster
|
|
258
251
|
state = stateTransition(
|
|
259
252
|
state,
|
|
260
253
|
block,
|
|
@@ -265,6 +258,7 @@ export class StateRegenerator implements IStateRegeneratorInternal {
|
|
|
265
258
|
verifyStateRoot: false,
|
|
266
259
|
verifyProposer: false,
|
|
267
260
|
verifySignatures: false,
|
|
261
|
+
dontTransferCache: false,
|
|
268
262
|
},
|
|
269
263
|
this.modules
|
|
270
264
|
);
|
|
@@ -390,8 +384,8 @@ export async function processSlotsToNearestCheckpoint(
|
|
|
390
384
|
const checkpointState = postState;
|
|
391
385
|
const cp = getCheckpointFromState(checkpointState);
|
|
392
386
|
checkpointStateCache.add(cp, checkpointState);
|
|
393
|
-
// consumers should not mutate
|
|
394
|
-
emitter?.emit(ChainEvent.checkpoint, cp, checkpointState
|
|
387
|
+
// consumers should not mutate state ever
|
|
388
|
+
emitter?.emit(ChainEvent.checkpoint, cp, checkpointState);
|
|
395
389
|
|
|
396
390
|
if (count >= 1) {
|
|
397
391
|
// in normal condition, we only process 1 epoch so never reach this
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BeaconStateAllForks,
|
|
3
|
-
EpochShuffling,
|
|
4
|
-
IShufflingCache,
|
|
5
|
-
ShufflingBuildProps,
|
|
6
|
-
computeEpochShuffling,
|
|
7
|
-
computeEpochShufflingAsync,
|
|
8
|
-
} from "@lodestar/state-transition";
|
|
1
|
+
import {CachedBeaconStateAllForks, EpochShuffling} from "@lodestar/state-transition";
|
|
9
2
|
import {Epoch, RootHex} from "@lodestar/types";
|
|
10
3
|
import {LodestarError, Logger, MapDef, pruneSetToMax} from "@lodestar/utils";
|
|
11
4
|
import {Metrics} from "../metrics/metrics.js";
|
|
@@ -53,7 +46,7 @@ export type ShufflingCacheOpts = {
|
|
|
53
46
|
* - if a shuffling is not available (which does not happen with default chain option of maxSkipSlots = 32), track a promise to make sure we don't compute the same shuffling twice
|
|
54
47
|
* - skip computing shuffling when loading state bytes from disk
|
|
55
48
|
*/
|
|
56
|
-
export class ShufflingCache
|
|
49
|
+
export class ShufflingCache {
|
|
57
50
|
/** LRU cache implemented as a map, pruned every time we add an item */
|
|
58
51
|
private readonly itemsByDecisionRootByEpoch: MapDef<Epoch, Map<RootHex, CacheItem>> = new MapDef(
|
|
59
52
|
() => new Map<RootHex, CacheItem>()
|
|
@@ -136,60 +129,20 @@ export class ShufflingCache implements IShufflingCache {
|
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* NOTE: If a shuffling is already queued and not calculated it will build and resolve
|
|
143
|
-
* the promise but the already queued build will happen at some later time
|
|
132
|
+
* Process a state to extract and cache all shufflings (previous, current, next).
|
|
133
|
+
* Uses the stored decision roots from epochCtx.
|
|
144
134
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
decisionRoot: RootHex,
|
|
148
|
-
buildProps?: T
|
|
149
|
-
): T extends ShufflingBuildProps ? EpochShuffling : EpochShuffling | null {
|
|
150
|
-
const cacheItem = this.itemsByDecisionRootByEpoch.getOrDefault(epoch).get(decisionRoot);
|
|
151
|
-
if (!cacheItem) {
|
|
152
|
-
this.metrics?.shufflingCache.miss.inc();
|
|
153
|
-
} else if (isShufflingCacheItem(cacheItem)) {
|
|
154
|
-
this.metrics?.shufflingCache.hit.inc();
|
|
155
|
-
return cacheItem.shuffling;
|
|
156
|
-
} else if (buildProps) {
|
|
157
|
-
// TODO: (@matthewkeil) This should possible log a warning??
|
|
158
|
-
this.metrics?.shufflingCache.shufflingPromiseNotResolvedAndThrownAway.inc();
|
|
159
|
-
} else {
|
|
160
|
-
this.metrics?.shufflingCache.shufflingPromiseNotResolved.inc();
|
|
161
|
-
}
|
|
135
|
+
processState(state: CachedBeaconStateAllForks): void {
|
|
136
|
+
const {epochCtx} = state;
|
|
162
137
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const timer = this.metrics?.shufflingCache.shufflingCalculationTime.startTimer({source: "getSync"});
|
|
166
|
-
shuffling = computeEpochShuffling(buildProps.state, buildProps.activeIndices, epoch);
|
|
167
|
-
timer?.();
|
|
168
|
-
this.set(shuffling, decisionRoot);
|
|
169
|
-
}
|
|
170
|
-
return shuffling as T extends ShufflingBuildProps ? EpochShuffling : EpochShuffling | null;
|
|
171
|
-
}
|
|
138
|
+
// Cache previous shuffling
|
|
139
|
+
this.set(epochCtx.previousShuffling, epochCtx.previousDecisionRoot);
|
|
172
140
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
/**
|
|
179
|
-
* TODO: (@matthewkeil) This will get replaced by a proper build queue and a worker to do calculations
|
|
180
|
-
* on a NICE thread
|
|
181
|
-
*/
|
|
182
|
-
const timer = this.metrics?.shufflingCache.shufflingCalculationTime.startTimer({source: "build"});
|
|
183
|
-
computeEpochShufflingAsync(state, activeIndices, epoch)
|
|
184
|
-
.then((shuffling) => {
|
|
185
|
-
this.set(shuffling, decisionRoot);
|
|
186
|
-
})
|
|
187
|
-
.catch((err) =>
|
|
188
|
-
this.logger?.error(`error building shuffling for epoch ${epoch} at decisionRoot ${decisionRoot}`, {}, err)
|
|
189
|
-
)
|
|
190
|
-
.finally(() => {
|
|
191
|
-
timer?.();
|
|
192
|
-
});
|
|
141
|
+
// Cache current shuffling
|
|
142
|
+
this.set(epochCtx.currentShuffling, epochCtx.currentDecisionRoot);
|
|
143
|
+
|
|
144
|
+
// Cache next shuffling
|
|
145
|
+
this.set(epochCtx.nextShuffling, epochCtx.nextDecisionRoot);
|
|
193
146
|
}
|
|
194
147
|
|
|
195
148
|
/**
|
|
@@ -207,7 +160,8 @@ export class ShufflingCache implements IShufflingCache {
|
|
|
207
160
|
(Date.now() - cacheItem.timeInsertedMs) / 1000
|
|
208
161
|
);
|
|
209
162
|
} else {
|
|
210
|
-
this.metrics?.shufflingCache.
|
|
163
|
+
this.metrics?.shufflingCache.shufflingSetMultipleTimes.inc();
|
|
164
|
+
return;
|
|
211
165
|
}
|
|
212
166
|
}
|
|
213
167
|
// set the shuffling
|
|
@@ -3,7 +3,6 @@ import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
|
3
3
|
import {Epoch, RootHex} from "@lodestar/types";
|
|
4
4
|
import {toRootHex} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/index.js";
|
|
6
|
-
import {StateRegenerationOpts} from "../regen/interface.js";
|
|
7
6
|
import {MapTracker} from "./mapMetrics.js";
|
|
8
7
|
import {BlockStateCache} from "./types.js";
|
|
9
8
|
|
|
@@ -39,7 +38,7 @@ export class BlockStateCacheImpl implements BlockStateCache {
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
get(rootHex: RootHex
|
|
41
|
+
get(rootHex: RootHex): CachedBeaconStateAllForks | null {
|
|
43
42
|
this.metrics?.lookups.inc();
|
|
44
43
|
const item = this.head?.stateRoot === rootHex ? this.head.state : this.cache.get(rootHex);
|
|
45
44
|
if (!item) {
|
|
@@ -49,7 +48,7 @@ export class BlockStateCacheImpl implements BlockStateCache {
|
|
|
49
48
|
this.metrics?.hits.inc();
|
|
50
49
|
this.metrics?.stateClonedCount.observe(item.clonedCount);
|
|
51
50
|
|
|
52
|
-
return item
|
|
51
|
+
return item;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
add(item: CachedBeaconStateAllForks): void {
|
|
@@ -4,7 +4,6 @@ import {RootHex} from "@lodestar/types";
|
|
|
4
4
|
import {toRootHex} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/index.js";
|
|
6
6
|
import {LinkedList} from "../../util/array.js";
|
|
7
|
-
import {StateRegenerationOpts} from "../regen/interface.js";
|
|
8
7
|
import {MapTracker} from "./mapMetrics.js";
|
|
9
8
|
import {BlockStateCache} from "./types.js";
|
|
10
9
|
|
|
@@ -86,14 +85,14 @@ export class FIFOBlockStateCache implements BlockStateCache {
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
const firstState = firstValue.value;
|
|
89
|
-
//
|
|
90
|
-
return firstState
|
|
88
|
+
// consumers should not mutate the returned state
|
|
89
|
+
return firstState;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
/**
|
|
94
93
|
* Get a state from this cache given a state root hex.
|
|
95
94
|
*/
|
|
96
|
-
get(rootHex: RootHex
|
|
95
|
+
get(rootHex: RootHex): CachedBeaconStateAllForks | null {
|
|
97
96
|
this.metrics?.lookups.inc();
|
|
98
97
|
const item = this.cache.get(rootHex);
|
|
99
98
|
if (!item) {
|
|
@@ -103,7 +102,7 @@ export class FIFOBlockStateCache implements BlockStateCache {
|
|
|
103
102
|
this.metrics?.hits.inc();
|
|
104
103
|
this.metrics?.stateClonedCount.observe(item.clonedCount);
|
|
105
104
|
|
|
106
|
-
return item
|
|
105
|
+
return item;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
/**
|
|
@@ -3,7 +3,6 @@ import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
|
3
3
|
import {Epoch, RootHex, phase0} from "@lodestar/types";
|
|
4
4
|
import {MapDef, toRootHex} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/index.js";
|
|
6
|
-
import {StateRegenerationOpts} from "../regen/interface.js";
|
|
7
6
|
import {MapTracker} from "./mapMetrics.js";
|
|
8
7
|
import {CacheItemType, CheckpointStateCache} from "./types.js";
|
|
9
8
|
|
|
@@ -42,21 +41,16 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache {
|
|
|
42
41
|
this.maxEpochs = maxEpochs;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
async getOrReload(cp: CheckpointHex
|
|
46
|
-
return this.get(cp
|
|
44
|
+
async getOrReload(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | null> {
|
|
45
|
+
return this.get(cp);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
async getStateOrBytes(cp: CheckpointHex): Promise<Uint8Array | CachedBeaconStateAllForks | null> {
|
|
50
|
-
|
|
51
|
-
return this.get(cp, {dontTransferCache: true});
|
|
49
|
+
return this.get(cp);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
async getOrReloadLatest(
|
|
55
|
-
rootHex
|
|
56
|
-
maxEpoch: number,
|
|
57
|
-
opts?: StateRegenerationOpts
|
|
58
|
-
): Promise<CachedBeaconStateAllForks | null> {
|
|
59
|
-
return this.getLatest(rootHex, maxEpoch, opts);
|
|
52
|
+
async getOrReloadLatest(rootHex: string, maxEpoch: number): Promise<CachedBeaconStateAllForks | null> {
|
|
53
|
+
return this.getLatest(rootHex, maxEpoch);
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
async processState(): Promise<number> {
|
|
@@ -64,7 +58,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache {
|
|
|
64
58
|
return 0;
|
|
65
59
|
}
|
|
66
60
|
|
|
67
|
-
get(cp: CheckpointHex
|
|
61
|
+
get(cp: CheckpointHex): CachedBeaconStateAllForks | null {
|
|
68
62
|
this.metrics?.lookups.inc();
|
|
69
63
|
const cpKey = toCheckpointKey(cp);
|
|
70
64
|
const item = this.cache.get(cpKey);
|
|
@@ -81,7 +75,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache {
|
|
|
81
75
|
|
|
82
76
|
this.metrics?.stateClonedCount.observe(item.clonedCount);
|
|
83
77
|
|
|
84
|
-
return item
|
|
78
|
+
return item;
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
add(cp: phase0.Checkpoint, item: CachedBeaconStateAllForks): void {
|
|
@@ -98,14 +92,14 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache {
|
|
|
98
92
|
/**
|
|
99
93
|
* Searches for the latest cached state with a `root`, starting with `epoch` and descending
|
|
100
94
|
*/
|
|
101
|
-
getLatest(rootHex: RootHex, maxEpoch: Epoch
|
|
95
|
+
getLatest(rootHex: RootHex, maxEpoch: Epoch): CachedBeaconStateAllForks | null {
|
|
102
96
|
// sort epochs in descending order, only consider epochs lte `epoch`
|
|
103
97
|
const epochs = Array.from(this.epochIndex.keys())
|
|
104
98
|
.sort((a, b) => b - a)
|
|
105
99
|
.filter((e) => e <= maxEpoch);
|
|
106
100
|
for (const epoch of epochs) {
|
|
107
101
|
if (this.epochIndex.get(epoch)?.has(rootHex)) {
|
|
108
|
-
return this.get({rootHex, epoch}
|
|
102
|
+
return this.get({rootHex, epoch});
|
|
109
103
|
}
|
|
110
104
|
}
|
|
111
105
|
return null;
|
|
@@ -11,7 +11,6 @@ import {Logger, MapDef, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils"
|
|
|
11
11
|
import {Metrics} from "../../metrics/index.js";
|
|
12
12
|
import {AllocSource, BufferPool, BufferWithKey} from "../../util/bufferPool.js";
|
|
13
13
|
import {IClock} from "../../util/clock.js";
|
|
14
|
-
import {StateRegenerationOpts} from "../regen/interface.js";
|
|
15
14
|
import {serializeState} from "../serializeState.js";
|
|
16
15
|
import {CPStateDatastore, DatastoreKey} from "./datastore/index.js";
|
|
17
16
|
import {MapTracker} from "./mapMetrics.js";
|
|
@@ -204,10 +203,10 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
204
203
|
* - Get block for processing
|
|
205
204
|
* - Regen head state
|
|
206
205
|
*/
|
|
207
|
-
async getOrReload(cp: CheckpointHex
|
|
208
|
-
const stateOrStateBytesData = await this.getStateOrLoadDb(cp
|
|
206
|
+
async getOrReload(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | null> {
|
|
207
|
+
const stateOrStateBytesData = await this.getStateOrLoadDb(cp);
|
|
209
208
|
if (stateOrStateBytesData === null || isCachedBeaconState(stateOrStateBytesData)) {
|
|
210
|
-
return stateOrStateBytesData
|
|
209
|
+
return stateOrStateBytesData ?? null;
|
|
211
210
|
}
|
|
212
211
|
const {persistedKey, stateBytes} = stateOrStateBytesData;
|
|
213
212
|
const logMeta = {persistedKey: toHex(persistedKey)};
|
|
@@ -233,7 +232,8 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
233
232
|
sszTimer?.();
|
|
234
233
|
const timer = this.metrics?.cpStateCache.stateReloadDuration.startTimer();
|
|
235
234
|
const newCachedState = loadCachedBeaconState(seedState, stateBytes, {}, validatorsBytes);
|
|
236
|
-
|
|
235
|
+
// hashTreeRoot() calls the commit() inside
|
|
236
|
+
// there is no modification inside the state, it's just that we want to compute and cache all roots
|
|
237
237
|
const stateRoot = toRootHex(newCachedState.hashTreeRoot());
|
|
238
238
|
timer?.();
|
|
239
239
|
|
|
@@ -252,7 +252,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
252
252
|
this.cache.set(cpKey, {type: CacheItemType.inMemory, state: newCachedState, persistedKey});
|
|
253
253
|
this.epochIndex.getOrDefault(cp.epoch).add(cp.rootHex);
|
|
254
254
|
// don't prune from memory here, call it at the last 1/3 of slot 0 of an epoch
|
|
255
|
-
return newCachedState
|
|
255
|
+
return newCachedState;
|
|
256
256
|
} catch (e) {
|
|
257
257
|
this.logger.debug("Reload: error loading cached state", logMeta, e as Error);
|
|
258
258
|
return null;
|
|
@@ -263,8 +263,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
263
263
|
* Return either state or state bytes loaded from db.
|
|
264
264
|
*/
|
|
265
265
|
async getStateOrBytes(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | Uint8Array | null> {
|
|
266
|
-
|
|
267
|
-
const stateOrLoadedState = await this.getStateOrLoadDb(cp, {dontTransferCache: true});
|
|
266
|
+
const stateOrLoadedState = await this.getStateOrLoadDb(cp);
|
|
268
267
|
if (stateOrLoadedState === null || isCachedBeaconState(stateOrLoadedState)) {
|
|
269
268
|
return stateOrLoadedState;
|
|
270
269
|
}
|
|
@@ -274,12 +273,9 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
274
273
|
/**
|
|
275
274
|
* Return either state or state bytes with persisted key loaded from db.
|
|
276
275
|
*/
|
|
277
|
-
async getStateOrLoadDb(
|
|
278
|
-
cp: CheckpointHex,
|
|
279
|
-
opts?: StateRegenerationOpts
|
|
280
|
-
): Promise<CachedBeaconStateAllForks | LoadedStateBytesData | null> {
|
|
276
|
+
async getStateOrLoadDb(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | LoadedStateBytesData | null> {
|
|
281
277
|
const cpKey = toCacheKey(cp);
|
|
282
|
-
const inMemoryState = this.get(cpKey
|
|
278
|
+
const inMemoryState = this.get(cpKey);
|
|
283
279
|
if (inMemoryState) {
|
|
284
280
|
return inMemoryState;
|
|
285
281
|
}
|
|
@@ -308,7 +304,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
308
304
|
/**
|
|
309
305
|
* Similar to get() api without reloading from disk
|
|
310
306
|
*/
|
|
311
|
-
get(cpOrKey: CheckpointHex | string
|
|
307
|
+
get(cpOrKey: CheckpointHex | string): CachedBeaconStateAllForks | null {
|
|
312
308
|
this.metrics?.cpStateCache.lookups.inc();
|
|
313
309
|
const cpKey = typeof cpOrKey === "string" ? cpOrKey : toCacheKey(cpOrKey);
|
|
314
310
|
const cacheItem = this.cache.get(cpKey);
|
|
@@ -326,7 +322,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
326
322
|
if (isInMemoryCacheItem(cacheItem)) {
|
|
327
323
|
const {state} = cacheItem;
|
|
328
324
|
this.metrics?.cpStateCache.stateClonedCount.observe(state.clonedCount);
|
|
329
|
-
return state
|
|
325
|
+
return state;
|
|
330
326
|
}
|
|
331
327
|
|
|
332
328
|
return null;
|
|
@@ -360,14 +356,14 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
360
356
|
/**
|
|
361
357
|
* Searches in-memory state for the latest cached state with a `root` without reload, starting with `epoch` and descending
|
|
362
358
|
*/
|
|
363
|
-
getLatest(rootHex: RootHex, maxEpoch: Epoch
|
|
359
|
+
getLatest(rootHex: RootHex, maxEpoch: Epoch): CachedBeaconStateAllForks | null {
|
|
364
360
|
// sort epochs in descending order, only consider epochs lte `epoch`
|
|
365
361
|
const epochs = Array.from(this.epochIndex.keys())
|
|
366
362
|
.sort((a, b) => b - a)
|
|
367
363
|
.filter((e) => e <= maxEpoch);
|
|
368
364
|
for (const epoch of epochs) {
|
|
369
365
|
if (this.epochIndex.get(epoch)?.has(rootHex)) {
|
|
370
|
-
const inMemoryClonedState = this.get({rootHex, epoch}
|
|
366
|
+
const inMemoryClonedState = this.get({rootHex, epoch});
|
|
371
367
|
if (inMemoryClonedState) {
|
|
372
368
|
return inMemoryClonedState;
|
|
373
369
|
}
|
|
@@ -383,11 +379,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
383
379
|
* - Get block for processing
|
|
384
380
|
* - Regen head state
|
|
385
381
|
*/
|
|
386
|
-
async getOrReloadLatest(
|
|
387
|
-
rootHex: RootHex,
|
|
388
|
-
maxEpoch: Epoch,
|
|
389
|
-
opts?: StateRegenerationOpts
|
|
390
|
-
): Promise<CachedBeaconStateAllForks | null> {
|
|
382
|
+
async getOrReloadLatest(rootHex: RootHex, maxEpoch: Epoch): Promise<CachedBeaconStateAllForks | null> {
|
|
391
383
|
// sort epochs in descending order, only consider epochs lte `epoch`
|
|
392
384
|
const epochs = Array.from(this.epochIndex.keys())
|
|
393
385
|
.sort((a, b) => b - a)
|
|
@@ -395,9 +387,9 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
|
|
|
395
387
|
for (const epoch of epochs) {
|
|
396
388
|
if (this.epochIndex.get(epoch)?.has(rootHex)) {
|
|
397
389
|
try {
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
390
|
+
const state = await this.getOrReload({rootHex, epoch});
|
|
391
|
+
if (state) {
|
|
392
|
+
return state;
|
|
401
393
|
}
|
|
402
394
|
} catch (e) {
|
|
403
395
|
this.logger.debug("Error get or reload state", {epoch, rootHex}, e as Error);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
3
3
|
import {Epoch, RootHex, phase0} from "@lodestar/types";
|
|
4
|
-
import {StateRegenerationOpts} from "../regen/interface.js";
|
|
5
4
|
|
|
6
5
|
export type CheckpointHex = {epoch: Epoch; rootHex: RootHex};
|
|
7
6
|
|
|
@@ -21,7 +20,7 @@ export type CheckpointHex = {epoch: Epoch; rootHex: RootHex};
|
|
|
21
20
|
* The cache key is state root
|
|
22
21
|
*/
|
|
23
22
|
export interface BlockStateCache {
|
|
24
|
-
get(rootHex: RootHex
|
|
23
|
+
get(rootHex: RootHex): CachedBeaconStateAllForks | null;
|
|
25
24
|
add(item: CachedBeaconStateAllForks): void;
|
|
26
25
|
setHeadState(item: CachedBeaconStateAllForks | null): void;
|
|
27
26
|
/**
|
|
@@ -60,16 +59,12 @@ export interface BlockStateCache {
|
|
|
60
59
|
*/
|
|
61
60
|
export interface CheckpointStateCache {
|
|
62
61
|
init?: () => Promise<void>;
|
|
63
|
-
getOrReload(cp: CheckpointHex
|
|
62
|
+
getOrReload(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | null>;
|
|
64
63
|
getStateOrBytes(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | Uint8Array | null>;
|
|
65
|
-
get(cpOrKey: CheckpointHex | string
|
|
64
|
+
get(cpOrKey: CheckpointHex | string): CachedBeaconStateAllForks | null;
|
|
66
65
|
add(cp: phase0.Checkpoint, state: CachedBeaconStateAllForks): void;
|
|
67
|
-
getLatest(rootHex: RootHex, maxEpoch: Epoch
|
|
68
|
-
getOrReloadLatest(
|
|
69
|
-
rootHex: RootHex,
|
|
70
|
-
maxEpoch: Epoch,
|
|
71
|
-
opts?: StateRegenerationOpts
|
|
72
|
-
): Promise<CachedBeaconStateAllForks | null>;
|
|
66
|
+
getLatest(rootHex: RootHex, maxEpoch: Epoch): CachedBeaconStateAllForks | null;
|
|
67
|
+
getOrReloadLatest(rootHex: RootHex, maxEpoch: Epoch): Promise<CachedBeaconStateAllForks | null>;
|
|
73
68
|
updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null;
|
|
74
69
|
prune(finalizedEpoch: Epoch, justifiedEpoch: Epoch): void;
|
|
75
70
|
pruneFinalized(finalizedEpoch: Epoch): void;
|
|
@@ -42,10 +42,10 @@ export class StateArchiveRepository extends Repository<Slot, BeaconStateAllForks
|
|
|
42
42
|
|
|
43
43
|
// Index Root -> Slot
|
|
44
44
|
|
|
45
|
-
async
|
|
45
|
+
async getBinaryByRoot(stateRoot: Root): Promise<Uint8Array | null> {
|
|
46
46
|
const slot = await this.getSlotByRoot(stateRoot);
|
|
47
47
|
if (slot !== null && Number.isInteger(slot)) {
|
|
48
|
-
return this.
|
|
48
|
+
return this.getBinary(slot);
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
+
import {ChainConfig} from "@lodestar/config";
|
|
2
3
|
import {
|
|
3
4
|
BLOB_TX_TYPE,
|
|
4
5
|
BYTES_PER_FIELD_ELEMENT,
|
|
@@ -7,7 +8,9 @@ import {
|
|
|
7
8
|
ForkPostBellatrix,
|
|
8
9
|
ForkPostCapella,
|
|
9
10
|
ForkSeq,
|
|
11
|
+
SLOTS_PER_EPOCH,
|
|
10
12
|
} from "@lodestar/params";
|
|
13
|
+
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
11
14
|
import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
|
|
12
15
|
import {fromHex, toRootHex} from "@lodestar/utils";
|
|
13
16
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
@@ -34,14 +37,11 @@ const INTEROP_GAS_LIMIT = 30e6;
|
|
|
34
37
|
const PRUNE_PAYLOAD_ID_AFTER_MS = 5000;
|
|
35
38
|
|
|
36
39
|
export type ExecutionEngineMockOpts = {
|
|
37
|
-
genesisBlockHash
|
|
40
|
+
genesisBlockHash?: string;
|
|
38
41
|
eth1BlockHash?: string;
|
|
39
42
|
onlyPredefinedResponses?: boolean;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
electraForkTimestamp?: number;
|
|
43
|
-
fuluForkTimestamp?: number;
|
|
44
|
-
gloasForkTimestamp?: number;
|
|
43
|
+
genesisTime?: number;
|
|
44
|
+
config?: ChainConfig;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
type ExecutionBlock = {
|
|
@@ -74,17 +74,21 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
74
74
|
/** Preparing payloads to be retrieved via engine_getPayloadV1 */
|
|
75
75
|
private readonly preparingPayloads = new Map<number, PreparedPayload>();
|
|
76
76
|
private readonly payloadsForDeletion = new Map<number, number>();
|
|
77
|
-
|
|
78
77
|
private readonly predefinedPayloadStatuses = new Map<RootHex, PayloadStatus>();
|
|
79
78
|
|
|
80
79
|
private payloadId = 0;
|
|
80
|
+
private capellaForkTimestamp: number;
|
|
81
|
+
private denebForkTimestamp: number;
|
|
82
|
+
private electraForkTimestamp: number;
|
|
83
|
+
private fuluForkTimestamp: number;
|
|
84
|
+
private gloasForkTimestamp: number;
|
|
81
85
|
|
|
82
86
|
readonly handlers: {
|
|
83
87
|
[K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
constructor(private readonly opts: ExecutionEngineMockOpts) {
|
|
87
|
-
this.validBlocks.set(opts.genesisBlockHash, {
|
|
91
|
+
this.validBlocks.set(opts.genesisBlockHash ?? ZERO_HASH_HEX, {
|
|
88
92
|
parentHash: ZERO_HASH_HEX,
|
|
89
93
|
blockHash: ZERO_HASH_HEX,
|
|
90
94
|
timestamp: 0,
|
|
@@ -100,6 +104,29 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
100
104
|
blockNumber: 1,
|
|
101
105
|
});
|
|
102
106
|
|
|
107
|
+
const {config} = opts;
|
|
108
|
+
|
|
109
|
+
this.capellaForkTimestamp =
|
|
110
|
+
opts.genesisTime && config
|
|
111
|
+
? computeTimeAtSlot(config, config.CAPELLA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
112
|
+
: Infinity;
|
|
113
|
+
this.denebForkTimestamp =
|
|
114
|
+
opts.genesisTime && config
|
|
115
|
+
? computeTimeAtSlot(config, config.DENEB_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
116
|
+
: Infinity;
|
|
117
|
+
this.electraForkTimestamp =
|
|
118
|
+
opts.genesisTime && config
|
|
119
|
+
? computeTimeAtSlot(config, config.ELECTRA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
120
|
+
: Infinity;
|
|
121
|
+
this.fuluForkTimestamp =
|
|
122
|
+
opts.genesisTime && config
|
|
123
|
+
? computeTimeAtSlot(config, config.FULU_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
124
|
+
: Infinity;
|
|
125
|
+
this.gloasForkTimestamp =
|
|
126
|
+
opts.genesisTime && config
|
|
127
|
+
? computeTimeAtSlot(config, config.GLOAS_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
128
|
+
: Infinity;
|
|
129
|
+
|
|
103
130
|
this.handlers = {
|
|
104
131
|
engine_newPayloadV1: this.notifyNewPayload.bind(this),
|
|
105
132
|
engine_newPayloadV2: this.notifyNewPayload.bind(this),
|
|
@@ -448,11 +475,11 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
448
475
|
}
|
|
449
476
|
|
|
450
477
|
private timestampToFork(timestamp: number): ForkPostBellatrix {
|
|
451
|
-
if (timestamp >=
|
|
452
|
-
if (timestamp >=
|
|
453
|
-
if (timestamp >=
|
|
454
|
-
if (timestamp >=
|
|
455
|
-
if (timestamp >=
|
|
478
|
+
if (timestamp >= this.gloasForkTimestamp) return ForkName.gloas;
|
|
479
|
+
if (timestamp >= this.fuluForkTimestamp) return ForkName.fulu;
|
|
480
|
+
if (timestamp >= this.electraForkTimestamp) return ForkName.electra;
|
|
481
|
+
if (timestamp >= this.denebForkTimestamp) return ForkName.deneb;
|
|
482
|
+
if (timestamp >= this.capellaForkTimestamp) return ForkName.capella;
|
|
456
483
|
return ForkName.bellatrix;
|
|
457
484
|
}
|
|
458
485
|
}
|
|
@@ -1308,33 +1308,19 @@ export function createLodestarMetrics(
|
|
|
1308
1308
|
name: "lodestar_shuffling_cache_miss_count",
|
|
1309
1309
|
help: "Count of shuffling cache miss",
|
|
1310
1310
|
}),
|
|
1311
|
-
|
|
1312
|
-
name: "
|
|
1313
|
-
help: "Count of shuffling that were
|
|
1314
|
-
}),
|
|
1315
|
-
shufflingPromiseNotResolvedAndThrownAway: register.gauge({
|
|
1316
|
-
name: "lodestar_shuffling_cache_promise_not_resolved_and_thrown_away_count",
|
|
1317
|
-
help: "Count of shuffling cache promises that were discarded and the shuffling was built synchronously",
|
|
1311
|
+
shufflingSetMultipleTimes: register.gauge({
|
|
1312
|
+
name: "lodestar_shuffling_cache_set_multiple_times_count",
|
|
1313
|
+
help: "Count of shuffling that were set multiple times",
|
|
1318
1314
|
}),
|
|
1319
1315
|
shufflingPromiseNotResolved: register.gauge({
|
|
1320
1316
|
name: "lodestar_shuffling_cache_promise_not_resolved_count",
|
|
1321
1317
|
help: "Count of shuffling cache promises that were requested before the promise was resolved",
|
|
1322
1318
|
}),
|
|
1323
|
-
nextShufflingNotOnEpochCache: register.gauge({
|
|
1324
|
-
name: "lodestar_shuffling_cache_next_shuffling_not_on_epoch_cache",
|
|
1325
|
-
help: "The next shuffling was not on the epoch cache before the epoch transition",
|
|
1326
|
-
}),
|
|
1327
1319
|
shufflingPromiseResolutionTime: register.histogram({
|
|
1328
1320
|
name: "lodestar_shuffling_cache_promise_resolution_time_seconds",
|
|
1329
1321
|
help: "Time from promise insertion until promise resolution when shuffling was ready in seconds",
|
|
1330
1322
|
buckets: [0.5, 1, 1.5, 2],
|
|
1331
1323
|
}),
|
|
1332
|
-
shufflingCalculationTime: register.histogram<{source: "build" | "getSync"}>({
|
|
1333
|
-
name: "lodestar_shuffling_cache_shuffling_calculation_time_seconds",
|
|
1334
|
-
help: "Run time of shuffling calculation",
|
|
1335
|
-
buckets: [0.5, 0.75, 1, 1.25, 1.5],
|
|
1336
|
-
labelNames: ["source"],
|
|
1337
|
-
}),
|
|
1338
1324
|
},
|
|
1339
1325
|
|
|
1340
1326
|
seenCache: {
|
|
@@ -55,7 +55,7 @@ export async function handleColumnSidecarUnavailability({
|
|
|
55
55
|
const blobsCount = getBlobKzgCommitmentsCountFromSignedBeaconBlockSerialized(chain.config, blockBytes);
|
|
56
56
|
|
|
57
57
|
// There are zero blobs for that column index, so we can safely return without any error
|
|
58
|
-
if (blobsCount
|
|
58
|
+
if (blobsCount === 0) return;
|
|
59
59
|
|
|
60
60
|
// There are blobs for that column index so we should have synced for it
|
|
61
61
|
// We need to inform to peers that we don't have that expected data
|