@aztec/cli 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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 (146) hide show
  1. package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
  2. package/dest/cmds/contracts/inspect_contract.js +9 -5
  3. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  4. package/dest/cmds/infrastructure/index.js +3 -3
  5. package/dest/cmds/infrastructure/sequencers.d.ts +2 -1
  6. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  7. package/dest/cmds/infrastructure/sequencers.js +27 -15
  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 +14 -12
  11. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  12. package/dest/cmds/l1/advance_epoch.js +3 -2
  13. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  14. package/dest/cmds/l1/assume_proven_through.js +3 -3
  15. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  16. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  17. package/dest/cmds/l1/bridge_erc20.js +4 -4
  18. package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
  19. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  20. package/dest/cmds/l1/deploy_l1_contracts.js +22 -5
  21. package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
  22. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  23. package/dest/cmds/l1/deploy_new_rollup.js +16 -7
  24. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  25. package/dest/cmds/l1/governance_utils.js +17 -17
  26. package/dest/cmds/l1/index.d.ts +1 -0
  27. package/dest/cmds/l1/index.d.ts.map +1 -1
  28. package/dest/cmds/l1/index.js +29 -39
  29. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
  30. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
  31. package/dest/cmds/l1/trigger_seed_snapshot.js +19 -0
  32. package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
  33. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  34. package/dest/cmds/l1/update_l1_validators.js +156 -101
  35. package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
  36. package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
  37. package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
  38. package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
  39. package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
  40. package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
  41. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
  42. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
  43. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
  44. package/dest/cmds/misc/index.d.ts.map +1 -1
  45. package/dest/cmds/misc/index.js +7 -3
  46. package/dest/cmds/misc/update/github.d.ts +0 -1
  47. package/dest/cmds/misc/update/github.d.ts.map +1 -1
  48. package/dest/cmds/misc/update/github.js +0 -1
  49. package/dest/cmds/misc/update.d.ts.map +1 -1
  50. package/dest/cmds/misc/update.js +2 -3
  51. package/dest/cmds/pxe/get_contract_data.js +1 -1
  52. package/dest/cmds/pxe/get_node_info.d.ts.map +1 -1
  53. package/dest/cmds/pxe/get_node_info.js +11 -7
  54. package/dest/cmds/pxe/get_pxe_info.js +2 -2
  55. package/dest/config/cached_fetch.d.ts +18 -0
  56. package/dest/config/cached_fetch.d.ts.map +1 -0
  57. package/dest/config/cached_fetch.js +54 -0
  58. package/dest/config/chain_l2_config.d.ts +38 -0
  59. package/dest/config/chain_l2_config.d.ts.map +1 -0
  60. package/dest/config/chain_l2_config.js +376 -0
  61. package/dest/config/enrich_env.d.ts +4 -0
  62. package/dest/config/enrich_env.d.ts.map +1 -0
  63. package/dest/config/enrich_env.js +12 -0
  64. package/dest/config/get_l1_config.d.ts +8 -0
  65. package/dest/config/get_l1_config.d.ts.map +1 -0
  66. package/dest/config/get_l1_config.js +22 -0
  67. package/dest/config/index.d.ts +5 -0
  68. package/dest/config/index.d.ts.map +1 -0
  69. package/dest/config/index.js +4 -0
  70. package/dest/config/network_config.d.ts +19 -0
  71. package/dest/config/network_config.d.ts.map +1 -0
  72. package/dest/config/network_config.js +79 -0
  73. package/dest/utils/aztec.d.ts +12 -11
  74. package/dest/utils/aztec.d.ts.map +1 -1
  75. package/dest/utils/aztec.js +52 -22
  76. package/dest/utils/commands.d.ts +1 -1
  77. package/dest/utils/commands.d.ts.map +1 -1
  78. package/dest/utils/commands.js +5 -5
  79. package/dest/utils/encoding.js +1 -1
  80. package/dest/utils/github.d.ts +0 -1
  81. package/dest/utils/github.d.ts.map +1 -1
  82. package/dest/utils/github.js +0 -1
  83. package/dest/utils/index.d.ts +1 -0
  84. package/dest/utils/index.d.ts.map +1 -1
  85. package/dest/utils/index.js +1 -0
  86. package/dest/utils/inspect.d.ts.map +1 -1
  87. package/dest/utils/inspect.js +18 -26
  88. package/dest/utils/setup_contracts.d.ts +5 -0
  89. package/dest/utils/setup_contracts.d.ts.map +1 -0
  90. package/dest/utils/setup_contracts.js +36 -0
  91. package/package.json +38 -32
  92. package/src/cmds/contracts/inspect_contract.ts +16 -6
  93. package/src/cmds/infrastructure/index.ts +10 -2
  94. package/src/cmds/infrastructure/sequencers.ts +32 -15
  95. package/src/cmds/infrastructure/setup_l2_contract.ts +16 -11
  96. package/src/cmds/l1/advance_epoch.ts +3 -2
  97. package/src/cmds/l1/assume_proven_through.ts +3 -3
  98. package/src/cmds/l1/bridge_erc20.ts +4 -3
  99. package/src/cmds/l1/deploy_l1_contracts.ts +30 -6
  100. package/src/cmds/l1/deploy_new_rollup.ts +22 -8
  101. package/src/cmds/l1/governance_utils.ts +18 -17
  102. package/src/cmds/l1/index.ts +69 -96
  103. package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
  104. package/src/cmds/l1/update_l1_validators.ts +191 -92
  105. package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
  106. package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
  107. package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
  108. package/src/cmds/misc/index.ts +13 -4
  109. package/src/cmds/misc/update/github.ts +0 -1
  110. package/src/cmds/misc/update.ts +1 -7
  111. package/src/cmds/pxe/get_contract_data.ts +1 -1
  112. package/src/cmds/pxe/get_node_info.ts +10 -7
  113. package/src/cmds/pxe/get_pxe_info.ts +2 -2
  114. package/src/config/cached_fetch.ts +67 -0
  115. package/src/config/chain_l2_config.ts +493 -0
  116. package/src/config/enrich_env.ts +15 -0
  117. package/src/config/get_l1_config.ts +28 -0
  118. package/src/config/index.ts +4 -0
  119. package/src/config/network_config.ts +102 -0
  120. package/src/utils/aztec.ts +76 -27
  121. package/src/utils/commands.ts +5 -5
  122. package/src/utils/encoding.ts +1 -1
  123. package/src/utils/github.ts +0 -1
  124. package/src/utils/index.ts +1 -0
  125. package/src/utils/inspect.ts +18 -25
  126. package/src/utils/setup_contracts.ts +58 -0
  127. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  128. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  129. package/dest/cmds/devnet/bootstrap_network.js +0 -196
  130. package/dest/cmds/devnet/faucet.d.ts +0 -4
  131. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  132. package/dest/cmds/devnet/faucet.js +0 -26
  133. package/dest/cmds/devnet/index.d.ts +0 -4
  134. package/dest/cmds/devnet/index.d.ts.map +0 -1
  135. package/dest/cmds/devnet/index.js +0 -14
  136. package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
  137. package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
  138. package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
  139. package/dest/cmds/misc/setup_contracts.d.ts +0 -7
  140. package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
  141. package/dest/cmds/misc/setup_contracts.js +0 -27
  142. package/src/cmds/devnet/bootstrap_network.ts +0 -318
  143. package/src/cmds/devnet/faucet.ts +0 -33
  144. package/src/cmds/devnet/index.ts +0 -60
  145. package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
  146. package/src/cmds/misc/setup_contracts.ts +0 -40
