@aztec/cli 2.0.3 → 2.1.0-rc.10
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/sequencers.js +2 -2
- package/dest/cmds/l1/create_l1_account.js +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +2 -2
- package/dest/cmds/l1/get_l1_addresses.js +1 -1
- package/dest/cmds/l1/get_l1_balance.js +1 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +2 -20
- package/dest/cmds/l1/prover_stats.js +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +1 -1
- package/dest/cmds/l1/update_l1_validators.js +15 -7
- package/dest/config/cached_fetch.d.ts +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +7 -4
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +123 -66
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/index.d.ts +2 -0
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +2 -0
- package/dest/config/network_config.d.ts +19 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +79 -0
- package/dest/utils/aztec.d.ts +1 -1
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +4 -3
- package/package.json +25 -25
- package/src/cmds/infrastructure/sequencers.ts +2 -2
- package/src/cmds/l1/create_l1_account.ts +1 -1
- package/src/cmds/l1/deploy_l1_contracts.ts +2 -0
- package/src/cmds/l1/get_l1_addresses.ts +1 -1
- package/src/cmds/l1/get_l1_balance.ts +1 -1
- package/src/cmds/l1/index.ts +2 -32
- package/src/cmds/l1/prover_stats.ts +1 -1
- package/src/cmds/l1/trigger_seed_snapshot.ts +1 -1
- package/src/cmds/l1/update_l1_validators.ts +7 -7
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +148 -71
- package/src/config/enrich_env.ts +15 -0
- package/src/config/index.ts +2 -0
- package/src/config/network_config.ts +102 -0
- package/src/utils/aztec.ts +4 -2
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -216
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/src/cmds/devnet/bootstrap_network.ts +0 -321
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
|
@@ -22,6 +22,7 @@ export async function deployL1Contracts(
|
|
|
22
22
|
createVerificationJson: string | false,
|
|
23
23
|
initialValidators: EthAddress[],
|
|
24
24
|
realVerifier: boolean,
|
|
25
|
+
existingToken: EthAddress | undefined,
|
|
25
26
|
log: LogFn,
|
|
26
27
|
debugLogger: Logger,
|
|
27
28
|
) {
|
|
@@ -50,6 +51,7 @@ export async function deployL1Contracts(
|
|
|
50
51
|
fundingNeeded,
|
|
51
52
|
acceleratedTestDeployments,
|
|
52
53
|
config,
|
|
54
|
+
existingToken,
|
|
53
55
|
realVerifier,
|
|
54
56
|
createVerificationJson,
|
|
55
57
|
debugLogger,
|
|
@@ -2,7 +2,7 @@ import { EthAddress } from '@aztec/aztec.js';
|
|
|
2
2
|
import { RegistryContract, type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
|
-
import { createPublicClient, fallback, http } from 'viem';
|
|
5
|
+
import { createPublicClient, fallback, http } from '@spalladino/viem';
|
|
6
6
|
|
|
7
7
|
export async function getL1Addresses(
|
|
8
8
|
registryAddress: EthAddress,
|
|
@@ -3,7 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
5
|
|
|
6
|
-
import { createPublicClient, fallback, getContract, http } from 'viem';
|
|
6
|
+
import { createPublicClient, fallback, getContract, http } from '@spalladino/viem';
|
|
7
7
|
|
|
8
8
|
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
9
9
|
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
48
48
|
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
49
49
|
.option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
|
|
50
50
|
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
51
|
+
.option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
|
|
51
52
|
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
52
53
|
.action(async options => {
|
|
53
54
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
@@ -68,6 +69,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
68
69
|
options.createVerificationJson,
|
|
69
70
|
initialValidators,
|
|
70
71
|
options.realVerifier,
|
|
72
|
+
options.existingToken,
|
|
71
73
|
log,
|
|
72
74
|
debugLogger,
|
|
73
75
|
);
|
|
@@ -523,37 +525,5 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
523
525
|
await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
|
|
524
526
|
});
|
|
525
527
|
|
|
526
|
-
program
|
|
527
|
-
.command('prover-stats', { hidden: true })
|
|
528
|
-
.addOption(l1RpcUrlsOption)
|
|
529
|
-
.addOption(l1ChainIdOption)
|
|
530
|
-
.option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n)
|
|
531
|
-
.option('--end-block <number>', 'The last L1 block number to query', parseBigint)
|
|
532
|
-
.option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n)
|
|
533
|
-
.option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint)
|
|
534
|
-
.option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)')
|
|
535
|
-
.option(
|
|
536
|
-
'--node-url <string>',
|
|
537
|
-
'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)',
|
|
538
|
-
)
|
|
539
|
-
.option('--raw-logs', 'Output raw logs instead of aggregated stats')
|
|
540
|
-
.action(async options => {
|
|
541
|
-
const { proverStats } = await import('./prover_stats.js');
|
|
542
|
-
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } =
|
|
543
|
-
options;
|
|
544
|
-
await proverStats({
|
|
545
|
-
l1RpcUrls,
|
|
546
|
-
chainId,
|
|
547
|
-
l1RollupAddress,
|
|
548
|
-
startBlock,
|
|
549
|
-
endBlock,
|
|
550
|
-
batchSize,
|
|
551
|
-
nodeUrl,
|
|
552
|
-
provingTimeout,
|
|
553
|
-
rawLogs,
|
|
554
|
-
log,
|
|
555
|
-
});
|
|
556
|
-
});
|
|
557
|
-
|
|
558
528
|
return program;
|
|
559
529
|
}
|
|
@@ -6,9 +6,9 @@ import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
6
6
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
7
7
|
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
8
8
|
|
|
9
|
+
import { createPublicClient, fallback, getAbiItem, getAddress, http } from '@spalladino/viem';
|
|
9
10
|
import chunk from 'lodash.chunk';
|
|
10
11
|
import groupBy from 'lodash.groupby';
|
|
11
|
-
import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
|
|
12
12
|
|
|
13
13
|
export async function proverStats(opts: {
|
|
14
14
|
l1RpcUrls: string[];
|
|
@@ -2,7 +2,7 @@ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
4
|
|
|
5
|
-
import { getContract } from 'viem';
|
|
5
|
+
import { getContract } from '@spalladino/viem';
|
|
6
6
|
|
|
7
7
|
import type { RollupCommandArgs } from './update_l1_validators.js';
|
|
8
8
|
|
|
@@ -14,8 +14,8 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
14
14
|
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
15
15
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
16
16
|
|
|
17
|
-
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
18
|
-
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
17
|
+
import { encodeFunctionData, formatEther, getContract } from '@spalladino/viem';
|
|
18
|
+
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from '@spalladino/viem/accounts';
|
|
19
19
|
|
|
20
20
|
import { addLeadingHex } from '../../utils/aztec.js';
|
|
21
21
|
|
|
@@ -96,7 +96,7 @@ export async function addL1Validator({
|
|
|
96
96
|
|
|
97
97
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
98
98
|
|
|
99
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
99
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
100
100
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
101
101
|
const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
|
|
102
102
|
|
|
@@ -172,7 +172,7 @@ export async function addL1ValidatorViaRollup({
|
|
|
172
172
|
|
|
173
173
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
174
174
|
|
|
175
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
175
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
176
176
|
|
|
177
177
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
178
178
|
to: rollupAddress.toString(),
|
|
@@ -219,7 +219,7 @@ export async function removeL1Validator({
|
|
|
219
219
|
const account = getAccount(privateKey, mnemonic);
|
|
220
220
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
221
221
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
222
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
222
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
223
223
|
|
|
224
224
|
dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
|
|
225
225
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -246,7 +246,7 @@ export async function pruneRollup({
|
|
|
246
246
|
const account = getAccount(privateKey, mnemonic);
|
|
247
247
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
248
248
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
249
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
249
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
250
250
|
|
|
251
251
|
dualLog(`Trying prune`);
|
|
252
252
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -308,7 +308,7 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: Roll
|
|
|
308
308
|
log(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
|
|
309
309
|
const archive = await rollup.archive();
|
|
310
310
|
log(`Archive: ${archive}`);
|
|
311
|
-
const epochNum = await rollup.
|
|
311
|
+
const epochNum = await rollup.getCurrentEpochNumber();
|
|
312
312
|
log(`Current epoch: ${epochNum}`);
|
|
313
313
|
const slot = await rollup.getSlotNumber();
|
|
314
314
|
log(`Current slot: ${slot}`);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
+
|
|
3
|
+
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
|
|
6
|
+
export interface CachedFetchOptions {
|
|
7
|
+
/** Cache duration in milliseconds */
|
|
8
|
+
cacheDurationMs: number;
|
|
9
|
+
/** The cache file */
|
|
10
|
+
cacheFile?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Fetches data from a URL with file-based caching support.
|
|
15
|
+
* This utility can be used by both remote config and bootnodes fetching.
|
|
16
|
+
*
|
|
17
|
+
* @param url - The URL to fetch from
|
|
18
|
+
* @param networkName - Network name for cache directory structure
|
|
19
|
+
* @param options - Caching and error handling options
|
|
20
|
+
* @param cacheDir - Optional cache directory (defaults to no caching)
|
|
21
|
+
* @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
|
|
22
|
+
*/
|
|
23
|
+
export async function cachedFetch<T = any>(
|
|
24
|
+
url: string,
|
|
25
|
+
options: CachedFetchOptions,
|
|
26
|
+
fetch = globalThis.fetch,
|
|
27
|
+
log = createLogger('cached_fetch'),
|
|
28
|
+
): Promise<T | undefined> {
|
|
29
|
+
const { cacheDurationMs, cacheFile } = options;
|
|
30
|
+
|
|
31
|
+
// Try to read from cache first
|
|
32
|
+
try {
|
|
33
|
+
if (cacheFile) {
|
|
34
|
+
const info = await stat(cacheFile);
|
|
35
|
+
if (info.mtimeMs + cacheDurationMs > Date.now()) {
|
|
36
|
+
const cachedData = JSON.parse(await readFile(cacheFile, 'utf-8'));
|
|
37
|
+
return cachedData;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
log.trace('Failed to read data from cache');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(url);
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
if (cacheFile) {
|
|
55
|
+
await mkdir(dirname(cacheFile), { recursive: true });
|
|
56
|
+
await writeFile(cacheFile, JSON.stringify(data), 'utf-8');
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
log.warn('Failed to cache data on disk: ' + cacheFile, { cacheFile, err });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return data;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
log.warn(`Failed to fetch from ${url}`, { err });
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -5,10 +5,16 @@ import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
|
5
5
|
import type { P2PConfig } from '@aztec/p2p/config';
|
|
6
6
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import path, { dirname, join } from 'path';
|
|
8
|
+
import path, { join } from 'path';
|
|
10
9
|
|
|
11
10
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
|
|
11
|
+
import { cachedFetch } from './cached_fetch.js';
|
|
12
|
+
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
13
|
+
|
|
14
|
+
const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
|
|
15
|
+
|
|
16
|
+
const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
|
|
17
|
+
const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
|
|
12
18
|
|
|
13
19
|
export type L2ChainConfig = L1ContractsConfig &
|
|
14
20
|
Pick<P2PConfig, 'txPoolDeleteTxsAfterReorg'> &
|
|
@@ -18,13 +24,10 @@ export type L2ChainConfig = L1ContractsConfig &
|
|
|
18
24
|
sponsoredFPC: boolean;
|
|
19
25
|
p2pEnabled: boolean;
|
|
20
26
|
p2pBootstrapNodes: string[];
|
|
21
|
-
registryAddress: string;
|
|
22
|
-
slashFactoryAddress: string;
|
|
23
|
-
feeAssetHandlerAddress: string;
|
|
24
27
|
seqMinTxsPerBlock: number;
|
|
25
28
|
seqMaxTxsPerBlock: number;
|
|
26
29
|
realProofs: boolean;
|
|
27
|
-
|
|
30
|
+
snapshotsUrls: string[];
|
|
28
31
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
29
32
|
autoUpdateUrl?: string;
|
|
30
33
|
maxTxPoolSize: number;
|
|
@@ -32,6 +35,14 @@ export type L2ChainConfig = L1ContractsConfig &
|
|
|
32
35
|
publicMetricsCollectorUrl?: string;
|
|
33
36
|
publicMetricsCollectFrom?: string[];
|
|
34
37
|
|
|
38
|
+
// Setting the dbMapSize provides the default for every DB in the node.
|
|
39
|
+
// Then we explicitly override the sizes for the archiver and the larger trees.
|
|
40
|
+
dbMapSizeKb: number;
|
|
41
|
+
archiverStoreMapSizeKb: number;
|
|
42
|
+
noteHashTreeMapSizeKb: number;
|
|
43
|
+
nullifierTreeMapSizeKb: number;
|
|
44
|
+
publicDataTreeMapSizeKb: number;
|
|
45
|
+
|
|
35
46
|
// Control whether sentinel is enabled or not. Needed for slashing
|
|
36
47
|
sentinelEnabled: boolean;
|
|
37
48
|
};
|
|
@@ -47,6 +58,8 @@ const DefaultSlashConfig = {
|
|
|
47
58
|
slashingOffsetInRounds: 2,
|
|
48
59
|
/** No slash vetoer */
|
|
49
60
|
slashingVetoer: EthAddress.ZERO,
|
|
61
|
+
/** Use default disable duration */
|
|
62
|
+
slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
|
|
50
63
|
/** Use default slash amounts */
|
|
51
64
|
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
52
65
|
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
@@ -63,11 +76,20 @@ const DefaultSlashConfig = {
|
|
|
63
76
|
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
64
77
|
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
65
78
|
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
66
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.
|
|
79
|
+
slashBroadcastedInvalidBlockPenalty: 0n, // DefaultL1ContractsConfig.slashAmountSmall // Disabled until further testing
|
|
67
80
|
slashMaxPayloadSize: 50,
|
|
68
81
|
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
69
82
|
slashOffenseExpirationRounds: 8,
|
|
70
83
|
sentinelEnabled: true,
|
|
84
|
+
slashExecuteRoundsLookBack: 4,
|
|
85
|
+
} satisfies Partial<L2ChainConfig>;
|
|
86
|
+
|
|
87
|
+
const DefaultNetworkDBMapSizeConfig = {
|
|
88
|
+
dbMapSizeKb: defaultDBMapSizeKb,
|
|
89
|
+
archiverStoreMapSizeKb: tbMapSizeKb,
|
|
90
|
+
noteHashTreeMapSizeKb: tbMapSizeKb,
|
|
91
|
+
nullifierTreeMapSizeKb: tbMapSizeKb,
|
|
92
|
+
publicDataTreeMapSizeKb: tbMapSizeKb,
|
|
71
93
|
} satisfies Partial<L2ChainConfig>;
|
|
72
94
|
|
|
73
95
|
export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
@@ -76,13 +98,10 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
76
98
|
sponsoredFPC: false,
|
|
77
99
|
p2pEnabled: true,
|
|
78
100
|
p2pBootstrapNodes: [],
|
|
79
|
-
registryAddress: '0x6c04b1c116ec1ea0f918e3cc91e87b0af3e23b73',
|
|
80
|
-
slashFactoryAddress: '',
|
|
81
|
-
feeAssetHandlerAddress: '',
|
|
82
101
|
seqMinTxsPerBlock: 0,
|
|
83
102
|
seqMaxTxsPerBlock: 0,
|
|
84
103
|
realProofs: true,
|
|
85
|
-
|
|
104
|
+
snapshotsUrls: [`${SNAPSHOTS_URL}/staging-ignition/`],
|
|
86
105
|
autoUpdate: 'config-and-version',
|
|
87
106
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
|
|
88
107
|
maxTxPoolSize: 100_000_000, // 100MB
|
|
@@ -99,6 +118,8 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
99
118
|
aztecEpochDuration: 32,
|
|
100
119
|
/** The target validator committee size. */
|
|
101
120
|
aztecTargetCommitteeSize: 24,
|
|
121
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
122
|
+
lagInEpochs: 2,
|
|
102
123
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
103
124
|
aztecProofSubmissionEpochs: 1,
|
|
104
125
|
/** How many sequencers must agree with a slash for it to be executed. */
|
|
@@ -107,6 +128,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
107
128
|
slashingRoundSizeInEpochs: 4,
|
|
108
129
|
slashingLifetimeInRounds: 40,
|
|
109
130
|
slashingExecutionDelayInRounds: 28,
|
|
131
|
+
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
110
132
|
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
111
133
|
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
112
134
|
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
@@ -124,6 +146,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
124
146
|
|
|
125
147
|
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
126
148
|
activationThreshold: 200_000n * 10n ** 18n,
|
|
149
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
127
150
|
|
|
128
151
|
governanceProposerRoundSize: 300, // TODO TMNT-322
|
|
129
152
|
governanceProposerQuorum: 151, // TODO TMNT-322
|
|
@@ -140,11 +163,14 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
140
163
|
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
141
164
|
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
142
165
|
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
143
|
-
slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n,
|
|
166
|
+
slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
|
|
144
167
|
slashMaxPayloadSize: 50,
|
|
145
168
|
slashGracePeriodL2Slots: 32 * 4, // One round from genesis
|
|
146
169
|
slashOffenseExpirationRounds: 8,
|
|
147
170
|
sentinelEnabled: true,
|
|
171
|
+
slashExecuteRoundsLookBack: 4,
|
|
172
|
+
|
|
173
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
148
174
|
};
|
|
149
175
|
|
|
150
176
|
export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
@@ -153,13 +179,10 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
153
179
|
sponsoredFPC: true,
|
|
154
180
|
p2pEnabled: true,
|
|
155
181
|
p2pBootstrapNodes: [],
|
|
156
|
-
registryAddress: '0x2e48addca360da61e4d6c21ff2b1961af56eb83b',
|
|
157
|
-
slashFactoryAddress: '0xe19410632fd00695bc5a08dd82044b7b26317742',
|
|
158
|
-
feeAssetHandlerAddress: '0xb46dc3d91f849999330b6dd93473fa29fc45b076',
|
|
159
182
|
seqMinTxsPerBlock: 0,
|
|
160
183
|
seqMaxTxsPerBlock: 20,
|
|
161
184
|
realProofs: true,
|
|
162
|
-
|
|
185
|
+
snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`],
|
|
163
186
|
autoUpdate: 'config-and-version',
|
|
164
187
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
|
|
165
188
|
publicIncludeMetrics,
|
|
@@ -177,6 +200,10 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
177
200
|
aztecEpochDuration: 32,
|
|
178
201
|
/** The target validator committee size. */
|
|
179
202
|
aztecTargetCommitteeSize: 48,
|
|
203
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
204
|
+
lagInEpochs: DefaultL1ContractsConfig.lagInEpochs,
|
|
205
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
206
|
+
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
180
207
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
181
208
|
aztecProofSubmissionEpochs: 1,
|
|
182
209
|
/** The deposit amount for a validator */
|
|
@@ -195,6 +222,8 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
195
222
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
196
223
|
|
|
197
224
|
...DefaultSlashConfig,
|
|
225
|
+
|
|
226
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
198
227
|
};
|
|
199
228
|
|
|
200
229
|
export const testnetL2ChainConfig: L2ChainConfig = {
|
|
@@ -203,13 +232,10 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
203
232
|
sponsoredFPC: true,
|
|
204
233
|
p2pEnabled: true,
|
|
205
234
|
p2pBootstrapNodes: [],
|
|
206
|
-
registryAddress: '0xc2f24280f5c7f4897370dfdeb30f79ded14f1c81',
|
|
207
|
-
slashFactoryAddress: '0x76291684ae928d6e5bcff348e36917f4cc532db8',
|
|
208
|
-
feeAssetHandlerAddress: '0x50513c3713ffd33301e85f30d86ab764df421fe9',
|
|
209
235
|
seqMinTxsPerBlock: 0,
|
|
210
236
|
seqMaxTxsPerBlock: 20,
|
|
211
237
|
realProofs: true,
|
|
212
|
-
|
|
238
|
+
snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
|
|
213
239
|
autoUpdate: 'config-and-version',
|
|
214
240
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
|
|
215
241
|
maxTxPoolSize: 100_000_000, // 100MB
|
|
@@ -227,12 +253,16 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
227
253
|
aztecEpochDuration: 32,
|
|
228
254
|
/** The target validator committee size. */
|
|
229
255
|
aztecTargetCommitteeSize: 48,
|
|
256
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
257
|
+
lagInEpochs: 2,
|
|
230
258
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
231
259
|
aztecProofSubmissionEpochs: 1,
|
|
232
260
|
/** The deposit amount for a validator */
|
|
233
261
|
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
234
262
|
/** The minimum stake for a validator. */
|
|
235
263
|
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
264
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
265
|
+
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
236
266
|
/** The slashing round size */
|
|
237
267
|
slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
238
268
|
/** Governance proposing round size */
|
|
@@ -248,42 +278,101 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
248
278
|
slashPrunePenalty: 0n,
|
|
249
279
|
slashDataWithholdingPenalty: 0n,
|
|
250
280
|
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
281
|
+
|
|
282
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const ignitionL2ChainConfig: L2ChainConfig = {
|
|
286
|
+
l1ChainId: 1,
|
|
287
|
+
testAccounts: false,
|
|
288
|
+
sponsoredFPC: false,
|
|
289
|
+
p2pEnabled: true,
|
|
290
|
+
p2pBootstrapNodes: [],
|
|
291
|
+
seqMinTxsPerBlock: 0,
|
|
292
|
+
seqMaxTxsPerBlock: 0,
|
|
293
|
+
realProofs: true,
|
|
294
|
+
snapshotsUrls: [`${SNAPSHOTS_URL}/ignition/`],
|
|
295
|
+
autoUpdate: 'notify',
|
|
296
|
+
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json',
|
|
297
|
+
maxTxPoolSize: 100_000_000, // 100MB
|
|
298
|
+
publicIncludeMetrics,
|
|
299
|
+
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
300
|
+
publicMetricsCollectFrom: ['sequencer'],
|
|
301
|
+
txPoolDeleteTxsAfterReorg: false,
|
|
302
|
+
|
|
303
|
+
/** How many seconds an L1 slot lasts. */
|
|
304
|
+
ethereumSlotDuration: 12,
|
|
305
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
306
|
+
aztecSlotDuration: 72,
|
|
307
|
+
/** How many L2 slots an epoch lasts. */
|
|
308
|
+
aztecEpochDuration: 32,
|
|
309
|
+
/** The target validator committee size. */
|
|
310
|
+
aztecTargetCommitteeSize: 24,
|
|
311
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
312
|
+
lagInEpochs: 2,
|
|
313
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
314
|
+
aztecProofSubmissionEpochs: 1,
|
|
315
|
+
/** How many sequencers must agree with a slash for it to be executed. */
|
|
316
|
+
slashingQuorum: 65,
|
|
317
|
+
|
|
318
|
+
slashingRoundSizeInEpochs: 4,
|
|
319
|
+
slashingLifetimeInRounds: 40,
|
|
320
|
+
slashingExecutionDelayInRounds: 28,
|
|
321
|
+
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
322
|
+
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
323
|
+
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
324
|
+
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
325
|
+
slashingOffsetInRounds: 2,
|
|
326
|
+
slasherFlavor: 'tally',
|
|
327
|
+
slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
|
|
328
|
+
|
|
329
|
+
/** The mana target for the rollup */
|
|
330
|
+
manaTarget: 0n,
|
|
331
|
+
|
|
332
|
+
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
333
|
+
|
|
334
|
+
/** The proving cost per mana */
|
|
335
|
+
provingCostPerMana: 0n,
|
|
336
|
+
|
|
337
|
+
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
338
|
+
activationThreshold: 200_000n * 10n ** 18n,
|
|
339
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
340
|
+
|
|
341
|
+
governanceProposerRoundSize: 300, // TODO TMNT-322
|
|
342
|
+
governanceProposerQuorum: 151, // TODO TMNT-322
|
|
343
|
+
|
|
344
|
+
// Node slashing config
|
|
345
|
+
// TODO TMNT-330
|
|
346
|
+
slashMinPenaltyPercentage: 0.5,
|
|
347
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
348
|
+
slashInactivityTargetPercentage: 0.7,
|
|
349
|
+
slashInactivityConsecutiveEpochThreshold: 2,
|
|
350
|
+
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
351
|
+
slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
|
|
352
|
+
slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
|
|
353
|
+
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
354
|
+
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
355
|
+
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
356
|
+
slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
|
|
357
|
+
slashMaxPayloadSize: 50,
|
|
358
|
+
slashGracePeriodL2Slots: 32 * 4, // One round from genesis
|
|
359
|
+
slashOffenseExpirationRounds: 8,
|
|
360
|
+
sentinelEnabled: true,
|
|
361
|
+
slashExecuteRoundsLookBack: 4,
|
|
362
|
+
|
|
363
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
251
364
|
};
|
|
252
365
|
|
|
253
366
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
254
367
|
|
|
255
368
|
export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
|
|
256
|
-
const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
|
|
257
|
-
try {
|
|
258
|
-
if (cacheFile) {
|
|
259
|
-
const info = await stat(cacheFile);
|
|
260
|
-
if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
|
|
261
|
-
return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
} catch {
|
|
265
|
-
// no-op. Get the remote-file
|
|
266
|
-
}
|
|
267
|
-
|
|
268
369
|
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
const json = await response.json();
|
|
276
|
-
|
|
277
|
-
try {
|
|
278
|
-
if (cacheFile) {
|
|
279
|
-
await mkdir(dirname(cacheFile), { recursive: true });
|
|
280
|
-
await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
|
|
281
|
-
}
|
|
282
|
-
} catch {
|
|
283
|
-
// no-op
|
|
284
|
-
}
|
|
370
|
+
const data = await cachedFetch(url, {
|
|
371
|
+
cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
|
|
372
|
+
cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined,
|
|
373
|
+
});
|
|
285
374
|
|
|
286
|
-
return
|
|
375
|
+
return data?.bootnodes;
|
|
287
376
|
}
|
|
288
377
|
|
|
289
378
|
export async function getL2ChainConfig(
|
|
@@ -297,6 +386,8 @@ export async function getL2ChainConfig(
|
|
|
297
386
|
config = { ...testnetL2ChainConfig };
|
|
298
387
|
} else if (networkName === 'staging-ignition') {
|
|
299
388
|
config = { ...stagingIgnitionL2ChainConfig };
|
|
389
|
+
} else if (networkName === 'ignition') {
|
|
390
|
+
config = { ...ignitionL2ChainConfig };
|
|
300
391
|
}
|
|
301
392
|
if (!config) {
|
|
302
393
|
return undefined;
|
|
@@ -309,23 +400,6 @@ export async function getL2ChainConfig(
|
|
|
309
400
|
return config;
|
|
310
401
|
}
|
|
311
402
|
|
|
312
|
-
function enrichVar(envVar: EnvVar, value: string | undefined) {
|
|
313
|
-
// Don't override
|
|
314
|
-
if (process.env[envVar] || value === undefined) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
process.env[envVar] = value;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
321
|
-
// EthAddress doesn't like being given empty strings
|
|
322
|
-
if (value === '') {
|
|
323
|
-
enrichVar(envVar, EthAddress.ZERO.toString());
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
enrichVar(envVar, value);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
403
|
function getDefaultDataDir(networkName: NetworkNames): string {
|
|
330
404
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
331
405
|
}
|
|
@@ -352,9 +426,15 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
352
426
|
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
353
427
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
354
428
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
355
|
-
enrichVar('
|
|
429
|
+
enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
|
|
356
430
|
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
357
431
|
|
|
432
|
+
enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
|
|
433
|
+
enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
|
|
434
|
+
enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
|
|
435
|
+
enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
|
|
436
|
+
enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
|
|
437
|
+
|
|
358
438
|
if (config.autoUpdate) {
|
|
359
439
|
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
360
440
|
}
|
|
@@ -375,10 +455,6 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
375
455
|
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
376
456
|
}
|
|
377
457
|
|
|
378
|
-
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
379
|
-
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
380
|
-
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
381
|
-
|
|
382
458
|
// Deployment stuff
|
|
383
459
|
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
384
460
|
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
@@ -387,6 +463,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
387
463
|
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
388
464
|
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
389
465
|
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
466
|
+
enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
|
|
390
467
|
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
391
468
|
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
392
469
|
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
+
import type { EnvVar } from '@aztec/foundation/config';
|
|
3
|
+
|
|
4
|
+
export function enrichVar(envVar: EnvVar, value: string | undefined) {
|
|
5
|
+
// Don't override
|
|
6
|
+
if (process.env[envVar] || value === undefined) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
process.env[envVar] = value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
13
|
+
// EthAddress doesn't like being given empty strings
|
|
14
|
+
enrichVar(envVar, value || EthAddress.ZERO.toString());
|
|
15
|
+
}
|
package/src/config/index.ts
CHANGED