@lodestar/beacon-node 1.40.0-dev.cfd894719f → 1.40.0-dev.d2e683b6d2
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/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +7 -7
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +10 -0
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +2 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +7 -3
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +28 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +36 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.js +1 -1
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +8 -0
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +17 -28
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/options.d.ts +0 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +1 -1
- package/lib/chain/regen/queued.d.ts +1 -1
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.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 +4 -1
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
- package/lib/chain/stateCache/index.d.ts +0 -2
- package/lib/chain/stateCache/index.d.ts.map +1 -1
- package/lib/chain/stateCache/index.js +0 -2
- package/lib/chain/stateCache/index.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +2 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -0
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +1 -2
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +4 -3
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +7 -4
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +9 -0
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js +1 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +9 -7
- package/src/api/impl/lodestar/index.ts +12 -0
- package/src/api/impl/validator/index.ts +2 -1
- package/src/chain/ColumnReconstructionTracker.ts +8 -4
- package/src/chain/blocks/blockInput/blockInput.ts +45 -2
- package/src/chain/blocks/importBlock.ts +1 -1
- package/src/chain/blocks/writeBlockInputToDb.ts +9 -0
- package/src/chain/chain.ts +21 -31
- package/src/chain/options.ts +0 -2
- package/src/chain/regen/interface.ts +1 -1
- package/src/chain/regen/queued.ts +1 -2
- package/src/chain/regen/regen.ts +6 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
- package/src/chain/stateCache/index.ts +0 -2
- package/src/chain/stateCache/persistentCheckpointsCache.ts +6 -2
- package/src/chain/validation/block.ts +1 -2
- package/src/chain/validation/executionPayloadBid.ts +5 -4
- package/src/chain/validation/payloadAttestationMessage.ts +1 -1
- package/src/chain/validatorMonitor.ts +10 -5
- package/src/network/peers/peerManager.ts +11 -0
- package/src/network/processor/gossipHandlers.ts +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts +0 -54
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +0 -1
- package/lib/chain/stateCache/blockStateCacheImpl.js +0 -130
- package/lib/chain/stateCache/blockStateCacheImpl.js.map +0 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +0 -60
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +0 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js +0 -156
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +0 -1
- package/src/chain/stateCache/blockStateCacheImpl.ts +0 -149
- package/src/chain/stateCache/inMemoryCheckpointsCache.ts +0 -192
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {routes} from "@lodestar/api";
|
|
2
|
-
import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
3
|
-
import {Epoch, RootHex} from "@lodestar/types";
|
|
4
|
-
import {toRootHex} from "@lodestar/utils";
|
|
5
|
-
import {Metrics} from "../../metrics/index.js";
|
|
6
|
-
import {MapTracker} from "./mapMetrics.js";
|
|
7
|
-
import {BlockStateCache} from "./types.js";
|
|
8
|
-
|
|
9
|
-
const MAX_STATES = 3 * 32;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Old implementation of StateCache (used to call `StateContextCache`)
|
|
13
|
-
* - Prune per checkpoint so number of states ranges from 96 to 128
|
|
14
|
-
* - Keep a separate head state to make sure it is always available
|
|
15
|
-
*/
|
|
16
|
-
export class BlockStateCacheImpl implements BlockStateCache {
|
|
17
|
-
/**
|
|
18
|
-
* Max number of states allowed in the cache
|
|
19
|
-
*/
|
|
20
|
-
readonly maxStates: number;
|
|
21
|
-
|
|
22
|
-
private readonly cache: MapTracker<string, CachedBeaconStateAllForks>;
|
|
23
|
-
/** Epoch -> Set<blockRoot> */
|
|
24
|
-
private readonly epochIndex = new Map<Epoch, Set<string>>();
|
|
25
|
-
private readonly metrics: Metrics["stateCache"] | null | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Strong reference to prevent head state from being pruned.
|
|
28
|
-
* null if head state is being regen and not available at the moment.
|
|
29
|
-
*/
|
|
30
|
-
private head: {state: CachedBeaconStateAllForks; stateRoot: RootHex} | null = null;
|
|
31
|
-
|
|
32
|
-
constructor({maxStates = MAX_STATES, metrics}: {maxStates?: number; metrics?: Metrics | null}) {
|
|
33
|
-
this.maxStates = maxStates;
|
|
34
|
-
this.cache = new MapTracker(metrics?.stateCache);
|
|
35
|
-
if (metrics) {
|
|
36
|
-
this.metrics = metrics.stateCache;
|
|
37
|
-
metrics.stateCache.size.addCollect(() => metrics.stateCache.size.set(this.cache.size));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get(rootHex: RootHex): CachedBeaconStateAllForks | null {
|
|
42
|
-
this.metrics?.lookups.inc();
|
|
43
|
-
const item = this.head?.stateRoot === rootHex ? this.head.state : this.cache.get(rootHex);
|
|
44
|
-
if (!item) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
this.metrics?.hits.inc();
|
|
49
|
-
this.metrics?.stateClonedCount.observe(item.clonedCount);
|
|
50
|
-
|
|
51
|
-
return item;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
add(item: CachedBeaconStateAllForks): void {
|
|
55
|
-
const key = toRootHex(item.hashTreeRoot());
|
|
56
|
-
if (this.cache.get(key)) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.metrics?.adds.inc();
|
|
60
|
-
this.cache.set(key, item);
|
|
61
|
-
const epoch = item.epochCtx.epoch;
|
|
62
|
-
const blockRoots = this.epochIndex.get(epoch);
|
|
63
|
-
if (blockRoots) {
|
|
64
|
-
blockRoots.add(key);
|
|
65
|
-
} else {
|
|
66
|
-
this.epochIndex.set(epoch, new Set([key]));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setHeadState(item: CachedBeaconStateAllForks | null): void {
|
|
71
|
-
if (item) {
|
|
72
|
-
const key = toRootHex(item.hashTreeRoot());
|
|
73
|
-
this.head = {state: item, stateRoot: key};
|
|
74
|
-
} else {
|
|
75
|
-
this.head = null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get a seed state for state reload.
|
|
81
|
-
* This is to conform to the api only as this cache is not used in n-historical state.
|
|
82
|
-
* See ./fifoBlockStateCache.ts for implementation
|
|
83
|
-
*/
|
|
84
|
-
getSeedState(): CachedBeaconStateAllForks {
|
|
85
|
-
throw Error("Not implemented for BlockStateCacheImpl");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
clear(): void {
|
|
89
|
-
this.cache.clear();
|
|
90
|
-
this.epochIndex.clear();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
get size(): number {
|
|
94
|
-
return this.cache.size;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* TODO make this more robust.
|
|
99
|
-
* Without more thought, this currently breaks our assumptions about recent state availablity
|
|
100
|
-
*/
|
|
101
|
-
prune(headStateRootHex: RootHex): void {
|
|
102
|
-
const keys = Array.from(this.cache.keys());
|
|
103
|
-
if (keys.length > this.maxStates) {
|
|
104
|
-
// object keys are stored in insertion order, delete keys starting from the front
|
|
105
|
-
for (const key of keys.slice(0, keys.length - this.maxStates)) {
|
|
106
|
-
if (key !== headStateRootHex) {
|
|
107
|
-
const item = this.cache.get(key);
|
|
108
|
-
if (item) {
|
|
109
|
-
this.epochIndex.get(item.epochCtx.epoch)?.delete(key);
|
|
110
|
-
this.cache.delete(key);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Prune per finalized epoch.
|
|
119
|
-
*/
|
|
120
|
-
deleteAllBeforeEpoch(finalizedEpoch: Epoch): void {
|
|
121
|
-
for (const epoch of this.epochIndex.keys()) {
|
|
122
|
-
if (epoch < finalizedEpoch) {
|
|
123
|
-
this.deleteAllEpochItems(epoch);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/** ONLY FOR DEBUGGING PURPOSES. For lodestar debug API */
|
|
129
|
-
dumpSummary(): routes.lodestar.StateCacheItem[] {
|
|
130
|
-
return Array.from(this.cache.entries()).map(([key, state]) => ({
|
|
131
|
-
slot: state.slot,
|
|
132
|
-
root: toRootHex(state.hashTreeRoot()),
|
|
133
|
-
reads: this.cache.readCount.get(key) ?? 0,
|
|
134
|
-
lastRead: this.cache.lastRead.get(key) ?? 0,
|
|
135
|
-
checkpointState: false,
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
getStates(): IterableIterator<CachedBeaconStateAllForks> {
|
|
140
|
-
return this.cache.values();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private deleteAllEpochItems(epoch: Epoch): void {
|
|
144
|
-
for (const rootHex of this.epochIndex.get(epoch) || []) {
|
|
145
|
-
this.cache.delete(rootHex);
|
|
146
|
-
}
|
|
147
|
-
this.epochIndex.delete(epoch);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import {routes} from "@lodestar/api";
|
|
2
|
-
import {CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
3
|
-
import {Epoch, RootHex, phase0} from "@lodestar/types";
|
|
4
|
-
import {MapDef, toRootHex} from "@lodestar/utils";
|
|
5
|
-
import {Metrics} from "../../metrics/index.js";
|
|
6
|
-
import {MapTracker} from "./mapMetrics.js";
|
|
7
|
-
import {CacheItemType, CheckpointStateCache} from "./types.js";
|
|
8
|
-
|
|
9
|
-
export type CheckpointHex = {epoch: Epoch; rootHex: RootHex};
|
|
10
|
-
const MAX_EPOCHS = 10;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* In memory cache of CachedBeaconState
|
|
14
|
-
* belonging to checkpoint
|
|
15
|
-
*
|
|
16
|
-
* Similar API to Repository
|
|
17
|
-
*/
|
|
18
|
-
export class InMemoryCheckpointStateCache implements CheckpointStateCache {
|
|
19
|
-
private readonly cache: MapTracker<string, CachedBeaconStateAllForks>;
|
|
20
|
-
/** Epoch -> Set<blockRoot> */
|
|
21
|
-
private readonly epochIndex = new MapDef<Epoch, Set<string>>(() => new Set<string>());
|
|
22
|
-
/**
|
|
23
|
-
* Max number of epochs allowed in the cache
|
|
24
|
-
*/
|
|
25
|
-
private readonly maxEpochs: number;
|
|
26
|
-
private readonly metrics: Metrics["cpStateCache"] | null | undefined;
|
|
27
|
-
private preComputedCheckpoint: string | null = null;
|
|
28
|
-
private preComputedCheckpointHits: number | null = null;
|
|
29
|
-
|
|
30
|
-
constructor({metrics = null}: {metrics?: Metrics | null}, {maxEpochs = MAX_EPOCHS}: {maxEpochs?: number} = {}) {
|
|
31
|
-
this.cache = new MapTracker(metrics?.cpStateCache);
|
|
32
|
-
if (metrics) {
|
|
33
|
-
this.metrics = metrics.cpStateCache;
|
|
34
|
-
metrics.cpStateCache.size.addCollect(() =>
|
|
35
|
-
metrics.cpStateCache.size.set({type: CacheItemType.inMemory}, this.cache.size)
|
|
36
|
-
);
|
|
37
|
-
metrics.cpStateCache.epochSize.addCollect(() =>
|
|
38
|
-
metrics.cpStateCache.epochSize.set({type: CacheItemType.inMemory}, this.epochIndex.size)
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
this.maxEpochs = maxEpochs;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async getOrReload(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | null> {
|
|
45
|
-
return this.get(cp);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async getStateOrBytes(cp: CheckpointHex): Promise<Uint8Array | CachedBeaconStateAllForks | null> {
|
|
49
|
-
return this.get(cp);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async getOrReloadLatest(rootHex: string, maxEpoch: number): Promise<CachedBeaconStateAllForks | null> {
|
|
53
|
-
return this.getLatest(rootHex, maxEpoch);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async processState(): Promise<number> {
|
|
57
|
-
// do nothing, this class does not support prunning
|
|
58
|
-
return 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get(cp: CheckpointHex): CachedBeaconStateAllForks | null {
|
|
62
|
-
this.metrics?.lookups.inc();
|
|
63
|
-
const cpKey = toCheckpointKey(cp);
|
|
64
|
-
const item = this.cache.get(cpKey);
|
|
65
|
-
|
|
66
|
-
if (!item) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this.metrics?.hits.inc();
|
|
71
|
-
|
|
72
|
-
if (cpKey === this.preComputedCheckpoint) {
|
|
73
|
-
this.preComputedCheckpointHits = (this.preComputedCheckpointHits ?? 0) + 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
this.metrics?.stateClonedCount.observe(item.clonedCount);
|
|
77
|
-
|
|
78
|
-
return item;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
add(cp: phase0.Checkpoint, item: CachedBeaconStateAllForks): void {
|
|
82
|
-
const cpHex = toCheckpointHex(cp);
|
|
83
|
-
const key = toCheckpointKey(cpHex);
|
|
84
|
-
if (this.cache.has(key)) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.metrics?.adds.inc();
|
|
88
|
-
this.cache.set(key, item);
|
|
89
|
-
this.epochIndex.getOrDefault(cp.epoch).add(cpHex.rootHex);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Searches for the latest cached state with a `root`, starting with `epoch` and descending
|
|
94
|
-
*/
|
|
95
|
-
getLatest(rootHex: RootHex, maxEpoch: Epoch): CachedBeaconStateAllForks | null {
|
|
96
|
-
// sort epochs in descending order, only consider epochs lte `epoch`
|
|
97
|
-
const epochs = Array.from(this.epochIndex.keys())
|
|
98
|
-
.sort((a, b) => b - a)
|
|
99
|
-
.filter((e) => e <= maxEpoch);
|
|
100
|
-
for (const epoch of epochs) {
|
|
101
|
-
if (this.epochIndex.get(epoch)?.has(rootHex)) {
|
|
102
|
-
return this.get({rootHex, epoch});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Update the precomputed checkpoint and return the number of his for the
|
|
110
|
-
* previous one (if any).
|
|
111
|
-
*/
|
|
112
|
-
updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null {
|
|
113
|
-
const previousHits = this.preComputedCheckpointHits;
|
|
114
|
-
this.preComputedCheckpoint = toCheckpointKey({rootHex, epoch});
|
|
115
|
-
this.preComputedCheckpointHits = 0;
|
|
116
|
-
return previousHits;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
pruneFinalized(finalizedEpoch: Epoch): void {
|
|
120
|
-
for (const epoch of this.epochIndex.keys()) {
|
|
121
|
-
if (epoch < finalizedEpoch) {
|
|
122
|
-
this.deleteAllEpochItems(epoch);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
prune(finalizedEpoch: Epoch, justifiedEpoch: Epoch): void {
|
|
128
|
-
const epochs = Array.from(this.epochIndex.keys()).filter(
|
|
129
|
-
(epoch) => epoch !== finalizedEpoch && epoch !== justifiedEpoch
|
|
130
|
-
);
|
|
131
|
-
if (epochs.length > this.maxEpochs) {
|
|
132
|
-
for (const epoch of epochs.slice(0, epochs.length - this.maxEpochs)) {
|
|
133
|
-
this.deleteAllEpochItems(epoch);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
delete(cp: phase0.Checkpoint): void {
|
|
139
|
-
this.cache.delete(toCheckpointKey(toCheckpointHex(cp)));
|
|
140
|
-
const epochKey = toRootHex(cp.root);
|
|
141
|
-
const value = this.epochIndex.get(cp.epoch);
|
|
142
|
-
if (value) {
|
|
143
|
-
value.delete(epochKey);
|
|
144
|
-
if (value.size === 0) {
|
|
145
|
-
this.epochIndex.delete(cp.epoch);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
deleteAllEpochItems(epoch: Epoch): void {
|
|
151
|
-
for (const rootHex of this.epochIndex.get(epoch) || []) {
|
|
152
|
-
this.cache.delete(toCheckpointKey({rootHex, epoch}));
|
|
153
|
-
}
|
|
154
|
-
this.epochIndex.delete(epoch);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
clear(): void {
|
|
158
|
-
this.cache.clear();
|
|
159
|
-
this.epochIndex.clear();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** ONLY FOR DEBUGGING PURPOSES. For lodestar debug API */
|
|
163
|
-
dumpSummary(): routes.lodestar.StateCacheItem[] {
|
|
164
|
-
return Array.from(this.cache.entries()).map(([key, state]) => ({
|
|
165
|
-
slot: state.slot,
|
|
166
|
-
root: toRootHex(state.hashTreeRoot()),
|
|
167
|
-
reads: this.cache.readCount.get(key) ?? 0,
|
|
168
|
-
lastRead: this.cache.lastRead.get(key) ?? 0,
|
|
169
|
-
checkpointState: true,
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
getStates(): IterableIterator<CachedBeaconStateAllForks> {
|
|
174
|
-
return this.cache.values();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** ONLY FOR DEBUGGING PURPOSES. For spec tests on error */
|
|
178
|
-
dumpCheckpointKeys(): string[] {
|
|
179
|
-
return Array.from(this.cache.keys());
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export function toCheckpointHex(checkpoint: phase0.Checkpoint): CheckpointHex {
|
|
184
|
-
return {
|
|
185
|
-
epoch: checkpoint.epoch,
|
|
186
|
-
rootHex: toRootHex(checkpoint.root),
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function toCheckpointKey(cp: CheckpointHex): string {
|
|
191
|
-
return `${cp.rootHex}:${cp.epoch}`;
|
|
192
|
-
}
|