@@ -0,0 +1,493 @@
1
+ import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
2
+ import type { NetworkNames } from '@aztec/foundation/config';
3
+ import { EthAddress } from '@aztec/foundation/eth-address';
4
+ import type { SharedNodeConfig } from '@aztec/node-lib/config';
5
+ import type { P2PConfig } from '@aztec/p2p/config';
6
+ import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
7
+
8
+ import path from 'path';
9
+
10
+ import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
11
+ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
12
+
13
+ const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
14
+
15
+ const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
16
+ const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
17
+
18
+ export type L2ChainConfig = L1ContractsConfig &
19
+ Pick<P2PConfig, 'txPoolDeleteTxsAfterReorg'> &
20
+ Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
21
+ l1ChainId: number;
22
+ testAccounts: boolean;
23
+ sponsoredFPC: boolean;
24
+ p2pEnabled: boolean;
25
+ p2pBootstrapNodes: string[];
26
+ seqMinTxsPerBlock: number;
27
+ seqMaxTxsPerBlock: number;
28
+ realProofs: boolean;
29
+ snapshotsUrls: string[];
30
+ autoUpdate: SharedNodeConfig['autoUpdate'];
31
+ autoUpdateUrl?: string;
32
+ maxTxPoolSize: number;
33
+ publicIncludeMetrics?: string[];
34
+ publicMetricsCollectorUrl?: string;
35
+ publicMetricsCollectFrom?: string[];
36
+ skipArchiverInitialSync?: boolean;
37
+ blobAllowEmptySources?: boolean;
38
+
39
+ // Setting the dbMapSize provides the default for every DB in the node.
40
+ // Then we explicitly override the sizes for the archiver and the larger trees.
41
+ dbMapSizeKb: number;
42
+ archiverStoreMapSizeKb: number;
43
+ noteHashTreeMapSizeKb: number;
44
+ nullifierTreeMapSizeKb: number;
45
+ publicDataTreeMapSizeKb: number;
46
+
47
+ // Control whether sentinel is enabled or not. Needed for slashing
48
+ sentinelEnabled: boolean;
49
+ disableTransactions: boolean;
50
+ };
51
+
52
+ const DefaultSlashConfig = {
53
+ /** Tally-style slashing */
54
+ slasherFlavor: 'tally',
55
+ /** Allow one round for vetoing */
56
+ slashingExecutionDelayInRounds: 1,
57
+ /** How long for a slash payload to be executed */
58
+ slashingLifetimeInRounds: 5,
59
+ /** Allow 2 rounds to discover faults */
60
+ slashingOffsetInRounds: 2,
61
+ /** No slash vetoer */
62
+ slashingVetoer: EthAddress.ZERO,
63
+ /** Use default disable duration */
64
+ slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
65
+ /** Use default slash amounts */
66
+ slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
67
+ slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
68
+ slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
69
+
70
+ // Slashing stuff
71
+ slashMinPenaltyPercentage: 0.5,
72
+ slashMaxPenaltyPercentage: 2.0,
73
+ slashInactivityTargetPercentage: 0.7,
74
+ slashInactivityConsecutiveEpochThreshold: 1,
75
+ slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
76
+ slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
77
+ slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
78
+ slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
79
+ slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
80
+ slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
81
+ slashBroadcastedInvalidBlockPenalty: 0n, // DefaultL1ContractsConfig.slashAmountSmall // Disabled until further testing
82
+ slashMaxPayloadSize: 50,
83
+ slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
84
+ slashOffenseExpirationRounds: 8,
85
+ sentinelEnabled: true,
86
+ slashExecuteRoundsLookBack: 4,
87
+ } satisfies Partial<L2ChainConfig>;
88
+
89
+ const DefaultNetworkDBMapSizeConfig = {
90
+ dbMapSizeKb: defaultDBMapSizeKb,
91
+ archiverStoreMapSizeKb: tbMapSizeKb,
92
+ noteHashTreeMapSizeKb: tbMapSizeKb,
93
+ nullifierTreeMapSizeKb: tbMapSizeKb,
94
+ publicDataTreeMapSizeKb: tbMapSizeKb,
95
+ } satisfies Partial<L2ChainConfig>;
96
+
97
+ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
98
+ l1ChainId: 11155111,
99
+ testAccounts: false,
100
+ sponsoredFPC: false,
101
+ disableTransactions: true,
102
+ p2pEnabled: true,
103
+ p2pBootstrapNodes: [],
104
+ seqMinTxsPerBlock: 0,
105
+ seqMaxTxsPerBlock: 0,
106
+ realProofs: true,
107
+ snapshotsUrls: [`${SNAPSHOTS_URL}/staging-ignition/`],
108
+ autoUpdate: 'config-and-version',
109
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
110
+ maxTxPoolSize: 100_000_000, // 100MB
111
+ publicIncludeMetrics,
112
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
113
+ publicMetricsCollectFrom: ['sequencer'],
114
+ txPoolDeleteTxsAfterReorg: false,
115
+ blobAllowEmptySources: true,
116
+
117
+ /** How many seconds an L1 slot lasts. */
118
+ ethereumSlotDuration: 12,
119
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
120
+ aztecSlotDuration: 72,
121
+ /** How many L2 slots an epoch lasts. */
122
+ aztecEpochDuration: 32,
123
+ /** The target validator committee size. */
124
+ aztecTargetCommitteeSize: 24,
125
+ /** The number of epochs to lag behind the current epoch for validator selection. */
126
+ lagInEpochs: 2,
127
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
128
+ aztecProofSubmissionEpochs: 1,
129
+ /** How many sequencers must agree with a slash for it to be executed. */
130
+ slashingQuorum: 65,
131
+
132
+ slashingRoundSizeInEpochs: 4,
133
+ slashingLifetimeInRounds: 40,
134
+ slashingExecutionDelayInRounds: 28,
135
+ slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
136
+ slashAmountSmall: 2_000n * 10n ** 18n,
137
+ slashAmountMedium: 10_000n * 10n ** 18n,
138
+ slashAmountLarge: 50_000n * 10n ** 18n,
139
+ slashingOffsetInRounds: 2,
140
+ slasherFlavor: 'tally',
141
+ slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
142
+
143
+ /** The mana target for the rollup */
144
+ manaTarget: 0n,
145
+
146
+ exitDelaySeconds: 5 * 24 * 60 * 60,
147
+
148
+ /** The proving cost per mana */
149
+ provingCostPerMana: 0n,
150
+
151
+ ejectionThreshold: 100_000n * 10n ** 18n,
152
+ activationThreshold: 200_000n * 10n ** 18n,
153
+ localEjectionThreshold: 196_000n * 10n ** 18n,
154
+
155
+ governanceProposerRoundSize: 300, // TODO TMNT-322
156
+ governanceProposerQuorum: 151, // TODO TMNT-322
157
+
158
+ // Node slashing config
159
+ // TODO TMNT-330
160
+ slashMinPenaltyPercentage: 0.5,
161
+ slashMaxPenaltyPercentage: 2.0,
162
+ slashInactivityTargetPercentage: 0.7,
163
+ slashInactivityConsecutiveEpochThreshold: 2,
164
+ slashInactivityPenalty: 2_000n * 10n ** 18n,
165
+ slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
166
+ slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
167
+ slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
168
+ slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
169
+ slashUnknownPenalty: 2_000n * 10n ** 18n,
170
+ slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
171
+ slashMaxPayloadSize: 50,
172
+ slashGracePeriodL2Slots: 32 * 4, // One round from genesis
173
+ slashOffenseExpirationRounds: 8,
174
+ sentinelEnabled: true,
175
+ slashExecuteRoundsLookBack: 4,
176
+
177
+ ...DefaultNetworkDBMapSizeConfig,
178
+ };
179
+
180
+ export const stagingPublicL2ChainConfig: L2ChainConfig = {
181
+ l1ChainId: 11155111,
182
+ testAccounts: false,
183
+ sponsoredFPC: true,
184
+ disableTransactions: false,
185
+ p2pEnabled: true,
186
+ p2pBootstrapNodes: [],
187
+ seqMinTxsPerBlock: 0,
188
+ seqMaxTxsPerBlock: 20,
189
+ realProofs: true,
190
+ snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`],
191
+ autoUpdate: 'config-and-version',
192
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
193
+ publicIncludeMetrics,
194
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
195
+ publicMetricsCollectFrom: ['sequencer'],
196
+ maxTxPoolSize: 100_000_000, // 100MB
197
+ txPoolDeleteTxsAfterReorg: true,
198
+
199
+ // Deployment stuff
200
+ /** How many seconds an L1 slot lasts. */
201
+ ethereumSlotDuration: 12,
202
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
203
+ aztecSlotDuration: 36,
204
+ /** How many L2 slots an epoch lasts. */
205
+ aztecEpochDuration: 32,
206
+ /** The target validator committee size. */
207
+ aztecTargetCommitteeSize: 48,
208
+ /** The number of epochs to lag behind the current epoch for validator selection. */
209
+ lagInEpochs: DefaultL1ContractsConfig.lagInEpochs,
210
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
211
+ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
212
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
213
+ aztecProofSubmissionEpochs: 1,
214
+ /** The deposit amount for a validator */
215
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
216
+ /** The minimum stake for a validator. */
217
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
218
+ /** The slashing round size */
219
+ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
220
+ /** Governance proposing round size */
221
+ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
222
+ /** The mana target for the rollup */
223
+ manaTarget: DefaultL1ContractsConfig.manaTarget,
224
+ /** The proving cost per mana */
225
+ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
226
+ /** Exit delay for stakers */
227
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
228
+
229
+ ...DefaultSlashConfig,
230
+
231
+ ...DefaultNetworkDBMapSizeConfig,
232
+ };
233
+
234
+ export const testnetL2ChainConfig: L2ChainConfig = {
235
+ l1ChainId: 11155111,
236
+ testAccounts: false,
237
+ sponsoredFPC: true,
238
+ p2pEnabled: true,
239
+ disableTransactions: true,
240
+ p2pBootstrapNodes: [],
241
+ seqMinTxsPerBlock: 0,
242
+ seqMaxTxsPerBlock: 0,
243
+ realProofs: true,
244
+ snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
245
+ autoUpdate: 'config-and-version',
246
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
247
+ maxTxPoolSize: 100_000_000, // 100MB
248
+ publicIncludeMetrics,
249
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
250
+ publicMetricsCollectFrom: ['sequencer'],
251
+ txPoolDeleteTxsAfterReorg: true,
252
+ skipArchiverInitialSync: true,
253
+ blobAllowEmptySources: true,
254
+
255
+ // Deployment stuff
256
+ /** How many seconds an L1 slot lasts. */
257
+ ethereumSlotDuration: 12,
258
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
259
+ aztecSlotDuration: 36,
260
+ /** How many L2 slots an epoch lasts. */
261
+ aztecEpochDuration: 32,
262
+ /** The target validator committee size. */
263
+ aztecTargetCommitteeSize: 48,
264
+ /** The number of epochs to lag behind the current epoch for validator selection. */
265
+ lagInEpochs: 2,
266
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
267
+ aztecProofSubmissionEpochs: 1,
268
+ /** The deposit amount for a validator */
269
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
270
+ /** The minimum stake for a validator. */
271
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
272
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
273
+ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
274
+ /** The slashing round size */
275
+ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
276
+ /** Governance proposing round size */
277
+ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
278
+ /** The mana target for the rollup */
279
+ manaTarget: 0n,
280
+ /** The proving cost per mana */
281
+ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
282
+ /** Exit delay for stakers */
283
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
284
+
285
+ ...DefaultSlashConfig,
286
+ slashPrunePenalty: 0n,
287
+ slashDataWithholdingPenalty: 0n,
288
+ slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
289
+
290
+ ...DefaultNetworkDBMapSizeConfig,
291
+ };
292
+
293
+ export const mainnetL2ChainConfig: L2ChainConfig = {
294
+ l1ChainId: 1,
295
+ testAccounts: false,
296
+ sponsoredFPC: false,
297
+ p2pEnabled: true,
298
+ disableTransactions: true,
299
+ p2pBootstrapNodes: [],
300
+ seqMinTxsPerBlock: 0,
301
+ seqMaxTxsPerBlock: 0,
302
+ realProofs: true,
303
+ snapshotsUrls: [`${SNAPSHOTS_URL}/mainnet/`],
304
+ autoUpdate: 'notify',
305
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
306
+ maxTxPoolSize: 100_000_000, // 100MB
307
+ publicIncludeMetrics,
308
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
309
+ publicMetricsCollectFrom: ['sequencer'],
310
+ txPoolDeleteTxsAfterReorg: false,
311
+
312
+ /** How many seconds an L1 slot lasts. */
313
+ ethereumSlotDuration: 12,
314
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
315
+ aztecSlotDuration: 72,
316
+ /** How many L2 slots an epoch lasts. */
317
+ aztecEpochDuration: 32,
318
+ /** The target validator committee size. */
319
+ aztecTargetCommitteeSize: 24,
320
+ /** The number of epochs to lag behind the current epoch for validator selection. */
321
+ lagInEpochs: 2,
322
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
323
+ aztecProofSubmissionEpochs: 1,
324
+ /** How many sequencers must agree with a slash for it to be executed. */
325
+ slashingQuorum: 65,
326
+
327
+ slashingRoundSizeInEpochs: 4,
328
+ slashingLifetimeInRounds: 40,
329
+ slashingExecutionDelayInRounds: 28,
330
+ slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
331
+ slashAmountSmall: 2_000n * 10n ** 18n,
332
+ slashAmountMedium: 10_000n * 10n ** 18n,
333
+ slashAmountLarge: 50_000n * 10n ** 18n,
334
+ slashingOffsetInRounds: 2,
335
+ slasherFlavor: 'tally',
336
+ slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
337
+
338
+ /** The mana target for the rollup */
339
+ manaTarget: 0n,
340
+
341
+ exitDelaySeconds: 5 * 24 * 60 * 60,
342
+
343
+ /** The proving cost per mana */
344
+ provingCostPerMana: 0n,
345
+
346
+ ejectionThreshold: 100_000n * 10n ** 18n,
347
+ activationThreshold: 200_000n * 10n ** 18n,
348
+ localEjectionThreshold: 196_000n * 10n ** 18n,
349
+
350
+ governanceProposerRoundSize: 300, // TODO TMNT-322
351
+ governanceProposerQuorum: 151, // TODO TMNT-322
352
+
353
+ // Node slashing config
354
+ // TODO TMNT-330
355
+ slashMinPenaltyPercentage: 0.5,
356
+ slashMaxPenaltyPercentage: 2.0,
357
+ slashInactivityTargetPercentage: 0.7,
358
+ slashInactivityConsecutiveEpochThreshold: 2,
359
+ slashInactivityPenalty: 2_000n * 10n ** 18n,
360
+ slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
361
+ slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
362
+ slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
363
+ slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
364
+ slashUnknownPenalty: 2_000n * 10n ** 18n,
365
+ slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
366
+ slashMaxPayloadSize: 50,
367
+ slashGracePeriodL2Slots: 32 * 4, // One round from genesis
368
+ slashOffenseExpirationRounds: 8,
369
+ sentinelEnabled: true,
370
+ slashExecuteRoundsLookBack: 4,
371
+
372
+ ...DefaultNetworkDBMapSizeConfig,
373
+ };
374
+
375
+ export function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined {
376
+ let config: L2ChainConfig | undefined;
377
+ if (networkName === 'staging-public') {
378
+ config = { ...stagingPublicL2ChainConfig };
379
+ } else if (networkName === 'testnet') {
380
+ config = { ...testnetL2ChainConfig };
381
+ } else if (networkName === 'staging-ignition') {
382
+ config = { ...stagingIgnitionL2ChainConfig };
383
+ } else if (networkName === 'mainnet') {
384
+ config = { ...mainnetL2ChainConfig };
385
+ }
386
+ return config;
387
+ }
388
+
389
+ function getDefaultDataDir(networkName: NetworkNames): string {
390
+ return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
391
+ }
392
+
393
+ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
394
+ if (networkName === 'local') {
395
+ return;
396
+ }
397
+
398
+ enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
399
+ const config = getL2ChainConfig(networkName);
400
+
401
+ if (!config) {
402
+ throw new Error(`Unknown network name: ${networkName}`);
403
+ }
404
+
405
+ enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
406
+ enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
407
+ enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
408
+ enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
409
+ enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
410
+ enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
411
+ enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
412
+ enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
413
+ enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
414
+ enrichVar('SYNC_SNAPSHOTS_URLS', config.snapshotsUrls.join(','));
415
+ enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
416
+
417
+ enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
418
+ enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
419
+ enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
420
+ enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
421
+ enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
422
+
423
+ if (config.skipArchiverInitialSync !== undefined) {
424
+ enrichVar('SKIP_ARCHIVER_INITIAL_SYNC', config.skipArchiverInitialSync.toString());
425
+ }
426
+
427
+ if (config.blobAllowEmptySources !== undefined) {
428
+ enrichVar('BLOB_ALLOW_EMPTY_SOURCES', config.blobAllowEmptySources.toString());
429
+ }
430
+
431
+ if (config.autoUpdate) {
432
+ enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
433
+ }
434
+
435
+ if (config.autoUpdateUrl) {
436
+ enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
437
+ }
438
+
439
+ if (config.publicIncludeMetrics) {
440
+ enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
441
+ }
442
+
443
+ if (config.publicMetricsCollectorUrl) {
444
+ enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
445
+ }
446
+
447
+ if (config.publicMetricsCollectFrom) {
448
+ enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
449
+ }
450
+
451
+ // Deployment stuff
452
+ enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
453
+ enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
454
+ enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
455
+ enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
456
+ enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
457
+ enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
458
+ enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
459
+ enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
460
+ enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
461
+ enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
462
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
463
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
464
+ enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
465
+ enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
466
+ enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
467
+ enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
468
+ enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
469
+ enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
470
+ enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
471
+ enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
472
+ enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
473
+ enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
474
+ enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
475
+
476
+ // Slashing
477
+ enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
478
+ enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
479
+ enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
480
+ enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
481
+ enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
482
+ enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
483
+ enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
484
+ enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
485
+ enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
486
+ enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
487
+ enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
488
+ enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
489
+ enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
490
+
491
+ enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
492
+ enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
493
+ }
@@ -0,0 +1,15 @@
1
+ import { EthAddress } from '@aztec/aztec.js';
2
+ import type { EnvVar } from '@aztec/foundation/config';
3
+
4
+ export function enrichVar(envVar: EnvVar, value: string | undefined) {
5
+ // Don't override
6
+ if (process.env[envVar] || value === undefined) {
7
+ return;
8
+ }
9
+ process.env[envVar] = value;
10
+ }
11
+
12
+ export function enrichEthAddressVar(envVar: EnvVar, value: string) {
13
+ // EthAddress doesn't like being given empty strings
14
+ enrichVar(envVar, value || EthAddress.ZERO.toString());
15
+ }
@@ -0,0 +1,28 @@
1
+ import { type L1ContractAddresses, RegistryContract, getL1ContractsConfig, getPublicClient } from '@aztec/ethereum';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+
4
+ export async function getL1Config(
5
+ registryAddress: EthAddress,
6
+ l1RpcUrls: string[],
7
+ l1ChainId: number,
8
+ rollupVersion: number | 'canonical' = 'canonical',
9
+ ): Promise<{ addresses: L1ContractAddresses; config: Awaited<ReturnType<typeof getL1ContractsConfig>> }> {
10
+ const publicClient = getPublicClient({ l1RpcUrls, l1ChainId });
11
+ const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, rollupVersion);
12
+
13
+ const config = await getL1ContractsConfig(publicClient, addresses);
14
+
15
+ return {
16
+ addresses,
17
+ config,
18
+ };
19
+ }
20
+
21
+ export async function getL1RollupAddressFromEnv(l1RpcUrls: string[], l1ChainId: number) {
22
+ const registryAddress = process.env.REGISTRY_CONTRACT_ADDRESS;
23
+ if (!registryAddress || !EthAddress.isAddress(registryAddress)) {
24
+ throw new Error(`Failed to extract registry address`);
25
+ }
26
+ const { addresses } = await getL1Config(EthAddress.fromString(registryAddress), l1RpcUrls, l1ChainId);
27
+ return addresses.rollupAddress;
28
+ }
@@ -0,0 +1,4 @@
1
+ export * from './cached_fetch.js';
2
+ export * from './chain_l2_config.js';
3
+ export * from './get_l1_config.js';
4
+ export * from './network_config.js';
@@ -0,0 +1,102 @@
1
+ import { type NetworkConfig, NetworkConfigMapSchema, type NetworkNames } from '@aztec/foundation/config';
2
+
3
+ import { readFile } from 'fs/promises';
4
+ import { join } from 'path';
5
+
6
+ import { cachedFetch } from './cached_fetch.js';
7
+ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
8
+
9
+ const DEFAULT_CONFIG_URL =
10
+ 'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
11
+ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
12
+
13
+ /**
14
+ * Fetches remote network configuration from GitHub with caching support.
15
+ * Uses the reusable cachedFetch utility.
16
+ *
17
+ * @param networkName - The network name to fetch config for
18
+ * @param cacheDir - Optional cache directory for storing fetched config
19
+ * @returns Remote configuration for the specified network, or undefined if not found/error
20
+ */
21
+ export async function getNetworkConfig(
22
+ networkName: NetworkNames,
23
+ cacheDir?: string,
24
+ ): Promise<NetworkConfig | undefined> {
25
+ let url: URL | undefined;
26
+ const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
27
+
28
+ if (!configLocation) {
29
+ return undefined;
30
+ }
31
+
32
+ try {
33
+ if (configLocation.includes('://')) {
34
+ url = new URL(configLocation);
35
+ } else {
36
+ url = new URL(`file://${configLocation}`);
37
+ }
38
+ } catch {
39
+ /* no-op */
40
+ }
41
+
42
+ if (!url) {
43
+ return undefined;
44
+ }
45
+
46
+ try {
47
+ let rawConfig: any;
48
+
49
+ if (url.protocol === 'http:' || url.protocol === 'https:') {
50
+ rawConfig = await cachedFetch(url.href, {
51
+ cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
52
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
53
+ });
54
+ } else if (url.protocol === 'file:') {
55
+ rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
56
+ } else {
57
+ throw new Error('Unsupported Aztec network config protocol: ' + url.href);
58
+ }
59
+
60
+ if (!rawConfig) {
61
+ return undefined;
62
+ }
63
+
64
+ const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
65
+ if (networkName in networkConfigMap) {
66
+ return networkConfigMap[networkName];
67
+ } else {
68
+ return undefined;
69
+ }
70
+ } catch {
71
+ return undefined;
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Enriches environment variables with remote network configuration.
77
+ * This function is called before node config initialization to set env vars
78
+ * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
79
+ *
80
+ * @param networkName - The network name to fetch remote config for
81
+ */
82
+ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
83
+ if (networkName === 'local') {
84
+ return; // No remote config for local development
85
+ }
86
+
87
+ const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
88
+ const networkConfig = await getNetworkConfig(networkName, cacheDir);
89
+
90
+ if (!networkConfig) {
91
+ return;
92
+ }
93
+
94
+ enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
95
+ enrichVar('L1_CHAIN_ID', String(networkConfig.l1ChainId));
96
+ enrichVar('SYNC_SNAPSHOTS_URLS', networkConfig.snapshots.join(','));
97
+
98
+ enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', networkConfig.registryAddress.toString());
99
+ if (networkConfig.feeAssetHandlerAddress) {
100
+ enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', networkConfig.feeAssetHandlerAddress.toString());
101
+ }
102
+ }