@aztec/validator-client 0.0.0-test.1 → 0.0.1-commit.0208eb9
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/README.md +282 -0
- package/dest/block_proposal_handler.d.ts +63 -0
- package/dest/block_proposal_handler.d.ts.map +1 -0
- package/dest/block_proposal_handler.js +546 -0
- package/dest/checkpoint_builder.d.ts +66 -0
- package/dest/checkpoint_builder.d.ts.map +1 -0
- package/dest/checkpoint_builder.js +173 -0
- package/dest/config.d.ts +3 -14
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +41 -8
- package/dest/duties/validation_service.d.ts +50 -13
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +123 -17
- package/dest/factory.d.ts +28 -6
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +13 -6
- package/dest/index.d.ts +6 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +5 -1
- package/dest/key_store/ha_key_store.d.ts +99 -0
- package/dest/key_store/ha_key_store.d.ts.map +1 -0
- package/dest/key_store/ha_key_store.js +208 -0
- package/dest/key_store/index.d.ts +4 -1
- package/dest/key_store/index.d.ts.map +1 -1
- package/dest/key_store/index.js +3 -0
- package/dest/key_store/interface.d.ts +85 -6
- package/dest/key_store/interface.d.ts.map +1 -1
- package/dest/key_store/interface.js +3 -3
- package/dest/key_store/local_key_store.d.ts +46 -11
- package/dest/key_store/local_key_store.d.ts.map +1 -1
- package/dest/key_store/local_key_store.js +68 -17
- package/dest/key_store/node_keystore_adapter.d.ts +151 -0
- package/dest/key_store/node_keystore_adapter.d.ts.map +1 -0
- package/dest/key_store/node_keystore_adapter.js +330 -0
- package/dest/key_store/web3signer_key_store.d.ts +66 -0
- package/dest/key_store/web3signer_key_store.d.ts.map +1 -0
- package/dest/key_store/web3signer_key_store.js +156 -0
- package/dest/metrics.d.ts +13 -5
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +63 -22
- package/dest/tx_validator/index.d.ts +3 -0
- package/dest/tx_validator/index.d.ts.map +1 -0
- package/dest/tx_validator/index.js +2 -0
- package/dest/tx_validator/nullifier_cache.d.ts +14 -0
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/tx_validator/nullifier_cache.js +24 -0
- package/dest/tx_validator/tx_validator_factory.d.ts +19 -0
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
- package/dest/tx_validator/tx_validator_factory.js +54 -0
- package/dest/validator.d.ts +73 -58
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +559 -166
- package/package.json +37 -21
- package/src/block_proposal_handler.ts +555 -0
- package/src/checkpoint_builder.ts +314 -0
- package/src/config.ts +52 -22
- package/src/duties/validation_service.ts +193 -19
- package/src/factory.ts +65 -11
- package/src/index.ts +5 -1
- package/src/key_store/ha_key_store.ts +269 -0
- package/src/key_store/index.ts +3 -0
- package/src/key_store/interface.ts +100 -5
- package/src/key_store/local_key_store.ts +77 -18
- package/src/key_store/node_keystore_adapter.ts +398 -0
- package/src/key_store/web3signer_key_store.ts +205 -0
- package/src/metrics.ts +86 -23
- package/src/tx_validator/index.ts +2 -0
- package/src/tx_validator/nullifier_cache.ts +30 -0
- package/src/tx_validator/tx_validator_factory.ts +154 -0
- package/src/validator.ts +757 -221
- package/dest/errors/index.d.ts +0 -2
- package/dest/errors/index.d.ts.map +0 -1
- package/dest/errors/index.js +0 -1
- package/dest/errors/validator.error.d.ts +0 -29
- package/dest/errors/validator.error.d.ts.map +0 -1
- package/dest/errors/validator.error.js +0 -45
- package/src/errors/index.ts +0 -1
- package/src/errors/validator.error.ts +0 -55
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
+
import { KeystoreManager } from '@aztec/node-keystore';
|
|
5
|
+
import type { EthRemoteSignerConfig } from '@aztec/node-keystore';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import type { SigningContext } from '@aztec/validator-ha-signer/types';
|
|
8
|
+
import type { TypedDataDefinition } from 'viem';
|
|
9
|
+
import type { ExtendedValidatorKeyStore } from './interface.js';
|
|
10
|
+
export declare class NodeKeystoreAdapter implements ExtendedValidatorKeyStore {
|
|
11
|
+
private readonly keystoreManager;
|
|
12
|
+
private readonly validators;
|
|
13
|
+
private readonly addressIndex;
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Create an adapter from a keystore JSON file on disk.
|
|
17
|
+
* @param keystoreFilePath Absolute or relative path to a keystore JSON file
|
|
18
|
+
* @returns A configured NodeKeystoreAdapter instance
|
|
19
|
+
* @throws Error when the file fails schema validation or cannot be read
|
|
20
|
+
*/
|
|
21
|
+
static fromKeystoreFile(keystoreFilePath: string): NodeKeystoreAdapter;
|
|
22
|
+
/**
|
|
23
|
+
* Create an adapter from an in-memory keystore-like object.
|
|
24
|
+
* Validates resolved duplicate attester addresses across validators and sources.
|
|
25
|
+
* @param keystoreConfig Parsed config object (typically result of loadKeystoreFile)
|
|
26
|
+
* @returns A configured NodeKeystoreAdapter instance
|
|
27
|
+
* @throws Error when resolved duplicate attester addresses are detected
|
|
28
|
+
*/
|
|
29
|
+
static fromKeystoreConfig(keystoreConfig: unknown): NodeKeystoreAdapter;
|
|
30
|
+
/**
|
|
31
|
+
* Build an adapter directly from a list of validator private keys.
|
|
32
|
+
* Each key becomes a separate validator using the same key for attester and publisher,
|
|
33
|
+
* coinbase defaults to the derived EOA address, and feeRecipient is a 32-byte padded address.
|
|
34
|
+
* Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
|
|
35
|
+
*/
|
|
36
|
+
static fromPrivateKeys(privateKeys: string[]): NodeKeystoreAdapter;
|
|
37
|
+
/**
|
|
38
|
+
* Build an adapter for a Web3Signer setup by providing the signer URL and the EOA addresses.
|
|
39
|
+
* Each address becomes a separate validator; attester and publisher point to the same remote signer entry.
|
|
40
|
+
* Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
|
|
41
|
+
*/
|
|
42
|
+
static fromWeb3Signer(web3SignerUrl: string, addresses: EthAddress[]): NodeKeystoreAdapter;
|
|
43
|
+
static fromKeyStoreManager(manager: KeystoreManager): NodeKeystoreAdapter;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize address keys to lowercase hex strings for map/set usage.
|
|
46
|
+
*/
|
|
47
|
+
private static key;
|
|
48
|
+
/**
|
|
49
|
+
* Ensure per-validator signer cache exists; build it by creating
|
|
50
|
+
* attester/publisher signers and populating indices when missing.
|
|
51
|
+
* @param validatorIndex Index of the validator in the keystore
|
|
52
|
+
* @returns The cached validator entry
|
|
53
|
+
*/
|
|
54
|
+
private ensureValidator;
|
|
55
|
+
/**
|
|
56
|
+
* Iterate all validator indices in the keystore manager.
|
|
57
|
+
*/
|
|
58
|
+
private validatorIndices;
|
|
59
|
+
/**
|
|
60
|
+
* Find the validator index that contains the given attester address.
|
|
61
|
+
* @param attesterAddress Address to locate
|
|
62
|
+
* @returns Validator index
|
|
63
|
+
* @throws Error when no validator contains the attester
|
|
64
|
+
*/
|
|
65
|
+
private findValidatorIndexForAttester;
|
|
66
|
+
/**
|
|
67
|
+
* Get attester address by flat index across all validators' attester sets.
|
|
68
|
+
* @param index Zero-based flat index across all attesters
|
|
69
|
+
* @returns EthAddress for the indexed attester
|
|
70
|
+
* @throws Error when index is out of bounds
|
|
71
|
+
*/
|
|
72
|
+
getAddress(index: number): EthAddress;
|
|
73
|
+
/**
|
|
74
|
+
* Get all attester addresses across validators (legacy-compatible view).
|
|
75
|
+
*/
|
|
76
|
+
getAddresses(): EthAddress[];
|
|
77
|
+
/**
|
|
78
|
+
* Sign typed data with all attester signers across validators.
|
|
79
|
+
* @param typedData EIP-712 typed data
|
|
80
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
81
|
+
* @returns Array of signatures in validator order, flattened
|
|
82
|
+
*/
|
|
83
|
+
signTypedData(typedData: TypedDataDefinition, _context: SigningContext): Promise<Signature[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Sign a message with all attester signers across validators.
|
|
86
|
+
* @param message 32-byte message (already hashed/padded as needed)
|
|
87
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
88
|
+
* @returns Array of signatures in validator order, flattened
|
|
89
|
+
*/
|
|
90
|
+
signMessage(message: Buffer32, _context: SigningContext): Promise<Signature[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Sign typed data with a signer identified by address (any role).
|
|
93
|
+
* Hydrates caches on-demand when the address is first seen.
|
|
94
|
+
* @param address Address to sign with
|
|
95
|
+
* @param typedData EIP-712 typed data
|
|
96
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
97
|
+
* @returns Signature from the signer matching the address
|
|
98
|
+
* @throws Error when no signer exists for the address
|
|
99
|
+
*/
|
|
100
|
+
signTypedDataWithAddress(address: EthAddress, typedData: TypedDataDefinition, _context: SigningContext): Promise<Signature>;
|
|
101
|
+
/**
|
|
102
|
+
* Sign a message with a signer identified by address (any role).
|
|
103
|
+
* Hydrates caches on-demand when the address is first seen.
|
|
104
|
+
* @param address Address to sign with
|
|
105
|
+
* @param message 32-byte message
|
|
106
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
107
|
+
* @returns Signature from the signer matching the address
|
|
108
|
+
* @throws Error when no signer exists for the address
|
|
109
|
+
*/
|
|
110
|
+
signMessageWithAddress(address: EthAddress, message: Buffer32, _context: SigningContext): Promise<Signature>;
|
|
111
|
+
/**
|
|
112
|
+
* Get all attester addresses across validators (alias of getAddresses).
|
|
113
|
+
*/
|
|
114
|
+
getAttesterAddresses(): EthAddress[];
|
|
115
|
+
/**
|
|
116
|
+
* Get the effective coinbase address for the validator that contains the given attester.
|
|
117
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
118
|
+
* @returns Coinbase EthAddress
|
|
119
|
+
*/
|
|
120
|
+
getCoinbaseAddress(attesterAddress: EthAddress): EthAddress;
|
|
121
|
+
/**
|
|
122
|
+
* Get the publisher addresses for the validator that contains the given attester.
|
|
123
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
124
|
+
* @returns Array of publisher addresses
|
|
125
|
+
*/
|
|
126
|
+
getPublisherAddresses(attesterAddress: EthAddress): EthAddress[];
|
|
127
|
+
getAttestorForPublisher(publisherAddress: EthAddress): EthAddress;
|
|
128
|
+
/**
|
|
129
|
+
* Get the fee recipient for the validator that contains the given attester.
|
|
130
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
131
|
+
* @returns Fee recipient as AztecAddress
|
|
132
|
+
*/
|
|
133
|
+
getFeeRecipient(attesterAddress: EthAddress): AztecAddress;
|
|
134
|
+
/**
|
|
135
|
+
* Get the effective remote signer configuration for the attester.
|
|
136
|
+
* Precedence: account-level override > validator-level override > file-level default.
|
|
137
|
+
* Returns undefined for local signers (private key / JSON-V3 / mnemonic).
|
|
138
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
139
|
+
* @returns Effective remote signer configuration or undefined
|
|
140
|
+
*/
|
|
141
|
+
getRemoteSignerConfig(attesterAddress: EthAddress): EthRemoteSignerConfig | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Start the key store - no-op
|
|
144
|
+
*/
|
|
145
|
+
start(): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Stop the key store - no-op
|
|
148
|
+
*/
|
|
149
|
+
stop(): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZV9rZXlzdG9yZV9hZGFwdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMva2V5X3N0b3JlL25vZGVfa2V5c3RvcmVfYWRhcHRlci50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yError } from '@aztec/stdlib/validators';
|
|
3
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
4
|
+
export class NodeKeystoreAdapter {
|
|
5
|
+
keystoreManager;
|
|
6
|
+
// Per-validator cache (lazy)
|
|
7
|
+
validators = new Map();
|
|
8
|
+
addressIndex = new Map();
|
|
9
|
+
constructor(keystoreManager){
|
|
10
|
+
this.keystoreManager = keystoreManager;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create an adapter from a keystore JSON file on disk.
|
|
14
|
+
* @param keystoreFilePath Absolute or relative path to a keystore JSON file
|
|
15
|
+
* @returns A configured NodeKeystoreAdapter instance
|
|
16
|
+
* @throws Error when the file fails schema validation or cannot be read
|
|
17
|
+
*/ static fromKeystoreFile(keystoreFilePath) {
|
|
18
|
+
const keystoreConfig = loadKeystoreFile(keystoreFilePath);
|
|
19
|
+
return NodeKeystoreAdapter.fromKeystoreConfig(keystoreConfig);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create an adapter from an in-memory keystore-like object.
|
|
23
|
+
* Validates resolved duplicate attester addresses across validators and sources.
|
|
24
|
+
* @param keystoreConfig Parsed config object (typically result of loadKeystoreFile)
|
|
25
|
+
* @returns A configured NodeKeystoreAdapter instance
|
|
26
|
+
* @throws Error when resolved duplicate attester addresses are detected
|
|
27
|
+
*/ static fromKeystoreConfig(keystoreConfig) {
|
|
28
|
+
const keystoreManager = new KeystoreManager(keystoreConfig);
|
|
29
|
+
// Validate resolved attester addresses (covers JSON V3 and mnemonic duplicates across validators)
|
|
30
|
+
keystoreManager.validateResolvedUniqueAttesterAddresses();
|
|
31
|
+
return new NodeKeystoreAdapter(keystoreManager);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build an adapter directly from a list of validator private keys.
|
|
35
|
+
* Each key becomes a separate validator using the same key for attester and publisher,
|
|
36
|
+
* coinbase defaults to the derived EOA address, and feeRecipient is a 32-byte padded address.
|
|
37
|
+
* Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
|
|
38
|
+
*/ static fromPrivateKeys(privateKeys) {
|
|
39
|
+
// Minimal validation: 0x + 64 hex
|
|
40
|
+
const isPk = (s)=>/^0x[0-9a-fA-F]{64}$/.test(s);
|
|
41
|
+
for (const pk of privateKeys){
|
|
42
|
+
if (!isPk(pk)) {
|
|
43
|
+
throw new InvalidValidatorPrivateKeyError();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const validators = privateKeys.map((pk)=>{
|
|
47
|
+
const account = privateKeyToAccount(pk);
|
|
48
|
+
const ethAddress = account.address;
|
|
49
|
+
// TODO: Temporary fee recipient, replace with actual fee recipient when implemented
|
|
50
|
+
const feeRecipient = `0x${ethAddress.slice(2).padStart(64, '0')}`;
|
|
51
|
+
return {
|
|
52
|
+
attester: pk,
|
|
53
|
+
publisher: pk,
|
|
54
|
+
coinbase: ethAddress,
|
|
55
|
+
feeRecipient
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
const cfg = {
|
|
59
|
+
schemaVersion: 1,
|
|
60
|
+
validators
|
|
61
|
+
};
|
|
62
|
+
return NodeKeystoreAdapter.fromKeystoreConfig(cfg);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build an adapter for a Web3Signer setup by providing the signer URL and the EOA addresses.
|
|
66
|
+
* Each address becomes a separate validator; attester and publisher point to the same remote signer entry.
|
|
67
|
+
* Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
|
|
68
|
+
*/ static fromWeb3Signer(web3SignerUrl, addresses) {
|
|
69
|
+
const validators = addresses.map((address)=>{
|
|
70
|
+
const ethAddress = address.toString();
|
|
71
|
+
// TODO: Temporary fee recipient, replace with actual fee recipient when implemented
|
|
72
|
+
const feeRecipient = `0x${ethAddress.slice(2).padStart(64, '0')}`;
|
|
73
|
+
return {
|
|
74
|
+
attester: {
|
|
75
|
+
address: ethAddress,
|
|
76
|
+
remoteSignerUrl: web3SignerUrl
|
|
77
|
+
},
|
|
78
|
+
publisher: {
|
|
79
|
+
address: ethAddress,
|
|
80
|
+
remoteSignerUrl: web3SignerUrl
|
|
81
|
+
},
|
|
82
|
+
coinbase: ethAddress,
|
|
83
|
+
feeRecipient
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
const cfg = {
|
|
87
|
+
schemaVersion: 1,
|
|
88
|
+
validators
|
|
89
|
+
};
|
|
90
|
+
return NodeKeystoreAdapter.fromKeystoreConfig(cfg);
|
|
91
|
+
}
|
|
92
|
+
static fromKeyStoreManager(manager) {
|
|
93
|
+
return new NodeKeystoreAdapter(manager);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Normalize address keys to lowercase hex strings for map/set usage.
|
|
97
|
+
*/ static key(addr) {
|
|
98
|
+
return typeof addr === 'string' ? addr.toLowerCase() : addr.toString().toLowerCase();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Ensure per-validator signer cache exists; build it by creating
|
|
102
|
+
* attester/publisher signers and populating indices when missing.
|
|
103
|
+
* @param validatorIndex Index of the validator in the keystore
|
|
104
|
+
* @returns The cached validator entry
|
|
105
|
+
*/ ensureValidator(validatorIndex) {
|
|
106
|
+
const cached = this.validators.get(validatorIndex);
|
|
107
|
+
if (cached) {
|
|
108
|
+
return cached;
|
|
109
|
+
}
|
|
110
|
+
const attesters = this.keystoreManager.createAttesterSigners(validatorIndex);
|
|
111
|
+
const publishers = this.keystoreManager.createPublisherSigners(validatorIndex);
|
|
112
|
+
// Build 'all' + indices
|
|
113
|
+
const byAddress = new Map();
|
|
114
|
+
const attesterSet = new Set();
|
|
115
|
+
for (const s of attesters){
|
|
116
|
+
const k = NodeKeystoreAdapter.key(s.address);
|
|
117
|
+
byAddress.set(k, s);
|
|
118
|
+
attesterSet.add(k);
|
|
119
|
+
}
|
|
120
|
+
for (const s of publishers){
|
|
121
|
+
const k = NodeKeystoreAdapter.key(s.address);
|
|
122
|
+
if (!byAddress.has(k)) {
|
|
123
|
+
byAddress.set(k, s);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const all = Array.from(byAddress.values());
|
|
127
|
+
// Populate global index
|
|
128
|
+
for (const [k, signer] of byAddress.entries()){
|
|
129
|
+
this.addressIndex.set(k, {
|
|
130
|
+
signer,
|
|
131
|
+
validatorIndex
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const built = {
|
|
135
|
+
attesters,
|
|
136
|
+
publishers,
|
|
137
|
+
all,
|
|
138
|
+
byAddress,
|
|
139
|
+
attesterSet
|
|
140
|
+
};
|
|
141
|
+
this.validators.set(validatorIndex, built);
|
|
142
|
+
return built;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Iterate all validator indices in the keystore manager.
|
|
146
|
+
*/ *validatorIndices() {
|
|
147
|
+
const n = this.keystoreManager.getValidatorCount();
|
|
148
|
+
for(let i = 0; i < n; i++){
|
|
149
|
+
yield i;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Find the validator index that contains the given attester address.
|
|
154
|
+
* @param attesterAddress Address to locate
|
|
155
|
+
* @returns Validator index
|
|
156
|
+
* @throws Error when no validator contains the attester
|
|
157
|
+
*/ findValidatorIndexForAttester(attesterAddress) {
|
|
158
|
+
const key = NodeKeystoreAdapter.key(attesterAddress);
|
|
159
|
+
// Fast path: if we’ve already cached any validator that includes this as attester
|
|
160
|
+
for (const i of this.validatorIndices()){
|
|
161
|
+
const v = this.ensureValidator(i);
|
|
162
|
+
if (v.attesterSet.has(key)) {
|
|
163
|
+
return i;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
throw new Error(`Attester address ${attesterAddress.toString()} not found in any validator configuration`);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get attester address by flat index across all validators' attester sets.
|
|
170
|
+
* @param index Zero-based flat index across all attesters
|
|
171
|
+
* @returns EthAddress for the indexed attester
|
|
172
|
+
* @throws Error when index is out of bounds
|
|
173
|
+
*/ getAddress(index) {
|
|
174
|
+
const all = this.getAddresses();
|
|
175
|
+
if (index < 0 || index >= all.length) {
|
|
176
|
+
throw new Error(`Index ${index} is out of bounds (0..${all.length - 1}).`);
|
|
177
|
+
}
|
|
178
|
+
return all[index];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get all attester addresses across validators (legacy-compatible view).
|
|
182
|
+
*/ getAddresses() {
|
|
183
|
+
const out = [];
|
|
184
|
+
for (const i of this.validatorIndices()){
|
|
185
|
+
const v = this.ensureValidator(i);
|
|
186
|
+
// attester addresses only for backward compatibility
|
|
187
|
+
for (const s of v.attesters){
|
|
188
|
+
out.push(s.address);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Sign typed data with all attester signers across validators.
|
|
195
|
+
* @param typedData EIP-712 typed data
|
|
196
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
197
|
+
* @returns Array of signatures in validator order, flattened
|
|
198
|
+
*/ async signTypedData(typedData, _context) {
|
|
199
|
+
const jobs = [];
|
|
200
|
+
for (const i of this.validatorIndices()){
|
|
201
|
+
const v = this.ensureValidator(i);
|
|
202
|
+
for (const s of v.attesters){
|
|
203
|
+
jobs.push(this.keystoreManager.signTypedData(s, typedData));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return await Promise.all(jobs);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Sign a message with all attester signers across validators.
|
|
210
|
+
* @param message 32-byte message (already hashed/padded as needed)
|
|
211
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
212
|
+
* @returns Array of signatures in validator order, flattened
|
|
213
|
+
*/ async signMessage(message, _context) {
|
|
214
|
+
const jobs = [];
|
|
215
|
+
for (const i of this.validatorIndices()){
|
|
216
|
+
const v = this.ensureValidator(i);
|
|
217
|
+
for (const s of v.attesters){
|
|
218
|
+
jobs.push(this.keystoreManager.signMessage(s, message));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return await Promise.all(jobs);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Sign typed data with a signer identified by address (any role).
|
|
225
|
+
* Hydrates caches on-demand when the address is first seen.
|
|
226
|
+
* @param address Address to sign with
|
|
227
|
+
* @param typedData EIP-712 typed data
|
|
228
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
229
|
+
* @returns Signature from the signer matching the address
|
|
230
|
+
* @throws Error when no signer exists for the address
|
|
231
|
+
*/ async signTypedDataWithAddress(address, typedData, _context) {
|
|
232
|
+
const entry = this.addressIndex.get(NodeKeystoreAdapter.key(address));
|
|
233
|
+
if (entry) {
|
|
234
|
+
return await this.keystoreManager.signTypedData(entry.signer, typedData);
|
|
235
|
+
}
|
|
236
|
+
// If not in global index yet, lazily hydrate all validators once and retry
|
|
237
|
+
for (const i of this.validatorIndices()){
|
|
238
|
+
this.ensureValidator(i);
|
|
239
|
+
}
|
|
240
|
+
const second = this.addressIndex.get(NodeKeystoreAdapter.key(address));
|
|
241
|
+
if (second) {
|
|
242
|
+
return await this.keystoreManager.signTypedData(second.signer, typedData);
|
|
243
|
+
}
|
|
244
|
+
throw new Error(`No signer found for address ${address.toString()}`);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Sign a message with a signer identified by address (any role).
|
|
248
|
+
* Hydrates caches on-demand when the address is first seen.
|
|
249
|
+
* @param address Address to sign with
|
|
250
|
+
* @param message 32-byte message
|
|
251
|
+
* @param _context Signing context (ignored by NodeKeystoreAdapter, used for HA protection)
|
|
252
|
+
* @returns Signature from the signer matching the address
|
|
253
|
+
* @throws Error when no signer exists for the address
|
|
254
|
+
*/ async signMessageWithAddress(address, message, _context) {
|
|
255
|
+
const entry = this.addressIndex.get(NodeKeystoreAdapter.key(address));
|
|
256
|
+
if (entry) {
|
|
257
|
+
return await this.keystoreManager.signMessage(entry.signer, message);
|
|
258
|
+
}
|
|
259
|
+
for (const i of this.validatorIndices()){
|
|
260
|
+
this.ensureValidator(i);
|
|
261
|
+
}
|
|
262
|
+
const second = this.addressIndex.get(NodeKeystoreAdapter.key(address));
|
|
263
|
+
if (second) {
|
|
264
|
+
return await this.keystoreManager.signMessage(second.signer, message);
|
|
265
|
+
}
|
|
266
|
+
throw new Error(`No signer found for address ${address.toString()}`);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get all attester addresses across validators (alias of getAddresses).
|
|
270
|
+
*/ getAttesterAddresses() {
|
|
271
|
+
return this.getAddresses();
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get the effective coinbase address for the validator that contains the given attester.
|
|
275
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
276
|
+
* @returns Coinbase EthAddress
|
|
277
|
+
*/ getCoinbaseAddress(attesterAddress) {
|
|
278
|
+
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
279
|
+
return this.keystoreManager.getCoinbaseAddress(validatorIndex, attesterAddress);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Get the publisher addresses for the validator that contains the given attester.
|
|
283
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
284
|
+
* @returns Array of publisher addresses
|
|
285
|
+
*/ getPublisherAddresses(attesterAddress) {
|
|
286
|
+
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
287
|
+
const v = this.ensureValidator(validatorIndex);
|
|
288
|
+
return v.publishers.map((s)=>s.address);
|
|
289
|
+
}
|
|
290
|
+
getAttestorForPublisher(publisherAddress) {
|
|
291
|
+
const attestorAddresses = this.getAttesterAddresses();
|
|
292
|
+
for (const attestor of attestorAddresses){
|
|
293
|
+
const publishers = this.getPublisherAddresses(attestor);
|
|
294
|
+
const found = publishers.some((publisher)=>publisher.equals(publisherAddress));
|
|
295
|
+
if (found) {
|
|
296
|
+
return attestor;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Could not find an attestor for this publisher
|
|
300
|
+
throw new Error(`Failed to find attestor for publisher ${publisherAddress.toString()}`);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get the fee recipient for the validator that contains the given attester.
|
|
304
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
305
|
+
* @returns Fee recipient as AztecAddress
|
|
306
|
+
*/ getFeeRecipient(attesterAddress) {
|
|
307
|
+
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
308
|
+
return this.keystoreManager.getFeeRecipient(validatorIndex);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get the effective remote signer configuration for the attester.
|
|
312
|
+
* Precedence: account-level override > validator-level override > file-level default.
|
|
313
|
+
* Returns undefined for local signers (private key / JSON-V3 / mnemonic).
|
|
314
|
+
* @param attesterAddress Address of an attester belonging to the validator
|
|
315
|
+
* @returns Effective remote signer configuration or undefined
|
|
316
|
+
*/ getRemoteSignerConfig(attesterAddress) {
|
|
317
|
+
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
318
|
+
return this.keystoreManager.getEffectiveRemoteSignerConfig(validatorIndex, attesterAddress);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Start the key store - no-op
|
|
322
|
+
*/ start() {
|
|
323
|
+
return Promise.resolve();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Stop the key store - no-op
|
|
327
|
+
*/ stop() {
|
|
328
|
+
return Promise.resolve();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
+
import type { SigningContext } from '@aztec/validator-ha-signer/types';
|
|
5
|
+
import type { TypedDataDefinition } from 'viem';
|
|
6
|
+
import type { ValidatorKeyStore } from './interface.js';
|
|
7
|
+
/**
|
|
8
|
+
* Web3Signer Key Store
|
|
9
|
+
*
|
|
10
|
+
* An implementation of the Key store using Web3Signer remote signing service.
|
|
11
|
+
* This implementation uses the Web3Signer JSON-RPC API for secp256k1 signatures.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Web3SignerKeyStore implements ValidatorKeyStore {
|
|
14
|
+
private addresses;
|
|
15
|
+
private baseUrl;
|
|
16
|
+
constructor(addresses: EthAddress[], baseUrl: string);
|
|
17
|
+
/**
|
|
18
|
+
* Get the address of a signer by index
|
|
19
|
+
*
|
|
20
|
+
* @param index - The index of the signer
|
|
21
|
+
* @returns the address
|
|
22
|
+
*/
|
|
23
|
+
getAddress(index: number): EthAddress;
|
|
24
|
+
/**
|
|
25
|
+
* Get all addresses
|
|
26
|
+
*
|
|
27
|
+
* @returns all addresses
|
|
28
|
+
*/
|
|
29
|
+
getAddresses(): EthAddress[];
|
|
30
|
+
/**
|
|
31
|
+
* Sign EIP-712 typed data with all keystore addresses
|
|
32
|
+
* @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
|
|
33
|
+
* @param _context - Signing context (ignored by Web3SignerKeyStore, used for HA protection)
|
|
34
|
+
* @return signatures
|
|
35
|
+
*/
|
|
36
|
+
signTypedData(typedData: TypedDataDefinition, _context: SigningContext): Promise<Signature[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Sign EIP-712 typed data with a specific address
|
|
39
|
+
* @param address - The address of the signer to use
|
|
40
|
+
* @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
|
|
41
|
+
* @param _context - Signing context (ignored by Web3SignerKeyStore, used for HA protection)
|
|
42
|
+
* @returns signature for the specified address
|
|
43
|
+
* @throws Error if the address is not found in the keystore or signing fails
|
|
44
|
+
*/
|
|
45
|
+
signTypedDataWithAddress(address: EthAddress, typedData: TypedDataDefinition, _context: SigningContext): Promise<Signature>;
|
|
46
|
+
/**
|
|
47
|
+
* Sign a message with all keystore addresses using EIP-191 prefix
|
|
48
|
+
*
|
|
49
|
+
* @param message - The message to sign
|
|
50
|
+
* @param _context - Signing context (ignored by Web3SignerKeyStore, used for HA protection)
|
|
51
|
+
* @return signatures
|
|
52
|
+
*/
|
|
53
|
+
signMessage(message: Buffer32, _context: SigningContext): Promise<Signature[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Sign a message with a specific address using EIP-191 prefix
|
|
56
|
+
* @param address - The address of the signer to use
|
|
57
|
+
* @param message - The message to sign
|
|
58
|
+
* @param _context - Signing context (ignored by Web3SignerKeyStore, used for HA protection)
|
|
59
|
+
* @returns signature for the specified address
|
|
60
|
+
* @throws Error if the address is not found in the keystore or signing fails
|
|
61
|
+
*/
|
|
62
|
+
signMessageWithAddress(address: EthAddress, message: Buffer32, _context: SigningContext): Promise<Signature>;
|
|
63
|
+
private makeJsonRpcSignRequest;
|
|
64
|
+
private makeJsonRpcSignTypedDataRequest;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViM3NpZ25lcl9rZXlfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9rZXlfc3RvcmUvd2ViM3NpZ25lcl9rZXlfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFekQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQzNELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUV2RSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLE1BQU0sQ0FBQztB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