@aztec/ethereum 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa

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 (240) hide show
  1. package/dest/account.d.ts +1 -1
  2. package/dest/chain.d.ts +1 -1
  3. package/dest/client.d.ts +25 -3
  4. package/dest/client.d.ts.map +1 -1
  5. package/dest/client.js +60 -4
  6. package/dest/config.d.ts +48 -73
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +120 -386
  9. package/dest/constants.d.ts +1 -1
  10. package/dest/contracts/chain_state_override.d.ts +78 -0
  11. package/dest/contracts/chain_state_override.d.ts.map +1 -0
  12. package/dest/contracts/chain_state_override.js +137 -0
  13. package/dest/contracts/empire_base.d.ts +7 -5
  14. package/dest/contracts/empire_base.d.ts.map +1 -1
  15. package/dest/contracts/empire_base.js +1 -1
  16. package/dest/contracts/errors.d.ts +1 -1
  17. package/dest/contracts/errors.d.ts.map +1 -1
  18. package/dest/contracts/fee_asset_handler.d.ts +6 -5
  19. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  20. package/dest/contracts/fee_asset_handler.js +11 -9
  21. package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
  22. package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
  23. package/dest/contracts/fee_asset_price_oracle.js +656 -0
  24. package/dest/contracts/fee_juice.d.ts +1 -1
  25. package/dest/contracts/fee_juice.d.ts.map +1 -1
  26. package/dest/contracts/governance.d.ts +113 -36
  27. package/dest/contracts/governance.d.ts.map +1 -1
  28. package/dest/contracts/governance.js +207 -16
  29. package/dest/contracts/governance_proposer.d.ts +38 -4
  30. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  31. package/dest/contracts/governance_proposer.js +455 -12
  32. package/dest/contracts/gse.d.ts +4 -2
  33. package/dest/contracts/gse.d.ts.map +1 -1
  34. package/dest/contracts/gse.js +2 -2
  35. package/dest/contracts/inbox.d.ts +24 -3
  36. package/dest/contracts/inbox.d.ts.map +1 -1
  37. package/dest/contracts/inbox.js +42 -2
  38. package/dest/contracts/index.d.ts +6 -3
  39. package/dest/contracts/index.d.ts.map +1 -1
  40. package/dest/contracts/index.js +5 -2
  41. package/dest/contracts/log.d.ts +13 -0
  42. package/dest/contracts/log.d.ts.map +1 -0
  43. package/dest/contracts/log.js +1 -0
  44. package/dest/contracts/multicall.d.ts +130 -13
  45. package/dest/contracts/multicall.d.ts.map +1 -1
  46. package/dest/contracts/multicall.js +203 -93
  47. package/dest/contracts/outbox.d.ts +64 -0
  48. package/dest/contracts/outbox.d.ts.map +1 -0
  49. package/dest/contracts/outbox.js +113 -0
  50. package/dest/contracts/registry.d.ts +3 -1
  51. package/dest/contracts/registry.d.ts.map +1 -1
  52. package/dest/contracts/registry.js +30 -1
  53. package/dest/contracts/rollup.d.ts +5591 -131
  54. package/dest/contracts/rollup.d.ts.map +1 -1
  55. package/dest/contracts/rollup.js +1125 -232
  56. package/dest/contracts/slasher_contract.d.ts +1 -1
  57. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  58. package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +11 -10
  59. package/dest/contracts/slashing_proposer.d.ts.map +1 -0
  60. package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +21 -16
  61. package/dest/contracts/utils.d.ts +1 -1
  62. package/dest/deploy_aztec_l1_contracts.d.ts +267 -0
  63. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  64. package/dest/deploy_aztec_l1_contracts.js +417 -0
  65. package/dest/deploy_l1_contract.d.ts +68 -0
  66. package/dest/deploy_l1_contract.d.ts.map +1 -0
  67. package/dest/deploy_l1_contract.js +312 -0
  68. package/dest/eth-signer/eth-signer.d.ts +1 -1
  69. package/dest/eth-signer/index.d.ts +1 -1
  70. package/dest/forwarder_proxy.d.ts +32 -0
  71. package/dest/forwarder_proxy.d.ts.map +1 -0
  72. package/dest/forwarder_proxy.js +93 -0
  73. package/dest/l1_artifacts.d.ts +21007 -16779
  74. package/dest/l1_artifacts.d.ts.map +1 -1
  75. package/dest/l1_artifacts.js +9 -24
  76. package/dest/l1_contract_addresses.d.ts +61 -65
  77. package/dest/l1_contract_addresses.d.ts.map +1 -1
  78. package/dest/l1_contract_addresses.js +99 -80
  79. package/dest/l1_reader.d.ts +7 -5
  80. package/dest/l1_reader.d.ts.map +1 -1
  81. package/dest/l1_reader.js +15 -7
  82. package/dest/l1_tx_utils/config.d.ts +11 -5
  83. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  84. package/dest/l1_tx_utils/config.js +46 -10
  85. package/dest/l1_tx_utils/constants.d.ts +8 -2
  86. package/dest/l1_tx_utils/constants.d.ts.map +1 -1
  87. package/dest/l1_tx_utils/constants.js +27 -2
  88. package/dest/l1_tx_utils/factory.d.ts +18 -10
  89. package/dest/l1_tx_utils/factory.d.ts.map +1 -1
  90. package/dest/l1_tx_utils/factory.js +17 -7
  91. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  92. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  93. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  94. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  95. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  96. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  97. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  98. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  99. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  100. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  101. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  102. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  103. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  104. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  105. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
  106. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  107. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  108. package/dest/l1_tx_utils/index-blobs.js +2 -0
  109. package/dest/l1_tx_utils/index.d.ts +4 -1
  110. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  111. package/dest/l1_tx_utils/index.js +3 -0
  112. package/dest/l1_tx_utils/interfaces.d.ts +2 -2
  113. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
  114. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +252 -0
  115. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  116. package/dest/l1_tx_utils/l1_fee_analyzer.js +568 -0
  117. package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -8
  118. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  119. package/dest/l1_tx_utils/l1_tx_utils.js +202 -92
  120. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -30
  121. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  122. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +65 -168
  123. package/dest/l1_tx_utils/signer.d.ts +1 -1
  124. package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
  125. package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
  126. package/dest/{test → l1_tx_utils}/tx_delayer.js +70 -39
  127. package/dest/l1_tx_utils/types.d.ts +27 -1
  128. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  129. package/dest/l1_tx_utils/types.js +10 -0
  130. package/dest/l1_tx_utils/utils.d.ts +1 -1
  131. package/dest/l1_types.d.ts +1 -1
  132. package/dest/publisher_manager.d.ts +34 -7
  133. package/dest/publisher_manager.d.ts.map +1 -1
  134. package/dest/publisher_manager.js +119 -8
  135. package/dest/queries.d.ts +14 -3
  136. package/dest/queries.d.ts.map +1 -1
  137. package/dest/queries.js +84 -9
  138. package/dest/test/blob_kzg_warmup.d.ts +19 -0
  139. package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
  140. package/dest/test/blob_kzg_warmup.js +64 -0
  141. package/dest/test/chain_monitor.d.ts +80 -26
  142. package/dest/test/chain_monitor.d.ts.map +1 -1
  143. package/dest/test/chain_monitor.js +137 -39
  144. package/dest/test/eth_cheat_codes.d.ts +47 -8
  145. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  146. package/dest/test/eth_cheat_codes.js +100 -44
  147. package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
  148. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  149. package/dest/test/index.d.ts +2 -3
  150. package/dest/test/index.d.ts.map +1 -1
  151. package/dest/test/index.js +1 -2
  152. package/dest/test/rollup_cheat_codes.d.ts +75 -14
  153. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  154. package/dest/test/rollup_cheat_codes.js +145 -42
  155. package/dest/test/start_anvil.d.ts +25 -2
  156. package/dest/test/start_anvil.d.ts.map +1 -1
  157. package/dest/test/start_anvil.js +143 -28
  158. package/dest/test/upgrade_utils.d.ts +1 -1
  159. package/dest/test/upgrade_utils.js +2 -2
  160. package/dest/types.d.ts +57 -2
  161. package/dest/types.d.ts.map +1 -1
  162. package/dest/utils.d.ts +24 -4
  163. package/dest/utils.d.ts.map +1 -1
  164. package/dest/utils.js +112 -16
  165. package/dest/zkPassportVerifierAddress.d.ts +1 -1
  166. package/package.json +34 -17
  167. package/src/client.ts +66 -2
  168. package/src/config.ts +162 -470
  169. package/src/contracts/README.md +157 -0
  170. package/src/contracts/chain_state_override.ts +200 -0
  171. package/src/contracts/empire_base.ts +6 -5
  172. package/src/contracts/fee_asset_handler.ts +10 -7
  173. package/src/contracts/fee_asset_price_oracle.ts +285 -0
  174. package/src/contracts/governance.ts +279 -13
  175. package/src/contracts/governance_proposer.ts +74 -7
  176. package/src/contracts/gse.ts +7 -2
  177. package/src/contracts/inbox.ts +64 -4
  178. package/src/contracts/index.ts +5 -2
  179. package/src/contracts/log.ts +13 -0
  180. package/src/contracts/multicall.ts +247 -103
  181. package/src/contracts/outbox.ts +132 -0
  182. package/src/contracts/registry.ts +31 -1
  183. package/src/contracts/rollup.ts +830 -194
  184. package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +26 -21
  185. package/src/deploy_aztec_l1_contracts.ts +652 -0
  186. package/src/deploy_l1_contract.ts +362 -0
  187. package/src/forwarder_proxy.ts +108 -0
  188. package/src/l1_artifacts.ts +12 -35
  189. package/src/l1_contract_addresses.ts +120 -92
  190. package/src/l1_reader.ts +25 -10
  191. package/src/l1_tx_utils/config.ts +55 -14
  192. package/src/l1_tx_utils/constants.ts +13 -2
  193. package/src/l1_tx_utils/factory.ts +31 -31
  194. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  195. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  196. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  197. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  198. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
  199. package/src/l1_tx_utils/index-blobs.ts +2 -0
  200. package/src/l1_tx_utils/index.ts +3 -0
  201. package/src/l1_tx_utils/interfaces.ts +1 -1
  202. package/src/l1_tx_utils/l1_fee_analyzer.ts +875 -0
  203. package/src/l1_tx_utils/l1_tx_utils.ts +194 -72
  204. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +79 -214
  205. package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
  206. package/src/l1_tx_utils/types.ts +32 -0
  207. package/src/publisher_manager.ts +145 -12
  208. package/src/queries.ts +93 -10
  209. package/src/test/blob_kzg_warmup.ts +65 -0
  210. package/src/test/chain_monitor.ts +198 -51
  211. package/src/test/eth_cheat_codes.ts +91 -48
  212. package/src/test/index.ts +1 -2
  213. package/src/test/rollup_cheat_codes.ts +174 -45
  214. package/src/test/start_anvil.ts +179 -27
  215. package/src/test/upgrade_utils.ts +2 -2
  216. package/src/types.ts +62 -0
  217. package/src/utils.ts +128 -19
  218. package/dest/contracts/empire_slashing_proposer.d.ts +0 -65
  219. package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
  220. package/dest/contracts/empire_slashing_proposer.js +0 -194
  221. package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
  222. package/dest/deploy_l1_contracts.d.ts +0 -226
  223. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  224. package/dest/deploy_l1_contracts.js +0 -1473
  225. package/dest/index.d.ts +0 -18
  226. package/dest/index.d.ts.map +0 -1
  227. package/dest/index.js +0 -17
  228. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
  229. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
  230. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
  231. package/dest/test/delayed_tx_utils.d.ts +0 -13
  232. package/dest/test/delayed_tx_utils.d.ts.map +0 -1
  233. package/dest/test/delayed_tx_utils.js +0 -28
  234. package/dest/test/tx_delayer.d.ts +0 -36
  235. package/dest/test/tx_delayer.d.ts.map +0 -1
  236. package/src/contracts/empire_slashing_proposer.ts +0 -259
  237. package/src/deploy_l1_contracts.ts +0 -1849
  238. package/src/index.ts +0 -17
  239. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
  240. package/src/test/delayed_tx_utils.ts +0 -52
