@aztec/cli 3.0.0-nightly.20251127 → 3.0.0-nightly.20251201.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.
Files changed (72) hide show
  1. package/dest/cmds/aztec_node/block_number.d.ts +1 -1
  2. package/dest/cmds/aztec_node/get_block.d.ts +1 -1
  3. package/dest/cmds/aztec_node/get_current_base_fee.d.ts +1 -1
  4. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +1 -1
  5. package/dest/cmds/aztec_node/get_logs.d.ts +1 -1
  6. package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
  7. package/dest/cmds/aztec_node/index.d.ts +1 -1
  8. package/dest/cmds/contracts/index.d.ts +1 -1
  9. package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
  10. package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
  11. package/dest/cmds/infrastructure/index.d.ts +1 -1
  12. package/dest/cmds/infrastructure/sequencers.d.ts +1 -1
  13. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  14. package/dest/cmds/l1/advance_epoch.d.ts +1 -1
  15. package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
  16. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  17. package/dest/cmds/l1/create_l1_account.d.ts +1 -1
  18. package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
  19. package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
  20. package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
  21. package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
  22. package/dest/cmds/l1/governance_utils.d.ts +5 -5
  23. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  24. package/dest/cmds/l1/index.d.ts +1 -1
  25. package/dest/cmds/l1/prover_stats.d.ts +1 -1
  26. package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
  27. package/dest/cmds/l1/prover_stats.js +26 -26
  28. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
  29. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
  30. package/dest/cmds/l1/update_l1_validators.d.ts +6 -6
  31. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  32. package/dest/cmds/misc/compute_selector.d.ts +1 -1
  33. package/dest/cmds/misc/example_contracts.d.ts +1 -1
  34. package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
  35. package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
  36. package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
  37. package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
  38. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
  39. package/dest/cmds/misc/index.d.ts +1 -1
  40. package/dest/cmds/misc/update/common.d.ts +1 -1
  41. package/dest/cmds/misc/update/github.d.ts +1 -1
  42. package/dest/cmds/misc/update/noir.d.ts +1 -1
  43. package/dest/cmds/misc/update/npm.d.ts +1 -1
  44. package/dest/cmds/misc/update/utils.d.ts +1 -1
  45. package/dest/cmds/misc/update.d.ts +1 -1
  46. package/dest/cmds/validator_keys/add.d.ts +1 -1
  47. package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +1 -1
  48. package/dest/cmds/validator_keys/index.d.ts +1 -1
  49. package/dest/cmds/validator_keys/new.d.ts +1 -1
  50. package/dest/cmds/validator_keys/shared.d.ts +1 -1
  51. package/dest/cmds/validator_keys/staker.d.ts +1 -1
  52. package/dest/cmds/validator_keys/utils.d.ts +1 -1
  53. package/dest/config/cached_fetch.d.ts +1 -1
  54. package/dest/config/chain_l2_config.d.ts +1 -1
  55. package/dest/config/enrich_env.d.ts +1 -1
  56. package/dest/config/get_l1_config.d.ts +1 -1
  57. package/dest/config/index.d.ts +1 -1
  58. package/dest/config/network_config.d.ts +5 -2
  59. package/dest/config/network_config.d.ts.map +1 -1
  60. package/dest/config/network_config.js +43 -27
  61. package/dest/utils/aztec.d.ts +1 -1
  62. package/dest/utils/aztec.d.ts.map +1 -1
  63. package/dest/utils/commands.d.ts +2 -2
  64. package/dest/utils/commands.d.ts.map +1 -1
  65. package/dest/utils/encoding.d.ts +1 -1
  66. package/dest/utils/github.d.ts +1 -1
  67. package/dest/utils/index.d.ts +1 -1
  68. package/dest/utils/inspect.d.ts +1 -1
  69. package/dest/utils/setup_contracts.d.ts +1 -1
  70. package/package.json +31 -30
  71. package/src/cmds/l1/prover_stats.ts +34 -27
  72. package/src/config/network_config.ts +45 -28
@@ -17,7 +17,8 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
17
17
  *
18
18
  * @param networkName - The network name to fetch config for
19
19
  * @param cacheDir - Optional cache directory for storing fetched config
