@aztec/cli 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec
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 +1 -1
- package/dest/cmds/aztec_node/block_number.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_block.js +2 -1
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +1 -1
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +1 -1
- package/dest/cmds/aztec_node/get_logs.d.ts +3 -2
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
- package/dest/cmds/aztec_node/index.d.ts +1 -1
- 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 +1 -1
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +0 -1
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -2
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +9 -3
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/l1/advance_epoch.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +2 -1
- package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +2 -1
- 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} +39 -4
- 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 +3 -3
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- 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 +10 -8
- 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 +6 -6
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +7 -3
- 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 +1 -1
- package/dest/cmds/misc/generate_secret_key.d.ts +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 +1 -1
- package/dest/cmds/validator_keys/add.d.ts.map +1 -1
- package/dest/cmds/validator_keys/add.js +20 -7
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +1 -1
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -1
- package/dest/cmds/validator_keys/generate_bls_keypair.js +3 -2
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +16 -4
- package/dest/cmds/validator_keys/new.d.ts +7 -4
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +90 -16
- package/dest/cmds/validator_keys/shared.d.ts +4 -4
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +31 -28
- 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 +1 -1
- package/dest/config/chain_l2_config.d.ts +13 -11
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +110 -61
- package/dest/config/enrich_env.d.ts +1 -1
- 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 +6 -3
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +64 -28
- package/dest/utils/aztec.d.ts +7 -13
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +19 -40
- package/dest/utils/commands.d.ts +8 -7
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +6 -5
- 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 +3 -2
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/setup_contracts.d.ts +1 -1
- package/package.json +38 -30
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/get_block.ts +2 -1
- package/src/cmds/aztec_node/get_logs.ts +3 -2
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +0 -1
- package/src/cmds/infrastructure/sequencers.ts +5 -4
- package/src/cmds/l1/assume_proven_through.ts +4 -1
- package/src/cmds/l1/bridge_erc20.ts +2 -1
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +39 -22
- package/src/cmds/l1/deploy_new_rollup.ts +4 -9
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- 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 +7 -17
- 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 +7 -12
- package/src/cmds/misc/generate_secret_and_hash.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 +20 -10
- package/src/cmds/validator_keys/generate_bls_keypair.ts +3 -2
- package/src/cmds/validator_keys/index.ts +67 -21
- package/src/cmds/validator_keys/new.ts +110 -23
- package/src/cmds/validator_keys/shared.ts +32 -27
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/chain_l2_config.ts +139 -72
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +74 -29
- package/src/utils/aztec.ts +24 -83
- package/src/utils/commands.ts +6 -5
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +2 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
|
|
1
|
+
import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum/config';
|
|
2
|
+
import type { L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils/config';
|
|
2
3
|
import type { NetworkNames } from '@aztec/foundation/config';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
5
|
-
import type {
|
|
6
|
+
import type { P2PConfig } from '@aztec/p2p/config';
|
|
7
|
+
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
8
|
|
|
7
9
|
import path from 'path';
|
|
8
10
|
|
|
@@ -14,29 +16,30 @@ const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
|
|
|
14
16
|
const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
|
|
15
17
|
const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
|
|
16
18
|
|
|
17
|
-
export type L2ChainConfig = L1ContractsConfig &
|
|
18
|
-
Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> &
|
|
19
|
+
export type L2ChainConfig = Omit<L1ContractsConfig, keyof L1TxUtilsConfig> &
|
|
20
|
+
Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways' | 'slashOverridePayload' | 'slashSelfAllowed'> &
|
|
21
|
+
Pick<P2PConfig, 'bootstrapNodes' | 'p2pEnabled' | 'txPoolDeleteTxsAfterReorg'> &
|
|
22
|
+
Pick<SequencerConfig, 'buildCheckpointIfEmpty' | 'minTxsPerBlock' | 'maxTxsPerBlock' | 'blockDurationMs'> & {
|
|
19
23
|
l1ChainId: number;
|
|
20
24
|
testAccounts: boolean;
|
|
21
25
|
sponsoredFPC: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
seqMinTxsPerBlock: number;
|
|
25
|
-
seqMaxTxsPerBlock: number;
|
|
26
|
+
minTxsPerBlock: number;
|
|
27
|
+
maxTxsPerBlock: number;
|
|
26
28
|
realProofs: boolean;
|
|
27
29
|
snapshotsUrls: string[];
|
|
28
30
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
29
31
|
autoUpdateUrl?: string;
|
|
30
|
-
|
|
32
|
+
maxPendingTxCount: number;
|
|
33
|
+
publicMetricsOptOut: boolean;
|
|
31
34
|
publicIncludeMetrics?: string[];
|
|
32
35
|
publicMetricsCollectorUrl?: string;
|
|
33
36
|
publicMetricsCollectFrom?: string[];
|
|
34
37
|
skipArchiverInitialSync?: boolean;
|
|
35
38
|
blobAllowEmptySources?: boolean;
|
|
36
39
|
|
|
37
|
-
// Setting the
|
|
40
|
+
// Setting the dataStoreMapSize provides the default for every DB in the node.
|
|
38
41
|
// Then we explicitly override the sizes for the archiver and the larger trees.
|
|
39
|
-
|
|
42
|
+
dataStoreMapSizeKb: number;
|
|
40
43
|
archiverStoreMapSizeKb: number;
|
|
41
44
|
noteHashTreeMapSizeKb: number;
|
|
42
45
|
nullifierTreeMapSizeKb: number;
|
|
@@ -85,7 +88,7 @@ const DefaultSlashConfig = {
|
|
|
85
88
|
} satisfies Partial<L2ChainConfig>;
|
|
86
89
|
|
|
87
90
|
const DefaultNetworkDBMapSizeConfig = {
|
|
88
|
-
|
|
91
|
+
dataStoreMapSizeKb: defaultDBMapSizeKb,
|
|
89
92
|
archiverStoreMapSizeKb: tbMapSizeKb,
|
|
90
93
|
noteHashTreeMapSizeKb: tbMapSizeKb,
|
|
91
94
|
nullifierTreeMapSizeKb: tbMapSizeKb,
|
|
@@ -98,17 +101,21 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
98
101
|
sponsoredFPC: false,
|
|
99
102
|
disableTransactions: true,
|
|
100
103
|
p2pEnabled: true,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
bootstrapNodes: [],
|
|
105
|
+
minTxsPerBlock: 0,
|
|
106
|
+
maxTxsPerBlock: 0,
|
|
107
|
+
buildCheckpointIfEmpty: true,
|
|
104
108
|
realProofs: true,
|
|
105
109
|
snapshotsUrls: [`${SNAPSHOTS_URL}/staging-ignition/`],
|
|
106
110
|
autoUpdate: 'config-and-version',
|
|
107
111
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
|
|
108
|
-
|
|
112
|
+
maxPendingTxCount: 0,
|
|
113
|
+
publicMetricsOptOut: false,
|
|
109
114
|
publicIncludeMetrics,
|
|
110
115
|
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
111
116
|
publicMetricsCollectFrom: ['sequencer'],
|
|
117
|
+
txPoolDeleteTxsAfterReorg: false,
|
|
118
|
+
blobAllowEmptySources: true,
|
|
112
119
|
|
|
113
120
|
/** How many seconds an L1 slot lasts. */
|
|
114
121
|
ethereumSlotDuration: 12,
|
|
@@ -119,7 +126,11 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
119
126
|
/** The target validator committee size. */
|
|
120
127
|
aztecTargetCommitteeSize: 24,
|
|
121
128
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
122
|
-
|
|
129
|
+
lagInEpochsForValidatorSet: 2,
|
|
130
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
131
|
+
lagInEpochsForRandao: 2,
|
|
132
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
133
|
+
inboxLag: 1,
|
|
123
134
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
124
135
|
aztecProofSubmissionEpochs: 1,
|
|
125
136
|
/** How many sequencers must agree with a slash for it to be executed. */
|
|
@@ -133,7 +144,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
133
144
|
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
134
145
|
slashingOffsetInRounds: 2,
|
|
135
146
|
slasherFlavor: 'tally',
|
|
136
|
-
slashingVetoer: EthAddress.ZERO,
|
|
147
|
+
slashingVetoer: EthAddress.ZERO,
|
|
137
148
|
|
|
138
149
|
/** The mana target for the rollup */
|
|
139
150
|
manaTarget: 0n,
|
|
@@ -178,17 +189,20 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
178
189
|
sponsoredFPC: true,
|
|
179
190
|
disableTransactions: false,
|
|
180
191
|
p2pEnabled: true,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
bootstrapNodes: [],
|
|
193
|
+
minTxsPerBlock: 0,
|
|
194
|
+
maxTxsPerBlock: 20,
|
|
195
|
+
buildCheckpointIfEmpty: true,
|
|
184
196
|
realProofs: true,
|
|
185
197
|
snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`],
|
|
186
198
|
autoUpdate: 'config-and-version',
|
|
187
199
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
|
|
200
|
+
publicMetricsOptOut: false,
|
|
188
201
|
publicIncludeMetrics,
|
|
189
202
|
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
190
203
|
publicMetricsCollectFrom: ['sequencer'],
|
|
191
|
-
|
|
204
|
+
maxPendingTxCount: 1_000, // ~156MB
|
|
205
|
+
txPoolDeleteTxsAfterReorg: true,
|
|
192
206
|
|
|
193
207
|
// Deployment stuff
|
|
194
208
|
/** How many seconds an L1 slot lasts. */
|
|
@@ -200,7 +214,11 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
|
200
214
|
/** The target validator committee size. */
|
|
201
215
|
aztecTargetCommitteeSize: 48,
|
|
202
216
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
203
|
-
|
|
217
|
+
lagInEpochsForValidatorSet: DefaultL1ContractsConfig.lagInEpochsForValidatorSet,
|
|
218
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
219
|
+
lagInEpochsForRandao: DefaultL1ContractsConfig.lagInEpochsForRandao,
|
|
220
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
221
|
+
inboxLag: DefaultL1ContractsConfig.inboxLag,
|
|
204
222
|
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
205
223
|
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
206
224
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
@@ -231,17 +249,20 @@ export const nextNetL2ChainConfig: L2ChainConfig = {
|
|
|
231
249
|
sponsoredFPC: true,
|
|
232
250
|
p2pEnabled: true,
|
|
233
251
|
disableTransactions: false,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
252
|
+
bootstrapNodes: [],
|
|
253
|
+
minTxsPerBlock: 0,
|
|
254
|
+
maxTxsPerBlock: 8,
|
|
255
|
+
buildCheckpointIfEmpty: true,
|
|
237
256
|
realProofs: true,
|
|
238
257
|
snapshotsUrls: [],
|
|
239
258
|
autoUpdate: 'config-and-version',
|
|
240
259
|
autoUpdateUrl: '',
|
|
260
|
+
publicMetricsOptOut: true,
|
|
241
261
|
publicIncludeMetrics,
|
|
242
262
|
publicMetricsCollectorUrl: '',
|
|
243
263
|
publicMetricsCollectFrom: [''],
|
|
244
|
-
|
|
264
|
+
maxPendingTxCount: 1_000, // ~156MB
|
|
265
|
+
txPoolDeleteTxsAfterReorg: false,
|
|
245
266
|
|
|
246
267
|
// Deployment stuff
|
|
247
268
|
/** How many seconds an L1 slot lasts. */
|
|
@@ -253,7 +274,11 @@ export const nextNetL2ChainConfig: L2ChainConfig = {
|
|
|
253
274
|
/** The target validator committee size. */
|
|
254
275
|
aztecTargetCommitteeSize: 48,
|
|
255
276
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
256
|
-
|
|
277
|
+
lagInEpochsForValidatorSet: DefaultL1ContractsConfig.lagInEpochsForValidatorSet,
|
|
278
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
279
|
+
lagInEpochsForRandao: DefaultL1ContractsConfig.lagInEpochsForRandao,
|
|
280
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
281
|
+
inboxLag: DefaultL1ContractsConfig.inboxLag,
|
|
257
282
|
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
258
283
|
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
259
284
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
@@ -284,17 +309,20 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
284
309
|
sponsoredFPC: true,
|
|
285
310
|
p2pEnabled: true,
|
|
286
311
|
disableTransactions: true,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
312
|
+
bootstrapNodes: [],
|
|
313
|
+
minTxsPerBlock: 0,
|
|
314
|
+
maxTxsPerBlock: 20,
|
|
315
|
+
buildCheckpointIfEmpty: true,
|
|
290
316
|
realProofs: true,
|
|
291
317
|
snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
|
|
292
318
|
autoUpdate: 'config-and-version',
|
|
293
319
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
|
|
294
|
-
|
|
320
|
+
maxPendingTxCount: 5_000, // ~760MB
|
|
321
|
+
publicMetricsOptOut: false,
|
|
295
322
|
publicIncludeMetrics,
|
|
296
323
|
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
297
324
|
publicMetricsCollectFrom: ['sequencer'],
|
|
325
|
+
txPoolDeleteTxsAfterReorg: true,
|
|
298
326
|
skipArchiverInitialSync: true,
|
|
299
327
|
blobAllowEmptySources: true,
|
|
300
328
|
|
|
@@ -305,53 +333,57 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
305
333
|
/** How many L2 slots an epoch lasts. */
|
|
306
334
|
aztecEpochDuration: 32,
|
|
307
335
|
/** The target validator committee size. */
|
|
308
|
-
aztecTargetCommitteeSize:
|
|
336
|
+
aztecTargetCommitteeSize: 48,
|
|
309
337
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
310
|
-
|
|
338
|
+
lagInEpochsForValidatorSet: 2,
|
|
339
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
340
|
+
lagInEpochsForRandao: 2,
|
|
341
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
342
|
+
inboxLag: 1,
|
|
311
343
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
312
344
|
aztecProofSubmissionEpochs: 1,
|
|
313
345
|
|
|
314
|
-
// This is a diff from mainnet: we have
|
|
315
|
-
localEjectionThreshold:
|
|
346
|
+
// This is a diff from mainnet: we have 1-strike you're out, rather than 3 on mainnet.
|
|
347
|
+
localEjectionThreshold: 199_000n * 10n ** 18n,
|
|
316
348
|
/** How many sequencers must agree with a slash for it to be executed. */
|
|
317
|
-
slashingQuorum:
|
|
318
|
-
slashingRoundSizeInEpochs:
|
|
319
|
-
slashingExecutionDelayInRounds:
|
|
320
|
-
slashingLifetimeInRounds:
|
|
321
|
-
slashingVetoer: EthAddress.fromString('
|
|
349
|
+
slashingQuorum: 33,
|
|
350
|
+
slashingRoundSizeInEpochs: 2,
|
|
351
|
+
slashingExecutionDelayInRounds: 2,
|
|
352
|
+
slashingLifetimeInRounds: 5,
|
|
353
|
+
slashingVetoer: EthAddress.fromString('0xdfe19Da6a717b7088621d8bBB66be59F2d78e924'),
|
|
322
354
|
slashingOffsetInRounds: 2,
|
|
323
355
|
|
|
324
|
-
slashingDisableDuration:
|
|
356
|
+
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days
|
|
325
357
|
slasherFlavor: 'tally',
|
|
326
358
|
|
|
327
|
-
slashAmountSmall:
|
|
328
|
-
slashAmountMedium:
|
|
329
|
-
slashAmountLarge:
|
|
359
|
+
slashAmountSmall: 10_000n * 10n ** 18n,
|
|
360
|
+
slashAmountMedium: 50_000n * 10n ** 18n,
|
|
361
|
+
slashAmountLarge: 200_000n * 10n ** 18n,
|
|
330
362
|
|
|
331
363
|
/** The mana target for the rollup */
|
|
332
|
-
manaTarget:
|
|
364
|
+
manaTarget: 150_000_000n,
|
|
333
365
|
|
|
334
366
|
/** The proving cost per mana */
|
|
335
|
-
provingCostPerMana:
|
|
367
|
+
provingCostPerMana: 100n,
|
|
336
368
|
|
|
337
369
|
exitDelaySeconds: 4 * 24 * 60 * 60, // 4 days
|
|
338
370
|
|
|
339
371
|
activationThreshold: 200_000n * 10n ** 18n,
|
|
340
372
|
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
341
373
|
|
|
342
|
-
governanceProposerRoundSize:
|
|
343
|
-
governanceProposerQuorum:
|
|
374
|
+
governanceProposerRoundSize: 100,
|
|
375
|
+
governanceProposerQuorum: 60,
|
|
344
376
|
|
|
345
377
|
// Node slashing config
|
|
346
378
|
slashInactivityTargetPercentage: 0.8,
|
|
347
379
|
slashInactivityConsecutiveEpochThreshold: 2,
|
|
348
|
-
slashInactivityPenalty:
|
|
380
|
+
slashInactivityPenalty: 10_000n * 10n ** 18n,
|
|
349
381
|
slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
|
|
350
382
|
slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
|
|
351
|
-
slashProposeInvalidAttestationsPenalty:
|
|
352
|
-
slashAttestDescendantOfInvalidPenalty:
|
|
353
|
-
slashUnknownPenalty:
|
|
354
|
-
slashBroadcastedInvalidBlockPenalty:
|
|
383
|
+
slashProposeInvalidAttestationsPenalty: 10_000n * 10n ** 18n,
|
|
384
|
+
slashAttestDescendantOfInvalidPenalty: 10_000n * 10n ** 18n,
|
|
385
|
+
slashUnknownPenalty: 10_000n * 10n ** 18n,
|
|
386
|
+
slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n, // 10_000n * 10n ** 18n, Disabled for now until further testing
|
|
355
387
|
slashGracePeriodL2Slots: 1_200, // One day from deployment
|
|
356
388
|
slashOffenseExpirationRounds: 8,
|
|
357
389
|
|
|
@@ -366,22 +398,27 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
366
398
|
};
|
|
367
399
|
|
|
368
400
|
export const mainnetL2ChainConfig: L2ChainConfig = {
|
|
401
|
+
txPoolDeleteTxsAfterReorg: true,
|
|
402
|
+
disableTransactions: true,
|
|
403
|
+
|
|
369
404
|
l1ChainId: 1,
|
|
370
405
|
testAccounts: false,
|
|
371
406
|
sponsoredFPC: false,
|
|
372
407
|
p2pEnabled: true,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
408
|
+
bootstrapNodes: [],
|
|
409
|
+
minTxsPerBlock: 0,
|
|
410
|
+
maxTxsPerBlock: 0,
|
|
411
|
+
buildCheckpointIfEmpty: true,
|
|
377
412
|
realProofs: true,
|
|
378
413
|
snapshotsUrls: [`${SNAPSHOTS_URL}/mainnet/`],
|
|
379
414
|
autoUpdate: 'notify',
|
|
380
415
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
|
|
381
|
-
|
|
416
|
+
maxPendingTxCount: 0,
|
|
417
|
+
publicMetricsOptOut: true,
|
|
382
418
|
publicIncludeMetrics,
|
|
383
419
|
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
384
420
|
publicMetricsCollectFrom: ['sequencer'],
|
|
421
|
+
blobAllowEmptySources: true,
|
|
385
422
|
|
|
386
423
|
/** How many seconds an L1 slot lasts. */
|
|
387
424
|
ethereumSlotDuration: 12,
|
|
@@ -392,7 +429,11 @@ export const mainnetL2ChainConfig: L2ChainConfig = {
|
|
|
392
429
|
/** The target validator committee size. */
|
|
393
430
|
aztecTargetCommitteeSize: 24,
|
|
394
431
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
395
|
-
|
|
432
|
+
lagInEpochsForValidatorSet: 2,
|
|
433
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
434
|
+
lagInEpochsForRandao: 2,
|
|
435
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
436
|
+
inboxLag: 1,
|
|
396
437
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
397
438
|
aztecProofSubmissionEpochs: 1,
|
|
398
439
|
|
|
@@ -402,7 +443,7 @@ export const mainnetL2ChainConfig: L2ChainConfig = {
|
|
|
402
443
|
slashingRoundSizeInEpochs: 4,
|
|
403
444
|
slashingExecutionDelayInRounds: 28,
|
|
404
445
|
slashingLifetimeInRounds: 34,
|
|
405
|
-
slashingVetoer: EthAddress.
|
|
446
|
+
slashingVetoer: EthAddress.fromString('0xBbB4aF368d02827945748b28CD4b2D42e4A37480'),
|
|
406
447
|
slashingOffsetInRounds: 2,
|
|
407
448
|
|
|
408
449
|
slashingDisableDuration: 259_200, // 3 days
|
|
@@ -455,17 +496,20 @@ export const devnetL2ChainConfig: L2ChainConfig = {
|
|
|
455
496
|
sponsoredFPC: true,
|
|
456
497
|
p2pEnabled: true,
|
|
457
498
|
disableTransactions: false,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
499
|
+
bootstrapNodes: [],
|
|
500
|
+
minTxsPerBlock: 0,
|
|
501
|
+
maxTxsPerBlock: 8,
|
|
502
|
+
buildCheckpointIfEmpty: true,
|
|
461
503
|
realProofs: false,
|
|
462
504
|
snapshotsUrls: [],
|
|
463
505
|
autoUpdate: 'config-and-version',
|
|
464
506
|
autoUpdateUrl: '',
|
|
507
|
+
publicMetricsOptOut: true,
|
|
465
508
|
publicIncludeMetrics,
|
|
466
509
|
publicMetricsCollectorUrl: '',
|
|
467
510
|
publicMetricsCollectFrom: [''],
|
|
468
|
-
|
|
511
|
+
maxPendingTxCount: 1_000, // ~156MB
|
|
512
|
+
txPoolDeleteTxsAfterReorg: true,
|
|
469
513
|
|
|
470
514
|
// Deployment stuff
|
|
471
515
|
/** How many seconds an L1 slot lasts. */
|
|
@@ -477,7 +521,11 @@ export const devnetL2ChainConfig: L2ChainConfig = {
|
|
|
477
521
|
/** The target validator committee size. */
|
|
478
522
|
aztecTargetCommitteeSize: 1,
|
|
479
523
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
480
|
-
|
|
524
|
+
lagInEpochsForValidatorSet: 1,
|
|
525
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
526
|
+
lagInEpochsForRandao: 1,
|
|
527
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
528
|
+
inboxLag: DefaultL1ContractsConfig.inboxLag,
|
|
481
529
|
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
482
530
|
localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
|
|
483
531
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
@@ -524,7 +572,7 @@ function getDefaultDataDir(networkName: NetworkNames): string {
|
|
|
524
572
|
return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
|
|
525
573
|
}
|
|
526
574
|
|
|
527
|
-
export function
|
|
575
|
+
export function enrichEnvironmentWithChainName(networkName: NetworkNames) {
|
|
528
576
|
if (networkName === 'local') {
|
|
529
577
|
return;
|
|
530
578
|
}
|
|
@@ -536,19 +584,30 @@ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
|
536
584
|
throw new Error(`Unknown network name: ${networkName}`);
|
|
537
585
|
}
|
|
538
586
|
|
|
539
|
-
|
|
587
|
+
enrichEnvironmentWithChainConfig(config);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export function enrichEnvironmentWithChainConfig(config: L2ChainConfig) {
|
|
591
|
+
enrichVar('BOOTSTRAP_NODES', config.bootstrapNodes.join(','));
|
|
540
592
|
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
541
593
|
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
542
594
|
enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
|
|
543
595
|
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
544
|
-
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.
|
|
545
|
-
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.
|
|
596
|
+
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.minTxsPerBlock.toString());
|
|
597
|
+
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.maxTxsPerBlock.toString());
|
|
598
|
+
if (config.blockDurationMs !== undefined) {
|
|
599
|
+
enrichVar('SEQ_BLOCK_DURATION_MS', config.blockDurationMs.toString());
|
|
600
|
+
}
|
|
601
|
+
if (config.buildCheckpointIfEmpty !== undefined) {
|
|
602
|
+
enrichVar('SEQ_BUILD_CHECKPOINT_IF_EMPTY', config.buildCheckpointIfEmpty.toString());
|
|
603
|
+
}
|
|
546
604
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
547
605
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
548
606
|
enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
|
|
549
|
-
enrichVar('
|
|
607
|
+
enrichVar('P2P_MAX_PENDING_TX_COUNT', config.maxPendingTxCount.toString());
|
|
608
|
+
enrichVar('P2P_TX_POOL_DELETE_TXS_AFTER_REORG', config.txPoolDeleteTxsAfterReorg.toString());
|
|
550
609
|
|
|
551
|
-
enrichVar('DATA_STORE_MAP_SIZE_KB', config.
|
|
610
|
+
enrichVar('DATA_STORE_MAP_SIZE_KB', config.dataStoreMapSizeKb.toString());
|
|
552
611
|
enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
|
|
553
612
|
enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
|
|
554
613
|
enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
|
|
@@ -582,11 +641,16 @@ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
|
582
641
|
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
583
642
|
}
|
|
584
643
|
|
|
644
|
+
enrichVar('PUBLIC_OTEL_OPT_OUT', config.publicMetricsOptOut.toString());
|
|
645
|
+
|
|
585
646
|
// Deployment stuff
|
|
586
647
|
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
587
648
|
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
588
649
|
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
589
650
|
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
651
|
+
enrichVar('AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET', config.lagInEpochsForValidatorSet.toString());
|
|
652
|
+
enrichVar('AZTEC_LAG_IN_EPOCHS_FOR_RANDAO', config.lagInEpochsForRandao.toString());
|
|
653
|
+
enrichVar('AZTEC_INBOX_LAG', config.inboxLag.toString());
|
|
590
654
|
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
591
655
|
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
592
656
|
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
@@ -604,6 +668,7 @@ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
|
604
668
|
enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
|
|
605
669
|
enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
|
|
606
670
|
enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
|
|
671
|
+
enrichVar('AZTEC_SLASHING_DISABLE_DURATION', config.slashingDisableDuration.toString());
|
|
607
672
|
enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
|
|
608
673
|
enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
|
|
609
674
|
|
|
@@ -621,6 +686,8 @@ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
|
621
686
|
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
|
|
622
687
|
enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
|
|
623
688
|
enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
|
|
689
|
+
enrichVar('SLASH_GRACE_PERIOD_L2_SLOTS', config.slashGracePeriodL2Slots.toString());
|
|
690
|
+
enrichVar('SLASH_EXECUTE_ROUNDS_LOOK_BACK', config.slashExecuteRoundsLookBack.toString());
|
|
624
691
|
|
|
625
692
|
enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
|
|
626
693
|
enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
2
|
+
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
|
+
import { getL1ContractsConfig } from '@aztec/ethereum/queries';
|
|
2
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
6
|
|
|
4
7
|
export async function getL1Config(
|
|
@@ -8,27 +8,67 @@ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
|
8
8
|
|
|
9
9
|
const DEFAULT_CONFIG_URL =
|
|
10
10
|
'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
|
|
11
|
+
const FALLBACK_CONFIG_URL = 'https://metadata.aztec.network/network_config.json';
|
|
11
12
|
const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Fetches remote network configuration from GitHub with caching support.
|
|
15
|
-
* Uses the reusable cachedFetch utility.
|
|
16
|
+
* Uses the reusable cachedFetch utility. Falls back to metadata.aztec.network if the default URL fails.
|
|
16
17
|
*
|
|
17
18
|
* @param networkName - The network name to fetch config for
|
|
18
19
|
* @param cacheDir - Optional cache directory for storing fetched config
|
|
19
|
-
* @returns Remote configuration for the specified network, or undefined if not found
|
|
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
|
|
20
22
|
*/
|
|
21
23
|
export async function getNetworkConfig(
|
|
22
24
|
networkName: NetworkNames,
|
|
23
25
|
cacheDir?: string,
|
|
24
26
|
): Promise<NetworkConfig | undefined> {
|
|
25
|
-
|
|
27
|
+
// Try with the primary URL (env var or default)
|
|
26
28
|
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
let primaryError: Error | undefined;
|
|
31
|
+
let config: NetworkConfig | undefined;
|
|
32
|
+
|
|
33
|
+
// First try the primary config location
|
|
34
|
+
try {
|
|
35
|
+
config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
primaryError = error as Error;
|
|
30
38
|
}
|
|
31
39
|
|
|
40
|
+
// If primary fails and we were using the default URL, try the fallback
|
|
41
|
+
if (!config && configLocation === DEFAULT_CONFIG_URL) {
|
|
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;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Helper function to fetch network config from a specific URL.
|
|
60
|
+
* @param configLocation - The URL or file path to fetch from
|
|
61
|
+
* @param networkName - The network name to fetch config for
|
|
62
|
+
* @param cacheDir - Optional cache directory for storing fetched config
|
|
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
|
|
65
|
+
*/
|
|
66
|
+
async function fetchNetworkConfigFromUrl(
|
|
67
|
+
configLocation: string,
|
|
68
|
+
networkName: NetworkNames,
|
|
69
|
+
cacheDir?: string,
|
|
70
|
+
): Promise<NetworkConfig | undefined> {
|
|
71
|
+
let url: URL | undefined;
|
|
32
72
|
try {
|
|
33
73
|
if (configLocation.includes('://')) {
|
|
34
74
|
url = new URL(configLocation);
|
|
@@ -43,31 +83,27 @@ export async function getNetworkConfig(
|
|
|
43
83
|
return undefined;
|
|
44
84
|
}
|
|
45
85
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
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
|
+
}
|
|
59
98
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
99
|
+
if (!rawConfig) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
63
102
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
} catch {
|
|
103
|
+
const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
|
|
104
|
+
if (networkName in networkConfigMap) {
|
|
105
|
+
return networkConfigMap[networkName];
|
|
106
|
+
} else {
|
|
71
107
|
return undefined;
|
|
72
108
|
}
|
|
73
109
|
}
|
|
@@ -78,6 +114,8 @@ export async function getNetworkConfig(
|
|
|
78
114
|
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
79
115
|
*
|
|
80
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
|
|
81
119
|
*/
|
|
82
120
|
export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
|
|
83
121
|
if (networkName === 'local') {
|
|
@@ -88,7 +126,7 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
|
|
|
88
126
|
const networkConfig = await getNetworkConfig(networkName, cacheDir);
|
|
89
127
|
|
|
90
128
|
if (!networkConfig) {
|
|
91
|
-
return;
|
|
129
|
+
return; // Network not found in config, continue without enriching
|
|
92
130
|
}
|
|
93
131
|
|
|
94
132
|
enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
|
|
@@ -99,4 +137,11 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
|
|
|
99
137
|
if (networkConfig.feeAssetHandlerAddress) {
|
|
100
138
|
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', networkConfig.feeAssetHandlerAddress.toString());
|
|
101
139
|
}
|
|
140
|
+
|
|
141
|
+
if (networkConfig.blobFileStoreUrls?.length) {
|
|
142
|
+
enrichVar('BLOB_FILE_STORE_URLS', networkConfig.blobFileStoreUrls.join(','));
|
|
143
|
+
}
|
|
144
|
+
if (networkConfig.blockDurationMs !== undefined) {
|
|
145
|
+
enrichVar('SEQ_BLOCK_DURATION_MS', String(networkConfig.blockDurationMs));
|
|
146
|
+
}
|
|
102
147
|
}
|