package/dest/config.js CHANGED
@@ -1,287 +1,93 @@
1
- import { bigintConfigHelper, booleanConfigHelper, enumConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
1
+ import { bigintConfigHelper, booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, omitConfigMappings, optionalNumberConfigHelper } from '@aztec/foundation/config';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
- import { l1TxUtilsConfigMappings } from './l1_tx_utils/index.js';
4
- export const DefaultL1ContractsConfig = {
5
- ethereumSlotDuration: 12,
6
- aztecSlotDuration: 36,
7
- aztecEpochDuration: 32,
8
- aztecTargetCommitteeSize: 48,
9
- lagInEpochs: 2,
10
- aztecProofSubmissionEpochs: 1,
11
- activationThreshold: 100n * 10n ** 18n,
12
- ejectionThreshold: 50n * 10n ** 18n,
13
- localEjectionThreshold: 98n * 10n ** 18n,
14
- slashAmountSmall: 10n * 10n ** 18n,
15
- slashAmountMedium: 20n * 10n ** 18n,
16
- slashAmountLarge: 50n * 10n ** 18n,
17
- slashingRoundSizeInEpochs: 4,
18
- slashingLifetimeInRounds: 5,
19
- slashingExecutionDelayInRounds: 0,
20
- slashingVetoer: EthAddress.ZERO,
21
- governanceProposerRoundSize: 300,
22
- manaTarget: BigInt(1e10),
23
- provingCostPerMana: BigInt(100),
24
- exitDelaySeconds: 2 * 24 * 60 * 60,
25
- slasherFlavor: 'tally',
26
- slashingOffsetInRounds: 2,
27
- slashingDisableDuration: 5 * 24 * 60 * 60
3
+ import l1ContractsDefaultEnv from '@aztec/l1-artifacts/network-defaults.json' with {
4
+ type: 'json'
28
5
  };
29
- const LocalGovernanceConfiguration = {
30
- proposeConfig: {
31
- lockDelay: 60n * 60n * 24n * 30n,
32
- lockAmount: 1n * 10n ** 24n
33
- },
34
- votingDelay: 60n,
35
- votingDuration: 60n * 60n,
36
- executionDelay: 60n,
37
- gracePeriod: 60n * 60n * 24n * 7n,
38
- quorum: 1n * 10n ** 17n,
39
- requiredYeaMargin: 4n * 10n ** 16n,
40
- minimumVotes: 400n * 10n ** 18n
41
- };
42
- const StagingPublicGovernanceConfiguration = {
43
- proposeConfig: {
44
- lockDelay: 60n * 60n * 24n * 30n,
45
- lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n
46
- },
47
- votingDelay: 60n,
48
- votingDuration: 60n * 60n,
49
- executionDelay: 60n,
50
- gracePeriod: 60n * 60n * 24n * 7n,
51
- quorum: 3n * 10n ** 17n,
52
- requiredYeaMargin: 4n * 10n ** 16n,
53
- minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n
54
- };
55
- const TestnetGovernanceConfiguration = {
56
- proposeConfig: {
57
- lockDelay: 10n * 365n * 24n * 60n * 60n,
58
- lockAmount: 1250n * 200_000n * 10n ** 18n
59
- },
60
- votingDelay: 12n * 60n * 60n,
61
- votingDuration: 1n * 24n * 60n * 60n,
62
- executionDelay: 12n * 60n * 60n,
63
- gracePeriod: 1n * 24n * 60n * 60n,
64
- quorum: 2n * 10n ** 17n,
65
- requiredYeaMargin: 1n * 10n ** 17n,
66
- minimumVotes: 100n * 200_000n * 10n ** 18n
67
- };
68
- const StagingIgnitionGovernanceConfiguration = {
69
- proposeConfig: {
70
- lockDelay: 10n * 365n * 24n * 60n * 60n,
71
- lockAmount: 1250n * 200_000n * 10n ** 18n
72
- },
73
- votingDelay: 7n * 24n * 60n * 60n,
74
- votingDuration: 7n * 24n * 60n * 60n,
75
- executionDelay: 30n * 24n * 60n * 60n,
76
- gracePeriod: 7n * 24n * 60n * 60n,
77
- quorum: 2n * 10n ** 17n,
78
- requiredYeaMargin: 1n * 10n ** 17n,
79
- minimumVotes: 1250n * 200_000n * 10n ** 18n
80
- };
81
- const MainnetGovernanceConfiguration = {
82
- proposeConfig: {
83
- lockDelay: 90n * 24n * 60n * 60n,
84
- lockAmount: 258_750_000n * 10n ** 18n
85
- },
86
- votingDelay: 3n * 24n * 60n * 60n,
87
- votingDuration: 7n * 24n * 60n * 60n,
88
- executionDelay: 7n * 24n * 60n * 60n,
89
- gracePeriod: 7n * 24n * 60n * 60n,
90
- quorum: 2n * 10n ** 17n,
91
- requiredYeaMargin: 33n * 10n ** 16n,
92
- minimumVotes: 1000n * 200_000n * 10n ** 18n
93
- };
94
- export const getGovernanceConfiguration = (networkName)=>{
95
- switch(networkName){
96
- case 'local':
97
- return LocalGovernanceConfiguration;
98
- case 'next-net':
99
- return LocalGovernanceConfiguration;
100
- case 'devnet':
101
- return LocalGovernanceConfiguration;
102
- case 'staging-public':
103
- return StagingPublicGovernanceConfiguration;
104
- case 'testnet':
105
- return TestnetGovernanceConfiguration;
106
- case 'staging-ignition':
107
- return StagingIgnitionGovernanceConfiguration;
108
- case 'mainnet':
109
- return MainnetGovernanceConfiguration;
110
- default:
111
- throw new Error(`Unrecognized network name: ${networkName}`);
112
- }
113
- };
114
- // Making a default config here as we are only using it thought the deployment
115
- // and do not expect to be using different setups, so having environment variables
116
- // for it seems overkill
117
- const DefaultRewardConfig = {
118
- sequencerBps: 8000,
119
- rewardDistributor: EthAddress.ZERO.toString(),
120
- booster: EthAddress.ZERO.toString(),
121
- blockReward: 500n * 10n ** 18n
122
- };
123
- const MainnetRewardConfig = {
124
- sequencerBps: 7_000,
125
- rewardDistributor: EthAddress.ZERO.toString(),
126
- booster: EthAddress.ZERO.toString(),
127
- blockReward: 400n * 10n ** 18n
128
- };
129
- export const getRewardConfig = (networkName)=>{
130
- switch(networkName){
131
- case 'local':
132
- case 'devnet':
133
- case 'next-net':
134
- case 'staging-public':
135
- case 'testnet':
136
- case 'staging-ignition':
137
- return DefaultRewardConfig;
138
- case 'mainnet':
139
- return MainnetRewardConfig;
140
- default:
141
- throw new Error(`Unrecognized network name: ${networkName}`);
142
- }
143
- };
144
- export const getRewardBoostConfig = ()=>{
145
- // The reward configuration is specified with a precision of 1e5, and we use the same across
146
- // all networks.
147
- return {
148
- increment: 125_000,
149
- maxScore: 15_000_000,
150
- a: 1_000,
151
- k: 1_000_000,
152
- minimum: 100_000
153
- };
154
- };
155
- // Similar to the above, no need for environment variables for this.
156
- const LocalEntryQueueConfig = {
157
- bootstrapValidatorSetSize: 0n,
158
- bootstrapFlushSize: 0n,
159
- normalFlushSizeMin: 48n,
160
- normalFlushSizeQuotient: 2n,
161
- maxQueueFlushSize: 48n
162
- };
163
- const StagingPublicEntryQueueConfig = {
164
- bootstrapValidatorSetSize: 48n,
165
- bootstrapFlushSize: 48n,
166
- normalFlushSizeMin: 1n,
167
- normalFlushSizeQuotient: 2475n,
168
- maxQueueFlushSize: 32n
169
- };
170
- const TestnetEntryQueueConfig = {
171
- bootstrapValidatorSetSize: 256n,
172
- bootstrapFlushSize: 256n,
173
- normalFlushSizeMin: 4n,
174
- normalFlushSizeQuotient: 2048n,
175
- maxQueueFlushSize: 8n
176
- };
177
- const StagingIgnitionEntryQueueConfig = {
178
- bootstrapValidatorSetSize: 48n,
179
- bootstrapFlushSize: 48n,
180
- normalFlushSizeMin: 1n,
181
- normalFlushSizeQuotient: 2048n,
182
- maxQueueFlushSize: 24n
183
- };
184
- const MainnetEntryQueueConfig = {
185
- bootstrapValidatorSetSize: 1_000n,
186
- bootstrapFlushSize: 1_000n,
187
- normalFlushSizeMin: 1n,
188
- normalFlushSizeQuotient: 2_048n,
189
- maxQueueFlushSize: 8n
190
- };
191
- export const getEntryQueueConfig = (networkName)=>{
192
- switch(networkName){
193
- case 'local':
194
- return LocalEntryQueueConfig;
195
- case 'next-net':
196
- return LocalEntryQueueConfig;
197
- case 'devnet':
198
- return LocalEntryQueueConfig;
199
- case 'staging-public':
200
- return StagingPublicEntryQueueConfig;
201
- case 'testnet':
202
- return TestnetEntryQueueConfig;
203
- case 'staging-ignition':
204
- return StagingIgnitionEntryQueueConfig;
205
- case 'mainnet':
206
- return MainnetEntryQueueConfig;
207
- default:
208
- throw new Error(`Unrecognized network name: ${networkName}`);
209
- }
210
- };
211
- export const l1ContractsConfigMappings = {
6
+ import { l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
7
+ /**
8
+ * Config mappings for L1ContractsConfig.
9
+ * Default values come from l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
10
+ * Real deployments use forge scripts which require explicit env vars (vm.envUint).
11
+ */ export const l1ContractsConfigMappings = {
212
12
  ethereumSlotDuration: {
213
13
  env: 'ETHEREUM_SLOT_DURATION',
214
14
  description: 'How many seconds an L1 slot lasts.',
215
- ...numberConfigHelper(DefaultL1ContractsConfig.ethereumSlotDuration)
15
+ ...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION)
216
16
  },
217
17
  aztecSlotDuration: {
218
18
  env: 'AZTEC_SLOT_DURATION',
219
19
  description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
220
- ...numberConfigHelper(DefaultL1ContractsConfig.aztecSlotDuration)
20
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION)
221
21
  },
222
22
  aztecEpochDuration: {
223
23
  env: 'AZTEC_EPOCH_DURATION',
224
- description: `How many L2 slots an epoch lasts (maximum AZTEC_MAX_EPOCH_DURATION).`,
225
- ...numberConfigHelper(DefaultL1ContractsConfig.aztecEpochDuration)
24
+ description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
25
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION)
226
26
  },
227
27
  aztecTargetCommitteeSize: {
228
28
  env: 'AZTEC_TARGET_COMMITTEE_SIZE',
229
29
  description: 'The target validator committee size.',
230
- ...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize)
30
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE)
231
31
  },
