import { DateProvider } from '@aztec/foundation/timer'; import type { LocalSignerConfig, ValidatorHASignerConfig } from '@aztec/stdlib/ha-signing'; import type { CreateHASignerDeps, CreateLocalSignerWithProtectionDeps, SlashingProtectionDatabase } from './types.js'; import { ValidatorHASigner } from './validator_ha_signer.js'; /** * Create a validator HA signer with PostgreSQL backend * * After creating the signer, call `signer.start()` to begin background * cleanup tasks. Call `signer.stop()` during graceful shutdown. * * Example with manual migrations (recommended for production): * ```bash * # Run migrations separately * yarn migrate:up * ``` * * ```typescript * const { signer, db } = await createHASigner({ * databaseUrl: process.env.DATABASE_URL, * nodeId: 'validator-node-1', * pollingIntervalMs: 100, * peerSigningTimeoutMs: 3000, * }); * signer.start(); // Start background cleanup * * // ... use signer ... * * await signer.stop(); // On shutdown * ``` * * Note: Migrations must be run separately using `aztec migrate-ha-db up` before * creating the signer. The factory will verify the schema is initialized via `db.initialize()`. * * @param config - Configuration for the HA signer * @param deps - Optional dependencies (e.g., for testing) * @returns An object containing the signer and database instances */ export declare function createHASigner(config: ValidatorHASignerConfig, deps?: CreateHASignerDeps): Promise<{ signer: ValidatorHASigner; db: SlashingProtectionDatabase; }>; /** * Create a local (single-node) signing protection signer backed by LMDB. * * This provides double-signing protection for nodes that are NOT running in a * high-availability (multi-node) setup. It prevents a proposer from sending two * proposals for the same slot if the node crashes and restarts mid-proposal. * * `config.dataDirectory` is required so the protection database is persisted to disk and survives * crashes/restarts. Booting without it throws, since an ephemeral store silently drops all * double-signing protection across restarts. Set `config.allowEphemeralSigningProtection` to opt * into the ephemeral store anyway (dev/test networks only) — a loud warning is logged in that case. * * @param config - Local signer config * @param deps - Optional dependencies (telemetry, date provider). * @returns An object containing the signer and database instances. */ export declare function createLocalSignerWithProtection(config: LocalSignerConfig, deps?: CreateLocalSignerWithProtectionDeps): Promise<{ signer: ValidatorHASigner; db: SlashingProtectionDatabase; }>; /** * Create an in-memory LMDB-backed SlashingProtectionDatabase that can be shared across * multiple validator nodes in the same process. Used for testing HA setups. */ export declare function createSharedSlashingProtectionDb(dateProvider?: DateProvider): Promise; /** * Create a ValidatorHASigner backed by a pre-existing SlashingProtectionDatabase. * Used for testing HA setups where multiple nodes share the same protection database. */ export declare function createSignerFromSharedDb(db: SlashingProtectionDatabase, config: Pick, deps?: CreateLocalSignerWithProtectionDeps): { signer: ValidatorHASigner; db: SlashingProtectionDatabase; }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRXZELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLHVCQUF1QixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFRM0YsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsbUNBQW1DLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFDdEgsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFN0Q7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBZ0NHO0FBQ0gsd0JBQXNCLGNBQWMsQ0FDbEMsTUFBTSxFQUFFLHVCQUF1QixFQUMvQixJQUFJLENBQUMsRUFBRSxrQkFBa0IsR0FDeEIsT0FBTyxDQUFDO0lBQ1QsTUFBTSxFQUFFLGlCQUFpQixDQUFDO0lBQzFCLEVBQUUsRUFBRSwwQkFBMEIsQ0FBQztDQUNoQyxDQUFDLENBaUREO0FBRUQ7Ozs7Ozs7Ozs7Ozs7OztHQWVHO0FBQ0gsd0JBQXNCLCtCQUErQixDQUNuRCxNQUFNLEVBQUUsaUJBQWlCLEVBQ3pCLElBQUksQ0FBQyxFQUFF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