@aztec/cli 5.0.0-rc.1 → 5.0.0

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.
@@ -1,4 +1,5 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import type { LogFn } from '@aztec/foundation/log';
4
5
  import type { PXE } from '@aztec/pxe/server';
@@ -20,7 +21,7 @@ export declare function addOptions(program: Command, options: Option[]): Command
20
21
  export declare const makeNodeOption: (mandatory: boolean) => Option;
21
22
  export declare const nodeOption: Option;
22
23
  export declare const l1ChainIdOption: Option;
23
- export declare const createSecretKeyOption: (description: string, mandatory: boolean, argsParser?: ((value: string, previous: Fr) => Fr) | undefined) => Option;
24
+ export declare const createSigningKeyOption: (description: string, mandatory: boolean, argsParser?: ((value: string, previous: import("@aztec/foundation/curves/bn254").Fq) => import("@aztec/foundation/curves/bn254").Fq) | undefined) => Option;
24
25
  export declare const logJson: (log: LogFn) => (obj: object) => void;
25
26
  /**
26
27
  * Updates a file in place atomically.
@@ -132,12 +133,12 @@ export declare function parsePublicKey(publicKey: string): PublicKeys | undefine
132
133
  */
133
134
  export declare function parsePartialAddress(address: string): Fr;
134
135
  /**
135
- * Parses a secret key from a string.
136
- * @param privateKey - A string
137
- * @returns A secret key
136
+ * Parses an account signing key from a string.
137
+ * @param signingKey - A string
138
+ * @returns A signing key
138
139
  * @throws InvalidArgumentError if the input string is not valid.
139
140
  */
140
- export declare function parseSecretKey(secretKey: string): Fr;
141
+ export declare function parseSigningKey(signingKey: string): GrumpkinScalar;
141
142
  /**
142
143
  * Parses a field from a string.
143
144
  * @param field - A string representing the field.
@@ -157,4 +158,4 @@ export declare function parseFields(fields: string[]): Fr[];
157
158
  * @returns A JSON string
158
159
  */
159
160
  export declare function prettyPrintJSON(data: Record<string, any>): string;
160
- //# sourceMappingURL=data:application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GAAG,SAAS,CAepB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKtE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CASxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,EAAE,CAMvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAMlE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAyB5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAcjE"}
@@ -1,4 +1,5 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
4
5
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -28,7 +29,7 @@ export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain I
28
29
  }
29
30
  return parsedValue;
30
31
  });
31
- export const createSecretKeyOption = (description, mandatory, argsParser)=>new Option('-sk, --secret-key <string>', description).env('SECRET_KEY').argParser(argsParser ?? parseSecretKey).makeOptionMandatory(mandatory);
32
+ export const createSigningKeyOption = (description, mandatory, argsParser)=>new Option('-sk, --signing-key <string>', description).env('SIGNING_KEY').argParser(argsParser ?? parseSigningKey).makeOptionMandatory(mandatory);
32
33
  export const logJson = (log)=>(obj)=>log(JSON.stringify(obj, null, 2));
33
34
  /**
34
35
  * Updates a file in place atomically.
@@ -62,7 +63,7 @@ export const logJson = (log)=>(obj)=>log(JSON.stringify(obj, null, 2));
62
63
  let from;
63
64
  if (_from) {
64
65
  try {
65
- from = AztecAddress.fromString(_from);
66
+ from = AztecAddress.fromStringUnsafe(_from);
66
67
  } catch {
67
68
  throw new InvalidArgumentError(`Invalid option 'from' passed: ${_from}`);
68
69
  }
@@ -138,7 +139,7 @@ export function parseBigint(bigint) {
138
139
  * @throws InvalidArgumentError if the input string is not valid.
139
140
  */ export function parseAztecAddress(address) {
140
141
  try {
141
- return AztecAddress.fromString(address);
142
+ return AztecAddress.fromStringUnsafe(address);
142
143
  } catch {
143
144
  throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
144
145
  }
@@ -275,15 +276,15 @@ export function parseBigint(bigint) {
275
276
  }
276
277
  }