232
- lagInEpochs: {
233
- env: 'AZTEC_LAG_IN_EPOCHS',
32
+ lagInEpochsForValidatorSet: {
33
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
234
34
  description: 'The number of epochs to lag behind the current epoch for validator selection.',
235
- ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochs)
35
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET)
36
+ },
37
+ lagInEpochsForRandao: {
38
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
39
+ description: 'The number of epochs to lag behind the current epoch for randao selection.',
40
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_RANDAO)
41
+ },
42
+ inboxLag: {
43
+ env: 'AZTEC_INBOX_LAG',
44
+ description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
45
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_INBOX_LAG)
236
46
  },
237
47
  aztecProofSubmissionEpochs: {
238
48
  env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
239
49
  description: 'The number of epochs after an epoch ends that proofs are still accepted.',
240
- ...numberConfigHelper(DefaultL1ContractsConfig.aztecProofSubmissionEpochs)
50
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS)
241
51
  },
242
52
  activationThreshold: {
243
53
  env: 'AZTEC_ACTIVATION_THRESHOLD',
244
54
  description: 'The deposit amount for a validator',
245
- ...bigintConfigHelper(DefaultL1ContractsConfig.activationThreshold)
55
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD))
246
56
  },
247
57
  ejectionThreshold: {
248
58
  env: 'AZTEC_EJECTION_THRESHOLD',
249
59
  description: 'The minimum stake for a validator.',
250
- ...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold)
60
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD))
251
61
  },
