@aztec/cli 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114

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.
@@ -1,694 +1,57 @@
1
- import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum/config';
2
- import type { L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils/config';
3
1
  import type { NetworkNames } from '@aztec/foundation/config';
4
- import { EthAddress } from '@aztec/foundation/eth-address';
5
- import type { SharedNodeConfig } from '@aztec/node-lib/config';
6
- import type { P2PConfig } from '@aztec/p2p/config';
7
- import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
8
2
 
9
3
  import path from 'path';
10
4
 
11
- import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
12
- import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
5
+ import { devnetConfig, mainnetConfig, testnetConfig } from './generated/networks.js';
13
6
 
14
- const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
7
+ type NetworkConfigEnv = Record<string, string | number | boolean>;
15
8
 
16
- const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
17
- const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
18
-
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'> & {
23
- l1ChainId: number;
24
- testAccounts: boolean;
25
- sponsoredFPC: boolean;
26
- minTxsPerBlock: number;
27
- maxTxsPerBlock: number;
28
- realProofs: boolean;
29
- snapshotsUrls: string[];
30
- autoUpdate: SharedNodeConfig['autoUpdate'];
31
- autoUpdateUrl?: string;
32
- maxPendingTxCount: number;
33
- publicMetricsOptOut: boolean;
34
- publicIncludeMetrics?: string[];
35
- publicMetricsCollectorUrl?: string;
36
- publicMetricsCollectFrom?: string[];
37
- skipArchiverInitialSync?: boolean;
38
- blobAllowEmptySources?: boolean;
39
-
40
- // Setting the dataStoreMapSize provides the default for every DB in the node.
41
- // Then we explicitly override the sizes for the archiver and the larger trees.
42
- dataStoreMapSizeKb: number;
43
- archiverStoreMapSizeKb: number;
44
- noteHashTreeMapSizeKb: number;
45
- nullifierTreeMapSizeKb: number;
46
- publicDataTreeMapSizeKb: number;
47
-
48
- // Control whether sentinel is enabled or not. Needed for slashing
49
- sentinelEnabled: boolean;
50
- disableTransactions: boolean;
51
- };
52
-
53
- const DefaultSlashConfig = {
54
- /** Tally-style slashing */
55
- slasherFlavor: 'tally',
56
- /** Allow one round for vetoing */
57
- slashingExecutionDelayInRounds: 1,
58
- /** How long for a slash payload to be executed */
59
- slashingLifetimeInRounds: 5,
60
- /** Allow 2 rounds to discover faults */
61
- slashingOffsetInRounds: 2,
62
- /** No slash vetoer */
63
- slashingVetoer: EthAddress.ZERO,
64
- /** Use default disable duration */
65
- slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
66
- /** Use default slash amounts */
67
- slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
68
- slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
69
- slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
70
-
71
- // Slashing stuff
72
- slashMinPenaltyPercentage: 0.5,
73
- slashMaxPenaltyPercentage: 2.0,
74
- slashInactivityTargetPercentage: 0.7,
75
- slashInactivityConsecutiveEpochThreshold: 1,
76
- slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
77
- slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
78
- slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
79
- slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
80
- slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
81
- slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
82
- slashBroadcastedInvalidBlockPenalty: 0n, // DefaultL1ContractsConfig.slashAmountSmall // Disabled until further testing
83
- slashMaxPayloadSize: 50,
84
- slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
85
- slashOffenseExpirationRounds: 8,
86
- sentinelEnabled: true,
87
- slashExecuteRoundsLookBack: 4,
88
- } satisfies Partial<L2ChainConfig>;
89
-
90
- const DefaultNetworkDBMapSizeConfig = {
91
- dataStoreMapSizeKb: defaultDBMapSizeKb,
92
- archiverStoreMapSizeKb: tbMapSizeKb,
93
- noteHashTreeMapSizeKb: tbMapSizeKb,
94
- nullifierTreeMapSizeKb: tbMapSizeKb,
95
- publicDataTreeMapSizeKb: tbMapSizeKb,
96
- } satisfies Partial<L2ChainConfig>;
97
-
98
- export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
99
- l1ChainId: 11155111,
100
- testAccounts: false,
101
- sponsoredFPC: false,
102
- disableTransactions: true,
103
- p2pEnabled: true,
104
- bootstrapNodes: [],
105
- minTxsPerBlock: 0,
106
- maxTxsPerBlock: 0,
107
- buildCheckpointIfEmpty: true,
108
- realProofs: true,
109
- snapshotsUrls: [`${SNAPSHOTS_URL}/staging-ignition/`],
110
- autoUpdate: 'config-and-version',
111
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
112
- maxPendingTxCount: 0,
113
- publicMetricsOptOut: false,
114
- publicIncludeMetrics,
115
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
116
- publicMetricsCollectFrom: ['sequencer'],
117
- txPoolDeleteTxsAfterReorg: false,
118
- blobAllowEmptySources: true,
119
-
120
- /** How many seconds an L1 slot lasts. */
121
- ethereumSlotDuration: 12,
122
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
123
- aztecSlotDuration: 72,
124
- /** How many L2 slots an epoch lasts. */
125
- aztecEpochDuration: 32,
126
- /** The target validator committee size. */
127
- aztecTargetCommitteeSize: 24,
128
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
134
- /** The number of epochs after an epoch ends that proofs are still accepted. */
135
- aztecProofSubmissionEpochs: 1,
136
- /** How many sequencers must agree with a slash for it to be executed. */
137
- slashingQuorum: 65,
138
-
139
- slashingRoundSizeInEpochs: 4,
140
- slashingLifetimeInRounds: 40,
141
- slashingExecutionDelayInRounds: 28,
142
- slashAmountSmall: 2_000n * 10n ** 18n,
143
- slashAmountMedium: 10_000n * 10n ** 18n,
144
- slashAmountLarge: 50_000n * 10n ** 18n,
145
- slashingOffsetInRounds: 2,
146
- slasherFlavor: 'tally',
147
- slashingVetoer: EthAddress.ZERO,
148
-
149
- /** The mana target for the rollup */
150
- manaTarget: 0n,
151
-
152
- exitDelaySeconds: 5 * 24 * 60 * 60,
153
-
154
- /** The proving cost per mana */
155
- provingCostPerMana: 0n,
156
- localEjectionThreshold: 196_000n * 10n ** 18n,
157
-
158
- ejectionThreshold: 100_000n * 10n ** 18n,
159
- activationThreshold: 200_000n * 10n ** 18n,
160
-
161
- governanceProposerRoundSize: 300,
162
- governanceProposerQuorum: 151,
163
-
164
- // Node slashing config
165
- slashMinPenaltyPercentage: 0.5,
166
- slashMaxPenaltyPercentage: 2.0,
167
- slashInactivityTargetPercentage: 0.7,
168
- slashInactivityConsecutiveEpochThreshold: 2,
169
- slashInactivityPenalty: 2_000n * 10n ** 18n,
170
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
171
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
172
- slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
173
- slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
174
- slashUnknownPenalty: 2_000n * 10n ** 18n,
175
- slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
176
- slashMaxPayloadSize: 50,
177
- slashGracePeriodL2Slots: 32 * 4, // One round from genesis
178
- slashOffenseExpirationRounds: 8,
179
- sentinelEnabled: true,
180
- slashingDisableDuration: 5 * 24 * 60 * 60,
181
- slashExecuteRoundsLookBack: 4,
182
-
183
- ...DefaultNetworkDBMapSizeConfig,
9
+ const NetworkConfigs: Partial<Record<NetworkNames, NetworkConfigEnv>> = {
10
+ devnet: devnetConfig,
11
+ testnet: testnetConfig,
12
+ mainnet: mainnetConfig,
184
13
  };
