/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { WorkerCtx } from '../contract.js'; import type { Checkpoint, Store } from '../ports.js'; /** Result of one checkpoint sweep; exactly one outcome applies. */ export type CheckpointSummary = { sealed: Checkpoint | null; skipped: boolean; deadLettered: ReadonlyArray<{ reason: string; }>; retrying: ReadonlyArray<{ code: string; }>; }; /** * Folds every account's chain head into one signed Merkle root and stores it as a checkpoint. * Errors are caught so one bad run cannot stop future runs; an empty ledger is skipped rather * than sealed. * * @see {@link https://economy-lab-docs.pages.dev/economy/concepts/integrity/ Integrity} for how the * signed Merkle root anchors the ledger and proves it is unaltered. * @see {@link https://economy-lab-docs.pages.dev/economy/reference/background-worker/ Background * worker} for how scheduled sweeps are driven and retried. */ export declare function sealCheckpoint(store: Store, ctx: WorkerCtx): Promise; /** Result of one re-verification sweep; exactly one outcome applies. */ export type CheckpointVerifySummary = { verified: string | null; skipped: boolean; mismatch: boolean; deadLettered: ReadonlyArray<{ reason: string; }>; retrying: ReadonlyArray<{ code: string; }>; }; /** * Re-checks the most recent checkpoint against the current ledger, as a scheduled audit separate * from sealing. Delegates to `verifyCheckpoint` (chain.ts), which also checks the live head count * has not dropped below the sealed count, catching truncation a root check alone would miss. A * `false` result is a normal mismatch: recorded on the summary and logged at error level, not * thrown. Only a thrown error (corrupt row, unavailable storage) goes through the retry and * dead-letter split as sealing does. Skipped when no checkpoint exists yet. * * @see {@link https://economy-lab-docs.pages.dev/economy/concepts/integrity/ Integrity} for why a * head-count drop is itself a tamper signal and why a mismatch is logged, not thrown. */ export declare function reverifyCheckpoint(store: Store, ctx: WorkerCtx): Promise;