@aztec/cli 6.0.0-nightly.20260604 → 6.0.0-nightly.20260721
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/cmds/infrastructure/setup_l2_contract.js +5 -5
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts +2 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +2 -1
- package/dest/cmds/validator_keys/new.d.ts +6 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +78 -8
- package/dest/cmds/validator_keys/shared.d.ts +1 -1
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +66 -23
- package/dest/config/chain_l2_config.d.ts +7 -2
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +14 -1
- package/dest/config/generated/networks.d.ts +30 -12
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +29 -11
- package/dest/utils/commands.js +2 -2
- package/package.json +30 -30
- package/src/cmds/infrastructure/setup_l2_contract.ts +5 -5
- package/src/cmds/validator_keys/eth_json_v3_worker.ts +30 -0
- package/src/cmds/validator_keys/index.ts +18 -4
- package/src/cmds/validator_keys/new.ts +107 -8
- package/src/cmds/validator_keys/shared.ts +86 -34
- package/src/config/chain_l2_config.ts +14 -1
- package/src/config/generated/networks.ts +29 -11
- package/src/utils/commands.ts +2 -2
|
@@ -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 (
|
|
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
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
263
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
|
-
(
|
|
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
|
|
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
|
-
|
|
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
|
-
(
|
|
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
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { NetworkNames } from '@aztec/foundation/config';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { type ConsensusEnvVar, checkConsensusEnvOverrides } from '@aztec/stdlib/config';
|
|
2
4
|
|
|
3
5
|
import path from 'path';
|
|
4
6
|
|
|
@@ -12,6 +14,12 @@ const NetworkConfigs: Partial<Record<NetworkNames, NetworkConfigEnv>> = {
|
|
|
12
14
|
mainnet: mainnetConfig,
|
|
13
15
|
};
|
|
14
16
|
|
|
17
|
+
/** Every generated network config must define every consensus-critical env var. */
|
|
18
|
+
export type ConsensusComplete = Record<ConsensusEnvVar, string | number | boolean>;
|
|
19
|
+
({ devnetConfig, testnetConfig, mainnetConfig }) satisfies Record<string, ConsensusComplete>;
|
|
20
|
+
|
|
21
|
+
const log = createLogger('cli:chain_l2_config');
|
|
22
|
+
|
|
15
23
|
function enrichEnvironmentWithNetworkConfig(config: NetworkConfigEnv): void {
|
|
16
24
|
for (const [key, value] of Object.entries(config)) {
|
|
17
25
|
if (process.env[key] === undefined && value !== undefined) {
|
|
@@ -31,7 +39,9 @@ function getDefaultDataDir(networkName: NetworkNames): string {
|
|
|
31
39
|
* and DefaultSlasherConfig (which match the 'defaults' section of defaults.yml).
|
|
32
40
|
*
|
|
33
41
|
* For deployed networks: applies network configuration from generated defaults.yml,
|
|
34
|
-
* merging base defaults with network-specific overrides.
|
|
42
|
+
* merging base defaults with network-specific overrides. Before merging, enforces that operators have not
|
|
43
|
+
* overridden any consensus-critical env var with a value diverging from the network config (throwing unless
|
|
44
|
+
* ALLOW_OVERRIDING_NETWORK_CONFIG is set), so all nodes of a network agree on consensus-critical values.
|
|
35
45
|
*
|
|
36
46
|
* @param networkName - The network name
|
|
37
47
|
*/
|
|
@@ -49,6 +59,9 @@ export function enrichEnvironmentWithChainName(networkName: NetworkNames) {
|
|
|
49
59
|
const configKey = /^v\d+-devnet-\d+$/.test(networkName) ? 'devnet' : networkName;
|
|
50
60
|
const generatedConfig = NetworkConfigs[configKey];
|
|
51
61
|
if (generatedConfig) {
|
|
62
|
+
// The check is pure; this layer owns env mutation, so apply its canonical writes before enriching.
|
|
63
|
+
const canonical = checkConsensusEnvOverrides(generatedConfig, process.env, msg => log.warn(msg));
|
|
64
|
+
Object.assign(process.env, canonical);
|
|
52
65
|
enrichEnvironmentWithNetworkConfig(generatedConfig);
|
|
53
66
|
}
|
|
54
67
|
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
export const devnetConfig = {
|
|
5
5
|
ETHEREUM_SLOT_DURATION: 12,
|
|
6
|
-
AZTEC_SLOT_DURATION: 72,
|
|
7
|
-
AZTEC_TARGET_COMMITTEE_SIZE: 48,
|
|
8
6
|
AZTEC_ACTIVATION_THRESHOLD: 100000000000000000000,
|
|
9
7
|
AZTEC_EJECTION_THRESHOLD: 50000000000000000000,
|
|
10
8
|
AZTEC_LOCAL_EJECTION_THRESHOLD: 98000000000000000000,
|
|
11
9
|
AZTEC_EXIT_DELAY_SECONDS: 172800,
|
|
12
|
-
AZTEC_INBOX_LAG:
|
|
10
|
+
AZTEC_INBOX_LAG: 2,
|
|
13
11
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
14
12
|
AZTEC_MANA_TARGET: 100000000,
|
|
15
13
|
AZTEC_PROVING_COST_PER_MANA: 100,
|
|
@@ -24,6 +22,11 @@ export const devnetConfig = {
|
|
|
24
22
|
AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000,
|
|
25
23
|
AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000,
|
|
26
24
|
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300,
|
|
25
|
+
AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE: 0,
|
|
26
|
+
AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE: 0,
|
|
27
|
+
AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN: 48,
|
|
28
|
+
AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT: 2,
|
|
29
|
+
AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE: 48,
|
|
27
30
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
28
31
|
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
29
32
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
|
@@ -33,7 +36,7 @@ export const devnetConfig = {
|
|
|
33
36
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
34
37
|
SEQ_BUILD_CHECKPOINT_IF_EMPTY: true,
|
|
35
38
|
SEQ_BLOCK_DURATION_MS: 6000,
|
|
36
|
-
|
|
39
|
+
CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS: 12,
|
|
37
40
|
DATA_STORE_MAP_SIZE_KB: 134217728,
|
|
38
41
|
ARCHIVER_STORE_MAP_SIZE_KB: 1073741824,
|
|
39
42
|
NOTE_HASH_TREE_MAP_SIZE_KB: 1073741824,
|
|
@@ -41,10 +44,16 @@ export const devnetConfig = {
|
|
|
41
44
|
PUBLIC_DATA_TREE_MAP_SIZE_KB: 1073741824,
|
|
42
45
|
PUBLIC_OTEL_INCLUDE_METRICS: 'aztec.validator,aztec.tx_collector,aztec.mempool,aztec.p2p.gossip.agg_,aztec.ivc_verifier.agg_',
|
|
43
46
|
SENTINEL_ENABLED: true,
|
|
47
|
+
OFFENSE_COLLECTION_ENABLED: true,
|
|
48
|
+
AZTEC_SLOT_DURATION: 36,
|
|
44
49
|
AZTEC_EPOCH_DURATION: 8,
|
|
45
50
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 1,
|
|
46
51
|
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 1,
|
|
52
|
+
AZTEC_TARGET_COMMITTEE_SIZE: 1,
|
|
53
|
+
MAX_BLOCKS_PER_CHECKPOINT: 4,
|
|
47
54
|
AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 1,
|
|
55
|
+
AZTEC_SLASHING_QUORUM: 17,
|
|
56
|
+
AZTEC_GOVERNANCE_PROPOSER_QUORUM: 151,
|
|
48
57
|
L1_CHAIN_ID: 11155111,
|
|
49
58
|
TEST_ACCOUNTS: true,
|
|
50
59
|
SPONSORED_FPC: true,
|
|
@@ -73,7 +82,7 @@ export const devnetConfig = {
|
|
|
73
82
|
SLASH_INVALID_BLOCK_PENALTY: 10000000000000000000,
|
|
74
83
|
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 0,
|
|
75
84
|
SLASH_GRACE_PERIOD_L2_SLOTS: 0,
|
|
76
|
-
|
|
85
|
+
ENABLE_AUTO_SHUTDOWN: false,
|
|
77
86
|
} as const;
|
|
78
87
|
|
|
79
88
|
export const testnetConfig = {
|
|
@@ -83,7 +92,7 @@ export const testnetConfig = {
|
|
|
83
92
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
|
|
84
93
|
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
|
|
85
94
|
AZTEC_EXIT_DELAY_SECONDS: 172800,
|
|
86
|
-
AZTEC_INBOX_LAG:
|
|
95
|
+
AZTEC_INBOX_LAG: 2,
|
|
87
96
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
88
97
|
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
89
98
|
AZTEC_SLASHER_ENABLED: true,
|
|
@@ -91,6 +100,11 @@ export const testnetConfig = {
|
|
|
91
100
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
|
|
92
101
|
AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
|
|
93
102
|
AZTEC_SLASHING_DISABLE_DURATION: 432000,
|
|
103
|
+
AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE: 0,
|
|
104
|
+
AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE: 0,
|
|
105
|
+
AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN: 48,
|
|
106
|
+
AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT: 2,
|
|
107
|
+
AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE: 48,
|
|
94
108
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
95
109
|
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
96
110
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
|
@@ -100,7 +114,8 @@ export const testnetConfig = {
|
|
|
100
114
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
101
115
|
SEQ_BUILD_CHECKPOINT_IF_EMPTY: true,
|
|
102
116
|
SEQ_BLOCK_DURATION_MS: 6000,
|
|
103
|
-
|
|
117
|
+
MAX_BLOCKS_PER_CHECKPOINT: 10,
|
|
118
|
+
CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS: 12,
|
|
104
119
|
DATA_STORE_MAP_SIZE_KB: 134217728,
|
|
105
120
|
ARCHIVER_STORE_MAP_SIZE_KB: 1073741824,
|
|
106
121
|
NOTE_HASH_TREE_MAP_SIZE_KB: 1073741824,
|
|
@@ -108,6 +123,7 @@ export const testnetConfig = {
|
|
|
108
123
|
PUBLIC_DATA_TREE_MAP_SIZE_KB: 1073741824,
|
|
109
124
|
PUBLIC_OTEL_INCLUDE_METRICS: 'aztec.validator,aztec.tx_collector,aztec.mempool,aztec.p2p.gossip.agg_,aztec.ivc_verifier.agg_',
|
|
110
125
|
SENTINEL_ENABLED: true,
|
|
126
|
+
OFFENSE_COLLECTION_ENABLED: true,
|
|
111
127
|
AZTEC_SLOT_DURATION: 72,
|
|
112
128
|
AZTEC_ACTIVATION_THRESHOLD: 2E+23,
|
|
113
129
|
AZTEC_EJECTION_THRESHOLD: 1E+23,
|
|
@@ -143,7 +159,7 @@ export const testnetConfig = {
|
|
|
143
159
|
SLASH_INVALID_BLOCK_PENALTY: 1E+23,
|
|
144
160
|
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 1E+23,
|
|
145
161
|
SLASH_GRACE_PERIOD_L2_SLOTS: 64,
|
|
146
|
-
|
|
162
|
+
ENABLE_AUTO_SHUTDOWN: false,
|
|
147
163
|
} as const;
|
|
148
164
|
|
|
149
165
|
export const mainnetConfig = {
|
|
@@ -152,7 +168,7 @@ export const mainnetConfig = {
|
|
|
152
168
|
AZTEC_TARGET_COMMITTEE_SIZE: 48,
|
|
153
169
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
|
|
154
170
|
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
|
|
155
|
-
AZTEC_INBOX_LAG:
|
|
171
|
+
AZTEC_INBOX_LAG: 2,
|
|
156
172
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
157
173
|
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
158
174
|
AZTEC_SLASHER_ENABLED: true,
|
|
@@ -167,7 +183,8 @@ export const mainnetConfig = {
|
|
|
167
183
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
168
184
|
SEQ_BUILD_CHECKPOINT_IF_EMPTY: true,
|
|
169
185
|
SEQ_BLOCK_DURATION_MS: 6000,
|
|
170
|
-
|
|
186
|
+
MAX_BLOCKS_PER_CHECKPOINT: 10,
|
|
187
|
+
CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS: 12,
|
|
171
188
|
DATA_STORE_MAP_SIZE_KB: 134217728,
|
|
172
189
|
ARCHIVER_STORE_MAP_SIZE_KB: 1073741824,
|
|
173
190
|
NOTE_HASH_TREE_MAP_SIZE_KB: 1073741824,
|
|
@@ -175,6 +192,7 @@ export const mainnetConfig = {
|
|
|
175
192
|
PUBLIC_DATA_TREE_MAP_SIZE_KB: 1073741824,
|
|
176
193
|
PUBLIC_OTEL_INCLUDE_METRICS: 'aztec.validator,aztec.tx_collector,aztec.mempool,aztec.p2p.gossip.agg_,aztec.ivc_verifier.agg_',
|
|
177
194
|
SENTINEL_ENABLED: true,
|
|
195
|
+
OFFENSE_COLLECTION_ENABLED: true,
|
|
178
196
|
AZTEC_SLOT_DURATION: 72,
|
|
179
197
|
AZTEC_ACTIVATION_THRESHOLD: 2E+23,
|
|
180
198
|
AZTEC_EJECTION_THRESHOLD: 1E+23,
|
|
@@ -208,7 +226,7 @@ export const mainnetConfig = {
|
|
|
208
226
|
P2P_TX_POOL_DELETE_TXS_AFTER_REORG: true,
|
|
209
227
|
PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
|
|
210
228
|
PUBLIC_OTEL_COLLECT_FROM: '',
|
|
211
|
-
|
|
229
|
+
ENABLE_AUTO_SHUTDOWN: false,
|
|
212
230
|
SLASH_DATA_WITHHOLDING_PENALTY: 0,
|
|
213
231
|
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8,
|
|
214
232
|
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2,
|
package/src/utils/commands.ts
CHANGED
|
@@ -101,7 +101,7 @@ export async function getTxSender(pxe: PXE, _from?: string) {
|
|
|
101
101
|
let from: AztecAddress;
|
|
102
102
|
if (_from) {
|
|
103
103
|
try {
|
|
104
|
-
from = AztecAddress.
|
|
104
|
+
from = AztecAddress.fromStringUnsafe(_from);
|
|
105
105
|
} catch {
|
|
106
106
|
throw new InvalidArgumentError(`Invalid option 'from' passed: ${_from}`);
|
|
107
107
|
}
|
|
@@ -195,7 +195,7 @@ export function parseFieldFromHexString(str: string): Fr {
|
|
|
195
195
|
*/
|
|
196
196
|
export function parseAztecAddress(address: string): AztecAddress {
|
|
197
197
|
try {
|
|
198
|
-
return AztecAddress.
|
|
198
|
+
return AztecAddress.fromStringUnsafe(address);
|
|
199
199
|
} catch {
|
|
200
200
|
throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
|
|
201
201
|
}
|