@aztec/cli 0.0.1-commit.2f68f620 → 0.0.1-commit.321f6a9
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/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +6 -6
- package/dest/cmds/validator_keys/new.d.ts +2 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +21 -5
- package/dest/cmds/validator_keys/set_funding_account.d.ts +14 -0
- package/dest/cmds/validator_keys/set_funding_account.d.ts.map +1 -0
- package/dest/cmds/validator_keys/set_funding_account.js +37 -0
- package/dest/cmds/validator_keys/shared.d.ts +15 -2
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +34 -0
- package/dest/cmds/validator_keys/utils.d.ts +12 -2
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
- package/dest/cmds/validator_keys/utils.js +34 -0
- 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 +32 -14
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +31 -13
- package/dest/utils/commands.d.ts +7 -6
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +10 -9
- package/package.json +30 -30
- package/src/cmds/infrastructure/setup_l2_contract.ts +5 -5
- package/src/cmds/validator_keys/index.ts +30 -4
- package/src/cmds/validator_keys/new.ts +22 -1
- package/src/cmds/validator_keys/set_funding_account.ts +55 -0
- package/src/cmds/validator_keys/shared.ts +37 -1
- package/src/cmds/validator_keys/utils.ts +44 -1
- package/src/config/chain_l2_config.ts +14 -1
- package/src/config/generated/networks.ts +31 -13
- package/src/utils/commands.ts +14 -13
|
@@ -9,12 +9,14 @@ import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
|
9
9
|
import { readFile, writeFile } from 'fs/promises';
|
|
10
10
|
import { basename, dirname, join } from 'path';
|
|
11
11
|
import { createPublicClient, fallback, http } from 'viem';
|
|
12
|
-
import { generateMnemonic, mnemonicToAccount } from 'viem/accounts';
|
|
12
|
+
import { generateMnemonic, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
buildValidatorEntries,
|
|
16
|
+
encryptFundingAccountToFile,
|
|
16
17
|
logValidatorSummaries,
|
|
17
18
|
maybePrintJson,
|
|
19
|
+
resolveFundingAccount,
|
|
18
20
|
resolveKeystoreOutputPath,
|
|
19
21
|
writeBlsBn254ToFile,
|
|
20
22
|
writeEthJsonV3ToFile,
|
|
@@ -23,6 +25,7 @@ import {
|
|
|
23
25
|
import { processAttesterAccounts } from './staker.js';
|
|
24
26
|
import {
|
|
25
27
|
validateBlsPathOptions,
|
|
28
|
+
validateFundingAccountOptions,
|
|
26
29
|
validatePublisherOptions,
|
|
27
30
|
validateRemoteSignerOptions,
|
|
28
31
|
validateStakerOutputOptions,
|
|
@@ -51,6 +54,7 @@ export type NewValidatorKeystoreOptions = {
|
|
|
51
54
|
json?: boolean;
|
|
52
55
|
feeRecipient: AztecAddress;
|
|
53
56
|
coinbase?: EthAddress;
|
|
57
|
+
fundingAccount?: string;
|
|
54
58
|
remoteSigner?: string;
|
|
55
59
|
stakerOutput?: boolean;
|
|
56
60
|
gseAddress?: EthAddress;
|
|
@@ -147,6 +151,8 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
|
|
|
147
151
|
validatePublisherOptions(options);
|
|
148
152
|
// validate remote signer options
|
|
149
153
|
validateRemoteSignerOptions(options);
|
|
154
|
+
// validate funding account option
|
|
155
|
+
validateFundingAccountOptions(options);
|
|
150
156
|
|
|
151
157
|
const {
|
|
152
158
|
dataDir,
|
|
@@ -156,6 +162,7 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
|
|
|
156
162
|
publishers,
|
|
157
163
|
json,
|
|
158
164
|
coinbase,
|
|
165
|
+
fundingAccount,
|
|
159
166
|
accountIndex = 0,
|
|
160
167
|
addressIndex = 0,
|
|
161
168
|
feeRecipient,
|
|
@@ -213,17 +220,26 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
|
|
|
213
220
|
remoteSigner,
|
|
214
221
|
});
|
|
215
222
|
|
|
223
|
+
let resolvedFundingAccount = fundingAccount ? resolveFundingAccount(fundingAccount, remoteSigner) : undefined;
|
|
224
|
+
|
|
216
225
|
// If password provided, write ETH JSON V3 and BLS BN254 keystores and replace plaintext
|
|
217
226
|
if (shouldEncryptKeystores) {
|
|
218
227
|
const encryptedKeystoreOutDir =
|
|
219
228
|
encryptedKeystoreDir && encryptedKeystoreDir.length > 0 ? encryptedKeystoreDir : keystoreOutDir;
|
|
220
229
|
await writeEthJsonV3ToFile(validators, { outDir: encryptedKeystoreOutDir, password: ethPassword });
|
|
221
230
|
await writeBlsBn254ToFile(validators, { outDir: encryptedKeystoreOutDir, password: blsPassword });
|
|
231
|
+
if (resolvedFundingAccount) {
|
|
232
|
+
resolvedFundingAccount = await encryptFundingAccountToFile(resolvedFundingAccount, {
|
|
233
|
+
outDir: encryptedKeystoreOutDir,
|
|
234
|
+
password: ethPassword,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
222
237
|
}
|
|
223
238
|
|
|
224
239
|
const keystore = {
|
|
225
240
|
schemaVersion: 1,
|
|
226
241
|
validators,
|
|
242
|
+
...(resolvedFundingAccount ? { fundingAccount: resolvedFundingAccount } : {}),
|
|
227
243
|
};
|
|
228
244
|
|
|
229
245
|
await writeKeystoreFile(outputPath, keystore);
|
|
@@ -285,6 +301,11 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
|
|
|
285
301
|
// print a concise summary of public keys (addresses and BLS pubkeys) if no --json options was selected
|
|
286
302
|
if (!json) {
|
|
287
303
|
logValidatorSummaries(log, summaries);
|
|
304
|
+
if (fundingAccount) {
|
|
305
|
+
const funderAddress =
|
|
306
|
+
fundingAccount.length === 66 ? privateKeyToAccount(fundingAccount as `0x${string}`).address : fundingAccount;
|
|
307
|
+
log(`funding account: ${funderAddress}`);
|
|
308
|
+
}
|
|
288
309
|
}
|
|
289
310
|
|
|
290
311
|
if (mnemonic && remoteSigner && !json) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import { loadKeystoreFile } from '@aztec/node-keystore/loader';
|
|
3
|
+
import type { KeyStore } from '@aztec/node-keystore/types';
|
|
4
|
+
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
7
|
+
|
|
8
|
+
import { encryptFundingAccountToFile, maybePrintJson, resolveFundingAccount, writeKeystoreFile } from './shared.js';
|
|
9
|
+
import { validateFundingAccountOptions } from './utils.js';
|
|
10
|
+
|
|
11
|
+
export type SetFundingAccountOptions = {
|
|
12
|
+
remoteSigner?: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
encryptedKeystoreDir?: string;
|
|
15
|
+
json?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sets the top-level funding account of an existing keystore, replacing any previous one. The
|
|
20
|
+
* account may be a private key, or an address paired with a remote signer URL. With a password,
|
|
21
|
+
* a plaintext key is encrypted to an ETH JSON V3 file and stored as a { path, password } reference.
|
|
22
|
+
*/
|
|
23
|
+
export async function setFundingAccount(
|
|
24
|
+
existing: string,
|
|
25
|
+
fundingAccount: string,
|
|
26
|
+
options: SetFundingAccountOptions,
|
|
27
|
+
log: LogFn,
|
|
28
|
+
) {
|
|
29
|
+
const { remoteSigner, password, encryptedKeystoreDir, json } = options;
|
|
30
|
+
|
|
31
|
+
const keystore: KeyStore = loadKeystoreFile(existing);
|
|
32
|
+
|
|
33
|
+
const validated = { fundingAccount, remoteSigner };
|
|
34
|
+
validateFundingAccountOptions(validated, !!keystore.remoteSigner);
|
|
35
|
+
|
|
36
|
+
let resolved = resolveFundingAccount(validated.fundingAccount!, remoteSigner);
|
|
37
|
+
if (password !== undefined) {
|
|
38
|
+
const outDir = encryptedKeystoreDir && encryptedKeystoreDir.length > 0 ? encryptedKeystoreDir : dirname(existing);
|
|
39
|
+
resolved = await encryptFundingAccountToFile(resolved, { outDir, password });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (keystore.fundingAccount) {
|
|
43
|
+
log('Replacing existing funding account in keystore');
|
|
44
|
+
}
|
|
45
|
+
keystore.fundingAccount = resolved;
|
|
46
|
+
|
|
47
|
+
await writeKeystoreFile(existing, keystore);
|
|
48
|
+
|
|
49
|
+
if (!json) {
|
|
50
|
+
const value = validated.fundingAccount!;
|
|
51
|
+
const funderAddress = value.length === 66 ? privateKeyToAccount(value as `0x${string}`).address : value;
|
|
52
|
+
log(`Set funding account ${funderAddress} in ${existing}`);
|
|
53
|
+
}
|
|
54
|
+
maybePrintJson(log, !!json, keystore as unknown as Record<string, any>);
|
|
55
|
+
}
|
|
@@ -3,7 +3,7 @@ import { asyncPool } from '@aztec/foundation/async-pool';
|
|
|
3
3
|
import { deriveBlsPrivateKey } from '@aztec/foundation/crypto/bls';
|
|
4
4
|
import { createBn254Keystore } from '@aztec/foundation/crypto/bls/bn254_keystore';
|
|
5
5
|
import { computeBn254G1PublicKeyCompressed } from '@aztec/foundation/crypto/bn254';
|
|
6
|
-
import
|
|
6
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import type { EthAccount, EthPrivateKey, ValidatorKeyStore } from '@aztec/node-keystore/types';
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -125,6 +125,21 @@ export function deriveEthAttester(
|
|
|
125
125
|
: (('0x' + Buffer.from(acct.getHdKey().privateKey!).toString('hex')) as EthPrivateKey);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Resolve a `--funding-account` value into a keystore `EthAccount`. A 66-char value is a private key
|
|
130
|
+
* (used verbatim). A 42-char value is an address: with an explicit `remoteSigner` URL it becomes an
|
|
131
|
+
* `{ address, remoteSignerUrl }` pair; without one it is stored as a bare address that falls back to
|
|
132
|
+
* the keystore-level remote signer at runtime. Callers must validate the value first (see
|
|
133
|
+
* `validateFundingAccountOptions`).
|
|
134
|
+
*/
|
|
135
|
+
export function resolveFundingAccount(fundingAccount: string, remoteSigner?: string): EthAccount {
|
|
136
|
+
if (fundingAccount.length === 66) {
|
|
137
|
+
return fundingAccount as EthPrivateKey;
|
|
138
|
+
}
|
|
139
|
+
const address = EthAddress.fromString(fundingAccount);
|
|
140
|
+
return remoteSigner ? ({ address, remoteSignerUrl: remoteSigner } as EthAccount) : address;
|
|
141
|
+
}
|
|
142
|
+
|
|
128
143
|
export async function buildValidatorEntries(input: BuildValidatorsInput) {
|
|
129
144
|
const {
|
|
130
145
|
validatorCount,
|
|
@@ -330,6 +345,27 @@ export async function writeEthJsonV3Keystore(
|
|
|
330
345
|
return outPath;
|
|
331
346
|
}
|
|
332
347
|
|
|
348
|
+
/**
|
|
349
|
+
* If `account` is a plaintext ETH private key, encrypt it to a JSON V3 file and return a
|
|
350
|
+
* { path, password } reference; otherwise return it unchanged.
|
|
351
|
+
*/
|
|
352
|
+
async function maybeEncryptEthAccount(account: any, label: string, options: { outDir: string; password: string }) {
|
|
353
|
+
if (typeof account === 'string' && account.startsWith('0x') && account.length === 66) {
|
|
354
|
+
const fileBase = `${label}_${account.slice(2, 10)}`;
|
|
355
|
+
const p = await writeEthJsonV3Keystore(options.outDir, fileBase, options.password, account);
|
|
356
|
+
return { path: p, password: options.password };
|
|
357
|
+
}
|
|
358
|
+
return account;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** Encrypt a plaintext funding-account key to a JSON V3 file, replacing it with a { path, password } reference. */
|
|
362
|
+
export async function encryptFundingAccountToFile(
|
|
363
|
+
account: EthAccount,
|
|
364
|
+
options: { outDir: string; password: string },
|
|
365
|
+
): Promise<EthAccount> {
|
|
366
|
+
return (await maybeEncryptEthAccount(account, 'funding', options)) as EthAccount;
|
|
367
|
+
}
|
|
368
|
+
|
|
333
369
|
/** Replace plaintext ETH keys in validators with { path, password } pointing to JSON V3 files. */
|
|
334
370
|
export async function writeEthJsonV3ToFile(
|
|
335
371
|
validators: ValidatorKeyStore[],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { ethPrivateKeySchema } from '@aztec/node-keystore/schemas';
|
|
3
3
|
import type { EthPrivateKey } from '@aztec/node-keystore/types';
|
|
4
4
|
|
|
@@ -79,3 +79,46 @@ export function validatePublisherOptions(options: { publishers?: string[]; publi
|
|
|
79
79
|
options.publishers = normalizedKeys as EthPrivateKey[];
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Validates and normalizes the `--funding-account` option in place. The value may be a private key
|
|
85
|
+
* (used as a local signer) or an ETH address. An address needs a remote signer to sign funding txs:
|
|
86
|
+
* either `--remote-signer`, or a keystore that already defines one (pass `hasKeystoreRemoteSigner`),
|
|
87
|
+
* which a bare address inherits at runtime.
|
|
88
|
+
*/
|
|
89
|
+
export function validateFundingAccountOptions(
|
|
90
|
+
options: { fundingAccount?: string; remoteSigner?: string },
|
|
91
|
+
hasKeystoreRemoteSigner = false,
|
|
92
|
+
) {
|
|
93
|
+
if (!options.fundingAccount) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let value = options.fundingAccount.trim();
|
|
98
|
+
if (!value.startsWith('0x')) {
|
|
99
|
+
value = '0x' + value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (value.length === 66) {
|
|
103
|
+
try {
|
|
104
|
+
ethPrivateKeySchema.parse(value);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw new Error(`Invalid funding account private key: ${error instanceof Error ? error.message : String(error)}`);
|
|
107
|
+
}
|
|
108
|
+
} else if (value.length === 42) {
|
|
109
|
+
try {
|
|
110
|
+
EthAddress.fromString(value);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
throw new Error(`Invalid funding account address: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
}
|
|
114
|
+
if (!options.remoteSigner && !hasKeystoreRemoteSigner) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
'--funding-account as an address requires --remote-signer, or a keystore that already defines a remote signer',
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
throw new Error('Invalid funding account: expected a 32-byte private key or a 20-byte address');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
options.fundingAccount = value;
|
|
124
|
+
}
|
|
@@ -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,9 +226,9 @@ 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
|
-
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.
|
|
231
|
+
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.7,
|
|
214
232
|
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2,
|
|
215
233
|
SLASH_INACTIVITY_PENALTY: 2E+21,
|
|
216
234
|
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 2E+21,
|
|
@@ -221,6 +239,6 @@ export const mainnetConfig = {
|
|
|
221
239
|
SLASH_UNKNOWN_PENALTY: 2E+21,
|
|
222
240
|
SLASH_INVALID_BLOCK_PENALTY: 2E+21,
|
|
223
241
|
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 2E+21,
|
|
224
|
-
SLASH_GRACE_PERIOD_L2_SLOTS:
|
|
242
|
+
SLASH_GRACE_PERIOD_L2_SLOTS: 8400,
|
|
225
243
|
} as const;
|
|
226
244
|
|
package/src/utils/commands.ts
CHANGED
|
@@ -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';
|
|
@@ -50,14 +51,14 @@ export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain I
|
|
|
50
51
|
return parsedValue;
|
|
51
52
|
});
|
|
52
53
|
|
|
53
|
-
export const
|
|
54
|
+
export const createSigningKeyOption = (
|
|
54
55
|
description: string,
|
|
55
56
|
mandatory: boolean,
|
|
56
|
-
argsParser?: (value: string, previous:
|
|
57
|
+
argsParser?: (value: string, previous: GrumpkinScalar) => GrumpkinScalar,
|
|
57
58
|
) =>
|
|
58
|
-
new Option('-sk, --
|
|
59
|
-
.env('
|
|
60
|
-
.argParser(argsParser ??
|
|
59
|
+
new Option('-sk, --signing-key <string>', description)
|
|
60
|
+
.env('SIGNING_KEY')
|
|
61
|
+
.argParser(argsParser ?? parseSigningKey)
|
|
61
62
|
.makeOptionMandatory(mandatory);
|
|
62
63
|
|
|
63
64
|
export const logJson = (log: LogFn) => (obj: object) => log(JSON.stringify(obj, null, 2));
|
|
@@ -101,7 +102,7 @@ export async function getTxSender(pxe: PXE, _from?: string) {
|
|
|
101
102
|
let from: AztecAddress;
|
|
102
103
|
if (_from) {
|
|
103
104
|
try {
|
|
104
|
-
from = AztecAddress.
|
|
105
|
+
from = AztecAddress.fromStringUnsafe(_from);
|
|
105
106
|
} catch {
|
|
106
107
|
throw new InvalidArgumentError(`Invalid option 'from' passed: ${_from}`);
|
|
107
108
|
}
|
|
@@ -195,7 +196,7 @@ export function parseFieldFromHexString(str: string): Fr {
|
|
|
195
196
|
*/
|
|
196
197
|
export function parseAztecAddress(address: string): AztecAddress {
|
|
197
198
|
try {
|
|
198
|
-
return AztecAddress.
|
|
199
|
+
return AztecAddress.fromStringUnsafe(address);
|
|
199
200
|
} catch {
|
|
200
201
|
throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
|
|
201
202
|
}
|
|
@@ -357,16 +358,16 @@ export function parsePartialAddress(address: string): Fr {
|
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
/**
|
|
360
|
-
* Parses
|
|
361
|
-
* @param
|
|
362
|
-
* @returns A
|
|
361
|
+
* Parses an account signing key from a string.
|
|
362
|
+
* @param signingKey - A string
|
|
363
|
+
* @returns A signing key
|
|
363
364
|
* @throws InvalidArgumentError if the input string is not valid.
|
|
364
365
|
*/
|
|
365
|
-
export function
|
|
366
|
+
export function parseSigningKey(signingKey: string): GrumpkinScalar {
|
|
366
367
|
try {
|
|
367
|
-
return
|
|
368
|
+
return GrumpkinScalar.fromHexString(signingKey);
|
|
368
369
|
} catch {
|
|
369
|
-
throw new InvalidArgumentError(`Invalid
|
|
370
|
+
throw new InvalidArgumentError(`Invalid signing key: ${signingKey}`);
|
|
370
371
|
}
|
|
371
372
|
}
|
|
372
373
|
|