@aztec/cli 2.0.3 → 2.1.0-rc.2
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/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/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +2 -2
- package/dest/cmds/l1/update_l1_validators.js +13 -5
- 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 +2 -1
- package/package.json +23 -23
- package/src/cmds/l1/deploy_l1_contracts.ts +2 -0
- package/src/cmds/l1/index.ts +2 -0
- package/src/cmds/l1/update_l1_validators.ts +5 -5
- 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 +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type EthAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, createVerificationJson: string | false, initialValidators: EthAddress[], realVerifier: boolean, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
3
|
+
export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, createVerificationJson: string | false, initialValidators: EthAddress[], realVerifier: boolean, existingToken: EthAddress | undefined, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=deploy_l1_contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA8DpB"}
|
|
@@ -5,7 +5,7 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
5
5
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
6
6
|
import { deployAztecContracts } from '../../utils/aztec.js';
|
|
7
7
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
8
|
-
export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, log, debugLogger) {
|
|
8
|
+
export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, existingToken, log, debugLogger) {
|
|
9
9
|
const config = getL1ContractsConfigEnvVars();
|
|
10
10
|
const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
11
11
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
@@ -16,7 +16,7 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
|
|
|
16
16
|
withdrawer: a,
|
|
17
17
|
bn254SecretKey: new SecretValue(Fr.random().toBigInt())
|
|
18
18
|
}));
|
|
19
|
-
const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidatorOperators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, realVerifier, createVerificationJson, debugLogger);
|
|
19
|
+
const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidatorOperators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger);
|
|
20
20
|
if (json) {
|
|
21
21
|
log(JSON.stringify(Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v])=>[
|
|
22
22
|
k,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAkhB/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -8,10 +8,10 @@ const l1RpcUrlsOption = new Option('--l1-rpc-urls <string>', 'List of Ethereum h
|
|
|
8
8
|
]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
|
|
9
9
|
const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
|
|
10
10
|
export function injectCommands(program, log, debugLogger) {
|
|
11
|
-
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).option('--real-verifier', 'Deploy the real verifier', false).option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false).action(async (options)=>{
|
|
11
|
+
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).option('--real-verifier', 'Deploy the real verifier', false).option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress).option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false).action(async (options)=>{
|
|
12
12
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
13
13
|
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
14
|
-
await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.acceleratedTestDeployments, options.json, options.createVerificationJson, initialValidators, options.realVerifier, log, debugLogger);
|
|
14
|
+
await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.acceleratedTestDeployments, options.json, options.createVerificationJson, initialValidators, options.realVerifier, options.existingToken, log, debugLogger);
|
|
15
15
|
});
|
|
16
16
|
program.command('deploy-new-rollup').description('Deploys a new rollup contract and adds it to the registry (if you are the owner).').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', MNEMONIC ?? 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--real-verifier', 'Deploy the real verifier', false).action(async (options)=>{
|
|
17
17
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
@@ -34,7 +34,9 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
|
|
|
34
34
|
const gseAddress = await rollup.read.getGSE();
|
|
35
35
|
const gse = new GSEContract(l1Client, gseAddress);
|
|
36
36
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
37
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client,
|
|
37
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
|
|
38
|
+
logger: debugLogger
|
|
39
|
+
});
|
|
38
40
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
39
41
|
const merkleProofArray = merkleProof.map((proof)=>addLeadingHex(proof));
|
|
40
42
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -88,7 +90,9 @@ export async function addL1ValidatorViaRollup({ rpcUrls, chainId, privateKey, mn
|
|
|
88
90
|
const gseAddress = await rollup.read.getGSE();
|
|
89
91
|
const gse = new GSEContract(l1Client, gseAddress);
|
|
90
92
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
91
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client,
|
|
93
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
|
|
94
|
+
logger: debugLogger
|
|
95
|
+
});
|
|
92
96
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
93
97
|
to: rollupAddress.toString(),
|
|
94
98
|
data: encodeFunctionData({
|
|
@@ -128,7 +132,9 @@ export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic
|
|
|
128
132
|
const account = getAccount(privateKey, mnemonic);
|
|
129
133
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
130
134
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
131
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client,
|
|
135
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
|
|
136
|
+
logger: debugLogger
|
|
137
|
+
});
|
|
132
138
|
dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
|
|
133
139
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
134
140
|
to: rollupAddress.toString(),
|
|
@@ -148,7 +154,9 @@ export async function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, roll
|
|
|
148
154
|
const account = getAccount(privateKey, mnemonic);
|
|
149
155
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
150
156
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
151
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client,
|
|
157
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
|
|
158
|
+
logger: debugLogger
|
|
159
|
+
});
|
|
152
160
|
dualLog(`Trying prune`);
|
|
153
161
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
154
162
|
to: rollupAddress.toString(),
|
|
@@ -208,7 +216,7 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }) {
|
|
|
208
216
|
log(`Committee: ${committee?.map((v)=>v.toString()).join(', ')}`);
|
|
209
217
|
const archive = await rollup.archive();
|
|
210
218
|
log(`Archive: ${archive}`);
|
|
211
|
-
const epochNum = await rollup.
|
|
219
|
+
const epochNum = await rollup.getCurrentEpochNumber();
|
|
212
220
|
log(`Current epoch: ${epochNum}`);
|
|
213
221
|
const slot = await rollup.getSlotNumber();
|
|
214
222
|
log(`Current slot: ${slot}`);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CachedFetchOptions {
|
|
2
|
+
/** Cache duration in milliseconds */
|
|
3
|
+
cacheDurationMs: number;
|
|
4
|
+
/** The cache file */
|
|
5
|
+
cacheFile?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetches data from a URL with file-based caching support.
|
|
9
|
+
* This utility can be used by both remote config and bootnodes fetching.
|
|
10
|
+
*
|
|
11
|
+
* @param url - The URL to fetch from
|
|
12
|
+
* @param networkName - Network name for cache directory structure
|
|
13
|
+
* @param options - Caching and error handling options
|
|
14
|
+
* @param cacheDir - Optional cache directory (defaults to no caching)
|
|
15
|
+
* @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
|
|
16
|
+
*/
|
|
17
|
+
export declare function cachedFetch<T = any>(url: string, options: CachedFetchOptions, fetch?: typeof globalThis.fetch, log?: import("@aztec/aztec.js").Logger): Promise<T | undefined>;
|
|
18
|
+
//# sourceMappingURL=cached_fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached_fetch.d.ts","sourceRoot":"","sources":["../../src/config/cached_fetch.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,GAAG,EACvC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,EAC3B,KAAK,0BAAmB,EACxB,GAAG,mCAA+B,GACjC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAuCxB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
+
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
3
|
+
import { dirname } from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Fetches data from a URL with file-based caching support.
|
|
6
|
+
* This utility can be used by both remote config and bootnodes fetching.
|
|
7
|
+
*
|
|
8
|
+
* @param url - The URL to fetch from
|
|
9
|
+
* @param networkName - Network name for cache directory structure
|
|
10
|
+
* @param options - Caching and error handling options
|
|
11
|
+
* @param cacheDir - Optional cache directory (defaults to no caching)
|
|
12
|
+
* @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
|
|
13
|
+
*/ export async function cachedFetch(url, options, fetch = globalThis.fetch, log = createLogger('cached_fetch')) {
|
|
14
|
+
const { cacheDurationMs, cacheFile } = options;
|
|
15
|
+
// Try to read from cache first
|
|
16
|
+
try {
|
|
17
|
+
if (cacheFile) {
|
|
18
|
+
const info = await stat(cacheFile);
|
|
19
|
+
if (info.mtimeMs + cacheDurationMs > Date.now()) {
|
|
20
|
+
const cachedData = JSON.parse(await readFile(cacheFile, 'utf-8'));
|
|
21
|
+
return cachedData;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} catch {
|
|
25
|
+
log.trace('Failed to read data from cache');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(url);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const data = await response.json();
|
|
34
|
+
try {
|
|
35
|
+
if (cacheFile) {
|
|
36
|
+
await mkdir(dirname(cacheFile), {
|
|
37
|
+
recursive: true
|
|
38
|
+
});
|
|
39
|
+
await writeFile(cacheFile, JSON.stringify(data), 'utf-8');
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
log.warn('Failed to cache data on disk: ' + cacheFile, {
|
|
43
|
+
cacheFile,
|
|
44
|
+
err
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return data;
|
|
48
|
+
} catch (err) {
|
|
49
|
+
log.warn(`Failed to fetch from ${url}`, {
|
|
50
|
+
err
|
|
51
|
+
});
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -9,24 +9,27 @@ export type L2ChainConfig = L1ContractsConfig & Pick<P2PConfig, 'txPoolDeleteTxs
|
|
|
9
9
|
sponsoredFPC: boolean;
|
|
10
10
|
p2pEnabled: boolean;
|
|
11
11
|
p2pBootstrapNodes: string[];
|
|
12
|
-
registryAddress: string;
|
|
13
|
-
slashFactoryAddress: string;
|
|
14
|
-
feeAssetHandlerAddress: string;
|
|
15
12
|
seqMinTxsPerBlock: number;
|
|
16
13
|
seqMaxTxsPerBlock: number;
|
|
17
14
|
realProofs: boolean;
|
|
18
|
-
|
|
15
|
+
snapshotsUrls: string[];
|
|
19
16
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
20
17
|
autoUpdateUrl?: string;
|
|
21
18
|
maxTxPoolSize: number;
|
|
22
19
|
publicIncludeMetrics?: string[];
|
|
23
20
|
publicMetricsCollectorUrl?: string;
|
|
24
21
|
publicMetricsCollectFrom?: string[];
|
|
22
|
+
dbMapSizeKb: number;
|
|
23
|
+
archiverStoreMapSizeKb: number;
|
|
24
|
+
noteHashTreeMapSizeKb: number;
|
|
25
|
+
nullifierTreeMapSizeKb: number;
|
|
26
|
+
publicDataTreeMapSizeKb: number;
|
|
25
27
|
sentinelEnabled: boolean;
|
|
26
28
|
};
|
|
27
29
|
export declare const stagingIgnitionL2ChainConfig: L2ChainConfig;
|
|
28
30
|
export declare const stagingPublicL2ChainConfig: L2ChainConfig;
|
|
29
31
|
export declare const testnetL2ChainConfig: L2ChainConfig;
|
|
32
|
+
export declare const ignitionL2ChainConfig: L2ChainConfig;
|
|
30
33
|
export declare function getBootnodes(networkName: NetworkNames, cacheDir?: string): Promise<any>;
|
|
31
34
|
export declare function getL2ChainConfig(networkName: NetworkNames, cacheDir?: string): Promise<L2ChainConfig | undefined>;
|
|
32
35
|
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAarE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,GAC5C,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,uBAAuB,CAAC,GAAG;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAIpC,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAGhC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA+CJ,eAAO,MAAM,4BAA4B,EAAE,aA+E1C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAmDxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAsDlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aA+EnC,CAAC;AAIF,wBAAsB,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,MAAM,gBAQ9E;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAoBpC;AAMD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA4F/E"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import
|
|
4
|
-
import path, { dirname, join } from 'path';
|
|
3
|
+
import path, { join } from 'path';
|
|
5
4
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
|
|
6
5
|
type: 'json'
|
|
7
6
|
};
|
|
7
|
+
import { cachedFetch } from './cached_fetch.js';
|
|
8
|
+
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
9
|
+
const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
|
|
10
|
+
const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
|
|
11
|
+
const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
|
|
8
12
|
const DefaultSlashConfig = {
|
|
9
13
|
/** Tally-style slashing */ slasherFlavor: 'tally',
|
|
10
14
|
/** Allow one round for vetoing */ slashingExecutionDelayInRounds: 1,
|
|
11
15
|
/** How long for a slash payload to be executed */ slashingLifetimeInRounds: 5,
|
|
12
16
|
/** Allow 2 rounds to discover faults */ slashingOffsetInRounds: 2,
|
|
13
17
|
/** No slash vetoer */ slashingVetoer: EthAddress.ZERO,
|
|
18
|
+
/** Use default disable duration */ slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
|
|
14
19
|
/** Use default slash amounts */ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
15
20
|
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
16
21
|
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
@@ -25,11 +30,19 @@ const DefaultSlashConfig = {
|
|
|
25
30
|
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
26
31
|
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
27
32
|
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
28
|
-
slashBroadcastedInvalidBlockPenalty:
|
|
33
|
+
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
29
34
|
slashMaxPayloadSize: 50,
|
|
30
35
|
slashGracePeriodL2Slots: 32 * 2,
|
|
31
36
|
slashOffenseExpirationRounds: 8,
|
|
32
|
-
sentinelEnabled: true
|
|
37
|
+
sentinelEnabled: true,
|
|
38
|
+
slashExecuteRoundsLookBack: 4
|
|
39
|
+
};
|
|
40
|
+
const DefaultNetworkDBMapSizeConfig = {
|
|
41
|
+
dbMapSizeKb: defaultDBMapSizeKb,
|
|
42
|
+
archiverStoreMapSizeKb: tbMapSizeKb,
|
|
43
|
+
noteHashTreeMapSizeKb: tbMapSizeKb,
|
|
44
|
+
nullifierTreeMapSizeKb: tbMapSizeKb,
|
|
45
|
+
publicDataTreeMapSizeKb: tbMapSizeKb
|
|
33
46
|
};
|
|
34
47
|
export const stagingIgnitionL2ChainConfig = {
|
|
35
48
|
l1ChainId: 11155111,
|
|
@@ -37,13 +50,12 @@ export const stagingIgnitionL2ChainConfig = {
|
|
|
37
50
|
sponsoredFPC: false,
|
|
38
51
|
p2pEnabled: true,
|
|
39
52
|
p2pBootstrapNodes: [],
|
|
40
|
-
registryAddress: '0x6c04b1c116ec1ea0f918e3cc91e87b0af3e23b73',
|
|
41
|
-
slashFactoryAddress: '',
|
|
42
|
-
feeAssetHandlerAddress: '',
|
|
43
53
|
seqMinTxsPerBlock: 0,
|
|
44
54
|
seqMaxTxsPerBlock: 0,
|
|
45
55
|
realProofs: true,
|
|
46
|
-
|
|
56
|
+
snapshotsUrls: [
|
|
57
|
+
`${SNAPSHOTS_URL}/staging-ignition/`
|
|
58
|
+
],
|
|
47
59
|
autoUpdate: 'config-and-version',
|
|
48
60
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
|
|
49
61
|
maxTxPoolSize: 100_000_000,
|
|
@@ -57,11 +69,13 @@ export const stagingIgnitionL2ChainConfig = {
|
|
|
57
69
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 72,
|
|
58
70
|
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
59
71
|
/** The target validator committee size. */ aztecTargetCommitteeSize: 24,
|
|
72
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
60
73
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
61
74
|
/** How many sequencers must agree with a slash for it to be executed. */ slashingQuorum: 65,
|
|
62
75
|
slashingRoundSizeInEpochs: 4,
|
|
63
76
|
slashingLifetimeInRounds: 40,
|
|
64
77
|
slashingExecutionDelayInRounds: 28,
|
|
78
|
+
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
65
79
|
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
66
80
|
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
67
81
|
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
@@ -73,6 +87,7 @@ export const stagingIgnitionL2ChainConfig = {
|
|
|
73
87
|
/** The proving cost per mana */ provingCostPerMana: 0n,
|
|
74
88
|
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
75
89
|
activationThreshold: 200_000n * 10n ** 18n,
|
|
90
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
76
91
|
governanceProposerRoundSize: 300,
|
|
77
92
|
governanceProposerQuorum: 151,
|
|
78
93
|
// Node slashing config
|
|
@@ -87,11 +102,13 @@ export const stagingIgnitionL2ChainConfig = {
|
|
|
87
102
|
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
88
103
|
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
89
104
|
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
90
|
-
slashBroadcastedInvalidBlockPenalty:
|
|
105
|
+
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
91
106
|
slashMaxPayloadSize: 50,
|
|
92
107
|
slashGracePeriodL2Slots: 32 * 4,
|
|
93
108
|
slashOffenseExpirationRounds: 8,
|
|
94
|
-
sentinelEnabled: true
|
|
109
|
+
sentinelEnabled: true,
|
|
110
|
+
slashExecuteRoundsLookBack: 4,
|
|
111
|
+
...DefaultNetworkDBMapSizeConfig
|
|
95
112
|
};
|
|
96
113
|
export const stagingPublicL2ChainConfig = {
|
|
97
114
|
l1ChainId: 11155111,
|
|
@@ -99,13 +116,12 @@ export const stagingPublicL2ChainConfig = {
|
|
|
99
116
|
sponsoredFPC: true,
|
|
100
117
|
p2pEnabled: true,
|
|
101
118
|
p2pBootstrapNodes: [],
|
|
102
|
-
registryAddress: '0x2e48addca360da61e4d6c21ff2b1961af56eb83b',
|
|
103
|
-
slashFactoryAddress: '0xe19410632fd00695bc5a08dd82044b7b26317742',
|
|
104
|
-
feeAssetHandlerAddress: '0xb46dc3d91f849999330b6dd93473fa29fc45b076',
|
|
105
119
|
seqMinTxsPerBlock: 0,
|
|
106
120
|
seqMaxTxsPerBlock: 20,
|
|
107
121
|
realProofs: true,
|
|
108
|
-
|
|
122
|
+
snapshotsUrls: [
|
|
123
|
+
`${SNAPSHOTS_URL}/staging-public/`
|
|
124
|
+
],
|
|
109
125
|
autoUpdate: 'config-and-version',
|
|
110
126
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
|
|
111
127
|
publicIncludeMetrics,
|
|
@@ -120,6 +136,8 @@ export const stagingPublicL2ChainConfig = {
|
|
|
120
136
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
121
137
|
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
122
138
|
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
139
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: DefaultL1ContractsConfig.lagInEpochs,
|
|
140
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
123
141
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
124
142
|
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
125
143
|
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
@@ -128,7 +146,8 @@ export const stagingPublicL2ChainConfig = {
|
|
|
128
146
|
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
129
147
|
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
130
148
|
/** Exit delay for stakers */ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
131
|
-
...DefaultSlashConfig
|
|
149
|
+
...DefaultSlashConfig,
|
|
150
|
+
...DefaultNetworkDBMapSizeConfig
|
|
132
151
|
};
|
|
133
152
|
export const testnetL2ChainConfig = {
|
|
134
153
|
l1ChainId: 11155111,
|
|
@@ -136,13 +155,12 @@ export const testnetL2ChainConfig = {
|
|
|
136
155
|
sponsoredFPC: true,
|
|
137
156
|
p2pEnabled: true,
|
|
138
157
|
p2pBootstrapNodes: [],
|
|
139
|
-
registryAddress: '0xc2f24280f5c7f4897370dfdeb30f79ded14f1c81',
|
|
140
|
-
slashFactoryAddress: '0x76291684ae928d6e5bcff348e36917f4cc532db8',
|
|
141
|
-
feeAssetHandlerAddress: '0x50513c3713ffd33301e85f30d86ab764df421fe9',
|
|
142
158
|
seqMinTxsPerBlock: 0,
|
|
143
159
|
seqMaxTxsPerBlock: 20,
|
|
144
160
|
realProofs: true,
|
|
145
|
-
|
|
161
|
+
snapshotsUrls: [
|
|
162
|
+
`${SNAPSHOTS_URL}/testnet/`
|
|
163
|
+
],
|
|
146
164
|
autoUpdate: 'config-and-version',
|
|
147
165
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
|
|
148
166
|
maxTxPoolSize: 100_000_000,
|
|
@@ -157,9 +175,11 @@ export const testnetL2ChainConfig = {
|
|
|
157
175
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
158
176
|
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
159
177
|
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
178
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
160
179
|
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
161
180
|
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
162
181
|
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
182
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
163
183
|
/** The slashing round size */ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
164
184
|
/** Governance proposing round size */ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
|
|
165
185
|
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
@@ -168,38 +188,83 @@ export const testnetL2ChainConfig = {
|
|
|
168
188
|
...DefaultSlashConfig,
|
|
169
189
|
slashPrunePenalty: 0n,
|
|
170
190
|
slashDataWithholdingPenalty: 0n,
|
|
171
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium
|
|
191
|
+
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
192
|
+
...DefaultNetworkDBMapSizeConfig
|
|
193
|
+
};
|
|
194
|
+
export const ignitionL2ChainConfig = {
|
|
195
|
+
l1ChainId: 1,
|
|
196
|
+
testAccounts: false,
|
|
197
|
+
sponsoredFPC: false,
|
|
198
|
+
p2pEnabled: true,
|
|
199
|
+
p2pBootstrapNodes: [],
|
|
200
|
+
seqMinTxsPerBlock: 0,
|
|
201
|
+
seqMaxTxsPerBlock: 0,
|
|
202
|
+
realProofs: true,
|
|
203
|
+
snapshotsUrls: [
|
|
204
|
+
`${SNAPSHOTS_URL}/ignition/`
|
|
205
|
+
],
|
|
206
|
+
autoUpdate: 'notify',
|
|
207
|
+
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json',
|
|
208
|
+
maxTxPoolSize: 100_000_000,
|
|
209
|
+
publicIncludeMetrics,
|
|
210
|
+
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
211
|
+
publicMetricsCollectFrom: [
|
|
212
|
+
'sequencer'
|
|
213
|
+
],
|
|
214
|
+
txPoolDeleteTxsAfterReorg: false,
|
|
215
|
+
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
216
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 72,
|
|
217
|
+
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
218
|
+
/** The target validator committee size. */ aztecTargetCommitteeSize: 24,
|
|
219
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
220
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
221
|
+
/** How many sequencers must agree with a slash for it to be executed. */ slashingQuorum: 65,
|
|
222
|
+
slashingRoundSizeInEpochs: 4,
|
|
223
|
+
slashingLifetimeInRounds: 40,
|
|
224
|
+
slashingExecutionDelayInRounds: 28,
|
|
225
|
+
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
226
|
+
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
227
|
+
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
228
|
+
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
229
|
+
slashingOffsetInRounds: 2,
|
|
230
|
+
slasherFlavor: 'tally',
|
|
231
|
+
slashingVetoer: EthAddress.ZERO,
|
|
232
|
+
/** The mana target for the rollup */ manaTarget: 0n,
|
|
233
|
+
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
234
|
+
/** The proving cost per mana */ provingCostPerMana: 0n,
|
|
235
|
+
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
236
|
+
activationThreshold: 200_000n * 10n ** 18n,
|
|
237
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
238
|
+
governanceProposerRoundSize: 300,
|
|
239
|
+
governanceProposerQuorum: 151,
|
|
240
|
+
// Node slashing config
|
|
241
|
+
// TODO TMNT-330
|
|
242
|
+
slashMinPenaltyPercentage: 0.5,
|
|
243
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
244
|
+
slashInactivityTargetPercentage: 0.7,
|
|
245
|
+
slashInactivityConsecutiveEpochThreshold: 2,
|
|
246
|
+
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
247
|
+
slashPrunePenalty: 0n,
|
|
248
|
+
slashDataWithholdingPenalty: 0n,
|
|
249
|
+
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
250
|
+
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
251
|
+
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
252
|
+
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
253
|
+
slashMaxPayloadSize: 50,
|
|
254
|
+
slashGracePeriodL2Slots: 32 * 4,
|
|
255
|
+
slashOffenseExpirationRounds: 8,
|
|
256
|
+
sentinelEnabled: true,
|
|
257
|
+
slashExecuteRoundsLookBack: 4,
|
|
258
|
+
...DefaultNetworkDBMapSizeConfig
|
|
172
259
|
};
|
|
173
260
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
174
261
|
export async function getBootnodes(networkName, cacheDir) {
|
|
175
|
-
const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
|
|
176
|
-
try {
|
|
177
|
-
if (cacheFile) {
|
|
178
|
-
const info = await stat(cacheFile);
|
|
179
|
-
if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
|
|
180
|
-
return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} catch {
|
|
184
|
-
// no-op. Get the remote-file
|
|
185
|
-
}
|
|
186
262
|
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
try {
|
|
193
|
-
if (cacheFile) {
|
|
194
|
-
await mkdir(dirname(cacheFile), {
|
|
195
|
-
recursive: true
|
|
196
|
-
});
|
|
197
|
-
await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
|
|
198
|
-
}
|
|
199
|
-
} catch {
|
|
200
|
-
// no-op
|
|
201
|
-
}
|
|
202
|
-
return json['bootnodes'];
|
|
263
|
+
const data = await cachedFetch(url, {
|
|
264
|
+
cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
|
|
265
|
+
cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined
|
|
266
|
+
});
|
|
267
|
+
return data?.bootnodes;
|
|
203
268
|
}
|
|
204
269
|
export async function getL2ChainConfig(networkName, cacheDir) {
|
|
205
270
|
let config;
|
|
@@ -215,6 +280,10 @@ export async function getL2ChainConfig(networkName, cacheDir) {
|
|
|
215
280
|
config = {
|
|
216
281
|
...stagingIgnitionL2ChainConfig
|
|
217
282
|
};
|
|
283
|
+
} else if (networkName === 'ignition') {
|
|
284
|
+
config = {
|
|
285
|
+
...ignitionL2ChainConfig
|
|
286
|
+
};
|
|
218
287
|
}
|
|
219
288
|
if (!config) {
|
|
220
289
|
return undefined;
|
|
@@ -226,21 +295,6 @@ export async function getL2ChainConfig(networkName, cacheDir) {
|
|
|
226
295
|
}
|
|
227
296
|
return config;
|
|
228
297
|
}
|
|
229
|
-
function enrichVar(envVar, value) {
|
|
230
|
-
// Don't override
|
|
231
|
-
if (process.env[envVar] || value === undefined) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
process.env[envVar] = value;
|
|
235
|
-
}
|
|
236
|
-
function enrichEthAddressVar(envVar, value) {
|
|
237
|
-
// EthAddress doesn't like being given empty strings
|
|
238
|
-
if (value === '') {
|
|
239
|
-
enrichVar(envVar, EthAddress.ZERO.toString());
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
enrichVar(envVar, value);
|
|
243
|
-
}
|
|
244
298
|
function getDefaultDataDir(networkName) {
|
|
245
299
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
246
300
|
}
|
|
@@ -263,8 +317,13 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
263
317
|
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
264
318
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
265
319
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
266
|
-
enrichVar('
|
|
320
|
+
enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
|
|
267
321
|
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
322
|
+
enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
|
|
323
|
+
enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
|
|
324
|
+
enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
|
|
325
|
+
enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
|
|
326
|
+
enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
|
|
268
327
|
if (config.autoUpdate) {
|
|
269
328
|
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
270
329
|
}
|
|
@@ -280,9 +339,6 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
280
339
|
if (config.publicMetricsCollectFrom) {
|
|
281
340
|
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
282
341
|
}
|
|
283
|
-
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
284
|
-
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
285
|
-
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
286
342
|
// Deployment stuff
|
|
287
343
|
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
288
344
|
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
@@ -291,6 +347,7 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
291
347
|
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
292
348
|
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
293
349
|
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
350
|
+
enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
|
|
294
351
|
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
295
352
|
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
296
353
|
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrich_env.d.ts","sourceRoot":"","sources":["../../src/config/enrich_env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,QAMlE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAGhE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
+
export function enrichVar(envVar, value) {
|
|
3
|
+
// Don't override
|
|
4
|
+
if (process.env[envVar] || value === undefined) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
process.env[envVar] = value;
|
|
8
|
+
}
|
|
9
|
+
export function enrichEthAddressVar(envVar, value) {
|
|
10
|
+
// EthAddress doesn't like being given empty strings
|
|
11
|
+
enrichVar(envVar, value || EthAddress.ZERO.toString());
|
|
12
|
+
}
|
package/dest/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
package/dest/config/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type NetworkConfig, type NetworkNames } from '@aztec/foundation/config';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches remote network configuration from GitHub with caching support.
|
|
4
|
+
* Uses the reusable cachedFetch utility.
|
|
5
|
+
*
|
|
6
|
+
* @param networkName - The network name to fetch config for
|
|
7
|
+
* @param cacheDir - Optional cache directory for storing fetched config
|
|
8
|
+
* @returns Remote configuration for the specified network, or undefined if not found/error
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: string): Promise<NetworkConfig | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Enriches environment variables with remote network configuration.
|
|
13
|
+
* This function is called before node config initialization to set env vars
|
|
14
|
+
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
15
|
+
*
|
|
16
|
+
* @param networkName - The network name to fetch remote config for
|
|
17
|
+
*/
|
|
18
|
+
export declare function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=network_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network_config.d.ts","sourceRoot":"","sources":["../../src/config/network_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAA0B,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYzG;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAiDpC;AAED;;;;;;GAMG;AACH,wBAAsB,kCAAkC,CAAC,WAAW,EAAE,YAAY,iBAoBjF"}
|