@aztec/cli 0.0.0-test.0 → 0.0.1-fake-c83136db25

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