@aztec/cli 3.0.0-nightly.20250930 → 3.0.0-nightly.20251002
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/devnet/bootstrap_network.js +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +2 -2
- 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/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 +107 -63
- 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 +84 -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 +24 -24
- package/src/cmds/devnet/bootstrap_network.ts +1 -1
- package/src/cmds/infrastructure/setup_l2_contract.ts +2 -2
- package/src/cmds/l1/deploy_l1_contracts.ts +2 -0
- package/src/cmds/l1/index.ts +2 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +128 -69
- package/src/config/enrich_env.ts +15 -0
- package/src/config/index.ts +2 -0
- package/src/config/network_config.ts +108 -0
- package/src/utils/aztec.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,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,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,OAAO,EACrB,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,
|
|
1
|
+
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,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,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,YAAY,EAAE,OAAO,EACrB,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,CAiCtC;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,UAAU,EAC3B,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,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,mBAAmB,EAAE,UAAU,CAAA;CAAE,CAAC,CA6CtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAK7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -24,7 +24,7 @@ import { encodeArgs } from './encoding.js';
|
|
|
24
24
|
* @param chainId - The chain ID of the L1 host.
|
|
25
25
|
* @param privateKey - The private key to be used in contract deployment.
|
|
26
26
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
27
|
-
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, realVerifier, createVerificationJson, debugLogger) {
|
|
27
|
+
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger) {
|
|
28
28
|
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
29
29
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
30
30
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
@@ -41,6 +41,7 @@ import { encodeArgs } from './encoding.js';
|
|
|
41
41
|
acceleratedTestDeployments,
|
|
42
42
|
feeJuicePortalInitialBalance,
|
|
43
43
|
realVerifier,
|
|
44
|
+
existingTokenAddress: existingToken,
|
|
44
45
|
...config
|
|
45
46
|
}, config, createVerificationJson);
|
|
46
47
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251002",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -70,20 +70,20 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
74
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
75
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
76
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
77
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
78
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
79
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
80
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
81
|
-
"@aztec/node-lib": "3.0.0-nightly.
|
|
82
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
83
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
84
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
85
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
86
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
73
|
+
"@aztec/accounts": "3.0.0-nightly.20251002",
|
|
74
|
+
"@aztec/archiver": "3.0.0-nightly.20251002",
|
|
75
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251002",
|
|
76
|
+
"@aztec/constants": "3.0.0-nightly.20251002",
|
|
77
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251002",
|
|
78
|
+
"@aztec/ethereum": "3.0.0-nightly.20251002",
|
|
79
|
+
"@aztec/foundation": "3.0.0-nightly.20251002",
|
|
80
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251002",
|
|
81
|
+
"@aztec/node-lib": "3.0.0-nightly.20251002",
|
|
82
|
+
"@aztec/p2p": "3.0.0-nightly.20251002",
|
|
83
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251002",
|
|
84
|
+
"@aztec/stdlib": "3.0.0-nightly.20251002",
|
|
85
|
+
"@aztec/test-wallet": "3.0.0-nightly.20251002",
|
|
86
|
+
"@aztec/world-state": "3.0.0-nightly.20251002",
|
|
87
87
|
"@iarna/toml": "^2.2.5",
|
|
88
88
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
89
89
|
"commander": "^12.1.0",
|
|
@@ -110,15 +110,15 @@
|
|
|
110
110
|
"typescript": "^5.3.3"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
114
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
115
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
116
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
117
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
118
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
119
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
120
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
121
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
113
|
+
"@aztec/accounts": "3.0.0-nightly.20251002",
|
|
114
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251002",
|
|
115
|
+
"@aztec/ethereum": "3.0.0-nightly.20251002",
|
|
116
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251002",
|
|
117
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251002",
|
|
118
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251002",
|
|
119
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251002",
|
|
120
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251002",
|
|
121
|
+
"@aztec/stdlib": "3.0.0-nightly.20251002"
|
|
122
122
|
},
|
|
123
123
|
"files": [
|
|
124
124
|
"dest",
|
|
@@ -19,13 +19,13 @@ export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, j
|
|
|
19
19
|
if (testAccounts) {
|
|
20
20
|
log('setupL2Contracts: Deploying test accounts...');
|
|
21
21
|
const initialAccountsData = await getInitialTestAccountsData();
|
|
22
|
-
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
22
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, node, initialAccountsData, waitOpts);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (json) {
|
|
26
26
|
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
27
27
|
deployedAccountManagers.forEach((a, i) => {
|
|
28
|
-
toPrint[`testAccount${i}`] = a.
|
|
28
|
+
toPrint[`testAccount${i}`] = a.address;
|
|
29
29
|
});
|
|
30
30
|
log(JSON.stringify(toPrint, null, 2));
|
|
31
31
|
}
|
|
@@ -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,
|
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
|
);
|
|
@@ -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
|
+
}
|
|
@@ -4,13 +4,17 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
4
4
|
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
5
5
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import path, { dirname, join } from 'path';
|
|
7
|
+
import path, { join } from 'path';
|
|
9
8
|
|
|
10
9
|
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
|
|
10
|
+
import { cachedFetch } from './cached_fetch.js';
|
|
11
|
+
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
11
12
|
|
|
12
13
|
const SNAPSHOT_URL = 'https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev/snapshots';
|
|
13
14
|
|
|
15
|
+
const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
|
|
16
|
+
const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
|
|
17
|
+
|
|
14
18
|
export type L2ChainConfig = L1ContractsConfig &
|
|
15
19
|
Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
|
|
16
20
|
l1ChainId: number;
|
|
@@ -18,13 +22,10 @@ export type L2ChainConfig = L1ContractsConfig &
|
|
|
18
22
|
sponsoredFPC: boolean;
|
|
19
23
|
p2pEnabled: boolean;
|
|
20
24
|
p2pBootstrapNodes: string[];
|
|
21
|
-
registryAddress: string;
|
|
22
|
-
slashFactoryAddress: string;
|
|
23
|
-
feeAssetHandlerAddress: string;
|
|
24
25
|
seqMinTxsPerBlock: number;
|
|
25
26
|
seqMaxTxsPerBlock: number;
|
|
26
27
|
realProofs: boolean;
|
|
27
|
-
|
|
28
|
+
snapshotsUrls: string[];
|
|
28
29
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
29
30
|
autoUpdateUrl?: string;
|
|
30
31
|
maxTxPoolSize: number;
|
|
@@ -32,6 +33,14 @@ export type L2ChainConfig = L1ContractsConfig &
|
|
|
32
33
|
publicMetricsCollectorUrl?: string;
|
|
33
34
|
publicMetricsCollectFrom?: string[];
|
|
34
35
|
|
|
36
|
+
// Setting the dbMapSize provides the default for every DB in the node.
|
|
37
|
+
// Then we explicitly override the sizes for the archiver and the larger trees.
|
|
38
|
+
dbMapSizeKb: number;
|
|
39
|
+
archiverStoreMapSizeKb: number;
|
|
40
|
+
noteHashTreeMapSizeKb: number;
|
|
41
|
+
nullifierTreeMapSizeKb: number;
|
|
42
|
+
publicDataTreeMapSizeKb: number;
|
|
43
|
+
|
|
35
44
|
// Control whether sentinel is enabled or not. Needed for slashing
|
|
36
45
|
sentinelEnabled: boolean;
|
|
37
46
|
};
|
|
@@ -73,19 +82,24 @@ const DefaultSlashConfig = {
|
|
|
73
82
|
slashExecuteRoundsLookBack: 4,
|
|
74
83
|
} satisfies Partial<L2ChainConfig>;
|
|
75
84
|
|
|
85
|
+
const DefaultNetworkDBMapSizeConfig = {
|
|
86
|
+
dbMapSizeKb: defaultDBMapSizeKb,
|
|
87
|
+
archiverStoreMapSizeKb: tbMapSizeKb,
|
|
88
|
+
noteHashTreeMapSizeKb: tbMapSizeKb,
|
|
89
|
+
nullifierTreeMapSizeKb: tbMapSizeKb,
|
|
90
|
+
publicDataTreeMapSizeKb: tbMapSizeKb,
|
|
91
|
+
} satisfies Partial<L2ChainConfig>;
|
|
92
|
+
|
|
76
93
|
export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
77
94
|
l1ChainId: 11155111,
|
|
78
95
|
testAccounts: false,
|
|
79
96
|
sponsoredFPC: false,
|
|
80
97
|
p2pEnabled: true,
|
|
81
98
|
p2pBootstrapNodes: [],
|
|
82
|
-
registryAddress: '0x5f85fa0f40bc4b5ccd53c9f34258aa55d25cdde8',
|
|
83
|
-
slashFactoryAddress: '0x257db2ca1471b7f76f414d2997404bfbe916c8c9',
|
|
84
|
-
feeAssetHandlerAddress: '0x67d645b0a3e053605ea861d7e8909be6669812c4',
|
|
85
99
|
seqMinTxsPerBlock: 0,
|
|
86
100
|
seqMaxTxsPerBlock: 0,
|
|
87
101
|
realProofs: true,
|
|
88
|
-
|
|
102
|
+
snapshotsUrls: [`${SNAPSHOT_URL}/staging-ignition/`],
|
|
89
103
|
autoUpdate: 'config-and-version',
|
|
90
104
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
|
|
91
105
|
maxTxPoolSize: 100_000_000, // 100MB
|
|
@@ -152,6 +166,8 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
152
166
|
sentinelEnabled: true,
|
|
153
167
|
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
154
168
|
slashExecuteRoundsLookBack: 4,
|
|
169
|
+
|
|
170
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
155
171
|
};
|
|
156
172
|
|
|
157
173
|
export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
@@ -160,13 +176,10 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
160
176
|
sponsoredFPC: true,
|
|
161
177
|
p2pEnabled: true,
|
|
162
178
|
p2pBootstrapNodes: [],
|
|
163
|
-
registryAddress: '0x2e48addca360da61e4d6c21ff2b1961af56eb83b',
|
|
164
|
-
slashFactoryAddress: '0xe19410632fd00695bc5a08dd82044b7b26317742',
|
|
165
|
-
feeAssetHandlerAddress: '0xb46dc3d91f849999330b6dd93473fa29fc45b076',
|
|
166
179
|
seqMinTxsPerBlock: 0,
|
|
167
180
|
seqMaxTxsPerBlock: 20,
|
|
168
181
|
realProofs: true,
|
|
169
|
-
|
|
182
|
+
snapshotsUrls: [`${SNAPSHOT_URL}/staging-public/`],
|
|
170
183
|
autoUpdate: 'config-and-version',
|
|
171
184
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
|
|
172
185
|
publicIncludeMetrics,
|
|
@@ -205,6 +218,8 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
205
218
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
206
219
|
|
|
207
220
|
...DefaultSlashConfig,
|
|
221
|
+
|
|
222
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
208
223
|
};
|
|
209
224
|
|
|
210
225
|
export const testnetL2ChainConfig: L2ChainConfig = {
|
|
@@ -213,13 +228,10 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
213
228
|
sponsoredFPC: true,
|
|
214
229
|
p2pEnabled: true,
|
|
215
230
|
p2pBootstrapNodes: [],
|
|
216
|
-
registryAddress: '0xcfe61b2574984326679cd15c6566fbd4a724f3b4',
|
|
217
|
-
slashFactoryAddress: '0x58dc5b14f9d3085c9106f5b8208a1026f94614f0',
|
|
218
|
-
feeAssetHandlerAddress: '0x7abdec6e68ae27c37feb6a77371382a109ec4763',
|
|
219
231
|
seqMinTxsPerBlock: 0,
|
|
220
232
|
seqMaxTxsPerBlock: 20,
|
|
221
233
|
realProofs: true,
|
|
222
|
-
|
|
234
|
+
snapshotsUrls: [`${SNAPSHOT_URL}/testnet/`],
|
|
223
235
|
autoUpdate: 'config-and-version',
|
|
224
236
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
|
|
225
237
|
maxTxPoolSize: 100_000_000, // 100MB
|
|
@@ -260,42 +272,102 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
260
272
|
...DefaultSlashConfig,
|
|
261
273
|
slashPrunePenalty: 0n,
|
|
262
274
|
slashDataWithholdingPenalty: 0n,
|
|
275
|
+
|
|
276
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const ignitionL2ChainConfig: L2ChainConfig = {
|
|
280
|
+
l1ChainId: 1,
|
|
281
|
+
testAccounts: false,
|
|
282
|
+
sponsoredFPC: false,
|
|
283
|
+
p2pEnabled: true,
|
|
284
|
+
p2pBootstrapNodes: [],
|
|
285
|
+
seqMinTxsPerBlock: 0,
|
|
286
|
+
seqMaxTxsPerBlock: 0,
|
|
287
|
+
realProofs: true,
|
|
288
|
+
snapshotsUrls: ['https://storage.googleapis.com/aztec-testnet/snapshots/ignition/'],
|
|
289
|
+
autoUpdate: 'notify',
|
|
290
|
+
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json',
|
|
291
|
+
maxTxPoolSize: 100_000_000, // 100MB
|
|
292
|
+
publicIncludeMetrics,
|
|
293
|
+
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
294
|
+
publicMetricsCollectFrom: ['sequencer'],
|
|
295
|
+
|
|
296
|
+
/** How many seconds an L1 slot lasts. */
|
|
297
|
+
ethereumSlotDuration: 12,
|
|
298
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
299
|
+
aztecSlotDuration: 72,
|
|
300
|
+
/** How many L2 slots an epoch lasts. */
|
|
301
|
+
aztecEpochDuration: 32,
|
|
302
|
+
/** The target validator committee size. */
|
|
303
|
+
aztecTargetCommitteeSize: 24,
|
|
304
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
305
|
+
aztecProofSubmissionEpochs: 1,
|
|
306
|
+
/** How many sequencers must agree with a slash for it to be executed. */
|
|
307
|
+
slashingQuorum: 65,
|
|
308
|
+
|
|
309
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
310
|
+
lagInEpochs: 2,
|
|
311
|
+
|
|
312
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
313
|
+
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
314
|
+
|
|
315
|
+
slashingRoundSizeInEpochs: 4,
|
|
316
|
+
slashingLifetimeInRounds: 40,
|
|
317
|
+
slashingExecutionDelayInRounds: 28,
|
|
318
|
+
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
319
|
+
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
320
|
+
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
321
|
+
slashingOffsetInRounds: 2,
|
|
322
|
+
slasherFlavor: 'tally',
|
|
323
|
+
slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
|
|
324
|
+
|
|
325
|
+
/** The mana target for the rollup */
|
|
326
|
+
manaTarget: 0n,
|
|
327
|
+
|
|
328
|
+
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
329
|
+
|
|
330
|
+
/** The proving cost per mana */
|
|
331
|
+
provingCostPerMana: 0n,
|
|
332
|
+
|
|
333
|
+
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
334
|
+
activationThreshold: 200_000n * 10n ** 18n,
|
|
335
|
+
|
|
336
|
+
governanceProposerRoundSize: 300, // TODO TMNT-322
|
|
337
|
+
governanceProposerQuorum: 151, // TODO TMNT-322
|
|
338
|
+
|
|
339
|
+
// Node slashing config
|
|
340
|
+
// TODO TMNT-330
|
|
341
|
+
slashMinPenaltyPercentage: 0.5,
|
|
342
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
343
|
+
slashInactivityTargetPercentage: 0.7,
|
|
344
|
+
slashInactivityConsecutiveEpochThreshold: 2,
|
|
345
|
+
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
346
|
+
slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
|
|
347
|
+
slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
|
|
348
|
+
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
349
|
+
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
350
|
+
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
351
|
+
slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
|
|
352
|
+
slashMaxPayloadSize: 50,
|
|
353
|
+
slashGracePeriodL2Slots: 32 * 4, // One round from genesis
|
|
354
|
+
slashOffenseExpirationRounds: 8,
|
|
355
|
+
sentinelEnabled: true,
|
|
356
|
+
slashExecuteRoundsLookBack: 4,
|
|
357
|
+
|
|
358
|
+
...DefaultNetworkDBMapSizeConfig,
|
|
263
359
|
};
|
|
264
360
|
|
|
265
361
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
266
362
|
|
|
267
363
|
export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
|
|
268
|
-
const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
|
|
269
|
-
try {
|
|
270
|
-
if (cacheFile) {
|
|
271
|
-
const info = await stat(cacheFile);
|
|
272
|
-
if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
|
|
273
|
-
return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} catch {
|
|
277
|
-
// no-op. Get the remote-file
|
|
278
|
-
}
|
|
279
|
-
|
|
280
364
|
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
const json = await response.json();
|
|
288
|
-
|
|
289
|
-
try {
|
|
290
|
-
if (cacheFile) {
|
|
291
|
-
await mkdir(dirname(cacheFile), { recursive: true });
|
|
292
|
-
await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
|
|
293
|
-
}
|
|
294
|
-
} catch {
|
|
295
|
-
// no-op
|
|
296
|
-
}
|
|
365
|
+
const data = await cachedFetch(url, {
|
|
366
|
+
cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
|
|
367
|
+
cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined,
|
|
368
|
+
});
|
|
297
369
|
|
|
298
|
-
return
|
|
370
|
+
return data?.bootnodes;
|
|
299
371
|
}
|
|
300
372
|
|
|
301
373
|
export async function getL2ChainConfig(
|
|
@@ -309,6 +381,8 @@ export async function getL2ChainConfig(
|
|
|
309
381
|
config = { ...testnetL2ChainConfig };
|
|
310
382
|
} else if (networkName === 'staging-ignition') {
|
|
311
383
|
config = { ...stagingIgnitionL2ChainConfig };
|
|
384
|
+
} else if (networkName === 'ignition') {
|
|
385
|
+
config = { ...ignitionL2ChainConfig };
|
|
312
386
|
}
|
|
313
387
|
if (!config) {
|
|
314
388
|
return undefined;
|
|
@@ -321,23 +395,6 @@ export async function getL2ChainConfig(
|
|
|
321
395
|
return config;
|
|
322
396
|
}
|
|
323
397
|
|
|
324
|
-
function enrichVar(envVar: EnvVar, value: string | undefined) {
|
|
325
|
-
// Don't override
|
|
326
|
-
if (process.env[envVar] || value === undefined) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
process.env[envVar] = value;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
333
|
-
// EthAddress doesn't like being given empty strings
|
|
334
|
-
if (value === '') {
|
|
335
|
-
enrichVar(envVar, EthAddress.ZERO.toString());
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
enrichVar(envVar, value);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
398
|
function getDefaultDataDir(networkName: NetworkNames): string {
|
|
342
399
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
343
400
|
}
|
|
@@ -364,9 +421,15 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
364
421
|
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
365
422
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
366
423
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
367
|
-
enrichVar('
|
|
424
|
+
enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
|
|
368
425
|
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
369
426
|
|
|
427
|
+
enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
|
|
428
|
+
enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
|
|
429
|
+
enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
|
|
430
|
+
enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
|
|
431
|
+
enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
|
|
432
|
+
|
|
370
433
|
if (config.autoUpdate) {
|
|
371
434
|
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
372
435
|
}
|
|
@@ -387,10 +450,6 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
387
450
|
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
388
451
|
}
|
|
389
452
|
|
|
390
|
-
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
391
|
-
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
392
|
-
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
393
|
-
|
|
394
453
|
// Deployment stuff
|
|
395
454
|
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
396
455
|
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.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
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type NetworkConfig, NetworkConfigMapSchema, type NetworkNames } from '@aztec/foundation/config';
|
|
2
|
+
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
|
|
6
|
+
import { cachedFetch } from './cached_fetch.js';
|
|
7
|
+
import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
8
|
+
|
|
9
|
+
const DEFAULT_CONFIG_URL =
|
|
10
|
+
'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
|
|
11
|
+
const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Fetches remote network configuration from GitHub with caching support.
|
|
15
|
+
* Uses the reusable cachedFetch utility.
|
|
16
|
+
*
|
|
17
|
+
* @param networkName - The network name to fetch config for
|
|
18
|
+
* @param cacheDir - Optional cache directory for storing fetched config
|
|
19
|
+
* @returns Remote configuration for the specified network, or undefined if not found/error
|
|
20
|
+
*/
|
|
21
|
+
export async function getNetworkConfig(
|
|
22
|
+
networkName: NetworkNames,
|
|
23
|
+
cacheDir?: string,
|
|
24
|
+
): Promise<NetworkConfig | undefined> {
|
|
25
|
+
let url: URL | undefined;
|
|
26
|
+
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
27
|
+
|
|
28
|
+
if (!configLocation) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
if (configLocation.includes('://')) {
|
|
34
|
+
url = new URL(configLocation);
|
|
35
|
+
} else {
|
|
36
|
+
url = new URL(`file://${configLocation}`);
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
/* no-op */
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!url) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
let rawConfig: any;
|
|
48
|
+
|
|
49
|
+
if (url.protocol === 'http:' || url.protocol === 'https:') {
|
|
50
|
+
rawConfig = await cachedFetch(url.href, {
|
|
51
|
+
cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
|
|
52
|
+
cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
|
|
53
|
+
});
|
|
54
|
+
} else if (url.protocol === 'file:') {
|
|
55
|
+
rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
|
|
56
|
+
} else {
|
|
57
|
+
throw new Error('Unsupported Aztec network config protocol: ' + url.href);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!rawConfig) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
|
|
65
|
+
if (networkName in networkConfigMap) {
|
|
66
|
+
return networkConfigMap[networkName];
|
|
67
|
+
} else {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Enriches environment variables with remote network configuration.
|
|
77
|
+
* This function is called before node config initialization to set env vars
|
|
78
|
+
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
79
|
+
*
|
|
80
|
+
* @param networkName - The network name to fetch remote config for
|
|
81
|
+
*/
|
|
82
|
+
export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
|
|
83
|
+
if (networkName === 'local') {
|
|
84
|
+
return; // No remote config for local development
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
|
|
88
|
+
const networkConfig = await getNetworkConfig(networkName, cacheDir);
|
|
89
|
+
|
|
90
|
+
if (!networkConfig) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
|
|
95
|
+
enrichVar('L1_CHAIN_ID', String(networkConfig.l1ChainId));
|
|
96
|
+
|
|
97
|
+
// Snapshot synch only supports a single source. Take the first
|
|
98
|
+
// See A-101 for more details
|
|
99
|
+
const firstSource = networkConfig[0];
|
|
100
|
+
if (firstSource) {
|
|
101
|
+
enrichVar('SYNC_SNAPSHOTS_URL', networkConfig.snapshots.join(','));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', networkConfig.registryAddress.toString());
|
|
105
|
+
if (networkConfig.feeAssetHandlerAddress) {
|
|
106
|
+
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', networkConfig.feeAssetHandlerAddress.toString());
|
|
107
|
+
}
|
|
108
|
+
}
|