@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
29 lines • 1.49 kB
TypeScript
import { phase0 } from "@lodestar/types";
import { IBeaconDb } from "../../../db/interface.js";
import { CPStateDatastore, DatastoreKey } from "./types.js";
/**
* Implementation of CPStateDatastore using db.
*/
export declare class DbCPStateDatastore implements CPStateDatastore {
private readonly db;
constructor(db: IBeaconDb);
write(cpKey: phase0.Checkpoint, stateBytes: Uint8Array): Promise<DatastoreKey>;
remove(serializedCheckpoint: DatastoreKey): Promise<void>;
read(serializedCheckpoint: DatastoreKey): Promise<Uint8Array | null>;
readLatestSafe(): Promise<Uint8Array | null>;
readKeys(): Promise<DatastoreKey[]>;
}
export declare function datastoreKeyToCheckpoint(key: DatastoreKey): phase0.Checkpoint;
export declare function checkpointToDatastoreKey(cp: phase0.Checkpoint): DatastoreKey;
/**
* Get the latest safe checkpoint state the node can use to boot from
* - it should be the checkpoint state that's unique in its epoch
* - its last processed block slot should be at epoch boundary or last slot of previous epoch
* - state slot should be at epoch boundary
* - state slot should be equal to epoch * SLOTS_PER_EPOCH
*
* return the serialized data of Current Root Checkpoint State (CRCS) or Previous Root Checkpoint State (PRCS)
*
*/
export declare function getLatestSafeDatastoreKey(allKeys: DatastoreKey[], readFn: (key: DatastoreKey) => Promise<Uint8Array | null>): Promise<Uint8Array | null>;
//# sourceMappingURL=db.d.ts.map