@aztec/validator-ha-signer 4.0.0-nightly.20260110

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.
Files changed (54) hide show
  1. package/README.md +182 -0
  2. package/dest/config.d.ts +47 -0
  3. package/dest/config.d.ts.map +1 -0
  4. package/dest/config.js +64 -0
  5. package/dest/db/index.d.ts +4 -0
  6. package/dest/db/index.d.ts.map +1 -0
  7. package/dest/db/index.js +3 -0
  8. package/dest/db/migrations/1_initial-schema.d.ts +9 -0
  9. package/dest/db/migrations/1_initial-schema.d.ts.map +1 -0
  10. package/dest/db/migrations/1_initial-schema.js +20 -0
  11. package/dest/db/postgres.d.ts +55 -0
  12. package/dest/db/postgres.d.ts.map +1 -0
  13. package/dest/db/postgres.js +150 -0
  14. package/dest/db/schema.d.ts +85 -0
  15. package/dest/db/schema.d.ts.map +1 -0
  16. package/dest/db/schema.js +201 -0
  17. package/dest/db/test_helper.d.ts +10 -0
  18. package/dest/db/test_helper.d.ts.map +1 -0
  19. package/dest/db/test_helper.js +14 -0
  20. package/dest/db/types.d.ts +109 -0
  21. package/dest/db/types.d.ts.map +1 -0
  22. package/dest/db/types.js +15 -0
  23. package/dest/errors.d.ts +30 -0
  24. package/dest/errors.d.ts.map +1 -0
  25. package/dest/errors.js +31 -0
  26. package/dest/factory.d.ts +50 -0
  27. package/dest/factory.d.ts.map +1 -0
  28. package/dest/factory.js +75 -0
  29. package/dest/migrations.d.ts +15 -0
  30. package/dest/migrations.d.ts.map +1 -0
  31. package/dest/migrations.js +42 -0
  32. package/dest/slashing_protection_service.d.ts +74 -0
  33. package/dest/slashing_protection_service.d.ts.map +1 -0
  34. package/dest/slashing_protection_service.js +184 -0
  35. package/dest/types.d.ts +75 -0
  36. package/dest/types.d.ts.map +1 -0
  37. package/dest/types.js +1 -0
  38. package/dest/validator_ha_signer.d.ts +74 -0
  39. package/dest/validator_ha_signer.d.ts.map +1 -0
  40. package/dest/validator_ha_signer.js +131 -0
  41. package/package.json +105 -0
  42. package/src/config.ts +116 -0
  43. package/src/db/index.ts +3 -0
  44. package/src/db/migrations/1_initial-schema.ts +26 -0
  45. package/src/db/postgres.ts +202 -0
  46. package/src/db/schema.ts +236 -0
  47. package/src/db/test_helper.ts +17 -0
  48. package/src/db/types.ts +117 -0
  49. package/src/errors.ts +42 -0
  50. package/src/factory.ts +87 -0
  51. package/src/migrations.ts +59 -0
  52. package/src/slashing_protection_service.ts +216 -0
  53. package/src/types.ts +105 -0
  54. package/src/validator_ha_signer.ts +164 -0
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # Validator HA Signer
2
+
3
+ Distributed locking and slashing protection for Aztec validators running in high-availability configurations.
4
+
5
+ ## Features
6
+
7
+ - **Distributed Locking**: Prevents multiple validator nodes from signing the same duty
8
+ - **Slashing Protection**: Blocks attempts to sign conflicting data for the same slot
9
+ - **Automatic Retry**: Failed signing attempts are cleared, allowing other nodes to retry
10
+ - **PostgreSQL Backend**: Shared database for coordination across nodes
11
+
12
+ ## Quick Start
13
+
14
+ ### Option 1: Automatic Migrations (Simplest)
15
+
16
+ ```typescript
17
+ import { createHASigner } from '@aztec/validator-ha-signer/factory';
18
+
19
+ // Migrations run automatically on startup
20
+ const { signer, db } = await createHASigner({
21
+ databaseUrl: process.env.DATABASE_URL,
22
+ enabled: true,
23
+ nodeId: 'validator-node-1',
24
+ pollingIntervalMs: 100,
25
+ signingTimeoutMs: 3000,
26
+ });
27
+
28
+ // Start background cleanup tasks
29
+ signer.start();
30
+
31
+ // Sign with protection
32
+ const signature = await signer.signWithProtection(
33
+ validatorAddress,
34
+ messageHash,
35
+ { slot: 100n, blockNumber: 50n, dutyType: 'BLOCK_PROPOSAL' },
36
+ async root => localSigner.signMessage(root),
37
+ );
38
+
39
+ // Cleanup on shutdown
40
+ await signer.stop();
41
+ await db.close();
42
+ ```
43
+
44
+ ### Option 2: Manual Migrations (Recommended for Production)
45
+
46
+ ```bash
47
+ # 1. Run migrations separately (once per deployment)
48
+ aztec migrate-ha-db up --database-url postgresql://user:pass@host:port/db
49
+ ```
50
+
51
+ ```typescript
52
+ // 2. Create signer (migrations already applied)
53
+ import { createHASigner } from '@aztec/validator-ha-signer/factory';
54
+
55
+ const { signer, db } = await createHASigner({
56
+ databaseUrl: process.env.DATABASE_URL,
57
+ enabled: true,
58
+ nodeId: 'validator-node-1',
59
+ pollingIntervalMs: 100,
60
+ signingTimeoutMs: 3000,
61
+ });
62
+
63
+ // Start background cleanup tasks
64
+ signer.start();
65
+
66
+ // On shutdown
67
+ await signer.stop();
68
+ await db.close();
69
+ ```
70
+
71
+ ### Advanced: Custom Connection Pool
72
+
73
+ If you need custom pool configuration (e.g., max connections, idle timeout) or want to share a connection pool across multiple components:
74
+
75
+ > **Note**: You still need to run migrations separately before using this approach.
76
+ > See [Option 2](#option-2-manual-migrations-recommended-for-production) above.
77
+
78
+ ```typescript
79
+ import { PostgresSlashingProtectionDatabase } from '@aztec/validator-ha-signer/db';
80
+ import { ValidatorHASigner } from '@aztec/validator-ha-signer/validator-ha-signer';
81
+
82
+ import { Pool } from 'pg';
83
+
84
+ // Custom pool configuration
85
+ const pool = new Pool({
86
+ connectionString: process.env.DATABASE_URL,
87
+ max: 20, // Maximum connections
88
+ idleTimeoutMillis: 30000,
89
+ });
90
+ const db = new PostgresSlashingProtectionDatabase(pool);
91
+ await db.initialize();
92
+
93
+ const signer = new ValidatorHASigner(db, {
94
+ enabled: true,
95
+ nodeId: 'validator-node-1',
96
+ pollingIntervalMs: 100,
97
+ signingTimeoutMs: 3000,
98
+ maxStuckDutiesAgeMs: 72000,
99
+ });
100
+
101
+ // Start background cleanup tasks
102
+ signer.start();
103
+
104
+ // On shutdown
105
+ await signer.stop();
106
+ await pool.end(); // You manage the pool lifecycle
107
+ ```
108
+
109
+ ## Configuration
110
+
111
+ Set via environment variables or config object:
112
+
113
+ - `VALIDATOR_HA_DATABASE_URL`: PostgreSQL connection string (e.g., `postgresql://user:pass@host:port/db`)
114
+ - `SLASHING_PROTECTION_ENABLED`: Whether slashing protection is enabled (default: true)
115
+ - `SLASHING_PROTECTION_NODE_ID`: Unique identifier for this validator node
116
+ - `SLASHING_PROTECTION_POLLING_INTERVAL_MS`: How often to check duty status (default: 100)
117
+ - `SLASHING_PROTECTION_SIGNING_TIMEOUT_MS`: Max wait for in-progress signing (default: 3000)
118
+ - `SLASHING_PROTECTION_MAX_STUCK_DUTIES_AGE_MS`: Max age of stuck duties before cleanup (default: 72000)
119
+
120
+ ## Database Migrations
121
+
122
+ This package uses `node-pg-migrate` for database schema management.
123
+
124
+ ### Migration Commands
125
+
126
+ ```bash
127
+ # Run pending migrations
128
+ aztec migrate-ha-db up --database-url postgresql://...
129
+
130
+ # Rollback last migration
131
+ aztec migrate-ha-db down --database-url postgresql://...
132
+ ```
133
+
134
+ ### Creating New Migrations
135
+
136
+ ```bash
137
+ # Generate a new migration file
138
+ npx node-pg-migrate create my-migration-name
139
+ ```
140
+
141
+ ### Production Deployment
142
+
143
+ Run migrations before starting your application:
144
+
145
+ ```yaml
146
+ # Kubernetes example
147
+ apiVersion: batch/v1
148
+ kind: Job
149
+ metadata:
150
+ name: validator-db-migrate
151
+ spec:
152
+ template:
153
+ spec:
154
+ containers:
155
+ - name: migrate
156
+ image: aztecprotocol/aztec:<image_tag>
157
+ command: ['node', '--no-warnings', '/usr/src/yarn-project/aztec/dest/bin/index.js', 'migrate-ha-db', 'up']
158
+ env:
159
+ - name: DATABASE_URL
160
+ valueFrom:
161
+ secretKeyRef:
162
+ name: db-secret
163
+ key: url
164
+ restartPolicy: OnFailure
165
+ ```
166
+
167
+ ## How It Works
168
+
169
+ When multiple validator nodes attempt to sign:
170
+
171
+ 1. First node acquires lock and signs
172
+ 2. Other nodes receive `DutyAlreadySignedError` (expected)
173
+ 3. If different data detected: `SlashingProtectionError` (likely for block builder signing)
174
+ 4. Failed attempts are auto-cleaned, allowing retry
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ yarn build # Build package
180
+ yarn test # Run tests
181
+ yarn clean # Clean build artifacts
182
+ ```
@@ -0,0 +1,47 @@
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
+ /**
3
+ * Configuration for the slashing protection service
4
+ */
5
+ export interface SlashingProtectionConfig {
6
+ /** Whether slashing protection is enabled */
7
+ enabled: boolean;
8
+ /** Unique identifier for this node */
9
+ nodeId: string;
10
+ /** How long to wait between polls when a duty is being signed (ms) */
11
+ pollingIntervalMs: number;
12
+ /** Maximum time to wait for a duty being signed to complete (ms) */
13
+ signingTimeoutMs: number;
14
+ /** Maximum age of a stuck duty in ms */
15
+ maxStuckDutiesAgeMs: number;
16
+ }
17
+ export declare const slashingProtectionConfigMappings: ConfigMappingsType<SlashingProtectionConfig>;
18
+ export declare const defaultSlashingProtectionConfig: SlashingProtectionConfig;
19
+ /**
20
+ * Configuration for creating an HA signer with PostgreSQL backend
21
+ */
22
+ export interface CreateHASignerConfig extends SlashingProtectionConfig {
23
+ /**
24
+ * PostgreSQL connection string
25
+ * Format: postgresql://user:password@host:port/database
26
+ */
27
+ databaseUrl: string;
28
+ /**
29
+ * PostgreSQL connection pool configuration
30
+ */
31
+ /** Maximum number of clients in the pool (default: 10) */
32
+ poolMaxCount?: number;
33
+ /** Minimum number of clients in the pool (default: 0) */
34
+ poolMinCount?: number;
35
+ /** Idle timeout in milliseconds (default: 10000) */
36
+ poolIdleTimeoutMs?: number;
37
+ /** Connection timeout in milliseconds (default: 0, no timeout) */
38
+ poolConnectionTimeoutMs?: number;
39
+ }
40
+ export declare const createHASignerConfigMappings: ConfigMappingsType<CreateHASignerConfig>;
41
+ /**
42
+ * Returns the validator HA signer configuration from environment variables.
43
+ * Note: If an environment variable is not set, the default value is used.
44
+ * @returns The validator HA signer configuration.
45
+ */
46
+ export declare function getConfigEnvVars(): CreateHASignerConfig;
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIi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FBRUY7Ozs7R0FJRztBQUNILHdCQUFnQixnQkFBZ0IsSUFBSSxvQkFBb0IsQ0FFdkQifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,gCAAgC,EAAE,kBAAkB,CAAC,wBAAwB,CA2BzF,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,wBAE7C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;IACpE;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,4BAA4B,EAAE,kBAAkB,CAAC,oBAAoB,CA2BjF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,oBAAoB,CAEvD"}
package/dest/config.js ADDED
@@ -0,0 +1,64 @@
1
+ import { booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper } from '@aztec/foundation/config';
2
+ export const slashingProtectionConfigMappings = {
3
+ enabled: {
4
+ env: 'SLASHING_PROTECTION_ENABLED',
5
+ description: 'Whether slashing protection is enabled',
6
+ ...booleanConfigHelper(true)
7
+ },
8
+ nodeId: {
9
+ env: 'SLASHING_PROTECTION_NODE_ID',
10
+ description: 'The unique identifier for this node',
11
+ defaultValue: ''
12
+ },
13
+ pollingIntervalMs: {
14
+ env: 'SLASHING_PROTECTION_POLLING_INTERVAL_MS',
15
+ description: 'The number of ms to wait between polls when a duty is being signed',
16
+ ...numberConfigHelper(100)
17
+ },
18
+ signingTimeoutMs: {
19
+ env: 'SLASHING_PROTECTION_SIGNING_TIMEOUT_MS',
20
+ description: 'The maximum time to wait for a duty being signed to complete',
21
+ ...numberConfigHelper(3_000)
22
+ },
23
+ maxStuckDutiesAgeMs: {
24
+ env: 'SLASHING_PROTECTION_MAX_STUCK_DUTIES_AGE_MS',
25
+ description: 'The maximum age of a stuck duty in ms',
26
+ // hard-coding at current 2 slot duration. This should be set by the validator on init
27
+ ...numberConfigHelper(72_000)
28
+ }
29
+ };
30
+ export const defaultSlashingProtectionConfig = getDefaultConfig(slashingProtectionConfigMappings);
31
+ export const createHASignerConfigMappings = {
32
+ ...slashingProtectionConfigMappings,
33
+ databaseUrl: {
34
+ env: 'VALIDATOR_HA_DATABASE_URL',
35
+ description: 'PostgreSQL connection string for validator HA signer (format: postgresql://user:password@host:port/database)'
36
+ },
37
+ poolMaxCount: {
38
+ env: 'VALIDATOR_HA_POOL_MAX',
39
+ description: 'Maximum number of clients in the pool',
40
+ ...numberConfigHelper(10)
41
+ },
42
+ poolMinCount: {
43
+ env: 'VALIDATOR_HA_POOL_MIN',
44
+ description: 'Minimum number of clients in the pool',
45
+ ...numberConfigHelper(0)
46
+ },
47
+ poolIdleTimeoutMs: {
48
+ env: 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS',
49
+ description: 'Idle timeout in milliseconds',
50
+ ...numberConfigHelper(10_000)
51
+ },
52
+ poolConnectionTimeoutMs: {
53
+ env: 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS',
54
+ description: 'Connection timeout in milliseconds (0 means no timeout)',
55
+ ...numberConfigHelper(0)
56
+ }
57
+ };
58
+ /**
59
+ * Returns the validator HA signer configuration from environment variables.
60
+ * Note: If an environment variable is not set, the default value is used.
61
+ * @returns The validator HA signer configuration.
62
+ */ export function getConfigEnvVars() {
63
+ return getConfigFromMappings(createHASignerConfigMappings);
64
+ }
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './schema.js';
3
+ export * from './postgres.js';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kYi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGVBQWUsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './schema.js';
3
+ export * from './postgres.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Initial schema for validator HA slashing protection
3
+ *
4
+ * This migration imports SQL from the schema.ts file to ensure a single source of truth.
5
+ */
6
+ import type { MigrationBuilder } from 'node-pg-migrate';
7
+ export declare function up(pgm: MigrationBuilder): void;
8
+ export declare function down(pgm: MigrationBuilder): void;
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMV9pbml0aWFsLXNjaGVtYS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RiL21pZ3JhdGlvbnMvMV9pbml0aWFsLXNjaGVtYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBQ0gsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUl4RCx3QkFBZ0IsRUFBRSxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsR0FBRyxJQUFJLENBVzlDO0FBRUQsd0JBQWdCLElBQUksQ0FBQyxHQUFHLEVBQUUsZ0JBQWdCLEdBQUcsSUFBSSxDQUdoRCJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_initial-schema.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/1_initial-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,wBAAgB,EAAE,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAW9C;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAGhD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Initial schema for validator HA slashing protection
3
+ *
4
+ * This migration imports SQL from the schema.ts file to ensure a single source of truth.
5
+ */ import { DROP_SCHEMA_VERSION_TABLE, DROP_VALIDATOR_DUTIES_TABLE, SCHEMA_SETUP, SCHEMA_VERSION } from '../schema.js';
6
+ export function up(pgm) {
7
+ for (const statement of SCHEMA_SETUP){
8
+ pgm.sql(statement);
9
+ }
10
+ // Insert initial schema version
11
+ pgm.sql(`
12
+ INSERT INTO schema_version (version)
13
+ VALUES (${SCHEMA_VERSION})
14
+ ON CONFLICT (version) DO NOTHING;
15
+ `);
16
+ }
17
+ export function down(pgm) {
18
+ pgm.sql(DROP_VALIDATOR_DUTIES_TABLE);
19
+ pgm.sql(DROP_SCHEMA_VERSION_TABLE);
20
+ }
@@ -0,0 +1,55 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import type { Pool } from 'pg';
3
+ import type { SlashingProtectionDatabase, TryInsertOrGetResult } from '../types.js';
4
+ import type { CheckAndRecordParams, DutyType } from './types.js';
5
+ /**
6
+ * PostgreSQL implementation of the slashing protection database
7
+ */
8
+ export declare class PostgresSlashingProtectionDatabase implements SlashingProtectionDatabase {
9
+ private readonly pool;
10
+ private readonly log;
11
+ constructor(pool: Pool);
12
+ /**
13
+ * Verify that database migrations have been run and schema version matches.
14
+ * Should be called once at startup.
15
+ *
16
+ * @throws Error if migrations haven't been run or schema version is outdated
17
+ */
18
+ initialize(): Promise<void>;
19
+ /**
20
+ * Atomically try to insert a new duty record, or get the existing one if present.
21
+ *
22
+ * @returns { isNew: true, record } if we successfully inserted and acquired the lock
23
+ * @returns { isNew: false, record } if a record already exists. lock_token is empty if the record already exists.
24
+ */
25
+ tryInsertOrGetExisting(params: CheckAndRecordParams): Promise<TryInsertOrGetResult>;
26
+ /**
27
+ * Update a duty to 'signed' status with the signature.
28
+ * Only succeeds if the lockToken matches (caller must be the one who created the duty).
29
+ *
30
+ * @returns true if the update succeeded, false if token didn't match or duty not found
31
+ */
32
+ updateDutySigned(validatorAddress: EthAddress, slot: bigint, dutyType: DutyType, signature: string, lockToken: string): Promise<boolean>;
33
+ /**
34
+ * Delete a duty record.
35
+ * Only succeeds if the lockToken matches (caller must be the one who created the duty).
36
+ * Used when signing fails to allow another node/attempt to retry.
37
+ *
38
+ * @returns true if the delete succeeded, false if token didn't match or duty not found
39
+ */
40
+ deleteDuty(validatorAddress: EthAddress, slot: bigint, dutyType: DutyType, lockToken: string): Promise<boolean>;
41
+ /**
42
+ * Convert a database row to a ValidatorDutyRecord
43
+ */
44
+ private rowToRecord;
45
+ /**
46
+ * Close the database connection pool
47
+ */
48
+ close(): Promise<void>;
49
+ /**
50
+ * Cleanup own stuck duties
51
+ * @returns the number of duties cleaned up
52
+ */
53
+ cleanupOwnStuckDuties(nodeId: string, maxAgeMs: number): Promise<number>;
54
+ }
55
+ //# sourceMappingURL=data:application/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B,EAAE,UAAU,EAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAkBlB;IAED;;;;;;OAMG;IACG,UAAU,CACd,gBAAgB,EAAE,UAAU,EAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAiBlB;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3B;IAED;;;OAGG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI7E;CACF"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * PostgreSQL implementation of SlashingProtectionDatabase
3
+ */ import { randomBytes } from '@aztec/foundation/crypto/random';
4
+ import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import { createLogger } from '@aztec/foundation/log';
6
+ import { CLEANUP_OWN_STUCK_DUTIES, DELETE_DUTY, INSERT_OR_GET_DUTY, SCHEMA_VERSION, UPDATE_DUTY_SIGNED } from './schema.js';
7
+ /**
8
+ * PostgreSQL implementation of the slashing protection database
9
+ */ export class PostgresSlashingProtectionDatabase {
10
+ pool;
11
+ log;
12
+ constructor(pool){
13
+ this.pool = pool;
14
+ this.log = createLogger('slashing-protection:postgres');
15
+ }
16
+ /**
17
+ * Verify that database migrations have been run and schema version matches.
18
+ * Should be called once at startup.
19
+ *
20
+ * @throws Error if migrations haven't been run or schema version is outdated
21
+ */ async initialize() {
22
+ let dbVersion;
23
+ try {
24
+ const result = await this.pool.query(`SELECT version FROM schema_version ORDER BY version DESC LIMIT 1`);
25
+ if (result.rows.length === 0) {
26
+ throw new Error('No version found');
27
+ }
28
+ dbVersion = result.rows[0].version;
29
+ } catch {
30
+ throw new Error('Database schema not initialized. Please run migrations first: aztec migrate up --database-url <url>');
31
+ }
32
+ if (dbVersion < SCHEMA_VERSION) {
33
+ throw new Error(`Database schema version ${dbVersion} is outdated (expected ${SCHEMA_VERSION}). Please run migrations: aztec migrate up --database-url <url>`);
34
+ }
35
+ if (dbVersion > SCHEMA_VERSION) {
36
+ throw new Error(`Database schema version ${dbVersion} is newer than expected (${SCHEMA_VERSION}). Please update your application.`);
37
+ }
38
+ this.log.info('Database schema verified', {
39
+ version: dbVersion
40
+ });
41
+ }
42
+ /**
43
+ * Atomically try to insert a new duty record, or get the existing one if present.
44
+ *
45
+ * @returns { isNew: true, record } if we successfully inserted and acquired the lock
46
+ * @returns { isNew: false, record } if a record already exists. lock_token is empty if the record already exists.
47
+ */ async tryInsertOrGetExisting(params) {
48
+ // create a token for ownership verification
49
+ const lockToken = randomBytes(16).toString('hex');
50
+ const result = await this.pool.query(INSERT_OR_GET_DUTY, [
51
+ params.validatorAddress.toString(),
52
+ params.slot.toString(),
53
+ params.blockNumber.toString(),
54
+ params.dutyType,
55
+ params.messageHash,
56
+ params.nodeId,
57
+ lockToken
58
+ ]);
59
+ if (result.rows.length === 0) {
60
+ // This shouldn't happen - the query always returns either the inserted or existing row
61
+ throw new Error('INSERT_OR_GET_DUTY returned no rows');
62
+ }
63
+ const row = result.rows[0];
64
+ return {
65
+ isNew: row.is_new,
66
+ record: this.rowToRecord(row)
67
+ };
68
+ }
69
+ /**
70
+ * Update a duty to 'signed' status with the signature.
71
+ * Only succeeds if the lockToken matches (caller must be the one who created the duty).
72
+ *
73
+ * @returns true if the update succeeded, false if token didn't match or duty not found
74
+ */ async updateDutySigned(validatorAddress, slot, dutyType, signature, lockToken) {
75
+ const result = await this.pool.query(UPDATE_DUTY_SIGNED, [
76
+ signature,
77
+ validatorAddress.toString(),
78
+ slot.toString(),
79
+ dutyType,
80
+ lockToken
81
+ ]);
82
+ if (result.rowCount === 0) {
83
+ this.log.warn('Failed to update duty to signed status: invalid token or duty not found', {
84
+ validatorAddress: validatorAddress.toString(),
85
+ slot: slot.toString(),
86
+ dutyType
87
+ });
88
+ return false;
89
+ }
90
+ return true;
91
+ }
92
+ /**
93
+ * Delete a duty record.
94
+ * Only succeeds if the lockToken matches (caller must be the one who created the duty).
95
+ * Used when signing fails to allow another node/attempt to retry.
96
+ *
97
+ * @returns true if the delete succeeded, false if token didn't match or duty not found
98
+ */ async deleteDuty(validatorAddress, slot, dutyType, lockToken) {
99
+ const result = await this.pool.query(DELETE_DUTY, [
100
+ validatorAddress.toString(),
101
+ slot.toString(),
102
+ dutyType,
103
+ lockToken
104
+ ]);
105
+ if (result.rowCount === 0) {
106
+ this.log.warn('Failed to delete duty: invalid token or duty not found', {
107
+ validatorAddress: validatorAddress.toString(),
108
+ slot: slot.toString(),
109
+ dutyType
110
+ });
111
+ return false;
112
+ }
113
+ return true;
114
+ }
115
+ /**
116
+ * Convert a database row to a ValidatorDutyRecord
117
+ */ rowToRecord(row) {
118
+ return {
119
+ validatorAddress: EthAddress.fromString(row.validator_address),
120
+ slot: BigInt(row.slot),
121
+ blockNumber: BigInt(row.block_number),
122
+ dutyType: row.duty_type,
123
+ status: row.status,
124
+ messageHash: row.message_hash,
125
+ signature: row.signature ?? undefined,
126
+ nodeId: row.node_id,
127
+ lockToken: row.lock_token,
128
+ startedAt: row.started_at,
129
+ completedAt: row.completed_at ?? undefined,
130
+ errorMessage: row.error_message ?? undefined
131
+ };
132
+ }
133
+ /**
134
+ * Close the database connection pool
135
+ */ async close() {
136
+ await this.pool.end();
137
+ this.log.info('Database connection pool closed');
138
+ }
139
+ /**
140
+ * Cleanup own stuck duties
141
+ * @returns the number of duties cleaned up
142
+ */ async cleanupOwnStuckDuties(nodeId, maxAgeMs) {
143
+ const cutoff = new Date(Date.now() - maxAgeMs);
144
+ const result = await this.pool.query(CLEANUP_OWN_STUCK_DUTIES, [
145
+ nodeId,
146
+ cutoff
147
+ ]);
148
+ return result.rowCount ?? 0;
149
+ }
150
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * SQL schema for the validator_duties table
3
+ *
4
+ * This table is used for distributed locking and slashing protection across multiple validator nodes.
5
+ * The PRIMARY KEY constraint ensures that only one node can acquire the lock for a given validator,
6
+ * slot, and duty type combination.
7
+ */
8
+ /**
9
+ * Current schema version
10
+ */
11
+ export declare const SCHEMA_VERSION = 1;
12
+ /**
13
+ * SQL to create the validator_duties table
14
+ */
15
+ export declare const CREATE_VALIDATOR_DUTIES_TABLE = "\nCREATE TABLE IF NOT EXISTS validator_duties (\n validator_address VARCHAR(42) NOT NULL,\n slot BIGINT NOT NULL,\n block_number BIGINT NOT NULL,\n duty_type VARCHAR(30) NOT NULL CHECK (duty_type IN ('BLOCK_PROPOSAL', 'ATTESTATION', 'ATTESTATIONS_AND_SIGNERS')),\n status VARCHAR(20) NOT NULL CHECK (status IN ('signing', 'signed', 'failed')),\n message_hash VARCHAR(66) NOT NULL,\n signature VARCHAR(132),\n node_id VARCHAR(255) NOT NULL,\n lock_token VARCHAR(64) NOT NULL,\n started_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n completed_at TIMESTAMP,\n error_message TEXT,\n\n PRIMARY KEY (validator_address, slot, duty_type),\n CHECK (completed_at IS NULL OR completed_at >= started_at)\n);\n";
16
+ /**
17
+ * SQL to create index on status and started_at for cleanup queries
18
+ */
19
+ export declare const CREATE_STATUS_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_validator_duties_status\nON validator_duties(status, started_at);\n";
20
+ /**
21
+ * SQL to create index for querying duties by node
22
+ */
23
+ export declare const CREATE_NODE_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_validator_duties_node\nON validator_duties(node_id, started_at);\n";
24
+ /**
25
+ * SQL to create the schema_version table for tracking migrations
26
+ */
27
+ export declare const CREATE_SCHEMA_VERSION_TABLE = "\nCREATE TABLE IF NOT EXISTS schema_version (\n version INTEGER PRIMARY KEY,\n applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n";
28
+ /**
29
+ * SQL to initialize schema version
30
+ */
31
+ export declare const INSERT_SCHEMA_VERSION = "\nINSERT INTO schema_version (version)\nVALUES ($1)\nON CONFLICT (version) DO NOTHING;\n";
32
+ /**
33
+ * Complete schema setup - all statements in order
34
+ */
35
+ export declare const SCHEMA_SETUP: readonly ["\nCREATE TABLE IF NOT EXISTS schema_version (\n version INTEGER PRIMARY KEY,\n applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n", "\nCREATE TABLE IF NOT EXISTS validator_duties (\n validator_address VARCHAR(42) NOT NULL,\n slot BIGINT NOT NULL,\n block_number BIGINT NOT NULL,\n duty_type VARCHAR(30) NOT NULL CHECK (duty_type IN ('BLOCK_PROPOSAL', 'ATTESTATION', 'ATTESTATIONS_AND_SIGNERS')),\n status VARCHAR(20) NOT NULL CHECK (status IN ('signing', 'signed', 'failed')),\n message_hash VARCHAR(66) NOT NULL,\n signature VARCHAR(132),\n node_id VARCHAR(255) NOT NULL,\n lock_token VARCHAR(64) NOT NULL,\n started_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n completed_at TIMESTAMP,\n error_message TEXT,\n\n PRIMARY KEY (validator_address, slot, duty_type),\n CHECK (completed_at IS NULL OR completed_at >= started_at)\n);\n", "\nCREATE INDEX IF NOT EXISTS idx_validator_duties_status\nON validator_duties(status, started_at);\n", "\nCREATE INDEX IF NOT EXISTS idx_validator_duties_node\nON validator_duties(node_id, started_at);\n"];
36
+ /**
37
+ * Query to get current schema version
38
+ */
39
+ export declare const GET_SCHEMA_VERSION = "\nSELECT version FROM schema_version ORDER BY version DESC LIMIT 1;\n";
40
+ /**
41
+ * Atomic insert-or-get query.
42
+ * Tries to insert a new duty record. If a record already exists (conflict),
43
+ * returns the existing record instead.
44
+ *
45
+ * Returns the record with an `is_new` flag indicating whether we inserted or got existing.
46
+ */
47
+ export declare const INSERT_OR_GET_DUTY = "\nWITH inserted AS (\n INSERT INTO validator_duties (\n validator_address,\n slot,\n block_number,\n duty_type,\n status,\n message_hash,\n node_id,\n lock_token,\n started_at\n ) VALUES ($1, $2, $3, $4, 'signing', $5, $6, $7, CURRENT_TIMESTAMP)\n ON CONFLICT (validator_address, slot, duty_type) DO NOTHING\n RETURNING\n validator_address,\n slot,\n block_number,\n duty_type,\n status,\n message_hash,\n signature,\n node_id,\n lock_token,\n started_at,\n completed_at,\n error_message,\n TRUE as is_new\n)\nSELECT * FROM inserted\nUNION ALL\nSELECT\n validator_address,\n slot,\n block_number,\n duty_type,\n status,\n message_hash,\n signature,\n node_id,\n '' as lock_token,\n started_at,\n completed_at,\n error_message,\n FALSE as is_new\nFROM validator_duties\nWHERE validator_address = $1\n AND slot = $2\n AND duty_type = $4\n AND NOT EXISTS (SELECT 1 FROM inserted);\n";
48
+ /**
49
+ * Query to update a duty to 'signed' status
50
+ */
51
+ export declare const UPDATE_DUTY_SIGNED = "\nUPDATE validator_duties\nSET status = 'signed',\n signature = $1,\n completed_at = CURRENT_TIMESTAMP\nWHERE validator_address = $2\n AND slot = $3\n AND duty_type = $4\n AND status = 'signing'\n AND lock_token = $5;\n";
52
+ /**
53
+ * Query to delete a duty
54
+ * Only deletes if the lockToken matches
55
+ */
56
+ export declare const DELETE_DUTY = "\nDELETE FROM validator_duties\nWHERE validator_address = $1\n AND slot = $2\n AND duty_type = $3\n AND status = 'signing'\n AND lock_token = $4;\n";
57
+ /**
58
+ * Query to clean up old signed duties (for maintenance)
59
+ * Removes signed duties older than a specified timestamp
60
+ */
61
+ export declare const CLEANUP_OLD_SIGNED_DUTIES = "\nDELETE FROM validator_duties\nWHERE status = 'signed'\n AND completed_at < $1;\n";
62
+ /**
63
+ * Query to clean up old duties (for maintenance)
64
+ * Removes duties older than a specified timestamp
65
+ */
66
+ export declare const CLEANUP_OLD_DUTIES = "\nDELETE FROM validator_duties\nWHERE status IN ('signing', 'signed', 'failed')\n AND started_at < $1;\n";
67
+ /**
68
+ * Query to cleanup own stuck duties
69
+ * Removes duties in 'signing' status for a specific node that are older than maxAgeMs
70
+ */
71
+ export declare const CLEANUP_OWN_STUCK_DUTIES = "\nDELETE FROM validator_duties\nWHERE node_id = $1\n AND status = 'signing'\n AND started_at < $2;\n";
72
+ /**
73
+ * SQL to drop the validator_duties table
74
+ */
75
+ export declare const DROP_VALIDATOR_DUTIES_TABLE = "DROP TABLE IF EXISTS validator_duties;";
76
+ /**
77
+ * SQL to drop the schema_version table
78
+ */
79
+ export declare const DROP_SCHEMA_VERSION_TABLE = "DROP TABLE IF EXISTS schema_version;";
80
+ /**
81
+ * Query to get stuck duties (for monitoring/alerting)
82
+ * Returns duties in 'signing' status that have been stuck for too long
83
+ */
84
+ export declare const GET_STUCK_DUTIES = "\nSELECT\n validator_address,\n slot,\n block_number,\n duty_type,\n status,\n message_hash,\n node_id,\n started_at,\n EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - started_at)) as age_seconds\nFROM validator_duties\nWHERE status = 'signing'\n AND started_at < $1\nORDER BY started_at ASC;\n";
85
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGIvc2NoZW1hLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVIOztHQUVHO0FBQ0gsZUFBTyxNQUFNLGNBQWMsSUFBSSxDQUFDO0FBRWhDOztHQUVHO0FBQ0gsZUFBTyxNQUFNLDZCQUE2QixpdEJBa0J6QyxDQUFDO0FBRUY7O0dBRUc7QUFDSCxlQUFPLE1BQU0sbUJBQW1CLHlHQUcvQixDQUFDO0FBRUY7O0dBRUc7QUFDSCxlQUFPLE1BQU0saUJBQWlCLHdHQUc3QixDQUFDO0FBRUY7O0dBRUc7QUFDSCxlQUFPLE1BQU0sMkJBQTJCLG1KQUt2QyxDQUFDO0FBRUY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