277
278
  /**
278
- * Parses a secret key from a string.
279
- * @param privateKey - A string
280
- * @returns A secret key
279
+ * Parses an account signing key from a string.
280
+ * @param signingKey - A string
281
+ * @returns A signing key
281
282
  * @throws InvalidArgumentError if the input string is not valid.
282
- */ export function parseSecretKey(secretKey) {
283
+ */ export function parseSigningKey(signingKey) {
283
284
  try {
284
- return Fr.fromHexString(secretKey);
285
+ return GrumpkinScalar.fromHexString(signingKey);
285
286
  } catch {
286
- throw new InvalidArgumentError(`Invalid encryption secret key: ${secretKey}`);
287
+ throw new InvalidArgumentError(`Invalid signing key: ${signingKey}`);
287
288
  }
288
289
  }
289
290
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -77,23 +77,23 @@
77
77
  ]
78
78
  },
79
79
  "dependencies": {
80
- "@aztec/accounts": "5.0.0-rc.1",
81
- "@aztec/archiver": "5.0.0-rc.1",
82
- "@aztec/aztec.js": "5.0.0-rc.1",
83
- "@aztec/constants": "5.0.0-rc.1",
84
- "@aztec/entrypoints": "5.0.0-rc.1",
85
- "@aztec/ethereum": "5.0.0-rc.1",
86
- "@aztec/foundation": "5.0.0-rc.1",
87
- "@aztec/l1-artifacts": "5.0.0-rc.1",
88
- "@aztec/node-keystore": "5.0.0-rc.1",
89
- "@aztec/node-lib": "5.0.0-rc.1",
90
- "@aztec/p2p": "5.0.0-rc.1",
91
- "@aztec/protocol-contracts": "5.0.0-rc.1",
92
- "@aztec/sequencer-client": "5.0.0-rc.1",
93
- "@aztec/slasher": "5.0.0-rc.1",
94
- "@aztec/stdlib": "5.0.0-rc.1",
95
- "@aztec/wallets": "5.0.0-rc.1",
96
- "@aztec/world-state": "5.0.0-rc.1",
80
+ "@aztec/accounts": "5.0.0",
81
+ "@aztec/archiver": "5.0.0",
82
+ "@aztec/aztec.js": "5.0.0",
83
+ "@aztec/constants": "5.0.0",
84
+ "@aztec/entrypoints": "5.0.0",
85
+ "@aztec/ethereum": "5.0.0",
86
+ "@aztec/foundation": "5.0.0",
87
+ "@aztec/l1-artifacts": "5.0.0",
88
+ "@aztec/node-keystore": "5.0.0",
89
+ "@aztec/node-lib": "5.0.0",
90
+ "@aztec/p2p": "5.0.0",
91
+ "@aztec/protocol-contracts": "5.0.0",
92
+ "@aztec/sequencer-client": "5.0.0",
93
+ "@aztec/slasher": "5.0.0",
94
+ "@aztec/stdlib": "5.0.0",
95
+ "@aztec/wallets": "5.0.0",
96
+ "@aztec/world-state": "5.0.0",
97
97
  "@ethersproject/wallet": "^5.8.0",
98
98
  "@iarna/toml": "^2.2.5",
99
99
  "@libp2p/peer-id-factory": "^3.0.4",
@@ -107,9 +107,9 @@
107
107
  "viem": "npm:@aztec/viem@2.38.2"
108
108
  },
109
109
  "devDependencies": {
110
- "@aztec/aztec-node": "5.0.0-rc.1",
111
- "@aztec/kv-store": "5.0.0-rc.1",
112
- "@aztec/telemetry-client": "5.0.0-rc.1",
110
+ "@aztec/aztec-node": "5.0.0",
111
+ "@aztec/kv-store": "5.0.0",
112
+ "@aztec/telemetry-client": "5.0.0",
113
113
  "@jest/globals": "^30.0.0",
114
114
  "@types/jest": "^30.0.0",
115
115
  "@types/lodash.chunk": "^4.2.9",
@@ -126,15 +126,15 @@
126
126
  "typescript": "^5.3.3"
127
127
  },
