@aztec/stdlib 0.0.1-commit.f504929 → 0.0.1-commit.f81dbcf
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.
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +14 -8
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -4
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/sequencer-config.d.ts +2 -4
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +1 -3
- package/dest/epoch-helpers/index.d.ts +5 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +4 -2
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +1 -4
- package/dest/interfaces/allowed_element.d.ts +25 -1
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -2
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +55 -7
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +11 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +5 -2
- package/dest/interfaces/block-builder.d.ts +17 -9
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +12 -5
- package/dest/interfaces/configs.d.ts +42 -7
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/validator.d.ts +65 -6
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +6 -3
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/p2p/block_proposal.d.ts +2 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +14 -24
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/slashing/tally.d.ts +5 -6
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +19 -10
- package/dest/tests/mocks.d.ts +4 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +13 -8
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +7 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +6 -3
- package/dest/tx/validator/error_texts.d.ts +6 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +6 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/package.json +9 -9
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +14 -7
- package/src/checkpoint/checkpoint.ts +12 -3
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/sequencer-config.ts +2 -5
- package/src/epoch-helpers/index.ts +3 -0
- package/src/gas/gas_fees.ts +1 -7
- package/src/interfaces/allowed_element.ts +28 -4
- package/src/interfaces/archiver.ts +3 -2
- package/src/interfaces/aztec-node.ts +23 -5
- package/src/interfaces/block-builder.ts +30 -11
- package/src/interfaces/configs.ts +12 -4
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/validator.ts +18 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/p2p/block_proposal.ts +1 -1
- package/src/p2p/checkpoint_proposal.ts +24 -38
- package/src/p2p/peer_error.ts +7 -0
- package/src/slashing/tally.ts +22 -4
- package/src/tests/mocks.ts +18 -7
- package/src/tx/block_header.ts +6 -0
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +7 -2
- package/src/tx/validator/error_texts.ts +7 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/dest/ha-signing/config.d.ts +0 -101
- package/dest/ha-signing/config.d.ts.map +0 -1
- package/dest/ha-signing/config.js +0 -92
- package/dest/ha-signing/index.d.ts +0 -3
- package/dest/ha-signing/index.d.ts.map +0 -1
- package/dest/ha-signing/index.js +0 -2
- package/dest/ha-signing/types.d.ts +0 -85
- package/dest/ha-signing/types.d.ts.map +0 -1
- package/dest/ha-signing/types.js +0 -32
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/ha-signing/config.ts +0 -149
- package/src/ha-signing/index.ts +0 -18
- package/src/ha-signing/types.ts +0 -112
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
export const validatorHASignerConfigMappings = {
|
|
5
|
-
haSigningEnabled: {
|
|
6
|
-
env: 'VALIDATOR_HA_SIGNING_ENABLED',
|
|
7
|
-
description: 'Whether HA signing / slashing protection is enabled',
|
|
8
|
-
...booleanConfigHelper(false)
|
|
9
|
-
},
|
|
10
|
-
l1Contracts: {
|
|
11
|
-
description: 'L1 contract addresses (rollup address required)',
|
|
12
|
-
nested: {
|
|
13
|
-
rollupAddress: {
|
|
14
|
-
description: 'The Ethereum address of the rollup contract (must be set programmatically)',
|
|
15
|
-
parseEnv: (val)=>EthAddress.fromString(val)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
nodeId: {
|
|
20
|
-
env: 'VALIDATOR_HA_NODE_ID',
|
|
21
|
-
description: 'The unique identifier for this node',
|
|
22
|
-
defaultValue: ''
|
|
23
|
-
},
|
|
24
|
-
pollingIntervalMs: {
|
|
25
|
-
env: 'VALIDATOR_HA_POLLING_INTERVAL_MS',
|
|
26
|
-
description: 'The number of ms to wait between polls when a duty is being signed',
|
|
27
|
-
...numberConfigHelper(100)
|
|
28
|
-
},
|
|
29
|
-
signingTimeoutMs: {
|
|
30
|
-
env: 'VALIDATOR_HA_SIGNING_TIMEOUT_MS',
|
|
31
|
-
description: 'The maximum time to wait for a duty being signed to complete',
|
|
32
|
-
...numberConfigHelper(3_000)
|
|
33
|
-
},
|
|
34
|
-
maxStuckDutiesAgeMs: {
|
|
35
|
-
env: 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS',
|
|
36
|
-
description: 'The maximum age of a stuck duty in ms (defaults to 2x Aztec slot duration)',
|
|
37
|
-
...optionalNumberConfigHelper()
|
|
38
|
-
},
|
|
39
|
-
cleanupOldDutiesAfterHours: {
|
|
40
|
-
env: 'VALIDATOR_HA_OLD_DUTIES_MAX_AGE_H',
|
|
41
|
-
description: 'Optional: clean up old duties after this many hours (disabled if not set)',
|
|
42
|
-
...optionalNumberConfigHelper()
|
|
43
|
-
},
|
|
44
|
-
databaseUrl: {
|
|
45
|
-
env: 'VALIDATOR_HA_DATABASE_URL',
|
|
46
|
-
description: 'PostgreSQL connection string for validator HA signer (format: postgresql://user:password@host:port/database)'
|
|
47
|
-
},
|
|
48
|
-
poolMaxCount: {
|
|
49
|
-
env: 'VALIDATOR_HA_POOL_MAX',
|
|
50
|
-
description: 'Maximum number of clients in the pool',
|
|
51
|
-
...numberConfigHelper(10)
|
|
52
|
-
},
|
|
53
|
-
poolMinCount: {
|
|
54
|
-
env: 'VALIDATOR_HA_POOL_MIN',
|
|
55
|
-
description: 'Minimum number of clients in the pool',
|
|
56
|
-
...numberConfigHelper(0)
|
|
57
|
-
},
|
|
58
|
-
poolIdleTimeoutMs: {
|
|
59
|
-
env: 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS',
|
|
60
|
-
description: 'Idle timeout in milliseconds',
|
|
61
|
-
...numberConfigHelper(10_000)
|
|
62
|
-
},
|
|
63
|
-
poolConnectionTimeoutMs: {
|
|
64
|
-
env: 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS',
|
|
65
|
-
description: 'Connection timeout in milliseconds (0 means no timeout)',
|
|
66
|
-
...numberConfigHelper(0)
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
export const defaultValidatorHASignerConfig = getDefaultConfig(validatorHASignerConfigMappings);
|
|
70
|
-
/**
|
|
71
|
-
* Returns the validator HA signer configuration from environment variables.
|
|
72
|
-
* Note: If an environment variable is not set, the default value is used.
|
|
73
|
-
* @returns The validator HA signer configuration.
|
|
74
|
-
*/ export function getConfigEnvVars() {
|
|
75
|
-
return getConfigFromMappings(validatorHASignerConfigMappings);
|
|
76
|
-
}
|
|
77
|
-
export const ValidatorHASignerConfigSchema = z.object({
|
|
78
|
-
haSigningEnabled: z.boolean(),
|
|
79
|
-
l1Contracts: z.object({
|
|
80
|
-
rollupAddress: z.instanceof(EthAddress)
|
|
81
|
-
}),
|
|
82
|
-
nodeId: z.string(),
|
|
83
|
-
pollingIntervalMs: z.number().min(0),
|
|
84
|
-
signingTimeoutMs: z.number().min(0),
|
|
85
|
-
maxStuckDutiesAgeMs: z.number().min(0).optional(),
|
|
86
|
-
cleanupOldDutiesAfterHours: z.number().min(0).optional(),
|
|
87
|
-
databaseUrl: z.string().optional(),
|
|
88
|
-
poolMaxCount: z.number().min(0).optional(),
|
|
89
|
-
poolMinCount: z.number().min(0).optional(),
|
|
90
|
-
poolIdleTimeoutMs: z.number().min(0).optional(),
|
|
91
|
-
poolConnectionTimeoutMs: z.number().min(0).optional()
|
|
92
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { type ValidatorHASignerConfig, ValidatorHASignerConfigSchema, defaultValidatorHASignerConfig, getConfigEnvVars, validatorHASignerConfigMappings, } from './config.js';
|
|
2
|
-
export { DutyType, type BlockProposalSigningContext, type HAProtectedSigningContext, type NoHAProtectionSigningContext, type OtherSigningContext, type SigningContext, type VoteSigningContext, getBlockNumberFromSigningContext, isHAProtectedContext, } from './types.js';
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oYS1zaWduaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLHVCQUF1QixFQUM1Qiw2QkFBNkIsRUFDN0IsOEJBQThCLEVBQzlCLGdCQUFnQixFQUNoQiwrQkFBK0IsR0FDaEMsTUFBTSxhQUFhLENBQUM7QUFDckIsT0FBTyxFQUNMLFFBQVEsRUFDUixLQUFLLDJCQUEyQixFQUNoQyxLQUFLLHlCQUF5QixFQUM5QixLQUFLLDRCQUE0QixFQUNqQyxLQUFLLG1CQUFtQixFQUN4QixLQUFLLGNBQWMsRUFDbkIsS0FBSyxrQkFBa0IsRUFDdkIsZ0NBQWdDLEVBQ2hDLG9CQUFvQixHQUNyQixNQUFNLFlBQVksQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ha-signing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,gCAAgC,EAChC,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dest/ha-signing/index.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { BlockNumber, type CheckpointNumber, type IndexWithinCheckpoint, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
/**
|
|
3
|
-
* Type of validator duty being performed
|
|
4
|
-
*/
|
|
5
|
-
export declare enum DutyType {
|
|
6
|
-
BLOCK_PROPOSAL = "BLOCK_PROPOSAL",
|
|
7
|
-
CHECKPOINT_PROPOSAL = "CHECKPOINT_PROPOSAL",
|
|
8
|
-
ATTESTATION = "ATTESTATION",
|
|
9
|
-
ATTESTATIONS_AND_SIGNERS = "ATTESTATIONS_AND_SIGNERS",
|
|
10
|
-
GOVERNANCE_VOTE = "GOVERNANCE_VOTE",
|
|
11
|
-
SLASHING_VOTE = "SLASHING_VOTE",
|
|
12
|
-
AUTH_REQUEST = "AUTH_REQUEST",
|
|
13
|
-
TXS = "TXS"
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Base context for signing operations
|
|
17
|
-
*/
|
|
18
|
-
interface BaseSigningContext {
|
|
19
|
-
/** Slot number for this duty */
|
|
20
|
-
slot: SlotNumber;
|
|
21
|
-
/**
|
|
22
|
-
* Block or checkpoint number for this duty.
|
|
23
|
-
* For block proposals, this is the block number.
|
|
24
|
-
* For checkpoint proposals, this is the checkpoint number.
|
|
25
|
-
*/
|
|
26
|
-
blockNumber: BlockNumber | CheckpointNumber;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Signing context for block proposals.
|
|
30
|
-
* blockIndexWithinCheckpoint is REQUIRED and must be >= 0.
|
|
31
|
-
*/
|
|
32
|
-
export interface BlockProposalSigningContext extends BaseSigningContext {
|
|
33
|
-
/** Block index within checkpoint (0, 1, 2...). Required for block proposals. */
|
|
34
|
-
blockIndexWithinCheckpoint: IndexWithinCheckpoint;
|
|
35
|
-
dutyType: DutyType.BLOCK_PROPOSAL;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Signing context for non-block-proposal duties that require HA protection.
|
|
39
|
-
* blockIndexWithinCheckpoint is not applicable (internally always -1).
|
|
40
|
-
*/
|
|
41
|
-
export interface OtherSigningContext extends BaseSigningContext {
|
|
42
|
-
dutyType: DutyType.CHECKPOINT_PROPOSAL | DutyType.ATTESTATION | DutyType.ATTESTATIONS_AND_SIGNERS;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Signing context for governance/slashing votes which only need slot for HA protection.
|
|
46
|
-
* blockNumber is not applicable (internally always 0).
|
|
47
|
-
*/
|
|
48
|
-
export interface VoteSigningContext {
|
|
49
|
-
slot: SlotNumber;
|
|
50
|
-
dutyType: DutyType.GOVERNANCE_VOTE | DutyType.SLASHING_VOTE;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Signing context for duties which don't require slot/blockNumber
|
|
54
|
-
* as they don't need HA protection (AUTH_REQUEST, TXS).
|
|
55
|
-
*/
|
|
56
|
-
export interface NoHAProtectionSigningContext {
|
|
57
|
-
dutyType: DutyType.AUTH_REQUEST | DutyType.TXS;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Signing contexts that require HA protection (excludes AUTH_REQUEST).
|
|
61
|
-
* Used by the HA signer's signWithProtection method.
|
|
62
|
-
*/
|
|
63
|
-
export type HAProtectedSigningContext = BlockProposalSigningContext | OtherSigningContext | VoteSigningContext;
|
|
64
|
-
/**
|
|
65
|
-
* Context required for slashing protection during signing operations.
|
|
66
|
-
* Uses discriminated union to enforce type safety:
|
|
67
|
-
* - BLOCK_PROPOSAL duties MUST have blockIndexWithinCheckpoint >= 0
|
|
68
|
-
* - Other duty types do NOT have blockIndexWithinCheckpoint (internally -1)
|
|
69
|
-
* - Vote duties only need slot (blockNumber is internally 0)
|
|
70
|
-
* - AUTH_REQUEST and TXS duties don't need slot/blockNumber (no HA protection needed)
|
|
71
|
-
*/
|
|
72
|
-
export type SigningContext = HAProtectedSigningContext | NoHAProtectionSigningContext;
|
|
73
|
-
/**
|
|
74
|
-
* Type guard to check if a SigningContext requires HA protection.
|
|
75
|
-
* Returns true for contexts that need HA protection, false for AUTH_REQUEST and TXS.
|
|
76
|
-
*/
|
|
77
|
-
export declare function isHAProtectedContext(context: SigningContext): context is HAProtectedSigningContext;
|
|
78
|
-
/**
|
|
79
|
-
* Gets the block number from a signing context.
|
|
80
|
-
* - Vote duties (GOVERNANCE_VOTE, SLASHING_VOTE): returns BlockNumber(0)
|
|
81
|
-
* - Other duties: returns the blockNumber from the context
|
|
82
|
-
*/
|
|
83
|
-
export declare function getBlockNumberFromSigningContext(context: HAProtectedSigningContext): BlockNumber | CheckpointNumber;
|
|
84
|
-
export {};
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oYS1zaWduaW5nL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxXQUFXLEVBQ1gsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxxQkFBcUIsRUFDMUIsS0FBSyxVQUFVLEVBQ2hCLE1BQU0saUNBQWlDLENBQUM7QUFFekM7O0d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,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,QAAQ,EAAE,QAAQ,CAAC,mBAAmB,GAAG,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,wBAAwB,CAAC;CACnG;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,2BAA2B,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAE/G;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,yBAAyB,GAAG,4BAA4B,CAAC;AAEtF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,IAAI,yBAAyB,CAElG;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,yBAAyB,GAAG,WAAW,GAAG,gBAAgB,CAYnH"}
|
package/dest/ha-signing/types.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
/**
|
|
3
|
-
* Type of validator duty being performed
|
|
4
|
-
*/ export var DutyType = /*#__PURE__*/ function(DutyType) {
|
|
5
|
-
DutyType["BLOCK_PROPOSAL"] = "BLOCK_PROPOSAL";
|
|
6
|
-
DutyType["CHECKPOINT_PROPOSAL"] = "CHECKPOINT_PROPOSAL";
|
|
7
|
-
DutyType["ATTESTATION"] = "ATTESTATION";
|
|
8
|
-
DutyType["ATTESTATIONS_AND_SIGNERS"] = "ATTESTATIONS_AND_SIGNERS";
|
|
9
|
-
DutyType["GOVERNANCE_VOTE"] = "GOVERNANCE_VOTE";
|
|
10
|
-
DutyType["SLASHING_VOTE"] = "SLASHING_VOTE";
|
|
11
|
-
DutyType["AUTH_REQUEST"] = "AUTH_REQUEST";
|
|
12
|
-
DutyType["TXS"] = "TXS";
|
|
13
|
-
return DutyType;
|
|
14
|
-
}({});
|
|
15
|
-
/**
|
|
16
|
-
* Type guard to check if a SigningContext requires HA protection.
|
|
17
|
-
* Returns true for contexts that need HA protection, false for AUTH_REQUEST and TXS.
|
|
18
|
-
*/ export function isHAProtectedContext(context) {
|
|
19
|
-
return context.dutyType !== "AUTH_REQUEST" && context.dutyType !== "TXS";
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Gets the block number from a signing context.
|
|
23
|
-
* - Vote duties (GOVERNANCE_VOTE, SLASHING_VOTE): returns BlockNumber(0)
|
|
24
|
-
* - Other duties: returns the blockNumber from the context
|
|
25
|
-
*/ export function getBlockNumberFromSigningContext(context) {
|
|
26
|
-
// Check for duty types that have blockNumber
|
|
27
|
-
if (context.dutyType === "BLOCK_PROPOSAL" || context.dutyType === "CHECKPOINT_PROPOSAL" || context.dutyType === "ATTESTATION" || context.dutyType === "ATTESTATIONS_AND_SIGNERS") {
|
|
28
|
-
return context.blockNumber;
|
|
29
|
-
}
|
|
30
|
-
// Vote duties (GOVERNANCE_VOTE, SLASHING_VOTE) don't have blockNumber
|
|
31
|
-
return BlockNumber(0);
|
|
32
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { ViemClient } from '@aztec/ethereum/types';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
export type EventMap = {
|
|
5
|
-
newRollupVersion: [{
|
|
6
|
-
currentVersion: bigint;
|
|
7
|
-
latestVersion: bigint;
|
|
8
|
-
}];
|
|
9
|
-
newNodeVersion: [{
|
|
10
|
-
currentVersion: string;
|
|
11
|
-
latestVersion: string;
|
|
12
|
-
}];
|
|
13
|
-
updateNodeConfig: [object];
|
|
14
|
-
updatePublicTelemetryConfig: [object];
|
|
15
|
-
};
|
|
16
|
-
type Config = {
|
|
17
|
-
baseURL: URL;
|
|
18
|
-
nodeVersion?: string;
|
|
19
|
-
checkIntervalMs?: number;
|
|
20
|
-
registryContractAddress: EthAddress;
|
|
21
|
-
publicClient: ViemClient;
|
|
22
|
-
fetch?: typeof fetch;
|
|
23
|
-
};
|
|
24
|
-
export declare class UpdateChecker extends EventEmitter<EventMap> {
|
|
25
|
-
private updatesUrl;
|
|
26
|
-
private nodeVersion;
|
|
27
|
-
private rollupVersion;
|
|
28
|
-
private fetch;
|
|
29
|
-
private getLatestRollupVersion;
|
|
30
|
-
private checkIntervalMs;
|
|
31
|
-
private log;
|
|
32
|
-
private runningPromise;
|
|
33
|
-
private lastPatchedConfig;
|
|
34
|
-
private lastPatchedPublicTelemetryConfig;
|
|
35
|
-
constructor(updatesUrl: URL, nodeVersion: string | undefined, rollupVersion: bigint, fetch: typeof globalThis.fetch, getLatestRollupVersion: () => Promise<bigint>, checkIntervalMs?: number, log?: import("@aztec/foundation/log").Logger);
|
|
36
|
-
static new(config: Config): Promise<UpdateChecker>;
|
|
37
|
-
start(): void;
|
|
38
|
-
stop(): Promise<void>;
|
|
39
|
-
trigger(): Promise<void>;
|
|
40
|
-
private runChecks;
|
|
41
|
-
private checkRollupVersion;
|
|
42
|
-
private checkConfig;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns package version.
|
|
46
|
-
*/
|
|
47
|
-
export declare function getPackageVersion(): string | undefined;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBkYXRlLWNoZWNrZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cGRhdGUtY2hlY2tlci91cGRhdGUtY2hlY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQ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;IAEM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3B;IAEM,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;IAED,OAAO,CAAC,SAAS,CAEf;YAEY,kBAAkB;YAelB,WAAW;CAsC1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAWtD"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
5
|
-
import { EventEmitter } from 'events';
|
|
6
|
-
import { readFileSync } from 'fs';
|
|
7
|
-
import { dirname, resolve } from 'path';
|
|
8
|
-
import { isDeepStrictEqual } from 'util';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
const updateConfigSchema = z.object({
|
|
11
|
-
version: z.string().optional(),
|
|
12
|
-
publicTelemetry: z.any().optional(),
|
|
13
|
-
config: z.any().optional()
|
|
14
|
-
});
|
|
15
|
-
export class UpdateChecker extends EventEmitter {
|
|
16
|
-
updatesUrl;
|
|
17
|
-
nodeVersion;
|
|
18
|
-
rollupVersion;
|
|
19
|
-
fetch;
|
|
20
|
-
getLatestRollupVersion;
|
|
21
|
-
checkIntervalMs;
|
|
22
|
-
log;
|
|
23
|
-
runningPromise;
|
|
24
|
-
lastPatchedConfig;
|
|
25
|
-
lastPatchedPublicTelemetryConfig;
|
|
26
|
-
constructor(updatesUrl, nodeVersion, rollupVersion, fetch1, getLatestRollupVersion, checkIntervalMs = 10 * 60_000, log = createLogger('foundation:update-check')){
|
|
27
|
-
super(), this.updatesUrl = updatesUrl, this.nodeVersion = nodeVersion, this.rollupVersion = rollupVersion, this.fetch = fetch1, this.getLatestRollupVersion = getLatestRollupVersion, this.checkIntervalMs = checkIntervalMs, this.log = log, this.lastPatchedConfig = {}, this.lastPatchedPublicTelemetryConfig = {}, this.runChecks = async ()=>{
|
|
28
|
-
await Promise.all([
|
|
29
|
-
this.checkRollupVersion(),
|
|
30
|
-
this.checkConfig()
|
|
31
|
-
]);
|
|
32
|
-
};
|
|
33
|
-
this.runningPromise = new RunningPromise(this.runChecks, this.log, this.checkIntervalMs);
|
|
34
|
-
}
|
|
35
|
-
static async new(config) {
|
|
36
|
-
const registryContract = new RegistryContract(config.publicClient, config.registryContractAddress);
|
|
37
|
-
const getLatestRollupVersion = ()=>registryContract.getRollupVersions().then((versions)=>versions.at(-1));
|
|
38
|
-
return new UpdateChecker(config.baseURL, config.nodeVersion ?? getPackageVersion(), await getLatestRollupVersion(), config.fetch ?? fetch, getLatestRollupVersion, config.checkIntervalMs);
|
|
39
|
-
}
|
|
40
|
-
start() {
|
|
41
|
-
if (this.runningPromise.isRunning()) {
|
|
42
|
-
this.log.debug(`Can't start update checker again`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.log.info('Starting update checker', {
|
|
46
|
-
nodeVersion: this.nodeVersion,
|
|
47
|
-
rollupVersion: this.rollupVersion
|
|
48
|
-
});
|
|
49
|
-
this.runningPromise.start();
|
|
50
|
-
}
|
|
51
|
-
stop() {
|
|
52
|
-
if (!this.runningPromise.isRunning()) {
|
|
53
|
-
this.log.debug(`Can't stop update checker because it is not running`);
|
|
54
|
-
return Promise.resolve();
|
|
55
|
-
}
|
|
56
|
-
return this.runningPromise.stop();
|
|
57
|
-
}
|
|
58
|
-
trigger() {
|
|
59
|
-
return this.runningPromise.trigger();
|
|
60
|
-
}
|
|
61
|
-
runChecks;
|
|
62
|
-
async checkRollupVersion() {
|
|
63
|
-
try {
|
|
64
|
-
const canonicalRollupVersion = await this.getLatestRollupVersion();
|
|
65
|
-
if (canonicalRollupVersion !== this.rollupVersion) {
|
|
66
|
-
this.log.debug('New canonical rollup version', {
|
|
67
|
-
currentVersion: this.rollupVersion,
|
|
68
|
-
latestVersion: canonicalRollupVersion
|
|
69
|
-
});
|
|
70
|
-
this.emit('newRollupVersion', {
|
|
71
|
-
currentVersion: this.rollupVersion,
|
|
72
|
-
latestVersion: canonicalRollupVersion
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
} catch (err) {
|
|
76
|
-
this.log.warn(`Failed to check if there is a new rollup`, err);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async checkConfig() {
|
|
80
|
-
try {
|
|
81
|
-
const response = await this.fetch(this.updatesUrl);
|
|
82
|
-
const body = await response.json();
|
|
83
|
-
if (!response.ok) {
|
|
84
|
-
this.log.warn(`Unexpected HTTP response checking for updates`, {
|
|
85
|
-
status: response.status,
|
|
86
|
-
body: await response.text(),
|
|
87
|
-
url: this.updatesUrl
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const { version, config, publicTelemetry } = updateConfigSchema.parse(body);
|
|
91
|
-
if (this.nodeVersion && version && version !== this.nodeVersion) {
|
|
92
|
-
this.log.debug('New node version', {
|
|
93
|
-
currentVersion: this.nodeVersion,
|
|
94
|
-
latestVersion: version
|
|
95
|
-
});
|
|
96
|
-
this.emit('newNodeVersion', {
|
|
97
|
-
currentVersion: this.nodeVersion,
|
|
98
|
-
latestVersion: version
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (config && Object.keys(config).length > 0 && !isDeepStrictEqual(config, this.lastPatchedConfig)) {
|
|
102
|
-
this.log.debug('New node config', {
|
|
103
|
-
config
|
|
104
|
-
});
|
|
105
|
-
this.lastPatchedConfig = config;
|
|
106
|
-
this.emit('updateNodeConfig', config);
|
|
107
|
-
}
|
|
108
|
-
if (publicTelemetry && Object.keys(publicTelemetry).length > 0 && !isDeepStrictEqual(publicTelemetry, this.lastPatchedPublicTelemetryConfig)) {
|
|
109
|
-
this.log.debug('New metrics config', {
|
|
110
|
-
config
|
|
111
|
-
});
|
|
112
|
-
this.lastPatchedPublicTelemetryConfig = publicTelemetry;
|
|
113
|
-
this.emit('updatePublicTelemetryConfig', publicTelemetry);
|
|
114
|
-
}
|
|
115
|
-
} catch (err) {
|
|
116
|
-
this.log.warn(`Failed to check if there is an update`, err);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Returns package version.
|
|
122
|
-
*/ export function getPackageVersion() {
|
|
123
|
-
try {
|
|
124
|
-
const releasePleaseManifestPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
|
|
125
|
-
const version = JSON.parse(readFileSync(releasePleaseManifestPath).toString())['.'];
|
|
126
|
-
return version;
|
|
127
|
-
} catch {
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
}
|
package/src/ha-signing/config.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
|
-
import {
|
|
3
|
-
type ConfigMappingsType,
|
|
4
|
-
booleanConfigHelper,
|
|
5
|
-
getConfigFromMappings,
|
|
6
|
-
getDefaultConfig,
|
|
7
|
-
numberConfigHelper,
|
|
8
|
-
optionalNumberConfigHelper,
|
|
9
|
-
} from '@aztec/foundation/config';
|
|
10
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
|
-
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
12
|
-
|
|
13
|
-
import { z } from 'zod';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for the Validator HA Signer
|
|
17
|
-
*
|
|
18
|
-
* This config is used for distributed locking and slashing protection
|
|
19
|
-
* when running multiple validator nodes in a high-availability setup.
|
|
20
|
-
*/
|
|
21
|
-
export interface ValidatorHASignerConfig {
|
|
22
|
-
/** Whether HA signing / slashing protection is enabled */
|
|
23
|
-
haSigningEnabled: boolean;
|
|
24
|
-
/** L1 contract addresses (rollup address required) */
|
|
25
|
-
l1Contracts: Pick<L1ContractAddresses, 'rollupAddress'>;
|
|
26
|
-
/** Unique identifier for this node */
|
|
27
|
-
nodeId: string;
|
|
28
|
-
/** How long to wait between polls when a duty is being signed (ms) */
|
|
29
|
-
pollingIntervalMs: number;
|
|
30
|
-
/** Maximum time to wait for a duty being signed to complete (ms) */
|
|
31
|
-
signingTimeoutMs: number;
|
|
32
|
-
/** Maximum age of a stuck duty in ms (defaults to 2x hardcoded Aztec slot duration if not set) */
|
|
33
|
-
maxStuckDutiesAgeMs?: number;
|
|
34
|
-
/** Optional: clean up old duties after this many hours (disabled if not set) */
|
|
35
|
-
cleanupOldDutiesAfterHours?: number;
|
|
36
|
-
/**
|
|
37
|
-
* PostgreSQL connection string
|
|
38
|
-
* Format: postgresql://user:password@host:port/database
|
|
39
|
-
*/
|
|
40
|
-
databaseUrl?: string;
|
|
41
|
-
/**
|
|
42
|
-
* PostgreSQL connection pool configuration
|
|
43
|
-
*/
|
|
44
|
-
/** Maximum number of clients in the pool (default: 10) */
|
|
45
|
-
poolMaxCount?: number;
|
|
46
|
-
/** Minimum number of clients in the pool (default: 0) */
|
|
47
|
-
poolMinCount?: number;
|
|
48
|
-
/** Idle timeout in milliseconds (default: 10000) */
|
|
49
|
-
poolIdleTimeoutMs?: number;
|
|
50
|
-
/** Connection timeout in milliseconds (default: 0, no timeout) */
|
|
51
|
-
poolConnectionTimeoutMs?: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const validatorHASignerConfigMappings: ConfigMappingsType<ValidatorHASignerConfig> = {
|
|
55
|
-
haSigningEnabled: {
|
|
56
|
-
env: 'VALIDATOR_HA_SIGNING_ENABLED',
|
|
57
|
-
description: 'Whether HA signing / slashing protection is enabled',
|
|
58
|
-
...booleanConfigHelper(false),
|
|
59
|
-
},
|
|
60
|
-
l1Contracts: {
|
|
61
|
-
description: 'L1 contract addresses (rollup address required)',
|
|
62
|
-
nested: {
|
|
63
|
-
rollupAddress: {
|
|
64
|
-
description: 'The Ethereum address of the rollup contract (must be set programmatically)',
|
|
65
|
-
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
nodeId: {
|
|
70
|
-
env: 'VALIDATOR_HA_NODE_ID',
|
|
71
|
-
description: 'The unique identifier for this node',
|
|
72
|
-
defaultValue: '',
|
|
73
|
-
},
|
|
74
|
-
pollingIntervalMs: {
|
|
75
|
-
env: 'VALIDATOR_HA_POLLING_INTERVAL_MS',
|
|
76
|
-
description: 'The number of ms to wait between polls when a duty is being signed',
|
|
77
|
-
...numberConfigHelper(100),
|
|
78
|
-
},
|
|
79
|
-
signingTimeoutMs: {
|
|
80
|
-
env: 'VALIDATOR_HA_SIGNING_TIMEOUT_MS',
|
|
81
|
-
description: 'The maximum time to wait for a duty being signed to complete',
|
|
82
|
-
...numberConfigHelper(3_000),
|
|
83
|
-
},
|
|
84
|
-
maxStuckDutiesAgeMs: {
|
|
85
|
-
env: 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS',
|
|
86
|
-
description: 'The maximum age of a stuck duty in ms (defaults to 2x Aztec slot duration)',
|
|
87
|
-
...optionalNumberConfigHelper(),
|
|
88
|
-
},
|
|
89
|
-
cleanupOldDutiesAfterHours: {
|
|
90
|
-
env: 'VALIDATOR_HA_OLD_DUTIES_MAX_AGE_H',
|
|
91
|
-
description: 'Optional: clean up old duties after this many hours (disabled if not set)',
|
|
92
|
-
...optionalNumberConfigHelper(),
|
|
93
|
-
},
|
|
94
|
-
databaseUrl: {
|
|
95
|
-
env: 'VALIDATOR_HA_DATABASE_URL',
|
|
96
|
-
description:
|
|
97
|
-
'PostgreSQL connection string for validator HA signer (format: postgresql://user:password@host:port/database)',
|
|
98
|
-
},
|
|
99
|
-
poolMaxCount: {
|
|
100
|
-
env: 'VALIDATOR_HA_POOL_MAX',
|
|
101
|
-
description: 'Maximum number of clients in the pool',
|
|
102
|
-
...numberConfigHelper(10),
|
|
103
|
-
},
|
|
104
|
-
poolMinCount: {
|
|
105
|
-
env: 'VALIDATOR_HA_POOL_MIN',
|
|
106
|
-
description: 'Minimum number of clients in the pool',
|
|
107
|
-
...numberConfigHelper(0),
|
|
108
|
-
},
|
|
109
|
-
poolIdleTimeoutMs: {
|
|
110
|
-
env: 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS',
|
|
111
|
-
description: 'Idle timeout in milliseconds',
|
|
112
|
-
...numberConfigHelper(10_000),
|
|
113
|
-
},
|
|
114
|
-
poolConnectionTimeoutMs: {
|
|
115
|
-
env: 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS',
|
|
116
|
-
description: 'Connection timeout in milliseconds (0 means no timeout)',
|
|
117
|
-
...numberConfigHelper(0),
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const defaultValidatorHASignerConfig: ValidatorHASignerConfig = getDefaultConfig(
|
|
122
|
-
validatorHASignerConfigMappings,
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Returns the validator HA signer configuration from environment variables.
|
|
127
|
-
* Note: If an environment variable is not set, the default value is used.
|
|
128
|
-
* @returns The validator HA signer configuration.
|
|
129
|
-
*/
|
|
130
|
-
export function getConfigEnvVars(): ValidatorHASignerConfig {
|
|
131
|
-
return getConfigFromMappings<ValidatorHASignerConfig>(validatorHASignerConfigMappings);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export const ValidatorHASignerConfigSchema = z.object({
|
|
135
|
-
haSigningEnabled: z.boolean(),
|
|
136
|
-
l1Contracts: z.object({
|
|
137
|
-
rollupAddress: z.instanceof(EthAddress),
|
|
138
|
-
}),
|
|
139
|
-
nodeId: z.string(),
|
|
140
|
-
pollingIntervalMs: z.number().min(0),
|
|
141
|
-
signingTimeoutMs: z.number().min(0),
|
|
142
|
-
maxStuckDutiesAgeMs: z.number().min(0).optional(),
|
|
143
|
-
cleanupOldDutiesAfterHours: z.number().min(0).optional(),
|
|
144
|
-
databaseUrl: z.string().optional(),
|
|
145
|
-
poolMaxCount: z.number().min(0).optional(),
|
|
146
|
-
poolMinCount: z.number().min(0).optional(),
|
|
147
|
-
poolIdleTimeoutMs: z.number().min(0).optional(),
|
|
148
|
-
poolConnectionTimeoutMs: z.number().min(0).optional(),
|
|
149
|
-
}) satisfies ZodFor<ValidatorHASignerConfig>;
|
package/src/ha-signing/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
type ValidatorHASignerConfig,
|
|
3
|
-
ValidatorHASignerConfigSchema,
|
|
4
|
-
defaultValidatorHASignerConfig,
|
|
5
|
-
getConfigEnvVars,
|
|
6
|
-
validatorHASignerConfigMappings,
|
|
7
|
-
} from './config.js';
|
|
8
|
-
export {
|
|
9
|
-
DutyType,
|
|
10
|
-
type BlockProposalSigningContext,
|
|
11
|
-
type HAProtectedSigningContext,
|
|
12
|
-
type NoHAProtectionSigningContext,
|
|
13
|
-
type OtherSigningContext,
|
|
14
|
-
type SigningContext,
|
|
15
|
-
type VoteSigningContext,
|
|
16
|
-
getBlockNumberFromSigningContext,
|
|
17
|
-
isHAProtectedContext,
|
|
18
|
-
} from './types.js';
|