@aztec/node-keystore 0.0.1-fake-ceab37513c → 0.0.2-commit.217f559981
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/config.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/keystore_manager.d.ts +6 -6
- package/dest/keystore_manager.d.ts.map +1 -1
- package/dest/keystore_manager.js +29 -11
- package/dest/loader.d.ts +1 -1
- package/dest/loader.d.ts.map +1 -1
- package/dest/loader.js +76 -20
- package/dest/schemas.d.ts +2372 -426
- package/dest/schemas.d.ts.map +1 -1
- package/dest/schemas.js +61 -17
- package/dest/signer.d.ts +2 -17
- package/dest/signer.d.ts.map +1 -1
- package/dest/signer.js +7 -6
- package/dest/types.d.ts +25 -16
- package/dest/types.d.ts.map +1 -1
- package/package.json +10 -7
- package/src/keystore_manager.ts +46 -14
- package/src/loader.ts +77 -13
- package/src/schemas.ts +110 -46
- package/src/signer.ts +8 -11
- package/src/types.ts +24 -14
package/src/loader.ts
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles loading and parsing keystore configuration files.
|
|
5
5
|
*/
|
|
6
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
+
import type { Hex } from '@aztec/foundation/string';
|
|
7
9
|
|
|
8
10
|
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
9
11
|
import { extname, join } from 'path';
|
|
12
|
+
import { privateKeyToAddress } from 'viem/accounts';
|
|
10
13
|
|
|
11
14
|
import { keystoreSchema } from './schemas.js';
|
|
12
15
|
import type { EthAccounts, KeyStore } from './types.js';
|
|
@@ -205,12 +208,18 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
205
208
|
// Track attester addresses to prevent duplicates
|
|
206
209
|
const attesterAddresses = new Set<string>();
|
|
207
210
|
|
|
211
|
+
// Determine schema version: use v2 if any input is v2
|
|
212
|
+
const schemaVersion = keystores.some(ks => ks.schemaVersion === 2) ? 2 : 1;
|
|
213
|
+
|
|
208
214
|
const merged: KeyStore = {
|
|
209
|
-
schemaVersion
|
|
215
|
+
schemaVersion,
|
|
210
216
|
validators: [],
|
|
211
217
|
slasher: undefined,
|
|
212
218
|
remoteSigner: undefined,
|
|
213
219
|
prover: undefined,
|
|
220
|
+
publisher: undefined,
|
|
221
|
+
coinbase: undefined,
|
|
222
|
+
feeRecipient: undefined,
|
|
214
223
|
};
|
|
215
224
|
|
|
216
225
|
for (let i = 0; i < keystores.length; i++) {
|
|
@@ -220,8 +229,9 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
220
229
|
if (keystore.validators) {
|
|
221
230
|
for (const validator of keystore.validators) {
|
|
222
231
|
// Check for duplicate attester addresses
|
|
223
|
-
const attesterKeys =
|
|
224
|
-
for (
|
|
232
|
+
const attesterKeys = extractAttesterAddresses(validator.attester);
|
|
233
|
+
for (let key of attesterKeys) {
|
|
234
|
+
key = key.toLowerCase();
|
|
225
235
|
if (attesterAddresses.has(key)) {
|
|
226
236
|
throw new KeyStoreLoadError(
|
|
227
237
|
`Duplicate attester address ${key} found across keystore files`,
|
|
@@ -230,8 +240,18 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
230
240
|
}
|
|
231
241
|
attesterAddresses.add(key);
|
|
232
242
|
}
|
|
243
|
+
|
|
244
|
+
// When merging v1 validators into a v2+ result, preserve original fallback behavior
|
|
245
|
+
// by explicitly setting publisher/coinbase/feeRecipient if they're missing
|
|
246
|
+
if (keystore.schemaVersion !== schemaVersion) {
|
|
247
|
+
throw new KeyStoreLoadError(
|
|
248
|
+
`Cannot merge keystores with different schema versions: ${keystore.schemaVersion} and ${schemaVersion}`,
|
|
249
|
+
`keystores[${i}].schemaVersion`,
|
|
250
|
+
);
|
|
251
|
+
} else {
|
|
252
|
+
merged.validators!.push(validator);
|
|
253
|
+
}
|
|
233
254
|
}
|
|
234
|
-
merged.validators!.push(...keystore.validators);
|
|
235
255
|
}
|
|
236
256
|
|
|
237
257
|
// Merge slasher (accumulate all)
|
|
@@ -264,6 +284,45 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
264
284
|
}
|
|
265
285
|
merged.prover = keystore.prover;
|
|
266
286
|
}
|
|
287
|
+
|
|
288
|
+
// Merge top-level publisher (accumulate all, unless conflicting MnemonicConfigs)
|
|
289
|
+
if (keystore.publisher) {
|
|
290
|
+
if (!merged.publisher) {
|
|
291
|
+
merged.publisher = keystore.publisher;
|
|
292
|
+
} else {
|
|
293
|
+
const isMnemonic = (accounts: EthAccounts): boolean =>
|
|
294
|
+
typeof accounts === 'object' && accounts !== null && 'mnemonic' in accounts;
|
|
295
|
+
|
|
296
|
+
// If either is a mnemonic, warn and use last one (can't merge mnemonics)
|
|
297
|
+
if (isMnemonic(merged.publisher) || isMnemonic(keystore.publisher)) {
|
|
298
|
+
logger.warn(
|
|
299
|
+
'Multiple default publisher configurations found with mnemonic, using the last one (cannot merge mnemonics)',
|
|
300
|
+
);
|
|
301
|
+
merged.publisher = keystore.publisher;
|
|
302
|
+
} else {
|
|
303
|
+
// Both are non-mnemonic, accumulate them
|
|
304
|
+
const toArray = (accounts: EthAccounts): unknown[] => (Array.isArray(accounts) ? accounts : [accounts]);
|
|
305
|
+
const combined = [...toArray(merged.publisher), ...toArray(keystore.publisher)];
|
|
306
|
+
merged.publisher = combined as unknown as EthAccounts;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Merge top-level coinbase (last one wins, but warn about conflicts)
|
|
312
|
+
if (keystore.coinbase) {
|
|
313
|
+
if (merged.coinbase) {
|
|
314
|
+
logger.warn('Multiple default coinbase addresses found, using the last one');
|
|
315
|
+
}
|
|
316
|
+
merged.coinbase = keystore.coinbase;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Merge top-level feeRecipient (last one wins, but warn about conflicts)
|
|
320
|
+
if (keystore.feeRecipient) {
|
|
321
|
+
if (merged.feeRecipient) {
|
|
322
|
+
logger.warn('Multiple default feeRecipient addresses found, using the last one');
|
|
323
|
+
}
|
|
324
|
+
merged.feeRecipient = keystore.feeRecipient;
|
|
325
|
+
}
|
|
267
326
|
}
|
|
268
327
|
|
|
269
328
|
// Clean up empty arrays
|
|
@@ -284,38 +343,43 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
284
343
|
* @param attester The attester configuration in any supported shape.
|
|
285
344
|
* @returns Array of string keys used to detect duplicates.
|
|
286
345
|
*/
|
|
287
|
-
function
|
|
346
|
+
function extractAttesterAddresses(attester: unknown): string[] {
|
|
288
347
|
// String forms (private key or other) - return as-is for coarse uniqueness
|
|
289
348
|
if (typeof attester === 'string') {
|
|
290
|
-
|
|
349
|
+
if (attester.length === 66) {
|
|
350
|
+
return [privateKeyToAddress(attester as Hex<32>)];
|
|
351
|
+
} else {
|
|
352
|
+
return [attester];
|
|
353
|
+
}
|
|
291
354
|
}
|
|
292
355
|
|
|
293
356
|
// Arrays of attester items
|
|
294
357
|
if (Array.isArray(attester)) {
|
|
295
358
|
const keys: string[] = [];
|
|
296
359
|
for (const item of attester) {
|
|
297
|
-
keys.push(...
|
|
360
|
+
keys.push(...extractAttesterAddresses(item));
|
|
298
361
|
}
|
|
299
362
|
return keys;
|
|
300
363
|
}
|
|
301
364
|
|
|
302
365
|
if (attester && typeof attester === 'object') {
|
|
366
|
+
if (attester instanceof EthAddress) {
|
|
367
|
+
return [attester.toString()];
|
|
368
|
+
}
|
|
369
|
+
|
|
303
370
|
const obj = attester as Record<string, unknown>;
|
|
304
371
|
|
|
305
372
|
// New shape: { eth: EthAccount, bls?: BLSAccount }
|
|
306
373
|
if ('eth' in obj) {
|
|
307
|
-
return
|
|
374
|
+
return extractAttesterAddresses(obj.eth);
|
|
308
375
|
}
|
|
309
376
|
|
|
310
377
|
// Remote signer account object shape: { address, remoteSignerUrl?, ... }
|
|
311
378
|
if ('address' in obj) {
|
|
312
379
|
return [String((obj as any).address)];
|
|
313
380
|
}
|
|
314
|
-
|
|
315
|
-
// Mnemonic or other object shapes: stringify
|
|
316
|
-
return [JSON.stringify(attester)];
|
|
317
381
|
}
|
|
318
382
|
|
|
319
|
-
//
|
|
320
|
-
return [
|
|
383
|
+
// mnemonic, encrypted file just disable early duplicates checking
|
|
384
|
+
return [];
|
|
321
385
|
}
|
package/src/schemas.ts
CHANGED
|
@@ -22,55 +22,65 @@ const urlSchema = z.string().url('Invalid URL');
|
|
|
22
22
|
// Remote signer config schema
|
|
23
23
|
const remoteSignerConfigSchema = z.union([
|
|
24
24
|
urlSchema,
|
|
25
|
-
z
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
z
|
|
26
|
+
.object({
|
|
27
|
+
remoteSignerUrl: urlSchema,
|
|
28
|
+
certPath: optional(z.string()),
|
|
29
|
+
certPass: optional(z.string()),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
30
32
|
]);
|
|
31
33
|
|
|
32
34
|
// Remote signer account schema
|
|
33
35
|
const remoteSignerAccountSchema = z.union([
|
|
34
36
|
schemas.EthAddress,
|
|
35
|
-
z
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
z
|
|
38
|
+
.object({
|
|
39
|
+
address: schemas.EthAddress,
|
|
40
|
+
remoteSignerUrl: urlSchema,
|
|
41
|
+
certPath: optional(z.string()),
|
|
42
|
+
certPass: optional(z.string()),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
41
45
|
]);
|
|
42
46
|
|
|
43
|
-
// JSON V3
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
// Encrypted keystore file schema (used for both JSON V3 ETH keys and EIP-2335 BLS keys)
|
|
48
|
+
const encryptedKeyFileSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
path: z.string(),
|
|
51
|
+
password: optional(z.string()),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
48
54
|
|
|
49
55
|
// Mnemonic config schema
|
|
50
|
-
const mnemonicConfigSchema = z
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const mnemonicConfigSchema = z
|
|
57
|
+
.object({
|
|
58
|
+
mnemonic: z.string().min(1, 'Mnemonic cannot be empty'),
|
|
59
|
+
addressIndex: z.number().int().min(0).default(0),
|
|
60
|
+
accountIndex: z.number().int().min(0).default(0),
|
|
61
|
+
addressCount: z.number().int().min(1).default(1),
|
|
62
|
+
accountCount: z.number().int().min(1).default(1),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
57
65
|
|
|
58
66
|
// EthAccount schema
|
|
59
|
-
const ethAccountSchema = z.union([ethPrivateKeySchema, remoteSignerAccountSchema,
|
|
67
|
+
const ethAccountSchema = z.union([ethPrivateKeySchema, remoteSignerAccountSchema, encryptedKeyFileSchema]);
|
|
60
68
|
|
|
61
69
|
// EthAccounts schema
|
|
62
70
|
const ethAccountsSchema = z.union([ethAccountSchema, z.array(ethAccountSchema), mnemonicConfigSchema]);
|
|
63
71
|
|
|
64
72
|
// BLSAccount schema
|
|
65
|
-
const blsAccountSchema = z.union([blsPrivateKeySchema,
|
|
73
|
+
const blsAccountSchema = z.union([blsPrivateKeySchema, encryptedKeyFileSchema]);
|
|
66
74
|
|
|
67
75
|
// AttesterAccount schema: either EthAccount or { eth: EthAccount, bls?: BLSAccount }
|
|
68
76
|
const attesterAccountSchema = z.union([
|
|
69
77
|
ethAccountSchema,
|
|
70
|
-
z
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
z
|
|
79
|
+
.object({
|
|
80
|
+
eth: ethAccountSchema,
|
|
81
|
+
bls: optional(blsAccountSchema),
|
|
82
|
+
})
|
|
83
|
+
.strict(),
|
|
74
84
|
]);
|
|
75
85
|
|
|
76
86
|
// AttesterAccounts schema: AttesterAccount | AttesterAccount[] | MnemonicConfig
|
|
@@ -79,33 +89,87 @@ const attesterAccountsSchema = z.union([attesterAccountSchema, z.array(attesterA
|
|
|
79
89
|
// Prover keystore schema
|
|
80
90
|
const proverKeyStoreSchema = z.union([
|
|
81
91
|
ethAccountSchema,
|
|
82
|
-
z
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
z
|
|
93
|
+
.object({
|
|
94
|
+
id: schemas.EthAddress,
|
|
95
|
+
publisher: ethAccountsSchema,
|
|
96
|
+
})
|
|
97
|
+
.strict(),
|
|
86
98
|
]);
|
|
87
99
|
|
|
88
|
-
// Validator keystore schema
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
// Validator keystore schema for v1 (feeRecipient required)
|
|
101
|
+
const validatorKeyStoreSchemaV1 = z
|
|
102
|
+
.object({
|
|
103
|
+
attester: attesterAccountsSchema,
|
|
104
|
+
coinbase: optional(schemas.EthAddress),
|
|
105
|
+
publisher: optional(ethAccountsSchema),
|
|
106
|
+
feeRecipient: AztecAddress.schema,
|
|
107
|
+
remoteSigner: optional(remoteSignerConfigSchema),
|
|
108
|
+
fundingAccount: optional(ethAccountSchema),
|
|
109
|
+
})
|
|
110
|
+
.strict();
|
|
111
|
+
|
|
112
|
+
// Validator keystore schema for v2 (feeRecipient optional, can fall back to top-level)
|
|
113
|
+
const validatorKeyStoreSchemaV2 = z
|
|
114
|
+
.object({
|
|
115
|
+
attester: attesterAccountsSchema,
|
|
116
|
+
coinbase: optional(schemas.EthAddress),
|
|
117
|
+
publisher: optional(ethAccountsSchema),
|
|
118
|
+
feeRecipient: optional(AztecAddress.schema),
|
|
119
|
+
remoteSigner: optional(remoteSignerConfigSchema),
|
|
120
|
+
fundingAccount: optional(ethAccountSchema),
|
|
121
|
+
})
|
|
122
|
+
.strict();
|
|
123
|
+
|
|
124
|
+
// Schema v1 - original format
|
|
125
|
+
const keystoreSchemaV1 = z
|
|
100
126
|
.object({
|
|
101
127
|
schemaVersion: z.literal(1),
|
|
102
|
-
validators: optional(z.array(
|
|
128
|
+
validators: optional(z.array(validatorKeyStoreSchemaV1)),
|
|
103
129
|
slasher: optional(ethAccountsSchema),
|
|
104
130
|
remoteSigner: optional(remoteSignerConfigSchema),
|
|
105
131
|
prover: optional(proverKeyStoreSchema),
|
|
106
132
|
fundingAccount: optional(ethAccountSchema),
|
|
107
133
|
})
|
|
134
|
+
.strict()
|
|
108
135
|
.refine(data => data.validators || data.prover, {
|
|
109
136
|
message: 'Keystore must have at least validators or prover configuration',
|
|
110
137
|
path: ['root'],
|
|
111
138
|
});
|
|
139
|
+
|
|
140
|
+
// Schema v2 - adds top-level publisher, coinbase, feeRecipient
|
|
141
|
+
const keystoreSchemaV2 = z
|
|
142
|
+
.object({
|
|
143
|
+
schemaVersion: z.literal(2),
|
|
144
|
+
validators: optional(z.array(validatorKeyStoreSchemaV2)),
|
|
145
|
+
slasher: optional(ethAccountsSchema),
|
|
146
|
+
remoteSigner: optional(remoteSignerConfigSchema),
|
|
147
|
+
prover: optional(proverKeyStoreSchema),
|
|
148
|
+
fundingAccount: optional(ethAccountSchema),
|
|
149
|
+
publisher: optional(ethAccountsSchema),
|
|
150
|
+
coinbase: optional(schemas.EthAddress),
|
|
151
|
+
feeRecipient: optional(AztecAddress.schema),
|
|
152
|
+
})
|
|
153
|
+
.strict()
|
|
154
|
+
.refine(data => data.validators || data.prover, {
|
|
155
|
+
message: 'Keystore must have at least validators or prover configuration',
|
|
156
|
+
path: ['root'],
|
|
157
|
+
})
|
|
158
|
+
.refine(
|
|
159
|
+
data => {
|
|
160
|
+
// If validators are present, ensure each validator has a feeRecipient or there's a top-level feeRecipient
|
|
161
|
+
if (data.validators) {
|
|
162
|
+
const hasTopLevelFeeRecipient = !!data.feeRecipient;
|
|
163
|
+
const allValidatorsHaveFeeRecipient = data.validators.every(v => v.feeRecipient);
|
|
164
|
+
return hasTopLevelFeeRecipient || allValidatorsHaveFeeRecipient;
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
message: 'Each validator must have a feeRecipient, or a top-level feeRecipient must be set for all validators',
|
|
170
|
+
path: ['feeRecipient'],
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
// Main keystore schema - accepts both v1 and v2
|
|
175
|
+
export const keystoreSchema = z.union([keystoreSchemaV1, keystoreSchemaV2]);
|
package/src/signer.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common interface for different signing backends (local, remote, encrypted)
|
|
5
5
|
*/
|
|
6
|
-
import type { EthSigner } from '@aztec/ethereum';
|
|
6
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
7
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
|
-
import {
|
|
8
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
9
|
+
import { Secp256k1Signer, toRecoveryBit } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
9
10
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
11
|
import { Signature, type ViemTransactionSignature } from '@aztec/foundation/eth-signature';
|
|
11
12
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
12
|
-
import { withHexPrefix } from '@aztec/foundation/string';
|
|
13
|
+
import { bufferToHex, withHexPrefix } from '@aztec/foundation/string';
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
type TransactionSerializable,
|
|
@@ -243,10 +244,6 @@ export class RemoteSigner implements EthSigner {
|
|
|
243
244
|
* Make a JSON-RPC eth_signTransaction request.
|
|
244
245
|
*/
|
|
245
246
|
private async makeJsonRpcSignTransactionRequest(tx: TransactionSerializable): Promise<Signature> {
|
|
246
|
-
if (tx.type !== 'eip1559') {
|
|
247
|
-
throw new Error('This signer does not support tx type: ' + tx.type);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
247
|
const txObject: RemoteSignerTxObject = {
|
|
251
248
|
from: this.address.toString(),
|
|
252
249
|
to: tx.to ?? null,
|
|
@@ -260,10 +257,10 @@ export class RemoteSigner implements EthSigner {
|
|
|
260
257
|
? withHexPrefix(tx.maxPriorityFeePerGas.toString(16))
|
|
261
258
|
: undefined,
|
|
262
259
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
260
|
+
maxFeePerBlobGas:
|
|
261
|
+
typeof tx.maxFeePerBlobGas !== 'undefined' ? withHexPrefix(tx.maxFeePerBlobGas.toString(16)) : undefined,
|
|
262
|
+
blobVersionedHashes: tx.blobVersionedHashes,
|
|
263
|
+
blobs: tx.blobs?.map(blob => (typeof blob === 'string' ? blob : bufferToHex(Buffer.from(blob)))),
|
|
267
264
|
};
|
|
268
265
|
|
|
269
266
|
let rawTxHex = await this.makeJsonRpcRequest('eth_signTransaction', txObject);
|
package/src/types.ts
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
* their associated keys and addresses.
|
|
7
7
|
*/
|
|
8
8
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
|
+
import type { Hex } from '@aztec/foundation/string';
|
|
9
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
11
|
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* An encrypted keystore file config points to a local file with an encrypted private key.
|
|
14
|
+
* The file may be in different formats:
|
|
15
|
+
* - JSON V3 format for ETH keys (Ethereum wallet standard)
|
|
16
|
+
* - EIP-2335 format for BLS keys (Ethereum 2.0 validator standard)
|
|
17
|
+
*/
|
|
18
|
+
export type EncryptedKeyFileConfig = { path: string; password?: string };
|
|
16
19
|
|
|
17
20
|
/** A private key is a 32-byte 0x-prefixed hex */
|
|
18
21
|
export type EthPrivateKey = Hex<32>;
|
|
@@ -47,8 +50,8 @@ export type EthRemoteSignerAccount =
|
|
|
47
50
|
certPass?: string;
|
|
48
51
|
};
|
|
49
52
|
|
|
50
|
-
/** An L1 account is a private key, a remote signer configuration, or
|
|
51
|
-
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount |
|
|
53
|
+
/** An L1 account is a private key, a remote signer configuration, or an encrypted keystore file (JSON V3 format) */
|
|
54
|
+
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount | EncryptedKeyFileConfig;
|
|
52
55
|
|
|
53
56
|
/** A mnemonic can be used to define a set of accounts */
|
|
54
57
|
export type MnemonicConfig = {
|
|
@@ -71,8 +74,8 @@ export type ProverKeyStoreWithId = {
|
|
|
71
74
|
|
|
72
75
|
export type ProverKeyStore = ProverKeyStoreWithId | EthAccount;
|
|
73
76
|
|
|
74
|
-
/** A BLS account is either a private key, or
|
|
75
|
-
export type BLSAccount = BLSPrivateKey |
|
|
77
|
+
/** A BLS account is either a private key, or an EIP-2335 encrypted keystore file */
|
|
78
|
+
export type BLSAccount = BLSPrivateKey | EncryptedKeyFileConfig;
|
|
76
79
|
|
|
77
80
|
/** An AttesterAccount is a combined EthAccount and optional BLSAccount */
|
|
78
81
|
export type AttesterAccount = { eth: EthAccount; bls?: BLSAccount } | EthAccount;
|
|
@@ -88,18 +91,19 @@ export type ValidatorKeyStore = {
|
|
|
88
91
|
attester: AttesterAccounts;
|
|
89
92
|
/**
|
|
90
93
|
* Coinbase address to use when proposing an L2 block as any of the validators in this configuration block.
|
|
91
|
-
* Falls back to the attester address if not set.
|
|
94
|
+
* Falls back to the keystore-level coinbase, then to the attester address if not set.
|
|
92
95
|
*/
|
|
93
96
|
coinbase?: EthAddress;
|
|
94
97
|
/**
|
|
95
98
|
* One or more EOAs used for sending block proposal L1 txs for all validators in this configuration block.
|
|
96
|
-
* Falls back to the attester account if not set.
|
|
99
|
+
* Falls back to the keystore-level publisher, then to the attester account if not set.
|
|
97
100
|
*/
|
|
98
101
|
publisher?: EthAccounts;
|
|
99
102
|
/**
|
|
100
103
|
* Fee recipient address to use when proposing an L2 block as any of the validators in this configuration block.
|
|
104
|
+
* Falls back to the keystore-level feeRecipient if not set.
|
|
101
105
|
*/
|
|
102
|
-
feeRecipient
|
|
106
|
+
feeRecipient?: AztecAddress;
|
|
103
107
|
/**
|
|
104
108
|
* Default remote signer for all accounts in this block.
|
|
105
109
|
*/
|
|
@@ -111,8 +115,8 @@ export type ValidatorKeyStore = {
|
|
|
111
115
|
};
|
|
112
116
|
|
|
113
117
|
export type KeyStore = {
|
|
114
|
-
/** Schema version of this keystore file (
|
|
115
|
-
schemaVersion:
|
|
118
|
+
/** Schema version of this keystore file (1 or 2). */
|
|
119
|
+
schemaVersion: 1 | 2;
|
|
116
120
|
/** Validator configurations. */
|
|
117
121
|
validators?: ValidatorKeyStore[];
|
|
118
122
|
/** One or more accounts used for creating slash payloads on L1. Does not create slash payloads if not set. */
|
|
@@ -123,4 +127,10 @@ export type KeyStore = {
|
|
|
123
127
|
prover?: ProverKeyStore;
|
|
124
128
|
/** Used for automatically funding publisher accounts if there is none defined in the corresponding ValidatorKeyStore*/
|
|
125
129
|
fundingAccount?: EthAccount;
|
|
130
|
+
/** Default publisher accounts for all validators in this keystore. Can be overridden by individual validator configs. */
|
|
131
|
+
publisher?: EthAccounts;
|
|
132
|
+
/** Default coinbase address for all validators in this keystore. Can be overridden by individual validator configs. */
|
|
133
|
+
coinbase?: EthAddress;
|
|
134
|
+
/** Default fee recipient address for all validators in this keystore. Can be overridden by individual validator configs. */
|
|
135
|
+
feeRecipient?: AztecAddress;
|
|
126
136
|
};
|