128
128
  "peerDependencies": {
129
- "@aztec/accounts": "5.0.0-rc.1",
130
- "@aztec/bb-prover": "5.0.0-rc.1",
131
- "@aztec/ethereum": "5.0.0-rc.1",
132
- "@aztec/l1-artifacts": "5.0.0-rc.1",
133
- "@aztec/noir-contracts.js": "5.0.0-rc.1",
134
- "@aztec/noir-protocol-circuits-types": "5.0.0-rc.1",
135
- "@aztec/noir-test-contracts.js": "5.0.0-rc.1",
136
- "@aztec/protocol-contracts": "5.0.0-rc.1",
137
- "@aztec/stdlib": "5.0.0-rc.1"
129
+ "@aztec/accounts": "5.0.0",
130
+ "@aztec/bb-prover": "5.0.0",
131
+ "@aztec/ethereum": "5.0.0",
132
+ "@aztec/l1-artifacts": "5.0.0",
133
+ "@aztec/noir-contracts.js": "5.0.0",
134
+ "@aztec/noir-protocol-circuits-types": "5.0.0",
135
+ "@aztec/noir-test-contracts.js": "5.0.0",
136
+ "@aztec/protocol-contracts": "5.0.0",
137
+ "@aztec/stdlib": "5.0.0"
138
138
  },