185
14
 
186
- export const stagingPublicL2ChainConfig: L2ChainConfig = {
187
- l1ChainId: 11155111,
188
- testAccounts: false,
189
- sponsoredFPC: true,
190
- disableTransactions: false,
191
- p2pEnabled: true,
192
- bootstrapNodes: [],
193
- minTxsPerBlock: 0,
194
- maxTxsPerBlock: 20,
195
- buildCheckpointIfEmpty: true,
196
- realProofs: true,
197
- snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`],
198
- autoUpdate: 'config-and-version',
199
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
200
- publicMetricsOptOut: false,
201
- publicIncludeMetrics,
202
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
203
- publicMetricsCollectFrom: ['sequencer'],
204
- maxPendingTxCount: 1_000, // ~156MB
205
- txPoolDeleteTxsAfterReorg: true,
206
-
207
- // Deployment stuff
208
- /** How many seconds an L1 slot lasts. */
209
- ethereumSlotDuration: 12,
210
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
211
- aztecSlotDuration: 36,
212
- /** How many L2 slots an epoch lasts. */
213
- aztecEpochDuration: 32,
214
- /** The target validator committee size. */
215
- aztecTargetCommitteeSize: 48,
216
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
222
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
223
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
224
- /** The number of epochs after an epoch ends that proofs are still accepted. */
225
- aztecProofSubmissionEpochs: 1,
226
- /** The deposit amount for a validator */
227
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
228
- /** The minimum stake for a validator. */
229
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
230
- /** The slashing round size */
231
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
232
- /** Governance proposing round size */
233
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
234
- /** The mana target for the rollup */
235
- manaTarget: DefaultL1ContractsConfig.manaTarget,
236
- /** The proving cost per mana */
237
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
238
- /** Exit delay for stakers */
239
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
240
-
241
- ...DefaultSlashConfig,
242
-
243
- ...DefaultNetworkDBMapSizeConfig,
244
- };
245
-
246
- export const nextNetL2ChainConfig: L2ChainConfig = {
247
- l1ChainId: 11155111,
248
- testAccounts: true,
249
- sponsoredFPC: true,
250
- p2pEnabled: true,
251
- disableTransactions: false,
252
- bootstrapNodes: [],
253
- minTxsPerBlock: 0,
254
- maxTxsPerBlock: 8,
255
- buildCheckpointIfEmpty: true,
256
- realProofs: true,
257
- snapshotsUrls: [],
258
- autoUpdate: 'config-and-version',
259
- autoUpdateUrl: '',
260
- publicMetricsOptOut: true,
261
- publicIncludeMetrics,
262
- publicMetricsCollectorUrl: '',
263
- publicMetricsCollectFrom: [''],
264
- maxPendingTxCount: 1_000, // ~156MB
265
- txPoolDeleteTxsAfterReorg: false,
266
-
267
- // Deployment stuff
268
- /** How many seconds an L1 slot lasts. */
269
- ethereumSlotDuration: 12,
270
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
271
- aztecSlotDuration: 36,
272
- /** How many L2 slots an epoch lasts. */
273
- aztecEpochDuration: 32,
274
- /** The target validator committee size. */
275
- aztecTargetCommitteeSize: 48,
276
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
282
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
283
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
284
- /** The number of epochs after an epoch ends that proofs are still accepted. */
285
- aztecProofSubmissionEpochs: 1,
286
- /** The deposit amount for a validator */
287
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
288
- /** The minimum stake for a validator. */
289
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
290
- /** The slashing round size */
291
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
292
- /** Governance proposing round size */
293
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
294
- /** The mana target for the rollup */
295
- manaTarget: DefaultL1ContractsConfig.manaTarget,
296
- /** The proving cost per mana */
297
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
298
- /** Exit delay for stakers */
299
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
300
-
301
- ...DefaultSlashConfig,
302
-
303
- ...DefaultNetworkDBMapSizeConfig,
304
- };
305
-
306
- export const testnetL2ChainConfig: L2ChainConfig = {
307
- l1ChainId: 11155111,
308
- testAccounts: false,
309
- sponsoredFPC: true,
310
- p2pEnabled: true,
311
- disableTransactions: false,
312
- bootstrapNodes: [],
313
- minTxsPerBlock: 0,
314
- maxTxsPerBlock: 20,
315
- buildCheckpointIfEmpty: true,
316
- realProofs: true,
317
- snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
318
- autoUpdate: 'config-and-version',
319
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
320
- maxPendingTxCount: 5_000, // ~760MB
321
- publicMetricsOptOut: false,
322
- publicIncludeMetrics,
323
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
324
- publicMetricsCollectFrom: ['sequencer'],
325
- txPoolDeleteTxsAfterReorg: true,
326
- skipArchiverInitialSync: true,
327
- blobAllowEmptySources: true,
328
-
329
- /** How many seconds an L1 slot lasts. */
330
- ethereumSlotDuration: 12,
331
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
332
- aztecSlotDuration: 72,
333
- /** How many L2 slots an epoch lasts. */
334
- aztecEpochDuration: 32,
335
- /** The target validator committee size. */
336
- aztecTargetCommitteeSize: 48,
337
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
343
- /** The number of epochs after an epoch ends that proofs are still accepted. */
344
- aztecProofSubmissionEpochs: 1,
345
-
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,
348
- /** How many sequencers must agree with a slash for it to be executed. */
349
- slashingQuorum: 33,
350
- slashingRoundSizeInEpochs: 2,
351
- slashingExecutionDelayInRounds: 2,
352
- slashingLifetimeInRounds: 5,
353
- slashingVetoer: EthAddress.fromString('0xdfe19Da6a717b7088621d8bBB66be59F2d78e924'),
354
- slashingOffsetInRounds: 2,
355
-
356
- slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days
357
- slasherFlavor: 'tally',
358
-
359
- slashAmountSmall: 10_000n * 10n ** 18n,
360
- slashAmountMedium: 50_000n * 10n ** 18n,
361
- slashAmountLarge: 200_000n * 10n ** 18n,
362
-
363
- /** The mana target for the rollup */
364
- manaTarget: 150_000_000n,
365
-
366
- /** The proving cost per mana */
367
- provingCostPerMana: 100n,
368
-
369
- exitDelaySeconds: 4 * 24 * 60 * 60, // 4 days
370
-
371
- activationThreshold: 200_000n * 10n ** 18n,
372
- ejectionThreshold: 100_000n * 10n ** 18n,
373
-
374
- governanceProposerRoundSize: 100,
375
- governanceProposerQuorum: 60,
376
-
377
- // Node slashing config
378
- slashInactivityTargetPercentage: 0.8,
379
- slashInactivityConsecutiveEpochThreshold: 2,
380
- slashInactivityPenalty: 10_000n * 10n ** 18n,
381
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
382
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
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
387
- slashGracePeriodL2Slots: 1_200, // One day from deployment
388
- slashOffenseExpirationRounds: 8,
389
-
390
- slashMinPenaltyPercentage: 0.5,
391
- slashMaxPenaltyPercentage: 2.0,
392
- slashMaxPayloadSize: 50,
393
- slashExecuteRoundsLookBack: 4,
394
-
395
- sentinelEnabled: true,
396
-
397
- ...DefaultNetworkDBMapSizeConfig,
398
- };
399
-
400
- export const mainnetL2ChainConfig: L2ChainConfig = {
401
- txPoolDeleteTxsAfterReorg: true,
402
- disableTransactions: true,
403
-
404
- l1ChainId: 1,
405
- testAccounts: false,
406
- sponsoredFPC: false,
407
- p2pEnabled: true,
408
- bootstrapNodes: [],
409
- minTxsPerBlock: 0,
410
- maxTxsPerBlock: 0,
411
- buildCheckpointIfEmpty: true,
412
- realProofs: true,
413
- snapshotsUrls: [`${SNAPSHOTS_URL}/mainnet/`],
414
- autoUpdate: 'notify',
415
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
416
- maxPendingTxCount: 0,
417
- publicMetricsOptOut: true,
418
- publicIncludeMetrics,
419
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
420
- publicMetricsCollectFrom: ['sequencer'],
421
- blobAllowEmptySources: true,
422
-
423
- /** How many seconds an L1 slot lasts. */
424
- ethereumSlotDuration: 12,
425
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
426
- aztecSlotDuration: 72,
427
- /** How many L2 slots an epoch lasts. */
428
- aztecEpochDuration: 32,
429
- /** The target validator committee size. */
430
- aztecTargetCommitteeSize: 24,
431
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
437
- /** The number of epochs after an epoch ends that proofs are still accepted. */
438
- aztecProofSubmissionEpochs: 1,
439
-
440
- localEjectionThreshold: 196_000n * 10n ** 18n,
441
- /** How many sequencers must agree with a slash for it to be executed. */
442
- slashingQuorum: 65,
443
- slashingRoundSizeInEpochs: 4,
444
- slashingExecutionDelayInRounds: 28,
445
- slashingLifetimeInRounds: 34,
446
- slashingVetoer: EthAddress.fromString('0xBbB4aF368d02827945748b28CD4b2D42e4A37480'),
447
- slashingOffsetInRounds: 2,
448
-
449
- slashingDisableDuration: 259_200, // 3 days
450
- slasherFlavor: 'tally',
451
-
452
- slashAmountSmall: 2_000n * 10n ** 18n,
453
- slashAmountMedium: 2_000n * 10n ** 18n,
454
- slashAmountLarge: 2_000n * 10n ** 18n,
455
-
456
- /** The mana target for the rollup */
457
- manaTarget: 0n,
458
-
459
- /** The proving cost per mana */
460
- provingCostPerMana: 0n,
461
-
462
- exitDelaySeconds: 4 * 24 * 60 * 60, // 4 days
463
-
464
- activationThreshold: 200_000n * 10n ** 18n,
465
- ejectionThreshold: 100_000n * 10n ** 18n,
466
-
467
- governanceProposerRoundSize: 1000,
468
- governanceProposerQuorum: 600,
469
-
470
- // Node slashing config
471
- slashInactivityTargetPercentage: 0.8,
472
- slashInactivityConsecutiveEpochThreshold: 2,
473
- slashInactivityPenalty: 2_000n * 10n ** 18n,
474
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
475
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
476
- slashProposeInvalidAttestationsPenalty: 2_000n * 10n ** 18n,
477
- slashAttestDescendantOfInvalidPenalty: 2_000n * 10n ** 18n,
478
- slashUnknownPenalty: 2_000n * 10n ** 18n,
479
- slashBroadcastedInvalidBlockPenalty: 2_000n * 10n ** 18n, // 10_000n * 10n ** 18n, Disabled for now until further testing
480
- slashGracePeriodL2Slots: 1_200, // One day from deployment
481
- slashOffenseExpirationRounds: 8,
482
-
483
- slashMinPenaltyPercentage: 0.5,
484
- slashMaxPenaltyPercentage: 2.0,
485
- slashMaxPayloadSize: 50,
486
- slashExecuteRoundsLookBack: 4,
487
-
488
- sentinelEnabled: true,
489
-
490
- ...DefaultNetworkDBMapSizeConfig,
491
- };
492
-
493
- export const devnetL2ChainConfig: L2ChainConfig = {
494
- l1ChainId: 11155111,
495
- testAccounts: true,
496
- sponsoredFPC: true,
497
- p2pEnabled: true,
498
- disableTransactions: false,
499
- bootstrapNodes: [],
500
- minTxsPerBlock: 0,
501
- maxTxsPerBlock: 8,
502
- buildCheckpointIfEmpty: true,
503
- realProofs: false,
504
- snapshotsUrls: [],
505
- autoUpdate: 'config-and-version',
506
- autoUpdateUrl: '',
507
- publicMetricsOptOut: true,
508
- publicIncludeMetrics,
509
- publicMetricsCollectorUrl: '',
510
- publicMetricsCollectFrom: [''],
511
- maxPendingTxCount: 1_000, // ~156MB
512
- txPoolDeleteTxsAfterReorg: true,
513
-
514
- // Deployment stuff
515
- /** How many seconds an L1 slot lasts. */
516
- ethereumSlotDuration: 12,
517
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
518
- aztecSlotDuration: 36,
519
- /** How many L2 slots an epoch lasts. */
520
- aztecEpochDuration: 8,
521
- /** The target validator committee size. */
522
- aztecTargetCommitteeSize: 1,
523
- /** The number of epochs to lag behind the current epoch for validator selection. */
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,
529
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
530
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
531
- /** The number of epochs after an epoch ends that proofs are still accepted. */
532
- aztecProofSubmissionEpochs: 1,
533
- /** The deposit amount for a validator */
534
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
535
- /** The minimum stake for a validator. */
536
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
537
- /** The slashing round size */
538
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
539
- /** Governance proposing round size */
540
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
541
- /** The mana target for the rollup */
542
- manaTarget: DefaultL1ContractsConfig.manaTarget,
543
- /** The proving cost per mana */
544
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
545
- /** Exit delay for stakers */
546
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
547
-
548
- ...DefaultSlashConfig,
549
-
550
- ...DefaultNetworkDBMapSizeConfig,
551
- };
552
-
553
- export function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined {
554
- let config: L2ChainConfig | undefined;
555
- if (networkName === 'staging-public') {
556
- config = { ...stagingPublicL2ChainConfig };
557
- } else if (networkName === 'testnet') {
558
- config = { ...testnetL2ChainConfig };
559
- } else if (networkName === 'staging-ignition') {
560
- config = { ...stagingIgnitionL2ChainConfig };
561
- } else if (networkName === 'mainnet') {
562
- config = { ...mainnetL2ChainConfig };
563
- } else if (networkName === 'next-net') {
564
- config = { ...nextNetL2ChainConfig };
565
- } else if (networkName === 'devnet') {
566
- config = { ...devnetL2ChainConfig };
15
+ function enrichEnvironmentWithNetworkConfig(config: NetworkConfigEnv): void {
16
+ for (const [key, value] of Object.entries(config)) {
17
+ if (process.env[key] === undefined && value !== undefined) {
18
+ process.env[key] = String(value);
19
+ }
567
20
  }
568
- return config;
569
21
  }
570
22
 
571
23
  function getDefaultDataDir(networkName: NetworkNames): string {
572
24
  return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
573
25
  }
574
26
 
27
+ /**
28
+ * Sets up environment for the given network.
29
+ *
30
+ * For 'local' network: returns early, using hardcoded defaults from DefaultL1ContractsConfig
31
+ * and DefaultSlasherConfig (which match the 'defaults' section of defaults.yml).
32
+ *
33
+ * For deployed networks: applies network configuration from generated defaults.yml,
34
+ * merging base defaults with network-specific overrides.
35
+ *
36
+ * @param networkName - The network name
37
+ */
575
38
  export function enrichEnvironmentWithChainName(networkName: NetworkNames) {
39
+ // For 'local', we don't inject any env vars - use hardcoded TypeScript/Solidity defaults
40
+ // These defaults are defined in defaults.yml 'defaults' section and match:
41
+ // - DefaultL1ContractsConfig (yarn-project/ethereum/src/config.ts)
42
+ // - Solidity vm.envOr defaults (l1-contracts/script/deploy/RollupConfiguration.sol)
576
43
  if (networkName === 'local') {
577
44
  return;
578
45
  }
579
46
 
580
- enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
581
- const config = getL2ChainConfig(networkName);
582
-
583
- if (!config) {
584
- throw new Error(`Unknown network name: ${networkName}`);
585
- }
586
-
587
- enrichEnvironmentWithChainConfig(config);
588
- }
589
-
590
- export function enrichEnvironmentWithChainConfig(config: L2ChainConfig) {
591
- enrichVar('BOOTSTRAP_NODES', config.bootstrapNodes.join(','));
592
- enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
593
- enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
594
- enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
595
- enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
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
- }
604
- enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
605
- enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
606
- enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
607
- enrichVar('P2P_MAX_PENDING_TX_COUNT', config.maxPendingTxCount.toString());
608
- enrichVar('P2P_TX_POOL_DELETE_TXS_AFTER_REORG', config.txPoolDeleteTxsAfterReorg.toString());
609
-
610
- enrichVar('DATA_STORE_MAP_SIZE_KB', config.dataStoreMapSizeKb.toString());
611
- enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
612
- enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
613
- enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
614
- enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
615
-
616
- if (config.skipArchiverInitialSync !== undefined) {
617
- enrichVar('SKIP_ARCHIVER_INITIAL_SYNC', config.skipArchiverInitialSync.toString());
618
- }
619
-
620
- if (config.blobAllowEmptySources !== undefined) {
621
- enrichVar('BLOB_ALLOW_EMPTY_SOURCES', config.blobAllowEmptySources.toString());
622
- }
623
-
624
- if (config.autoUpdate) {
625
- enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
47
+ // Apply generated network config from defaults.yml
48
+ const generatedConfig = NetworkConfigs[networkName];
49
+ if (generatedConfig) {
50
+ enrichEnvironmentWithNetworkConfig(generatedConfig);
626
51
  }
627
52
 
628
- if (config.autoUpdateUrl) {
629
- enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
53
+ // Set DATA_DIRECTORY if not already set
54
+ if (process.env['DATA_DIRECTORY'] === undefined) {
55
+ process.env['DATA_DIRECTORY'] = getDefaultDataDir(networkName);
630
56
  }
631
-
632
- if (config.publicIncludeMetrics) {
633
- enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
634
- }
635
-
636
- if (config.publicMetricsCollectorUrl) {
637
- enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
638
- }
639
-
640
- if (config.publicMetricsCollectFrom) {
641
- enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
642
- }
643
-
644
- enrichVar('PUBLIC_OTEL_OPT_OUT', config.publicMetricsOptOut.toString());
645
-
646
- // Deployment stuff
647
- enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
648
- enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
649
- enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
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());
654
- enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
655
- enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
656
- enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
657
- enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
658
- enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
659
- enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
660
- enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
661
- enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
662
- enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
663
- enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
664
- enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
665
- enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
666
- enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
667
- enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
668
- enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
669
- enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
670
- enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
671
- enrichVar('AZTEC_SLASHING_DISABLE_DURATION', config.slashingDisableDuration.toString());
672
- enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
673
- enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
674
-
675
- // Slashing
676
- enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
677
- enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
678
- enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
679
- enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
680
- enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
681
- enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
682
- enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
683
- enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
684
- enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
685
- enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
686
- enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
687
- enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
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());
691
-
692
- enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
693
- enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
694
57
  }