252
62
  localEjectionThreshold: {
253
63
  env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
254
64
  description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
255
- ...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold)
65
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD))
256
66
  },
257
67
  slashingOffsetInRounds: {
258
68
  env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
259
69
  description: 'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
260
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingOffsetInRounds)
70
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS)
261
71
  },
262
- slasherFlavor: {
263
- env: 'AZTEC_SLASHER_FLAVOR',
264
- description: 'Type of slasher proposer (empire, tally, or none)',
265
- ...enumConfigHelper([
266
- 'empire',
267
- 'tally',
268
- 'none'
269
- ], DefaultL1ContractsConfig.slasherFlavor)
72
+ slasherEnabled: {
73
+ env: 'AZTEC_SLASHER_ENABLED',
74
+ description: 'Whether to deploy a slasher proposer',
75
+ ...booleanConfigHelper(true)
270
76
  },
271
77
  slashAmountSmall: {
272
78
  env: 'AZTEC_SLASH_AMOUNT_SMALL',
273
79
  description: 'Small slashing amount for light offenses',
274
- ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountSmall)
80
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL))
275
81
  },
276
82
  slashAmountMedium: {
277
83
  env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
278
84
  description: 'Medium slashing amount for moderate offenses',
279
- ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountMedium)
85
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM))
280
86
  },