139
139
  "files": [
140
140
  "dest",
@@ -0,0 +1,30 @@
1
+ import { Wallet } from '@ethersproject/wallet';
2
+ import { parentPort, workerData } from 'worker_threads';
3
+
4
+ type EthJsonV3WorkerData = {
5
+ privateKeyHex: string;
6
+ password: string;
7
+ };
8
+
9
+ type SerializedError = {
10
+ message: string;
11
+ name?: string;
12
+ stack?: string;
13
+ };
14
+
15
+ function serializeError(error: unknown): SerializedError {
16
+ if (error instanceof Error) {
17
+ return { message: error.message, name: error.name, stack: error.stack };
18
+ }
19
+ return { message: String(error) };
20
+ }
21
+
22
+ void (async () => {
23
+ try {
24
+ const { privateKeyHex, password } = workerData as EthJsonV3WorkerData;
25
+ const json = await new Wallet(privateKeyHex).encrypt(password);
26
+ parentPort?.postMessage({ json });
27
+ } catch (error) {
28
+ parentPort?.postMessage({ error: serializeError(error) });
29
+ }
30
+ })();
@@ -1,6 +1,6 @@
1
1
  import type { LogFn } from '@aztec/foundation/log';
2
2
 
3
- import { Command } from 'commander';
3
+ import { Command, Option } from 'commander';
4
4
 
5
5
  import { parseAztecAddress, parseEthereumAddress, parseHex, parseOptionalInteger } from '../../utils/commands.js';
6
6
  import { defaultBlsPath } from './utils.js';
@@ -38,10 +38,24 @@ export function injectCommands(program: Command, log: LogFn) {
38
38
  .option('--remote-signer <url>', 'Default remote signer URL for accounts in this file')
39
39
  .option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
40
40
  .option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
41
- .option(
42
- '--password <str>',
43
- 'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed',
41
+ .addOption(
42
+ new Option('--password <str>', 'Shared password for writing ETH JSON V3 and BLS EIP-2335 keystore files').env(
43
+ 'AZTEC_KEYSTORE_PASSWORD',
44
+ ),
45
+ )
46
+ .option('--password-file <path>', 'File containing the shared password for writing keystore files')
47
+ .addOption(
48
+ new Option('--eth-password <str>', 'Password for writing ETH JSON V3 keystore files').env(
49
+ 'AZTEC_ETH_KEYSTORE_PASSWORD',
50
+ ),
51
+ )
52
+ .option('--eth-password-file <path>', 'File containing the password for writing ETH JSON V3 keystore files')
53
+ .addOption(
54
+ new Option('--bls-password <str>', 'Password for writing BLS EIP-2335 keystore files').env(
55
+ 'AZTEC_BLS_KEYSTORE_PASSWORD',
56
+ ),
44
57
  )
58
+ .option('--bls-password-file <path>', 'File containing the password for writing BLS EIP-2335 keystore files')
45
59
  .option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)')
46
60
  .option('--json', 'Echo resulting JSON to stdout')
47
61
  .option('--staker-output', 'Generate a single staker output JSON file with an array of validator entries')
@@ -6,7 +6,7 @@ import type { LogFn } from '@aztec/foundation/log';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
7
 
8
8
  import { wordlist } from '@scure/bip39/wordlists/english.js';
9
- import { writeFile } from 'fs/promises';
9
+ import { readFile, writeFile } from 'fs/promises';
10
10
  import { basename, dirname, join } from 'path';
11
11
  import { createPublicClient, fallback, http } from 'viem';
12
12
  import { generateMnemonic, mnemonicToAccount } from 'viem/accounts';
@@ -42,6 +42,11 @@ export type NewValidatorKeystoreOptions = {
42
42
  ikm?: string;
43
43
  blsPath?: string;
44
44
  password?: string;
45
+ passwordFile?: string;
46
+ ethPassword?: string;
47
+ ethPasswordFile?: string;
48
+ blsPassword?: string;
49
+ blsPasswordFile?: string;
45
50
  encryptedKeystoreDir?: string;
46
51
  json?: boolean;
47
52
  feeRecipient: AztecAddress;
@@ -53,6 +58,86 @@ export type NewValidatorKeystoreOptions = {
53
58
  l1ChainId?: number;
54
59
  };
55
60
 
61
+ type PasswordSourceOptions = Pick<
62
+ NewValidatorKeystoreOptions,
63
+ 'password' | 'passwordFile' | 'ethPassword' | 'ethPasswordFile' | 'blsPassword' | 'blsPasswordFile'
64
+ >;
65
+
66
+ type PasswordSource = {
67
+ password?: string;
68
+ passwordFile?: string;
69
+ passwordOption: string;
70
+ passwordFileOption: string;
71
+ };
72
+
73
+ function validatePassword(password: string, source: string): string {
74
+ if (password.length === 0) {
75
+ throw new Error(`${source} cannot be empty`);
76
+ }
77
+ return password;
78
+ }
79
+
80
+ function stripOneTrailingNewline(password: string): string {
81
+ if (password.endsWith('\n')) {
82
+ password = password.slice(0, -1);
83
+ }
84
+ if (password.endsWith('\r')) {
85
+ password = password.slice(0, -1);
86
+ }
87
+ return password;
88
+ }
89
+
90
+ async function resolvePasswordSource(source: PasswordSource): Promise<string | undefined> {
91
+ if (source.password !== undefined && source.passwordFile !== undefined) {
92
+ throw new Error(`${source.passwordOption} and ${source.passwordFileOption} cannot be used together`);
93
+ }
94
+ if (source.password !== undefined) {
95
+ return validatePassword(source.password, source.passwordOption);
96
+ }
97
+ if (source.passwordFile !== undefined) {
98
+ if (source.passwordFile.length === 0) {
99
+ throw new Error(`${source.passwordFileOption} cannot be empty`);
100
+ }
101
+ const password = stripOneTrailingNewline(await readFile(source.passwordFile, 'utf-8'));
102
+ return validatePassword(password, source.passwordFileOption);
103
+ }
104
+
105
+ return undefined;
106
+ }
107
+
108
+ async function resolvePasswords(options: PasswordSourceOptions) {
109
+ const sharedPassword = await resolvePasswordSource({
110
+ password: options.password,
111
+ passwordFile: options.passwordFile,
112
+ passwordOption: '--password',
113
+ passwordFileOption: '--password-file',
114
+ });
115
+ const ethPassword =
116
+ (await resolvePasswordSource({
117
+ password: options.ethPassword,
118
+ passwordFile: options.ethPasswordFile,
119
+ passwordOption: '--eth-password',
120
+ passwordFileOption: '--eth-password-file',
121
+ })) ?? sharedPassword;
122
+ const blsPassword =
123
+ (await resolvePasswordSource({
124
+ password: options.blsPassword,
125
+ passwordFile: options.blsPasswordFile,
126
+ passwordOption: '--bls-password',
127
+ passwordFileOption: '--bls-password-file',
128
+ })) ?? sharedPassword;
129
+
130
+ if (ethPassword === undefined && blsPassword === undefined) {
131
+ return {};
132
+ }
133
+ if (ethPassword === undefined || blsPassword === undefined) {
134
+ throw new Error(
135
+ 'Both ETH and BLS passwords are required when writing encrypted keystores. Provide --password to use one password for both, or provide both --eth-password and --bls-password.',
136
+ );
137
+ }
138
+ return { ethPassword, blsPassword };
139
+ }
140
+
56
141
  export async function newValidatorKeystore(options: NewValidatorKeystoreOptions, log: LogFn) {
57
142
  // validate bls-path inputs before proceeding with key generation
58
143
  validateBlsPathOptions(options);
@@ -78,7 +163,12 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
78
163
  blsPath,
79
164
  ikm,
80
165
  mnemonic: _mnemonic,
81
- password,
166
+ password: passwordOption,
167
+ passwordFile,
168
+ ethPassword: ethPasswordOption,
169
+ ethPasswordFile,
170
+ blsPassword: blsPasswordOption,
171
+ blsPasswordFile,
82
172
  encryptedKeystoreDir,
83
173
  stakerOutput,
84
174
  gseAddress,
@@ -86,9 +176,18 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
86
176
  l1ChainId,
87
177
  } = options;
88
178
 
179
+ const { ethPassword, blsPassword } = await resolvePasswords({
180
+ password: passwordOption,
181
+ passwordFile,
182
+ ethPassword: ethPasswordOption,
183
+ ethPasswordFile,
184
+ blsPassword: blsPasswordOption,
185
+ blsPasswordFile,
186
+ });
187
+ const shouldEncryptKeystores = ethPassword !== undefined && blsPassword !== undefined;
89
188
  const mnemonic = _mnemonic ?? generateMnemonic(wordlist);
90
189
 
91
- if (!_mnemonic && !json) {
190
+ if (!_mnemonic && !json && !shouldEncryptKeystores) {
92
191
  log('No mnemonic provided, generating new one...');
93
192
  log(`Using new mnemonic:`);
94
193
  log('');
@@ -115,11 +214,11 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
115
214
  });
116
215
 
117
216
  // If password provided, write ETH JSON V3 and BLS BN254 keystores and replace plaintext
118
- if (password !== undefined) {
217
+ if (shouldEncryptKeystores) {
119
218
  const encryptedKeystoreOutDir =
120
219
  encryptedKeystoreDir && encryptedKeystoreDir.length > 0 ? encryptedKeystoreDir : keystoreOutDir;
121
- await writeEthJsonV3ToFile(validators, { outDir: encryptedKeystoreOutDir, password });
122
- await writeBlsBn254ToFile(validators, { outDir: encryptedKeystoreOutDir, password });
220
+ await writeEthJsonV3ToFile(validators, { outDir: encryptedKeystoreOutDir, password: ethPassword });
221
+ await writeBlsBn254ToFile(validators, { outDir: encryptedKeystoreOutDir, password: blsPassword });
123
222
  }
124
223
 
125
224
  const keystore = {
@@ -145,7 +244,7 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
145
244
  // Process each validator
146
245
  for (let i = 0; i < validators.length; i++) {
147
246
  const validator = validators[i];
148
- const outputs = await processAttesterAccounts(validator.attester, gse, password);
247
+ const outputs = await processAttesterAccounts(validator.attester, gse);
149
248
 
150
249
  // Collect all staker outputs
151
250
  for (let j = 0; j < outputs.length; j++) {
@@ -160,7 +259,7 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
160
259
  }
161
260
  }
162
261
 
163
- const outputData = !_mnemonic ? { ...keystore, generatedMnemonic: mnemonic } : keystore;
262
+ const outputData = !_mnemonic && !shouldEncryptKeystores ? { ...keystore, generatedMnemonic: mnemonic } : keystore;
164
263
 
165
264
  // Handle JSON output
166
265
  if (json) {
@@ -1,4 +1,5 @@
1
1
  import { prettyPrintJSON } from '@aztec/cli/utils';
2
+ import { asyncPool } from '@aztec/foundation/async-pool';
2
3
  import { deriveBlsPrivateKey } from '@aztec/foundation/crypto/bls';
3
4
  import { createBn254Keystore } from '@aztec/foundation/crypto/bls/bn254_keystore';
4
5
  import { computeBn254G1PublicKeyCompressed } from '@aztec/foundation/crypto/bn254';
@@ -10,12 +11,60 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
10
11
  import { Wallet } from '@ethersproject/wallet';
11
12
  import { constants as fsConstants, mkdirSync } from 'fs';
12
13
  import { access, writeFile } from 'fs/promises';
13
- import { homedir } from 'os';
14
+ import { availableParallelism, homedir } from 'os';
14
15
  import { dirname, isAbsolute, join } from 'path';
15
16
  import { mnemonicToAccount } from 'viem/accounts';
17
+ import { Worker } from 'worker_threads';
16
18
 
17
19
  import { defaultBlsPath } from './utils.js';
18
20
 
21
+ type EthJsonV3WorkerResult = { json: string } | { error: { message: string; name?: string; stack?: string } };
22
+
23
+ // ethers' default scrypt parameters use substantial memory, so keep worker fan-out bounded.
24
+ const maxEthKeystoreWorkers = Math.max(1, Math.min(4, availableParallelism()));
25
+
26
+ function deserializeWorkerError(error: { message: string; name?: string; stack?: string }) {
27
+ const result = new Error(error.message);
28
+ result.name = error.name ?? result.name;
29
+ result.stack = error.stack;
30
+ return result;
31
+ }
32
+
33
+ function encryptEthJsonV3InWorker(privateKeyHex: string, password: string): Promise<string> {
34
+ return new Promise<string>((resolve, reject) => {
35
+ const worker = new Worker(new URL('./eth_json_v3_worker.js', import.meta.url), {
36
+ workerData: { privateKeyHex, password },
37
+ });
38
+ let settled = false;
39
+
40
+ worker.once('message', (result: EthJsonV3WorkerResult) => {
41
+ settled = true;
42
+
43
+ if ('json' in result) {
44
+ resolve(result.json);
45
+ } else {
46
+ reject(deserializeWorkerError(result.error));
47
+ }
48
+ });
49
+ worker.once('error', error => {
50
+ settled = true;
51
+ reject(error);
52
+ });
53
+ worker.once('exit', code => {
54
+ if (!settled) {
55
+ reject(new Error(`ETH JSON V3 worker stopped with exit code ${code}`));
56
+ }
57
+ });
58
+ });
59
+ }
60
+
61
+ async function encryptEthJsonV3(privateKeyHex: string, password: string): Promise<string> {
62
+ if (process.env.JEST_WORKER_ID !== undefined) {
63
+ return await new Wallet(privateKeyHex).encrypt(password);
64
+ }
65
+ return await encryptEthJsonV3InWorker(privateKeyHex, password);
66
+ }
67
+
19
68
  export type ValidatorSummary = { attesterEth?: string; attesterBls?: string; publisherEth?: string[] };
20
69
 
21
70
  export type BuildValidatorsInput = {
@@ -228,7 +277,7 @@ export async function writeBn254BlsKeystore(
228
277
  ): Promise<string> {
229
278
  mkdirSync(outDir, { recursive: true });
230
279
 
231
- const keystore = createBn254Keystore(password, privateKeyHex, pubkeyHex, derivationPath);
280
+ const keystore = await createBn254Keystore(password, privateKeyHex, pubkeyHex, derivationPath);
232
281
 
233
282
  const safeBase = fileNameBase.replace(/[^a-zA-Z0-9_-]/g, '_');
234
283
  const outPath = join(outDir, `keystore-${safeBase}.json`);
@@ -241,28 +290,29 @@ export async function writeBlsBn254ToFile(
241
290
  validators: ValidatorKeyStore[],
242
291
  options: { outDir: string; password: string; blsPath?: string },
243
292
  ): Promise<void> {
244
- for (let i = 0; i < validators.length; i++) {
245
- const v = validators[i];
246
- if (!v || typeof v !== 'object' || !('attester' in v)) {
247
- continue;
248
- }
249
- const att = (v as any).attester;
293
+ await Promise.all(
294
+ validators.map(async (v, i) => {
295
+ if (!v || typeof v !== 'object' || !('attester' in v)) {
296
+ return;
297
+ }
298
+ const att = (v as any).attester;
250
299
 
251
- // Shapes: { bls: <hex> } or { eth: <ethAccount>, bls?: <hex> } or plain EthAccount
252
- const blsKey: string | undefined = typeof att === 'object' && 'bls' in att ? (att as any).bls : undefined;
253
- if (!blsKey || typeof blsKey !== 'string') {
254
- continue;
255
- }
300
+ // Shapes: { bls: <hex> } or { eth: <ethAccount>, bls?: <hex> } or plain EthAccount
301
+ const blsKey: string | undefined = typeof att === 'object' && 'bls' in att ? (att as any).bls : undefined;
302
+ if (!blsKey || typeof blsKey !== 'string') {
303
+ return;
304
+ }
256
305
 
257
- const pub = await computeBlsPublicKeyCompressed(blsKey);
258
- const path = options.blsPath ?? defaultBlsPath;
259
- const fileBase = `${String(i + 1)}_${pub.slice(2, 18)}`;
260
- const keystorePath = await writeBn254BlsKeystore(options.outDir, fileBase, options.password, blsKey, pub, path);
306
+ const pub = await computeBlsPublicKeyCompressed(blsKey);
307
+ const path = options.blsPath ?? defaultBlsPath;
308
+ const fileBase = `${String(i + 1)}_${pub.slice(2, 18)}`;
309
+ const keystorePath = await writeBn254BlsKeystore(options.outDir, fileBase, options.password, blsKey, pub, path);
261
310
 
262
- if (typeof att === 'object') {
263
- (att as any).bls = { path: keystorePath, password: options.password };
264
- }
265
- }
311
+ if (typeof att === 'object') {
312
+ (att as any).bls = { path: keystorePath, password: options.password };
313
+ }
314
+ }),
315
+ );
266
316
  }
267
317
 
268
318
  /** Writes an Ethereum JSON V3 keystore using ethers, returns absolute path */
@@ -274,8 +324,7 @@ export async function writeEthJsonV3Keystore(
274
324
  ): Promise<string> {
275
325
  const safeBase = fileNameBase.replace(/[^a-zA-Z0-9_-]/g, '_');
276
326
  mkdirSync(outDir, { recursive: true });
277
- const wallet = new Wallet(privateKeyHex);
278
- const json = await wallet.encrypt(password);
327
+ const json = await encryptEthJsonV3(privateKeyHex, password);
279
328
  const outPath = join(outDir, `keystore-eth-${safeBase}.json`);
280
329
  await writeFile(outPath, json, { encoding: 'utf-8' });
281
330
  return outPath;
@@ -286,13 +335,16 @@ export async function writeEthJsonV3ToFile(
286
335
  validators: ValidatorKeyStore[],
287
336
  options: { outDir: string; password: string },
288
337
  ): Promise<void> {
289
- const maybeEncryptEth = async (account: any, label: string) => {
338
+ const tasks: (() => Promise<void>)[] = [];
339
+
340
+ const maybeQueueEncryptEth = (account: any, label: string, setEncryptedAccount: (account: any) => void) => {
290
341
  if (typeof account === 'string' && account.startsWith('0x') && account.length === 66) {
291
- const fileBase = `${label}_${account.slice(2, 10)}`;
292
- const p = await writeEthJsonV3Keystore(options.outDir, fileBase, options.password, account);
293
- return { path: p, password: options.password };
342
+ tasks.push(async () => {
343
+ const fileBase = `${label}_${account.slice(2, 10)}`;
344
+ const path = await writeEthJsonV3Keystore(options.outDir, fileBase, options.password, account);
345
+ setEncryptedAccount({ path, password: options.password });
346
+ });
294
347
  }
295
- return account;
296
348
  };
297
349
 
298
350
  for (let i = 0; i < validators.length; i++) {
@@ -304,23 +356,23 @@ export async function writeEthJsonV3ToFile(
304
356
  // attester may be string (eth), object with eth, or remote signer
305
357
  const att = (v as any).attester;
306
358
  if (typeof att === 'string') {
307
- (v as any).attester = await maybeEncryptEth(att, `attester_${i + 1}`);
359
+ maybeQueueEncryptEth(att, `attester_${i + 1}`, account => ((v as any).attester = account));
308
360
  } else if (att && typeof att === 'object' && 'eth' in att) {
309
- (att as any).eth = await maybeEncryptEth((att as any).eth, `attester_${i + 1}`);
361
+ maybeQueueEncryptEth((att as any).eth, `attester_${i + 1}`, account => ((att as any).eth = account));
310
362
  }
311
363
 
312
364
  // publisher can be single or array
313
365
  if ('publisher' in v) {
314
366
  const pub = (v as any).publisher;
315
367
  if (Array.isArray(pub)) {
316
- const out: any[] = [];
317
368
  for (let j = 0; j < pub.length; j++) {
318
- out.push(await maybeEncryptEth(pub[j], `publisher_${i + 1}_${j + 1}`));
369
+ maybeQueueEncryptEth(pub[j], `publisher_${i + 1}_${j + 1}`, account => (pub[j] = account));
319
370
  }
320
- (v as any).publisher = out;
321
371
  } else if (pub !== undefined) {
322
- (v as any).publisher = await maybeEncryptEth(pub, `publisher_${i + 1}`);
372
+ maybeQueueEncryptEth(pub, `publisher_${i + 1}`, account => ((v as any).publisher = account));
323
373
  }
324
374
  }
325
375
  }
376
+
377
+ await asyncPool(maxEthKeystoreWorkers, tasks, task => task());
326
378
  }