20
- * @returns Remote configuration for the specified network, or undefined if not found/error
20
+ * @returns Remote configuration for the specified network, or undefined if network not found in config
21
+ * @throws Error if both primary and fallback URLs fail to fetch
21
22
  */
22
23
  export async function getNetworkConfig(
23
24
  networkName: NetworkNames,
@@ -26,12 +27,29 @@ export async function getNetworkConfig(
26
27
  // Try with the primary URL (env var or default)
27
28
  const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
28
29
 
30
+ let primaryError: Error | undefined;
31
+ let config: NetworkConfig | undefined;
32
+
29
33
  // First try the primary config location
30
- let config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
34
+ try {
35
+ config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
36
+ } catch (error) {
37
+ primaryError = error as Error;
38
+ }
31
39
 
32
40
  // If primary fails and we were using the default URL, try the fallback
33
41
  if (!config && configLocation === DEFAULT_CONFIG_URL) {
34
- config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
42
+ try {
43
+ config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
44
+ } catch {
45
+ // Both failed - throw the primary error
46
+ if (primaryError) {
47
+ throw primaryError;
48
+ }
49
+ }
50
+ } else if (primaryError) {
51
+ // Primary failed and no fallback to try
52
+ throw primaryError;
35
53
  }
36
54
 
37
55
  return config;
@@ -42,7 +60,8 @@ export async function getNetworkConfig(
42
60
  * @param configLocation - The URL or file path to fetch from
43
61
  * @param networkName - The network name to fetch config for
44
62
  * @param cacheDir - Optional cache directory for storing fetched config
45
- * @returns Remote configuration for the specified network, or undefined if not found/error
63
+ * @returns Remote configuration for the specified network, or undefined if network not found in config, or undefined if URL invalid
64
+ * @throws Error if fetch/parse fails
46
65
  */
47
66
  async function fetchNetworkConfigFromUrl(
48
67
  configLocation: string,
@@ -64,31 +83,27 @@ async function fetchNetworkConfigFromUrl(
64
83
  return undefined;
65
84
  }
66
85
 
67
- try {
68
- let rawConfig: any;
69
-
70
- if (url.protocol === 'http:' || url.protocol === 'https:') {
71
- rawConfig = await cachedFetch(url.href, {
72
- cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
73
- cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
74
- });
75
- } else if (url.protocol === 'file:') {
76
- rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
77
- } else {
78
- throw new Error('Unsupported Aztec network config protocol: ' + url.href);
79
- }
86
+ let rawConfig: any;
87
+
88
+ if (url.protocol === 'http:' || url.protocol === 'https:') {
89
+ rawConfig = await cachedFetch(url.href, {
90
+ cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
91
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
92
+ });
93
+ } else if (url.protocol === 'file:') {
94
+ rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
95
+ } else {
96
+ throw new Error('Unsupported Aztec network config protocol: ' + url.href);
97
+ }
80
98
 
81
- if (!rawConfig) {
82
- return undefined;
83
- }
99
+ if (!rawConfig) {
100
+ return undefined;
101
+ }
84
102
 
85
- const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
86
- if (networkName in networkConfigMap) {
87
- return networkConfigMap[networkName];
88
- } else {
89
- return undefined;
90
- }
91
- } catch {
103
+ const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
104
+ if (networkName in networkConfigMap) {
105
+ return networkConfigMap[networkName];
106
+ } else {
92
107
  return undefined;
93
108
  }
94
109
  }
@@ -99,6 +114,8 @@ async function fetchNetworkConfigFromUrl(
99
114
  * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
100
115
  *
101
116
  * @param networkName - The network name to fetch remote config for
117
+ * @throws Error if network config fetch fails (network errors, parse errors, etc.)
118
+ * Does not throw if the network simply doesn't exist in the config - just returns without enriching
102
119
  */
103
120
  export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
104
121
  if (networkName === 'local') {
@@ -109,7 +126,7 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
109
126
  const networkConfig = await getNetworkConfig(networkName, cacheDir);
110
127
 
111
128
  if (!networkConfig) {
112
- throw new Error(`Failed to fetch network config for network: ${networkName}`);
129
+ return; // Network not found in config, continue without enriching
113
130
  }
114
131
 
115
132
  enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));