281
87
  slashAmountLarge: {
282
88
  env: 'AZTEC_SLASH_AMOUNT_LARGE',
283
89
  description: 'Large slashing amount for severe offenses',
284
- ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountLarge)
90
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE))
285
91
  },
286
92
  slashingQuorum: {
287
93
  env: 'AZTEC_SLASHING_QUORUM',
@@ -291,28 +97,28 @@ export const l1ContractsConfigMappings = {
291
97
  slashingRoundSizeInEpochs: {
292
98
  env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
293
99
  description: 'The slashing round size',
294
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingRoundSizeInEpochs)
100
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS)
295
101
  },
296
102
  slashingLifetimeInRounds: {
297
103
  env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
298
104
  description: 'The slashing lifetime in rounds',
299
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingLifetimeInRounds)
105
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS)
300
106
  },
301
107
  slashingExecutionDelayInRounds: {
302
108
  env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
303
109
  description: 'The slashing execution delay in rounds',
304
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingExecutionDelayInRounds)
110
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS)
305
111
  },
306
112
  slashingVetoer: {
307
113
  env: 'AZTEC_SLASHING_VETOER',
308
114
  description: 'The slashing vetoer',
309
115
  parseEnv: (val)=>EthAddress.fromString(val),
310
- defaultValue: DefaultL1ContractsConfig.slashingVetoer
116
+ defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER)
311
117
  },
