@aztec/cli 0.0.1-commit.03f7ef2 → 0.0.1-commit.08c5969dc

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 (48) hide show
  1. package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
  2. package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
  3. package/dest/cmds/aztec_node/{get_current_base_fee.js → get_current_min_fee.js} +2 -2
  4. package/dest/cmds/aztec_node/index.js +3 -3
  5. package/dest/cmds/infrastructure/sequencers.d.ts +1 -1
  6. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  7. package/dest/cmds/infrastructure/sequencers.js +2 -1
  8. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  9. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  10. package/dest/cmds/infrastructure/setup_l2_contract.js +4 -3
  11. package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
  12. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  13. package/dest/cmds/l1/assume_proven_through.js +3 -5
  14. package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
  15. package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
  16. package/dest/cmds/l1/compute_genesis_values.js +17 -0
  17. package/dest/cmds/l1/index.d.ts +1 -1
  18. package/dest/cmds/l1/index.d.ts.map +1 -1
  19. package/dest/cmds/l1/index.js +7 -2
  20. package/dest/cmds/l1/update_l1_validators.d.ts +3 -3
  21. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  22. package/dest/cmds/l1/update_l1_validators.js +47 -12
  23. package/dest/config/chain_l2_config.d.ts +12 -39
  24. package/dest/config/chain_l2_config.d.ts.map +1 -1
  25. package/dest/config/chain_l2_config.js +33 -505
  26. package/dest/config/generated/networks.d.ts +211 -0
  27. package/dest/config/generated/networks.d.ts.map +1 -0
  28. package/dest/config/generated/networks.js +212 -0
  29. package/dest/config/network_config.d.ts +1 -1
  30. package/dest/config/network_config.js +1 -1
  31. package/dest/utils/inspect.d.ts +1 -1
  32. package/dest/utils/inspect.d.ts.map +1 -1
  33. package/dest/utils/inspect.js +4 -1
  34. package/package.json +35 -30
  35. package/src/cmds/aztec_node/{get_current_base_fee.ts → get_current_min_fee.ts} +2 -2
  36. package/src/cmds/aztec_node/index.ts +3 -3
  37. package/src/cmds/infrastructure/sequencers.ts +2 -1
  38. package/src/cmds/infrastructure/setup_l2_contract.ts +5 -4
  39. package/src/cmds/l1/assume_proven_through.ts +4 -7
  40. package/src/cmds/l1/compute_genesis_values.ts +29 -0
  41. package/src/cmds/l1/index.ts +23 -4
  42. package/src/cmds/l1/update_l1_validators.ts +41 -15
  43. package/src/config/chain_l2_config.ts +33 -657
  44. package/src/config/generated/networks.ts +216 -0
  45. package/src/config/network_config.ts +1 -1
  46. package/src/utils/inspect.ts +4 -1
  47. package/dest/cmds/aztec_node/get_current_base_fee.d.ts +0 -3
  48. package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +0 -1
@@ -1,681 +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
- maxTxPoolSize: 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
- maxTxPoolSize: 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 epochs after an epoch ends that proofs are still accepted. */
133
- aztecProofSubmissionEpochs: 1,
134
- /** How many sequencers must agree with a slash for it to be executed. */
135
- slashingQuorum: 65,
136
-
137
- slashingRoundSizeInEpochs: 4,
138
- slashingLifetimeInRounds: 40,
139
- slashingExecutionDelayInRounds: 28,
140
- slashAmountSmall: 2_000n * 10n ** 18n,
141
- slashAmountMedium: 10_000n * 10n ** 18n,
142
- slashAmountLarge: 50_000n * 10n ** 18n,
143
- slashingOffsetInRounds: 2,
144
- slasherFlavor: 'tally',
145
- slashingVetoer: EthAddress.ZERO,
146
-
147
- /** The mana target for the rollup */
148
- manaTarget: 0n,
149
-
150
- exitDelaySeconds: 5 * 24 * 60 * 60,
151
-
152
- /** The proving cost per mana */
153
- provingCostPerMana: 0n,
154
- localEjectionThreshold: 196_000n * 10n ** 18n,
155
-
156
- ejectionThreshold: 100_000n * 10n ** 18n,
157
- activationThreshold: 200_000n * 10n ** 18n,
158
-
159
- governanceProposerRoundSize: 300,
160
- governanceProposerQuorum: 151,
161
-
162
- // Node slashing config
163
- slashMinPenaltyPercentage: 0.5,
164
- slashMaxPenaltyPercentage: 2.0,
165
- slashInactivityTargetPercentage: 0.7,
166
- slashInactivityConsecutiveEpochThreshold: 2,
167
- slashInactivityPenalty: 2_000n * 10n ** 18n,
168
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
169
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
170
- slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
171
- slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
172
- slashUnknownPenalty: 2_000n * 10n ** 18n,
173
- slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
174
- slashMaxPayloadSize: 50,
175
- slashGracePeriodL2Slots: 32 * 4, // One round from genesis
176
- slashOffenseExpirationRounds: 8,
177
- sentinelEnabled: true,
178
- slashingDisableDuration: 5 * 24 * 60 * 60,
179
- slashExecuteRoundsLookBack: 4,
180
-
181
- ...DefaultNetworkDBMapSizeConfig,
9
+ const NetworkConfigs: Partial<Record<NetworkNames, NetworkConfigEnv>> = {
10
+ devnet: devnetConfig,
11
+ testnet: testnetConfig,
12
+ mainnet: mainnetConfig,
182
13
  };
