import { routes } from "@lodestar/api";
import { ProtoBlock } from "@lodestar/fork-choice";
import { CachedBeaconStateAllForks } from "@lodestar/state-transition";
import { BeaconBlock, Epoch, RootHex, Slot, phase0 } from "@lodestar/types";
import { JobItemQueue } from "../../util/queue/index.js";
import { CheckpointHex } from "../stateCache/types.js";
import { IStateRegenerator, IStateRegeneratorInternal, RegenCaller, StateRegenerationOpts } from "./interface.js";
import { RegenModules } from "./regen.js";
type QueuedStateRegeneratorModules = RegenModules & {
    signal: AbortSignal;
};
type RegenRequestKey = keyof IStateRegeneratorInternal;
type RegenRequestByKey = {
    [K in RegenRequestKey]: {
        key: K;
        args: Parameters<IStateRegeneratorInternal[K]>;
    };
};
export type RegenRequest = RegenRequestByKey[RegenRequestKey];
/**
 * Regenerates states that have already been processed by the fork choice
 *
 * All requests are queued so that only a single state at a time may be regenerated at a time
 */
export declare class QueuedStateRegenerator implements IStateRegenerator {
    readonly jobQueue: JobItemQueue<[RegenRequest], CachedBeaconStateAllForks>;
    private readonly regen;
    private readonly forkChoice;
    private readonly blockStateCache;
    private readonly checkpointStateCache;
    private readonly metrics;
    private readonly logger;
    constructor(modules: QueuedStateRegeneratorModules);
    init(): Promise<void>;
    canAcceptWork(): boolean;
    dropCache(): void;
    dumpCacheSummary(): routes.lodestar.StateCacheItem[];
    /**
     * Get a state from block state cache.
     */
    getStateSync(stateRoot: RootHex): CachedBeaconStateAllForks | null;
    /**
     * Get state for block processing.
     */
    getPreStateSync(block: BeaconBlock): CachedBeaconStateAllForks | null;
    getCheckpointStateOrBytes(cp: CheckpointHex): Promise<CachedBeaconStateAllForks | Uint8Array | null>;
    /**
     * Get checkpoint state from cache
     */
    getCheckpointStateSync(cp: CheckpointHex): CachedBeaconStateAllForks | null;
    /**
     * Get state closest to head
     */
    getClosestHeadState(head: ProtoBlock): CachedBeaconStateAllForks | null;
    pruneOnCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void;
    pruneOnFinalized(finalizedEpoch: number): void;
    processState(blockRootHex: RootHex, postState: CachedBeaconStateAllForks): void;
    addCheckpointState(cp: phase0.Checkpoint, item: CachedBeaconStateAllForks): void;
    updateHeadState(newHead: ProtoBlock, maybeHeadState: CachedBeaconStateAllForks): void;
    updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null;
    /**
     * Get the state to run with `block`.
     * - State after `block.parentRoot` dialed forward to block.slot
     */
    getPreState(block: BeaconBlock, opts: StateRegenerationOpts, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
    /**
     * Get state of provided `blockRoot` and dial forward to `slot`
     * Use this api with care because we don't want the queue to be busy
     * For the context, gossip block validation uses this api so we want it to be as fast as possible
     * @returns
     */
    getBlockSlotState(block: ProtoBlock, slot: Slot, opts: StateRegenerationOpts, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
    getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
    private jobQueueProcessor;
}
export {};
//# sourceMappingURL=queued.d.ts.map