312
118
  slashingDisableDuration: {
313
119
  env: 'AZTEC_SLASHING_DISABLE_DURATION',
314
120
  description: 'How long slashing can be disabled for in seconds when vetoer disables it',
315
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingDisableDuration)
121
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION)
316
122
  },
317
123
  governanceProposerQuorum: {
318
124
  env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
@@ -322,25 +128,90 @@ export const l1ContractsConfigMappings = {
322
128
  governanceProposerRoundSize: {
323
129
  env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
324
130
  description: 'The governance proposing round size',
325
- ...numberConfigHelper(DefaultL1ContractsConfig.governanceProposerRoundSize)
131
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE)
132
+ },
133
+ governanceVotingDuration: {
134
+ env: 'AZTEC_GOVERNANCE_VOTING_DURATION',
135
+ description: 'Governance voting duration in seconds (only for local/devnet/next-net)',
136
+ ...numberConfigHelper(3600)
326
137
  },
327
138
  manaTarget: {
328
139
  env: 'AZTEC_MANA_TARGET',
329
140
  description: 'The mana target for the rollup',
330
- ...bigintConfigHelper(DefaultL1ContractsConfig.manaTarget)
141
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET))
331
142
  },
332
143
  provingCostPerMana: {
333
144
  env: 'AZTEC_PROVING_COST_PER_MANA',
334
145
  description: 'The proving cost per mana',
335
- ...bigintConfigHelper(DefaultL1ContractsConfig.provingCostPerMana)
146
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA))
147
+ },
148
+ initialEthPerFeeAsset: {
149
+ env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
150
+ description: 'The initial ETH per fee asset price (with 1e12 precision)',
151
+ ...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET))
336
152
  },