183
14
 
184
- export const stagingPublicL2ChainConfig: L2ChainConfig = {
185
- l1ChainId: 11155111,
186
- testAccounts: false,
187
- sponsoredFPC: true,
188
- disableTransactions: false,
189
- p2pEnabled: true,
190
- bootstrapNodes: [],
191
- minTxsPerBlock: 0,
192
- maxTxsPerBlock: 20,
193
- buildCheckpointIfEmpty: true,
194
- realProofs: true,
195
- snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`],
196
- autoUpdate: 'config-and-version',
197
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
198
- publicMetricsOptOut: false,
199
- publicIncludeMetrics,
200
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
201
- publicMetricsCollectFrom: ['sequencer'],
202
- maxTxPoolSize: 100_000_000, // 100MB
203
- txPoolDeleteTxsAfterReorg: true,
204
-
205
- // Deployment stuff
206
- /** How many seconds an L1 slot lasts. */
207
- ethereumSlotDuration: 12,
208
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
209
- aztecSlotDuration: 36,
210
- /** How many L2 slots an epoch lasts. */
211
- aztecEpochDuration: 32,
212
- /** The target validator committee size. */
213
- aztecTargetCommitteeSize: 48,
214
- /** The number of epochs to lag behind the current epoch for validator selection. */
215
- lagInEpochsForValidatorSet: DefaultL1ContractsConfig.lagInEpochsForValidatorSet,
216
- /** The number of epochs to lag behind the current epoch for randao selection. */
217
- lagInEpochsForRandao: DefaultL1ContractsConfig.lagInEpochsForRandao,
218
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
219
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
220
- /** The number of epochs after an epoch ends that proofs are still accepted. */
221
- aztecProofSubmissionEpochs: 1,
222
- /** The deposit amount for a validator */
223
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
224
- /** The minimum stake for a validator. */
225
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
226
- /** The slashing round size */
227
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
228
- /** Governance proposing round size */
229
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
230
- /** The mana target for the rollup */
231
- manaTarget: DefaultL1ContractsConfig.manaTarget,
232
- /** The proving cost per mana */
233
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
234
- /** Exit delay for stakers */
235
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
236
-
237
- ...DefaultSlashConfig,
238
-
239
- ...DefaultNetworkDBMapSizeConfig,
240
- };
241
-
242
- export const nextNetL2ChainConfig: L2ChainConfig = {
243
- l1ChainId: 11155111,
244
- testAccounts: true,
245
- sponsoredFPC: true,
246
- p2pEnabled: true,
247
- disableTransactions: false,
248
- bootstrapNodes: [],
249
- minTxsPerBlock: 0,
250
- maxTxsPerBlock: 8,
251
- buildCheckpointIfEmpty: true,
252
- realProofs: true,
253
- snapshotsUrls: [],
254
- autoUpdate: 'config-and-version',
255
- autoUpdateUrl: '',
256
- publicMetricsOptOut: true,
257
- publicIncludeMetrics,
258
- publicMetricsCollectorUrl: '',
259
- publicMetricsCollectFrom: [''],
260
- maxTxPoolSize: 100_000_000, // 100MB
261
- txPoolDeleteTxsAfterReorg: false,
262
-
263
- // Deployment stuff
264
- /** How many seconds an L1 slot lasts. */
265
- ethereumSlotDuration: 12,
266
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
267
- aztecSlotDuration: 36,
268
- /** How many L2 slots an epoch lasts. */
269
- aztecEpochDuration: 32,
270
- /** The target validator committee size. */
271
- aztecTargetCommitteeSize: 48,
272
- /** The number of epochs to lag behind the current epoch for validator selection. */
273
- lagInEpochsForValidatorSet: DefaultL1ContractsConfig.lagInEpochsForValidatorSet,
274
- /** The number of epochs to lag behind the current epoch for randao selection. */
275
- lagInEpochsForRandao: DefaultL1ContractsConfig.lagInEpochsForRandao,
276
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
277
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
278
- /** The number of epochs after an epoch ends that proofs are still accepted. */
279
- aztecProofSubmissionEpochs: 1,
280
- /** The deposit amount for a validator */
281
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
282
- /** The minimum stake for a validator. */
283
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
284
- /** The slashing round size */
285
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
286
- /** Governance proposing round size */
287
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
288
- /** The mana target for the rollup */
289
- manaTarget: DefaultL1ContractsConfig.manaTarget,
290
- /** The proving cost per mana */
291
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
292
- /** Exit delay for stakers */
293
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
294
-
295
- ...DefaultSlashConfig,
296
-
297
- ...DefaultNetworkDBMapSizeConfig,
298
- };
299
-
300
- export const testnetL2ChainConfig: L2ChainConfig = {
301
- l1ChainId: 11155111,
302
- testAccounts: false,
303
- sponsoredFPC: true,
304
- p2pEnabled: true,
305
- disableTransactions: true,
306
- bootstrapNodes: [],
307
- minTxsPerBlock: 0,
308
- maxTxsPerBlock: 20,
309
- buildCheckpointIfEmpty: true,
310
- realProofs: true,
311
- snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
312
- autoUpdate: 'config-and-version',
313
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
314
- maxTxPoolSize: 100_000_000, // 100MB
315
- publicMetricsOptOut: false,
316
- publicIncludeMetrics,
317
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
318
- publicMetricsCollectFrom: ['sequencer'],
319
- txPoolDeleteTxsAfterReorg: true,
320
- skipArchiverInitialSync: true,
321
- blobAllowEmptySources: true,
322
-
323
- /** How many seconds an L1 slot lasts. */
324
- ethereumSlotDuration: 12,
325
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
326
- aztecSlotDuration: 72,
327
- /** How many L2 slots an epoch lasts. */
328
- aztecEpochDuration: 32,
329
- /** The target validator committee size. */
330
- aztecTargetCommitteeSize: 48,
331
- /** The number of epochs to lag behind the current epoch for validator selection. */
332
- lagInEpochsForValidatorSet: 2,
333
- /** The number of epochs to lag behind the current epoch for randao selection. */
334
- lagInEpochsForRandao: 2,
335
- /** The number of epochs after an epoch ends that proofs are still accepted. */
336
- aztecProofSubmissionEpochs: 1,
337
-
338
- // This is a diff from mainnet: we have 1-strike you're out, rather than 3 on mainnet.
339
- localEjectionThreshold: 199_000n * 10n ** 18n,
340
- /** How many sequencers must agree with a slash for it to be executed. */
341
- slashingQuorum: 33,
342
- slashingRoundSizeInEpochs: 2,
343
- slashingExecutionDelayInRounds: 2,
344
- slashingLifetimeInRounds: 5,
345
- slashingVetoer: EthAddress.fromString('0xdfe19Da6a717b7088621d8bBB66be59F2d78e924'),
346
- slashingOffsetInRounds: 2,
347
-
348
- slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days
349
- slasherFlavor: 'tally',
350
-
351
- slashAmountSmall: 10_000n * 10n ** 18n,
352
- slashAmountMedium: 50_000n * 10n ** 18n,
353
- slashAmountLarge: 200_000n * 10n ** 18n,
354
-
355
- /** The mana target for the rollup */
356
- manaTarget: 150_000_000n,
357
-
358
- /** The proving cost per mana */
359
- provingCostPerMana: 100n,
360
-
361
- exitDelaySeconds: 4 * 24 * 60 * 60, // 4 days
362
-
363
- activationThreshold: 200_000n * 10n ** 18n,
364
- ejectionThreshold: 100_000n * 10n ** 18n,
365
-
366
- governanceProposerRoundSize: 100,
367
- governanceProposerQuorum: 60,
368
-
369
- // Node slashing config
370
- slashInactivityTargetPercentage: 0.8,
371
- slashInactivityConsecutiveEpochThreshold: 2,
372
- slashInactivityPenalty: 10_000n * 10n ** 18n,
373
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
374
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
375
- slashProposeInvalidAttestationsPenalty: 10_000n * 10n ** 18n,
376
- slashAttestDescendantOfInvalidPenalty: 10_000n * 10n ** 18n,
377
- slashUnknownPenalty: 10_000n * 10n ** 18n,
378
- slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n, // 10_000n * 10n ** 18n, Disabled for now until further testing
379
- slashGracePeriodL2Slots: 1_200, // One day from deployment
380
- slashOffenseExpirationRounds: 8,
381
-
382
- slashMinPenaltyPercentage: 0.5,
383
- slashMaxPenaltyPercentage: 2.0,
384
- slashMaxPayloadSize: 50,
385
- slashExecuteRoundsLookBack: 4,
386
-
387
- sentinelEnabled: true,
388
-
389
- ...DefaultNetworkDBMapSizeConfig,
390
- };
391
-
392
- export const mainnetL2ChainConfig: L2ChainConfig = {
393
- txPoolDeleteTxsAfterReorg: true,
394
- disableTransactions: true,
395
-
396
- l1ChainId: 1,
397
- testAccounts: false,
398
- sponsoredFPC: false,
399
- p2pEnabled: true,
400
- bootstrapNodes: [],
401
- minTxsPerBlock: 0,
402
- maxTxsPerBlock: 0,
403
- buildCheckpointIfEmpty: true,
404
- realProofs: true,
405
- snapshotsUrls: [`${SNAPSHOTS_URL}/mainnet/`],
406
- autoUpdate: 'notify',
407
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
408
- maxTxPoolSize: 0,
409
- publicMetricsOptOut: true,
410
- publicIncludeMetrics,
411
- publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
412
- publicMetricsCollectFrom: ['sequencer'],
413
- blobAllowEmptySources: true,
414
-
415
- /** How many seconds an L1 slot lasts. */
416
- ethereumSlotDuration: 12,
417
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
418
- aztecSlotDuration: 72,
419
- /** How many L2 slots an epoch lasts. */
420
- aztecEpochDuration: 32,
421
- /** The target validator committee size. */
422
- aztecTargetCommitteeSize: 24,
423
- /** The number of epochs to lag behind the current epoch for validator selection. */
424
- lagInEpochsForValidatorSet: 2,
425
- /** The number of epochs to lag behind the current epoch for randao selection. */
426
- lagInEpochsForRandao: 2,
427
- /** The number of epochs after an epoch ends that proofs are still accepted. */
428
- aztecProofSubmissionEpochs: 1,
429
-
430
- localEjectionThreshold: 196_000n * 10n ** 18n,
431
- /** How many sequencers must agree with a slash for it to be executed. */
432
- slashingQuorum: 65,
433
- slashingRoundSizeInEpochs: 4,
434
- slashingExecutionDelayInRounds: 28,
435
- slashingLifetimeInRounds: 34,
436
- slashingVetoer: EthAddress.fromString('0xBbB4aF368d02827945748b28CD4b2D42e4A37480'),
437
- slashingOffsetInRounds: 2,
438
-
439
- slashingDisableDuration: 259_200, // 3 days
440
- slasherFlavor: 'tally',
441
-
442
- slashAmountSmall: 2_000n * 10n ** 18n,
443
- slashAmountMedium: 2_000n * 10n ** 18n,
444
- slashAmountLarge: 2_000n * 10n ** 18n,
445
-
446
- /** The mana target for the rollup */
447
- manaTarget: 0n,
448
-
449
- /** The proving cost per mana */
450
- provingCostPerMana: 0n,
451
-
452
- exitDelaySeconds: 4 * 24 * 60 * 60, // 4 days
453
-
454
- activationThreshold: 200_000n * 10n ** 18n,
455
- ejectionThreshold: 100_000n * 10n ** 18n,
456
-
457
- governanceProposerRoundSize: 1000,
458
- governanceProposerQuorum: 600,
459
-
460
- // Node slashing config
461
- slashInactivityTargetPercentage: 0.8,
462
- slashInactivityConsecutiveEpochThreshold: 2,
463
- slashInactivityPenalty: 2_000n * 10n ** 18n,
464
- slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
465
- slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
466
- slashProposeInvalidAttestationsPenalty: 2_000n * 10n ** 18n,
467
- slashAttestDescendantOfInvalidPenalty: 2_000n * 10n ** 18n,
468
- slashUnknownPenalty: 2_000n * 10n ** 18n,
469
- slashBroadcastedInvalidBlockPenalty: 2_000n * 10n ** 18n, // 10_000n * 10n ** 18n, Disabled for now until further testing
470
- slashGracePeriodL2Slots: 1_200, // One day from deployment
471
- slashOffenseExpirationRounds: 8,
472
-
473
- slashMinPenaltyPercentage: 0.5,
474
- slashMaxPenaltyPercentage: 2.0,
475
- slashMaxPayloadSize: 50,
476
- slashExecuteRoundsLookBack: 4,
477
-
478
- sentinelEnabled: true,
479
-
480
- ...DefaultNetworkDBMapSizeConfig,
481
- };
482
-
483
- export const devnetL2ChainConfig: L2ChainConfig = {
484
- l1ChainId: 11155111,
485
- testAccounts: true,
486
- sponsoredFPC: true,
487
- p2pEnabled: true,
488
- disableTransactions: false,
489
- bootstrapNodes: [],
490
- minTxsPerBlock: 0,
491
- maxTxsPerBlock: 8,
492
- buildCheckpointIfEmpty: true,
493
- realProofs: false,
494
- snapshotsUrls: [],
495
- autoUpdate: 'config-and-version',
496
- autoUpdateUrl: '',
497
- publicMetricsOptOut: true,
498
- publicIncludeMetrics,
499
- publicMetricsCollectorUrl: '',
500
- publicMetricsCollectFrom: [''],
501
- maxTxPoolSize: 100_000_000, // 100MB
502
- txPoolDeleteTxsAfterReorg: true,
503
-
504
- // Deployment stuff
505
- /** How many seconds an L1 slot lasts. */
506
- ethereumSlotDuration: 12,
507
- /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
508
- aztecSlotDuration: 36,
509
- /** How many L2 slots an epoch lasts. */
510
- aztecEpochDuration: 8,
511
- /** The target validator committee size. */
512
- aztecTargetCommitteeSize: 1,
513
- /** The number of epochs to lag behind the current epoch for validator selection. */
514
- lagInEpochsForValidatorSet: 1,
515
- /** The number of epochs to lag behind the current epoch for randao selection. */
516
- lagInEpochsForRandao: 1,
517
- /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
518
- localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
519
- /** The number of epochs after an epoch ends that proofs are still accepted. */
520
- aztecProofSubmissionEpochs: 1,
521
- /** The deposit amount for a validator */
522
- activationThreshold: DefaultL1ContractsConfig.activationThreshold,
523
- /** The minimum stake for a validator. */
524
- ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
525
- /** The slashing round size */
526
- slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
527
- /** Governance proposing round size */
528
- governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
529
- /** The mana target for the rollup */
530
- manaTarget: DefaultL1ContractsConfig.manaTarget,
531
- /** The proving cost per mana */
532
- provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
533
- /** Exit delay for stakers */
534
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
535
-
536
- ...DefaultSlashConfig,
537
-
538
- ...DefaultNetworkDBMapSizeConfig,
539
- };
540
-
541
- export function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined {
542
- let config: L2ChainConfig | undefined;
543
- if (networkName === 'staging-public') {
544
- config = { ...stagingPublicL2ChainConfig };
545
- } else if (networkName === 'testnet') {
546
- config = { ...testnetL2ChainConfig };
547
- } else if (networkName === 'staging-ignition') {
548
- config = { ...stagingIgnitionL2ChainConfig };
549
- } else if (networkName === 'mainnet') {
550
- config = { ...mainnetL2ChainConfig };
551
- } else if (networkName === 'next-net') {
552
- config = { ...nextNetL2ChainConfig };
553
- } else if (networkName === 'devnet') {
554
- 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
+ }
555
20
  }
556
- return config;
557
21
  }
558
22
 
559
23
  function getDefaultDataDir(networkName: NetworkNames): string {
560
24
  return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
561
25
  }
562
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
+ */
563
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)
564
43
  if (networkName === 'local') {
565
44
  return;
566
45
  }
567
46
 
568
- enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
569
- const config = getL2ChainConfig(networkName);
570
-
571
- if (!config) {
572
- throw new Error(`Unknown network name: ${networkName}`);
573
- }
574
-
575
- enrichEnvironmentWithChainConfig(config);
576
- }
577
-
578
- export function enrichEnvironmentWithChainConfig(config: L2ChainConfig) {
579
- enrichVar('BOOTSTRAP_NODES', config.bootstrapNodes.join(','));
580
- enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
581
- enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
582
- enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
583
- enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
584
- enrichVar('SEQ_MIN_TX_PER_BLOCK', config.minTxsPerBlock.toString());
585
- enrichVar('SEQ_MAX_TX_PER_BLOCK', config.maxTxsPerBlock.toString());
586
- if (config.blockDurationMs !== undefined) {
587
- enrichVar('SEQ_BLOCK_DURATION_MS', config.blockDurationMs.toString());
588
- }
589
- if (config.buildCheckpointIfEmpty !== undefined) {
590
- enrichVar('SEQ_BUILD_CHECKPOINT_IF_EMPTY', config.buildCheckpointIfEmpty.toString());
591
- }
592
- enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
593
- enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
594
- enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
595
- enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
596
- enrichVar('P2P_TX_POOL_DELETE_TXS_AFTER_REORG', config.txPoolDeleteTxsAfterReorg.toString());
597
-
598
- enrichVar('DATA_STORE_MAP_SIZE_KB', config.dataStoreMapSizeKb.toString());
599
- enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
600
- enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
601
- enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
602
- enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
603
-
604
- if (config.skipArchiverInitialSync !== undefined) {
605
- enrichVar('SKIP_ARCHIVER_INITIAL_SYNC', config.skipArchiverInitialSync.toString());
606
- }
607
-
608
- if (config.blobAllowEmptySources !== undefined) {
609
- enrichVar('BLOB_ALLOW_EMPTY_SOURCES', config.blobAllowEmptySources.toString());
610
- }
611
-
612
- if (config.autoUpdate) {
613
- 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);
614
51
  }
615
52
 
616
- if (config.autoUpdateUrl) {
617
- 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);
618
56
  }
619
-
620
- if (config.publicIncludeMetrics) {
621
- enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
622
- }
623
-
624
- if (config.publicMetricsCollectorUrl) {
625
- enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
626
- }
627
-
628
- if (config.publicMetricsCollectFrom) {
629
- enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
630
- }
631
-
632
- enrichVar('PUBLIC_OTEL_OPT_OUT', config.publicMetricsOptOut.toString());
633
-
634
- // Deployment stuff
635
- enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
636
- enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
637
- enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
638
- enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
639
- enrichVar('AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET', config.lagInEpochsForValidatorSet.toString());
640
- enrichVar('AZTEC_LAG_IN_EPOCHS_FOR_RANDAO', config.lagInEpochsForRandao.toString());
641
- enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
642
- enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
643
- enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
644
- enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
645
- enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
646
- enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
647
- enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
648
- enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
649
- enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
650
- enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
651
- enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
652
- enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
653
- enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
654
- enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
655
- enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
656
- enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
657
- enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
658
- enrichVar('AZTEC_SLASHING_DISABLE_DURATION', config.slashingDisableDuration.toString());
659
- enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
660
- enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
661
-
662
- // Slashing
663
- enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
664
- enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
665
- enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
666
- enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
667
- enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
668
- enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
669
- enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
670
- enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
671
- enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
672
- enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
673
- enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
674
- enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
675
- enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
676
- enrichVar('SLASH_GRACE_PERIOD_L2_SLOTS', config.slashGracePeriodL2Slots.toString());
677
- enrichVar('SLASH_EXECUTE_ROUNDS_LOOK_BACK', config.slashExecuteRoundsLookBack.toString());
678
-
679
- enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
680
- enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
681
57
  }