@aztec/cli 0.0.1-fake-ceab37513c → 0.0.1-private.d0bedffd
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/README.md +2 -428
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +7 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +3 -8
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +4 -10
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +3 -3
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +7 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +3 -5
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +15 -7
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +11 -25
- package/dest/cmds/l1/advance_epoch.d.ts +2 -2
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +6 -5
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +8 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +3 -2
- package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
- package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
- package/dest/cmds/l1/compute_genesis_values.js +17 -0
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
- package/dest/cmds/l1/{deploy_l1_contracts.js → deploy_l1_contracts_cmd.js} +42 -7
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +5 -5
- package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +5 -2
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +3 -1
- package/dest/cmds/l1/index.d.ts +1 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +20 -13
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +32 -30
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +7 -7
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +62 -22
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +134 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +210 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +20 -11
- package/dest/config/cached_fetch.d.ts.map +1 -1
- package/dest/config/cached_fetch.js +111 -33
- package/dest/config/chain_l2_config.d.ts +13 -37
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +34 -363
- package/dest/config/enrich_env.d.ts +1 -1
- package/dest/config/enrich_env.js +1 -1
- package/dest/config/generated/networks.d.ts +222 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +223 -0
- package/dest/config/get_l1_config.d.ts +3 -2
- package/dest/config/get_l1_config.d.ts.map +1 -1
- package/dest/config/get_l1_config.js +3 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/network_config.d.ts +7 -4
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +67 -30
- package/dest/utils/aztec.d.ts +8 -20
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +22 -68
- package/dest/utils/commands.d.ts +21 -12
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +38 -11
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +17 -96
- package/dest/utils/setup_contracts.d.ts +2 -4
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +2 -22
- package/package.json +48 -30
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +11 -0
- package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +7 -18
- package/src/cmds/infrastructure/sequencers.ts +13 -11
- package/src/cmds/infrastructure/setup_l2_contract.ts +14 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -9
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/compute_genesis_values.ts +29 -0
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +43 -25
- package/src/cmds/l1/deploy_new_rollup.ts +6 -11
- package/src/cmds/l1/get_l1_addresses.ts +5 -3
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +34 -25
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +56 -34
- package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/index.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/cached_fetch.ts +120 -32
- package/src/config/chain_l2_config.ts +36 -470
- package/src/config/enrich_env.ts +1 -1
- package/src/config/generated/networks.ts +227 -0
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +77 -31
- package/src/utils/aztec.ts +27 -122
- package/src/utils/commands.ts +52 -15
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +23 -112
- package/src/utils/setup_contracts.ts +4 -43
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
|
@@ -1,50 +1,105 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
-
import { mkdir, readFile,
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'fs/promises';
|
|
3
3
|
import { dirname } from 'path';
|
|
4
|
+
const DEFAULT_MAX_AGE_MS = 5 * 60 * 1000; // 5 minutes
|
|
5
|
+
/** Extracts max-age value in milliseconds from a Response's Cache-Control header. Returns undefined if not present. */ export function parseMaxAge(response) {
|
|
6
|
+
const cacheControl = response.headers.get('cache-control');
|
|
7
|
+
if (!cacheControl) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const match = cacheControl.match(/max-age=(\d+)/);
|
|
11
|
+
if (!match) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return parseInt(match[1], 10) * 1000;
|
|
15
|
+
}
|
|
4
16
|
/**
|
|
5
|
-
* Fetches data from a URL with file-based caching
|
|
6
|
-
*
|
|
17
|
+
* Fetches data from a URL with file-based HTTP conditional caching.
|
|
18
|
+
*
|
|
19
|
+
* Data is stored as raw JSON in the cache file (same format as the server returns).
|
|
20
|
+
* Caching metadata (ETag, expiry) is stored in a separate sidecar `.meta` file.
|
|
21
|
+
* This keeps the data file human-readable and backward-compatible with older code.
|
|
7
22
|
*
|
|
8
23
|
* @param url - The URL to fetch from
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @returns The fetched and parsed JSON data, or undefined if fetch fails
|
|
24
|
+
* @param options - Caching options
|
|
25
|
+
* @param fetch - Fetch implementation (defaults to globalThis.fetch)
|
|
26
|
+
* @param log - Logger instance
|
|
27
|
+
* @returns The fetched and parsed JSON data, or undefined if fetch fails
|
|
13
28
|
*/ export async function cachedFetch(url, options, fetch = globalThis.fetch, log = createLogger('cached_fetch')) {
|
|
14
|
-
const {
|
|
15
|
-
//
|
|
29
|
+
const { cacheFile, defaultMaxAgeMs = DEFAULT_MAX_AGE_MS } = options;
|
|
30
|
+
// If no cacheFile, just fetch normally without caching
|
|
31
|
+
if (!cacheFile) {
|
|
32
|
+
return fetchAndParse(url, fetch, log);
|
|
33
|
+
}
|
|
34
|
+
const metaFile = cacheFile + '.meta';
|
|
35
|
+
// Try to read metadata
|
|
36
|
+
let meta;
|
|
16
37
|
try {
|
|
17
|
-
|
|
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
|
-
}
|
|
38
|
+
meta = JSON.parse(await readFile(metaFile, 'utf-8'));
|
|
24
39
|
} catch {
|
|
25
|
-
log.trace('
|
|
40
|
+
log.trace('No usable cache metadata found');
|
|
26
41
|
}
|
|
42
|
+
// Try to read cached data
|
|
43
|
+
let cachedData;
|
|
27
44
|
try {
|
|
28
|
-
|
|
45
|
+
cachedData = JSON.parse(await readFile(cacheFile, 'utf-8'));
|
|
46
|
+
} catch {
|
|
47
|
+
log.trace('No usable cached data found');
|
|
48
|
+
}
|
|
49
|
+
// If metadata and data exist and cache is fresh, return directly
|
|
50
|
+
if (meta && cachedData !== undefined && meta.expiresAt > Date.now()) {
|
|
51
|
+
return cachedData;
|
|
52
|
+
}
|
|
53
|
+
// Cache is stale or missing — make a (possibly conditional) request
|
|
54
|
+
try {
|
|
55
|
+
const headers = {};
|
|
56
|
+
if (meta?.etag && cachedData !== undefined) {
|
|
57
|
+
headers['If-None-Match'] = meta.etag;
|
|
58
|
+
}
|
|
59
|
+
const response = await fetch(url, {
|
|
60
|
+
headers
|
|
61
|
+
});
|
|
62
|
+
if (response.status === 304 && cachedData !== undefined) {
|
|
63
|
+
// Not modified — recompute expiry from new response headers and return cached data
|
|
64
|
+
const maxAgeMs = parseMaxAge(response) ?? defaultMaxAgeMs;
|
|
65
|
+
await writeMetaFile(metaFile, {
|
|
66
|
+
etag: meta?.etag,
|
|
67
|
+
expiresAt: Date.now() + maxAgeMs
|
|
68
|
+
}, log);
|
|
69
|
+
return cachedData;
|
|
70
|
+
}
|
|
29
71
|
if (!response.ok) {
|
|
30
72
|
log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
|
|
31
|
-
return
|
|
73
|
+
return cachedData;
|
|
32
74
|
}
|
|
75
|
+
// 200 — parse new data and cache it
|
|
33
76
|
const data = await response.json();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
err
|
|
45
|
-
});
|
|
46
|
-
}
|
|
77
|
+
const maxAgeMs = parseMaxAge(response) ?? defaultMaxAgeMs;
|
|
78
|
+
const etag = response.headers.get('etag') ?? undefined;
|
|
79
|
+
await ensureDir(cacheFile, log);
|
|
80
|
+
await Promise.all([
|
|
81
|
+
writeFile(cacheFile, JSON.stringify(data), 'utf-8'),
|
|
82
|
+
writeFile(metaFile, JSON.stringify({
|
|
83
|
+
etag,
|
|
84
|
+
expiresAt: Date.now() + maxAgeMs
|
|
85
|
+
}), 'utf-8')
|
|
86
|
+
]);
|
|
47
87
|
return data;
|
|
88
|
+
} catch (err) {
|
|
89
|
+
log.warn(`Failed to fetch from ${url}`, {
|
|
90
|
+
err
|
|
91
|
+
});
|
|
92
|
+
return cachedData;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function fetchAndParse(url, fetch, log) {
|
|
96
|
+
try {
|
|
97
|
+
const response = await fetch(url);
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return await response.json();
|
|
48
103
|
} catch (err) {
|
|
49
104
|
log.warn(`Failed to fetch from ${url}`, {
|
|
50
105
|
err
|
|
@@ -52,3 +107,26 @@ import { dirname } from 'path';
|
|
|
52
107
|
return undefined;
|
|
53
108
|
}
|
|
54
109
|
}
|
|
110
|
+
async function ensureDir(filePath, log) {
|
|
111
|
+
try {
|
|
112
|
+
await mkdir(dirname(filePath), {
|
|
113
|
+
recursive: true
|
|
114
|
+
});
|
|
115
|
+
} catch (err) {
|
|
116
|
+
log.warn('Failed to create cache directory for: ' + filePath, {
|
|
117
|
+
err
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function writeMetaFile(metaFile, meta, log) {
|
|
122
|
+
try {
|
|
123
|
+
await mkdir(dirname(metaFile), {
|
|
124
|
+
recursive: true
|
|
125
|
+
});
|
|
126
|
+
await writeFile(metaFile, JSON.stringify(meta), 'utf-8');
|
|
127
|
+
} catch (err) {
|
|
128
|
+
log.warn('Failed to write cache metadata: ' + metaFile, {
|
|
129
|
+
err
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
import { type L1ContractsConfig } from '@aztec/ethereum';
|
|
2
1
|
import type { NetworkNames } from '@aztec/foundation/config';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
17
|
-
autoUpdateUrl?: string;
|
|
18
|
-
maxTxPoolSize: number;
|
|
19
|
-
publicIncludeMetrics?: string[];
|
|
20
|
-
publicMetricsCollectorUrl?: string;
|
|
21
|
-
publicMetricsCollectFrom?: string[];
|
|
22
|
-
skipArchiverInitialSync?: boolean;
|
|
23
|
-
blobAllowEmptySources?: boolean;
|
|
24
|
-
dbMapSizeKb: number;
|
|
25
|
-
archiverStoreMapSizeKb: number;
|
|
26
|
-
noteHashTreeMapSizeKb: number;
|
|
27
|
-
nullifierTreeMapSizeKb: number;
|
|
28
|
-
publicDataTreeMapSizeKb: number;
|
|
29
|
-
sentinelEnabled: boolean;
|
|
30
|
-
disableTransactions: boolean;
|
|
31
|
-
};
|
|
32
|
-
export declare const stagingIgnitionL2ChainConfig: L2ChainConfig;
|
|
33
|
-
export declare const stagingPublicL2ChainConfig: L2ChainConfig;
|
|
34
|
-
export declare const testnetL2ChainConfig: L2ChainConfig;
|
|
35
|
-
export declare const mainnetL2ChainConfig: L2ChainConfig;
|
|
36
|
-
export declare function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined;
|
|
37
|
-
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): void;
|
|
38
|
-
//# sourceMappingURL=chain_l2_config.d.ts.map
|
|
2
|
+
/**
|
|
3
|
+
* Sets up environment for the given network.
|
|
4
|
+
*
|
|
5
|
+
* For 'local' network: returns early, using hardcoded defaults from DefaultL1ContractsConfig
|
|
6
|
+
* and DefaultSlasherConfig (which match the 'defaults' section of defaults.yml).
|
|
7
|
+
*
|
|
8
|
+
* For deployed networks: applies network configuration from generated defaults.yml,
|
|
9
|
+
* merging base defaults with network-specific overrides.
|
|
10
|
+
*
|
|
11
|
+
* @param networkName - The network name
|
|
12
|
+
*/
|
|
13
|
+
export declare function enrichEnvironmentWithChainName(networkName: NetworkNames): void;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW5fbDJfY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL2NoYWluX2wyX2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQTBCN0Q7Ozs7Ozs7Ozs7R0FVRztBQUNILHdCQUFnQiw4QkFBOEIsQ0FBQyxXQUFXLEVBQUUsWUFBWSxRQXFCdkUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AA0B7D;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,YAAY,QAqBvE"}
|
|
@@ -1,376 +1,47 @@
|
|
|
1
|
-
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
1
|
import path from 'path';
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
import { devnetConfig, mainnetConfig, testnetConfig } from './generated/networks.js';
|
|
3
|
+
const NetworkConfigs = {
|
|
4
|
+
devnet: devnetConfig,
|
|
5
|
+
testnet: testnetConfig,
|
|
6
|
+
mainnet: mainnetConfig
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/** Tally-style slashing */ slasherFlavor: 'tally',
|
|
13
|
-
/** Allow one round for vetoing */ slashingExecutionDelayInRounds: 1,
|
|
14
|
-
/** How long for a slash payload to be executed */ slashingLifetimeInRounds: 5,
|
|
15
|
-
/** Allow 2 rounds to discover faults */ slashingOffsetInRounds: 2,
|
|
16
|
-
/** No slash vetoer */ slashingVetoer: EthAddress.ZERO,
|
|
17
|
-
/** Use default disable duration */ slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
|
|
18
|
-
/** Use default slash amounts */ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
19
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
20
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
21
|
-
// Slashing stuff
|
|
22
|
-
slashMinPenaltyPercentage: 0.5,
|
|
23
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
24
|
-
slashInactivityTargetPercentage: 0.7,
|
|
25
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
26
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
27
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
28
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
29
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
30
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
31
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
32
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
33
|
-
slashMaxPayloadSize: 50,
|
|
34
|
-
slashGracePeriodL2Slots: 32 * 2,
|
|
35
|
-
slashOffenseExpirationRounds: 8,
|
|
36
|
-
sentinelEnabled: true,
|
|
37
|
-
slashExecuteRoundsLookBack: 4
|
|
38
|
-
};
|
|
39
|
-
const DefaultNetworkDBMapSizeConfig = {
|
|
40
|
-
dbMapSizeKb: defaultDBMapSizeKb,
|
|
41
|
-
archiverStoreMapSizeKb: tbMapSizeKb,
|
|
42
|
-
noteHashTreeMapSizeKb: tbMapSizeKb,
|
|
43
|
-
nullifierTreeMapSizeKb: tbMapSizeKb,
|
|
44
|
-
publicDataTreeMapSizeKb: tbMapSizeKb
|
|
45
|
-
};
|
|
46
|
-
export const stagingIgnitionL2ChainConfig = {
|
|
47
|
-
l1ChainId: 11155111,
|
|
48
|
-
testAccounts: false,
|
|
49
|
-
sponsoredFPC: false,
|
|
50
|
-
disableTransactions: true,
|
|
51
|
-
p2pEnabled: true,
|
|
52
|
-
p2pBootstrapNodes: [],
|
|
53
|
-
seqMinTxsPerBlock: 0,
|
|
54
|
-
seqMaxTxsPerBlock: 0,
|
|
55
|
-
realProofs: true,
|
|
56
|
-
snapshotsUrls: [
|
|
57
|
-
`${SNAPSHOTS_URL}/staging-ignition/`
|
|
58
|
-
],
|
|
59
|
-
autoUpdate: 'config-and-version',
|
|
60
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
|
|
61
|
-
maxTxPoolSize: 100_000_000,
|
|
62
|
-
publicIncludeMetrics,
|
|
63
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
64
|
-
publicMetricsCollectFrom: [
|
|
65
|
-
'sequencer'
|
|
66
|
-
],
|
|
67
|
-
txPoolDeleteTxsAfterReorg: false,
|
|
68
|
-
blobAllowEmptySources: true,
|
|
69
|
-
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
70
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 72,
|
|
71
|
-
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
72
|
-
/** The target validator committee size. */ aztecTargetCommitteeSize: 24,
|
|
73
|
-
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
74
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
75
|
-
/** How many sequencers must agree with a slash for it to be executed. */ slashingQuorum: 65,
|
|
76
|
-
slashingRoundSizeInEpochs: 4,
|
|
77
|
-
slashingLifetimeInRounds: 40,
|
|
78
|
-
slashingExecutionDelayInRounds: 28,
|
|
79
|
-
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
80
|
-
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
81
|
-
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
82
|
-
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
83
|
-
slashingOffsetInRounds: 2,
|
|
84
|
-
slasherFlavor: 'tally',
|
|
85
|
-
slashingVetoer: EthAddress.ZERO,
|
|
86
|
-
/** The mana target for the rollup */ manaTarget: 0n,
|
|
87
|
-
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
88
|
-
/** The proving cost per mana */ provingCostPerMana: 0n,
|
|
89
|
-
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
90
|
-
activationThreshold: 200_000n * 10n ** 18n,
|
|
91
|
-
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
92
|
-
governanceProposerRoundSize: 300,
|
|
93
|
-
governanceProposerQuorum: 151,
|
|
94
|
-
// Node slashing config
|
|
95
|
-
// TODO TMNT-330
|
|
96
|
-
slashMinPenaltyPercentage: 0.5,
|
|
97
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
98
|
-
slashInactivityTargetPercentage: 0.7,
|
|
99
|
-
slashInactivityConsecutiveEpochThreshold: 2,
|
|
100
|
-
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
101
|
-
slashPrunePenalty: 0n,
|
|
102
|
-
slashDataWithholdingPenalty: 0n,
|
|
103
|
-
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
104
|
-
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
105
|
-
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
106
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
107
|
-
slashMaxPayloadSize: 50,
|
|
108
|
-
slashGracePeriodL2Slots: 32 * 4,
|
|
109
|
-
slashOffenseExpirationRounds: 8,
|
|
110
|
-
sentinelEnabled: true,
|
|
111
|
-
slashExecuteRoundsLookBack: 4,
|
|
112
|
-
...DefaultNetworkDBMapSizeConfig
|
|
113
|
-
};
|
|
114
|
-
export const stagingPublicL2ChainConfig = {
|
|
115
|
-
l1ChainId: 11155111,
|
|
116
|
-
testAccounts: false,
|
|
117
|
-
sponsoredFPC: true,
|
|
118
|
-
disableTransactions: false,
|
|
119
|
-
p2pEnabled: true,
|
|
120
|
-
p2pBootstrapNodes: [],
|
|
121
|
-
seqMinTxsPerBlock: 0,
|
|
122
|
-
seqMaxTxsPerBlock: 20,
|
|
123
|
-
realProofs: true,
|
|
124
|
-
snapshotsUrls: [
|
|
125
|
-
`${SNAPSHOTS_URL}/staging-public/`
|
|
126
|
-
],
|
|
127
|
-
autoUpdate: 'config-and-version',
|
|
128
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
|
|
129
|
-
publicIncludeMetrics,
|
|
130
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
131
|
-
publicMetricsCollectFrom: [
|
|
132
|
-
'sequencer'
|
|
133
|
-
],
|
|
134
|
-
maxTxPoolSize: 100_000_000,
|
|
135
|
-
txPoolDeleteTxsAfterReorg: true,
|
|
136
|
-
// Deployment stuff
|
|
137
|
-
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
138
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
139
|
-
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
140
|
-
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
141
|
-
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: DefaultL1ContractsConfig.lagInEpochs,
|
|
142
|
-
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
143
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
144
|
-
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
145
|
-
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
146
|
-
/** The slashing round size */ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
147
|
-
/** Governance proposing round size */ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
|
|
148
|
-
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
149
|
-
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
150
|
-
/** Exit delay for stakers */ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
151
|
-
...DefaultSlashConfig,
|
|
152
|
-
...DefaultNetworkDBMapSizeConfig
|
|
153
|
-
};
|
|
154
|
-
export const testnetL2ChainConfig = {
|
|
155
|
-
l1ChainId: 11155111,
|
|
156
|
-
testAccounts: false,
|
|
157
|
-
sponsoredFPC: true,
|
|
158
|
-
p2pEnabled: true,
|
|
159
|
-
disableTransactions: true,
|
|
160
|
-
p2pBootstrapNodes: [],
|
|
161
|
-
seqMinTxsPerBlock: 0,
|
|
162
|
-
seqMaxTxsPerBlock: 0,
|
|
163
|
-
realProofs: true,
|
|
164
|
-
snapshotsUrls: [
|
|
165
|
-
`${SNAPSHOTS_URL}/testnet/`
|
|
166
|
-
],
|
|
167
|
-
autoUpdate: 'config-and-version',
|
|
168
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
|
|
169
|
-
maxTxPoolSize: 100_000_000,
|
|
170
|
-
publicIncludeMetrics,
|
|
171
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
172
|
-
publicMetricsCollectFrom: [
|
|
173
|
-
'sequencer'
|
|
174
|
-
],
|
|
175
|
-
txPoolDeleteTxsAfterReorg: true,
|
|
176
|
-
skipArchiverInitialSync: true,
|
|
177
|
-
blobAllowEmptySources: true,
|
|
178
|
-
// Deployment stuff
|
|
179
|
-
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
180
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
181
|
-
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
182
|
-
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
183
|
-
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
184
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
185
|
-
/** The deposit amount for a validator */ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
186
|
-
/** The minimum stake for a validator. */ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
187
|
-
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
188
|
-
/** The slashing round size */ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
|
|
189
|
-
/** Governance proposing round size */ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
|
|
190
|
-
/** The mana target for the rollup */ manaTarget: 0n,
|
|
191
|
-
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
192
|
-
/** Exit delay for stakers */ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
193
|
-
...DefaultSlashConfig,
|
|
194
|
-
slashPrunePenalty: 0n,
|
|
195
|
-
slashDataWithholdingPenalty: 0n,
|
|
196
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
197
|
-
...DefaultNetworkDBMapSizeConfig
|
|
198
|
-
};
|
|
199
|
-
export const mainnetL2ChainConfig = {
|
|
200
|
-
l1ChainId: 1,
|
|
201
|
-
testAccounts: false,
|
|
202
|
-
sponsoredFPC: false,
|
|
203
|
-
p2pEnabled: true,
|
|
204
|
-
disableTransactions: true,
|
|
205
|
-
p2pBootstrapNodes: [],
|
|
206
|
-
seqMinTxsPerBlock: 0,
|
|
207
|
-
seqMaxTxsPerBlock: 0,
|
|
208
|
-
realProofs: true,
|
|
209
|
-
snapshotsUrls: [
|
|
210
|
-
`${SNAPSHOTS_URL}/mainnet/`
|
|
211
|
-
],
|
|
212
|
-
autoUpdate: 'notify',
|
|
213
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
|
|
214
|
-
maxTxPoolSize: 100_000_000,
|
|
215
|
-
publicIncludeMetrics,
|
|
216
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
217
|
-
publicMetricsCollectFrom: [
|
|
218
|
-
'sequencer'
|
|
219
|
-
],
|
|
220
|
-
txPoolDeleteTxsAfterReorg: false,
|
|
221
|
-
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
222
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 72,
|
|
223
|
-
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
224
|
-
/** The target validator committee size. */ aztecTargetCommitteeSize: 24,
|
|
225
|
-
/** The number of epochs to lag behind the current epoch for validator selection. */ lagInEpochs: 2,
|
|
226
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
227
|
-
/** How many sequencers must agree with a slash for it to be executed. */ slashingQuorum: 65,
|
|
228
|
-
slashingRoundSizeInEpochs: 4,
|
|
229
|
-
slashingLifetimeInRounds: 40,
|
|
230
|
-
slashingExecutionDelayInRounds: 28,
|
|
231
|
-
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
232
|
-
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
233
|
-
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
234
|
-
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
235
|
-
slashingOffsetInRounds: 2,
|
|
236
|
-
slasherFlavor: 'tally',
|
|
237
|
-
slashingVetoer: EthAddress.ZERO,
|
|
238
|
-
/** The mana target for the rollup */ manaTarget: 0n,
|
|
239
|
-
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
240
|
-
/** The proving cost per mana */ provingCostPerMana: 0n,
|
|
241
|
-
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
242
|
-
activationThreshold: 200_000n * 10n ** 18n,
|
|
243
|
-
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
244
|
-
governanceProposerRoundSize: 300,
|
|
245
|
-
governanceProposerQuorum: 151,
|
|
246
|
-
// Node slashing config
|
|
247
|
-
// TODO TMNT-330
|
|
248
|
-
slashMinPenaltyPercentage: 0.5,
|
|
249
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
250
|
-
slashInactivityTargetPercentage: 0.7,
|
|
251
|
-
slashInactivityConsecutiveEpochThreshold: 2,
|
|
252
|
-
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
253
|
-
slashPrunePenalty: 0n,
|
|
254
|
-
slashDataWithholdingPenalty: 0n,
|
|
255
|
-
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
256
|
-
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
257
|
-
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
258
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
259
|
-
slashMaxPayloadSize: 50,
|
|
260
|
-
slashGracePeriodL2Slots: 32 * 4,
|
|
261
|
-
slashOffenseExpirationRounds: 8,
|
|
262
|
-
sentinelEnabled: true,
|
|
263
|
-
slashExecuteRoundsLookBack: 4,
|
|
264
|
-
...DefaultNetworkDBMapSizeConfig
|
|
265
|
-
};
|
|
266
|
-
export function getL2ChainConfig(networkName) {
|
|
267
|
-
let config;
|
|
268
|
-
if (networkName === 'staging-public') {
|
|
269
|
-
config = {
|
|
270
|
-
...stagingPublicL2ChainConfig
|
|
271
|
-
};
|
|
272
|
-
} else if (networkName === 'testnet') {
|
|
273
|
-
config = {
|
|
274
|
-
...testnetL2ChainConfig
|
|
275
|
-
};
|
|
276
|
-
} else if (networkName === 'staging-ignition') {
|
|
277
|
-
config = {
|
|
278
|
-
...stagingIgnitionL2ChainConfig
|
|
279
|
-
};
|
|
280
|
-
} else if (networkName === 'mainnet') {
|
|
281
|
-
config = {
|
|
282
|
-
...mainnetL2ChainConfig
|
|
283
|
-
};
|
|
8
|
+
function enrichEnvironmentWithNetworkConfig(config) {
|
|
9
|
+
for (const [key, value] of Object.entries(config)){
|
|
10
|
+
if (process.env[key] === undefined && value !== undefined) {
|
|
11
|
+
process.env[key] = String(value);
|
|
12
|
+
}
|
|
284
13
|
}
|
|
285
|
-
return config;
|
|
286
14
|
}
|
|
287
15
|
function getDefaultDataDir(networkName) {
|
|
288
16
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
289
17
|
}
|
|
290
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Sets up environment for the given network.
|
|
20
|
+
*
|
|
21
|
+
* For 'local' network: returns early, using hardcoded defaults from DefaultL1ContractsConfig
|
|
22
|
+
* and DefaultSlasherConfig (which match the 'defaults' section of defaults.yml).
|
|
23
|
+
*
|
|
24
|
+
* For deployed networks: applies network configuration from generated defaults.yml,
|
|
25
|
+
* merging base defaults with network-specific overrides.
|
|
26
|
+
*
|
|
27
|
+
* @param networkName - The network name
|
|
28
|
+
*/ export function enrichEnvironmentWithChainName(networkName) {
|
|
29
|
+
// For 'local', we don't inject any env vars - use hardcoded TypeScript/Solidity defaults
|
|
30
|
+
// These defaults are defined in defaults.yml 'defaults' section and match:
|
|
31
|
+
// - DefaultL1ContractsConfig (yarn-project/ethereum/src/config.ts)
|
|
32
|
+
// - Solidity vm.envOr defaults (l1-contracts/script/deploy/RollupConfiguration.sol)
|
|
291
33
|
if (networkName === 'local') {
|
|
292
34
|
return;
|
|
293
35
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
301
|
-
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
302
|
-
enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
|
|
303
|
-
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
304
|
-
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
305
|
-
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
306
|
-
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
307
|
-
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
308
|
-
enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
|
|
309
|
-
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
310
|
-
enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
|
|
311
|
-
enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
|
|
312
|
-
enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
|
|
313
|
-
enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
|
|
314
|
-
enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
|
|
315
|
-
if (config.skipArchiverInitialSync !== undefined) {
|
|
316
|
-
enrichVar('SKIP_ARCHIVER_INITIAL_SYNC', config.skipArchiverInitialSync.toString());
|
|
317
|
-
}
|
|
318
|
-
if (config.blobAllowEmptySources !== undefined) {
|
|
319
|
-
enrichVar('BLOB_ALLOW_EMPTY_SOURCES', config.blobAllowEmptySources.toString());
|
|
320
|
-
}
|
|
321
|
-
if (config.autoUpdate) {
|
|
322
|
-
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
323
|
-
}
|
|
324
|
-
if (config.autoUpdateUrl) {
|
|
325
|
-
enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
|
|
326
|
-
}
|
|
327
|
-
if (config.publicIncludeMetrics) {
|
|
328
|
-
enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
|
|
329
|
-
}
|
|
330
|
-
if (config.publicMetricsCollectorUrl) {
|
|
331
|
-
enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
|
|
36
|
+
// Apply generated network config from defaults.yml
|
|
37
|
+
// For devnet iterations (v4-devnet-1, etc.), use the base devnet config
|
|
38
|
+
const configKey = /^v\d+-devnet-\d+$/.test(networkName) ? 'devnet' : networkName;
|
|
39
|
+
const generatedConfig = NetworkConfigs[configKey];
|
|
40
|
+
if (generatedConfig) {
|
|
41
|
+
enrichEnvironmentWithNetworkConfig(generatedConfig);
|
|
332
42
|
}
|
|
333
|
-
if
|
|
334
|
-
|
|
43
|
+
// Set DATA_DIRECTORY if not already set
|
|
44
|
+
if (process.env['DATA_DIRECTORY'] === undefined) {
|
|
45
|
+
process.env['DATA_DIRECTORY'] = getDefaultDataDir(networkName);
|
|
335
46
|
}
|
|
336
|
-
// Deployment stuff
|
|
337
|
-
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
338
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
339
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
340
|
-
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
341
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
342
|
-
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
343
|
-
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
344
|
-
enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
|
|
345
|
-
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
346
|
-
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
347
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
348
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
|
|
349
|
-
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
|
|
350
|
-
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
|
|
351
|
-
enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
|
|
352
|
-
enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
|
|
353
|
-
enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
|
|
354
|
-
enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
|
|
355
|
-
enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
|
|
356
|
-
enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
|
|
357
|
-
enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
|
|
358
|
-
enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
|
|
359
|
-
enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
|
|
360
|
-
// Slashing
|
|
361
|
-
enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
|
|
362
|
-
enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
|
|
363
|
-
enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
|
|
364
|
-
enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
|
|
365
|
-
enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
|
|
366
|
-
enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
|
|
367
|
-
enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
|
|
368
|
-
enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
|
|
369
|
-
enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
|
|
370
|
-
enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
|
|
371
|
-
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
|
|
372
|
-
enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
|
|
373
|
-
enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
|
|
374
|
-
enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
|
|
375
|
-
enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
|
|
376
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EnvVar } from '@aztec/foundation/config';
|
|
2
2
|
export declare function enrichVar(envVar: EnvVar, value: string | undefined): void;
|
|
3
3
|
export declare function enrichEthAddressVar(envVar: EnvVar, value: string): void;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5yaWNoX2Vudi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy9lbnJpY2hfZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXZELHdCQUFnQixTQUFTLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLFNBQVMsUUFNbEU7QUFFRCx3QkFBZ0IsbUJBQW1CLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxRQUdoRSJ9
|