337
153
  exitDelaySeconds: {
338
154
  env: 'AZTEC_EXIT_DELAY_SECONDS',
339
155
  description: 'The delay before a validator can exit the set',
340
- ...numberConfigHelper(DefaultL1ContractsConfig.exitDelaySeconds)
156
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS)
157
+ },
158
+ entryQueueBootstrapValidatorSetSize: {
159
+ env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE',
160
+ description: 'Validator set size at or below which the entry queue uses the bootstrap flush size.',
161
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE)
341
162
  },
342
- ...l1TxUtilsConfigMappings
163
+ entryQueueBootstrapFlushSize: {
164
+ env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE',
165
+ description: 'Number of validators admitted from the entry queue per flush during the bootstrap phase.',
166
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE)
167
+ },
168
+ entryQueueFlushSizeMin: {
169
+ env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN',
170
+ description: 'Minimum number of validators admitted from the entry queue per flush.',
171
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN)
172
+ },
173
+ entryQueueFlushSizeQuotient: {
174
+ env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT',
175
+ description: 'Divisor applied to the queue size to derive the normal per-flush admission count.',
176
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT)
177
+ },
178
+ entryQueueMaxFlushSize: {
179
+ env: 'AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE',
180
+ description: 'Maximum number of validators admitted from the entry queue per flush.',
181
+ ...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE)
182
+ },
183
+ ...omitConfigMappings(l1TxUtilsConfigMappings, [
184
+ 'ethereumSlotDuration'
185
+ ])
343
186
  };
187
+ /**
188
+ * Default L1 contracts configuration derived from l1ContractsConfigMappings.
189
+ * Source of truth: l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
190
+ */ export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
191
+ /**
192
+ * Validates that `ethereumSlotDuration` and `aztecSlotDuration` are positive and that the L2 slot is an exact
193
+ * multiple of the L1 slot. Every L2 slot boundary must land on an L1 slot boundary; a non-multiple pairing
194
+ * desyncs the epoch/checkpoint timing math throughout the sequencer, validator client, and timetables. Returns
195
+ * a list of error messages (empty when valid).
196
+ */ export function validateSlotDurations(config) {
197
+ const errors = [];
198
+ if (config.ethereumSlotDuration <= 0) {
199
+ errors.push(`ethereumSlotDuration must be positive (got ${config.ethereumSlotDuration})`);
200
+ }
201
+ if (config.aztecSlotDuration <= 0) {
202
+ errors.push(`aztecSlotDuration must be positive (got ${config.aztecSlotDuration})`);
203
+ }
204
+ if (config.ethereumSlotDuration > 0 && config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
205
+ errors.push(`aztecSlotDuration (${config.aztecSlotDuration}s) must be a multiple of ethereumSlotDuration ` + `(${config.ethereumSlotDuration}s)`);
206
+ }
207
+ return errors;
208
+ }
209
+ /** Throws if {@link validateSlotDurations} reports any errors. */ export function assertValidSlotDurations(config) {
210
+ const errors = validateSlotDurations(config);
211
+ if (errors.length > 0) {
212
+ throw new Error(`Invalid slot duration configuration:\n${errors.map((e)=>` - ${e}`).join('\n')}`);
213
+ }
214
+ }
344
215
  export const genesisStateConfigMappings = {
345
216
  testAccounts: {
346
217
  env: 'TEST_ACCOUNTS',
@@ -351,6 +222,12 @@ export const genesisStateConfigMappings = {
351
222
  env: 'SPONSORED_FPC',
352
223
  description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
353
224
  ...booleanConfigHelper(false)
225
+ },
226
+ prefundAddresses: {
227
+ env: 'PREFUND_ADDRESSES',
228
+ description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
229
+ parseEnv: (val)=>val.split(',').map((a)=>a.trim()).filter((a)=>a.length > 0),
230
+ defaultValue: []
354
231
  }
355
232
  };
356
233
  export function getL1ContractsConfigEnvVars() {
@@ -359,146 +236,3 @@ export function getL1ContractsConfigEnvVars() {
359
236
  export function getGenesisStateConfigEnvVars() {
360
237
  return getConfigFromMappings(genesisStateConfigMappings);
361
238
  }
362
- /**
363
- * Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
364
- * during construction are satisfied before deployment.
365
- * Accumulates all validation errors and throws an exception listing them all if any are found.
366
- */ export function validateConfig(config) {
367
- const errors = [];
368
- // RollupCore constructor validation: normalFlushSizeMin > 0
369
- // From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
370
- const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
371
- if (entryQueueConfig.normalFlushSizeMin <= 0n) {
372
- errors.push('normalFlushSizeMin must be greater than 0');
373
- }
374
- // TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
375
- // While not explicitly required in constructor, this is a common validation for time-based systems
376
- if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
377
- errors.push(`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`);
378
- }
379
- // EmpireBase constructor validations for governance/slashing proposers
380
- // From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
381
- const { governanceProposerQuorum, governanceProposerRoundSize } = config;
382
- if (governanceProposerQuorum !== undefined && governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)) {
383
- errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`);
384
- }
385
- // From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
386
- if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
387
- errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`);
388
- }
389
- // Slashing quorum validations (similar to governance quorum)
390
- const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
391
- const { slashingQuorum } = config;
392
- if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
393
- errors.push(`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`);
394
- }
395
- if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
396
- errors.push(`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`);
397
- }
398
- // EmpireBase and TallySlashingProposer lifetime and execution delay validation
399
- // From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
400
- if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
401
- errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`);
402
- }
403
- // Staking asset validation: activationThreshold > ejectionThreshold
404
- if (config.activationThreshold < config.ejectionThreshold) {
405
- errors.push(`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`);
406
- }
407
- // TallySlashingProposer constructor validations
408
- if (config.slasherFlavor === 'tally') {
409
- validateTallySlasherConfig(config, errors);
410
- }
411
- // Epoch and slot duration validations
412
- if (config.aztecSlotDuration <= 0) {
413
- errors.push('aztecSlotDuration must be greater than 0');
414
- }
415
- if (config.ethereumSlotDuration <= 0) {
416
- errors.push('ethereumSlotDuration must be greater than 0');
417
- }
418
- if (config.aztecEpochDuration <= 0) {
419
- errors.push('aztecEpochDuration must be greater than 0');
420
- }
421
- // Committee size validation
422
- if (config.aztecTargetCommitteeSize < 0) {
423
- errors.push('aztecTargetCommitteeSize cannot be negative');
424
- }
425
- // Proof submission epochs validation
426
- if (config.aztecProofSubmissionEpochs < 0) {
427
- errors.push('aztecProofSubmissionEpochs cannot be negative');
428
- }
429
- // Exit delay validation
430
- if (config.exitDelaySeconds < 0) {
431
- errors.push('exitDelaySeconds cannot be negative');
432
- }
433
- // Mana validation
434
- if (config.manaTarget < 0n) {
435
- errors.push('manaTarget cannot be negative');
436
- }
437
- if (config.provingCostPerMana < 0n) {
438
- errors.push('provingCostPerMana cannot be negative');
439
- }
440
- // If any errors were found, throw an exception with all of them
441
- if (errors.length > 0) {
442
- throw new Error(`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index)=>`${index + 1}. ${error}`).join('\n')}`);
443
- }
444
- }
445
- function validateTallySlasherConfig(config, errors) {
446
- if (config.slasherFlavor !== 'tally') {
447
- return;
448
- }
449
- // From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
450
- if (config.slashingOffsetInRounds <= 0) {
451
- errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
452
- }
453
- // From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
454
- const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
455
- // From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
456
- const { slashingQuorum } = config;
457
- if (slashingQuorum !== undefined && slashingQuorum <= 0) {
458
- errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
459
- }
460
- // From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
461
- if (roundSizeInSlots <= 1) {
462
- errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
463
- }
464
- // From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
465
- if (config.slashAmountSmall > config.slashAmountMedium) {
466
- errors.push(`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`);
467
- }
468
- // From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
469
- if (config.slashAmountMedium > config.slashAmountLarge) {
470
- errors.push(`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`);
471
- }
472
- // From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
473
- const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
474
- if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
475
- errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
476
- }
477
- // From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
478
- if (config.slashingRoundSizeInEpochs <= 0) {
479
- errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
480
- }
481
- // From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
482
- const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
483
- if (roundSizeInSlots >= MAX_ROUND_SIZE) {
484
- errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
485
- }
486
- // From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
487
- if (config.aztecTargetCommitteeSize <= 0) {
488
- errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
489
- }
490
- // From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
491
- // voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
492
- const voteSize = config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs / 4;
493
- if (voteSize > 128) {
494
- errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
495
- }
496
- // From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
497
- if (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs % 4 !== 0) {
498
- errors.push(`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`);
499
- }
500
- // Slashing offset validation: should be positive to allow proper slashing timing
501
- if (config.slashingOffsetInRounds < 0) {
502
- errors.push('slashingOffsetInRounds cannot be negative');
503
- }
504
- }
@@ -1,4 +1,4 @@
1
1
  import type { Hex } from 'viem';
2
2
  export declare const NULL_KEY: Hex;
3
3
  export declare const AZTEC_TEST_CHAIN_ID = 677692;
4
- //# sourceMappingURL=constants.d.ts.map
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUVoQyxlQUFPLE1BQU0sUUFBUSxFQUFFLEdBQStFLENBQUM7QUFDdkcsZUFBTyxNQUFNLG1CQUFtQixTQUFTLENBQUMifQ==