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

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 (184) hide show
  1. package/dest/account.d.ts +1 -1
  2. package/dest/chain.d.ts +1 -1
  3. package/dest/client.d.ts +1 -1
  4. package/dest/client.js +6 -2
  5. package/dest/config.d.ts +11 -44
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +20 -332
  8. package/dest/constants.d.ts +1 -1
  9. package/dest/contracts/empire_base.d.ts +7 -5
  10. package/dest/contracts/empire_base.d.ts.map +1 -1
  11. package/dest/contracts/empire_base.js +1 -1
  12. package/dest/contracts/empire_slashing_proposer.d.ts +6 -4
  13. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
  14. package/dest/contracts/empire_slashing_proposer.js +17 -2
  15. package/dest/contracts/errors.d.ts +1 -1
  16. package/dest/contracts/errors.d.ts.map +1 -1
  17. package/dest/contracts/fee_asset_handler.d.ts +1 -1
  18. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  19. package/dest/contracts/fee_juice.d.ts +1 -1
  20. package/dest/contracts/fee_juice.d.ts.map +1 -1
  21. package/dest/contracts/governance.d.ts +16 -16
  22. package/dest/contracts/governance.d.ts.map +1 -1
  23. package/dest/contracts/governance_proposer.d.ts +6 -4
  24. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  25. package/dest/contracts/governance_proposer.js +17 -2
  26. package/dest/contracts/gse.d.ts +1 -1
  27. package/dest/contracts/gse.d.ts.map +1 -1
  28. package/dest/contracts/inbox.d.ts +7 -3
  29. package/dest/contracts/inbox.d.ts.map +1 -1
  30. package/dest/contracts/inbox.js +4 -0
  31. package/dest/contracts/index.d.ts +1 -1
  32. package/dest/contracts/multicall.d.ts +2 -2
  33. package/dest/contracts/multicall.d.ts.map +1 -1
  34. package/dest/contracts/registry.d.ts +1 -1
  35. package/dest/contracts/registry.d.ts.map +1 -1
  36. package/dest/contracts/rollup.d.ts +71 -64
  37. package/dest/contracts/rollup.d.ts.map +1 -1
  38. package/dest/contracts/rollup.js +90 -67
  39. package/dest/contracts/slasher_contract.d.ts +1 -1
  40. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  41. package/dest/contracts/tally_slashing_proposer.d.ts +9 -7
  42. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
  43. package/dest/contracts/tally_slashing_proposer.js +4 -4
  44. package/dest/contracts/utils.d.ts +1 -1
  45. package/dest/deploy_aztec_l1_contracts.d.ts +247 -0
  46. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  47. package/dest/deploy_aztec_l1_contracts.js +336 -0
  48. package/dest/deploy_l1_contract.d.ts +68 -0
  49. package/dest/deploy_l1_contract.d.ts.map +1 -0
  50. package/dest/deploy_l1_contract.js +312 -0
  51. package/dest/eth-signer/eth-signer.d.ts +1 -1
  52. package/dest/eth-signer/index.d.ts +1 -1
  53. package/dest/forwarder_proxy.d.ts +32 -0
  54. package/dest/forwarder_proxy.d.ts.map +1 -0
  55. package/dest/forwarder_proxy.js +93 -0
  56. package/dest/l1_artifacts.d.ts +2078 -880
  57. package/dest/l1_artifacts.d.ts.map +1 -1
  58. package/dest/l1_contract_addresses.d.ts +3 -3
  59. package/dest/l1_contract_addresses.d.ts.map +1 -1
  60. package/dest/l1_contract_addresses.js +3 -3
  61. package/dest/l1_reader.d.ts +3 -1
  62. package/dest/l1_reader.d.ts.map +1 -1
  63. package/dest/l1_reader.js +6 -0
  64. package/dest/l1_tx_utils/config.d.ts +5 -5
  65. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  66. package/dest/l1_tx_utils/config.js +30 -7
  67. package/dest/l1_tx_utils/constants.d.ts +7 -1
  68. package/dest/l1_tx_utils/constants.d.ts.map +1 -1
  69. package/dest/l1_tx_utils/constants.js +25 -0
  70. package/dest/l1_tx_utils/factory.d.ts +1 -1
  71. package/dest/l1_tx_utils/fee-strategies/index.d.ts +9 -0
  72. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  73. package/dest/l1_tx_utils/fee-strategies/index.js +11 -0
  74. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +18 -0
  75. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  76. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +111 -0
  77. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +32 -0
  78. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  79. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +173 -0
  80. package/dest/l1_tx_utils/fee-strategies/types.d.ts +64 -0
  81. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  82. package/dest/l1_tx_utils/fee-strategies/types.js +24 -0
  83. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  84. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  85. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
  86. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  87. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  88. package/dest/l1_tx_utils/index-blobs.js +2 -0
  89. package/dest/l1_tx_utils/index.d.ts +3 -1
  90. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  91. package/dest/l1_tx_utils/index.js +2 -0
  92. package/dest/l1_tx_utils/interfaces.d.ts +2 -2
  93. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
  94. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  95. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  96. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  97. package/dest/l1_tx_utils/l1_tx_utils.d.ts +1 -2
  98. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  99. package/dest/l1_tx_utils/l1_tx_utils.js +17 -4
  100. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +1 -1
  101. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
  102. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -26
  103. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  104. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +70 -141
  105. package/dest/l1_tx_utils/signer.d.ts +1 -1
  106. package/dest/l1_tx_utils/types.d.ts +1 -1
  107. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  108. package/dest/l1_tx_utils/utils.d.ts +1 -1
  109. package/dest/l1_types.d.ts +1 -1
  110. package/dest/publisher_manager.d.ts +1 -1
  111. package/dest/publisher_manager.d.ts.map +1 -1
  112. package/dest/queries.d.ts +1 -1
  113. package/dest/queries.d.ts.map +1 -1
  114. package/dest/queries.js +10 -3
  115. package/dest/test/chain_monitor.d.ts +27 -24
  116. package/dest/test/chain_monitor.d.ts.map +1 -1
  117. package/dest/test/chain_monitor.js +32 -34
  118. package/dest/test/delayed_tx_utils.d.ts +1 -1
  119. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  120. package/dest/test/eth_cheat_codes.d.ts +8 -12
  121. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  122. package/dest/test/eth_cheat_codes.js +11 -3
  123. package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
  124. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  125. package/dest/test/index.d.ts +1 -1
  126. package/dest/test/rollup_cheat_codes.d.ts +14 -13
  127. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  128. package/dest/test/rollup_cheat_codes.js +46 -39
  129. package/dest/test/start_anvil.d.ts +4 -1
  130. package/dest/test/start_anvil.d.ts.map +1 -1
  131. package/dest/test/start_anvil.js +2 -1
  132. package/dest/test/tx_delayer.d.ts +1 -1
  133. package/dest/test/tx_delayer.d.ts.map +1 -1
  134. package/dest/test/tx_delayer.js +4 -3
  135. package/dest/test/upgrade_utils.d.ts +1 -1
  136. package/dest/types.d.ts +57 -2
  137. package/dest/types.d.ts.map +1 -1
  138. package/dest/utils.d.ts +15 -3
  139. package/dest/utils.d.ts.map +1 -1
  140. package/dest/utils.js +18 -0
  141. package/dest/zkPassportVerifierAddress.d.ts +1 -1
  142. package/package.json +33 -14
  143. package/src/client.ts +2 -2
  144. package/src/config.ts +24 -412
  145. package/src/contracts/empire_base.ts +6 -5
  146. package/src/contracts/empire_slashing_proposer.ts +16 -5
  147. package/src/contracts/governance_proposer.ts +16 -5
  148. package/src/contracts/inbox.ts +7 -2
  149. package/src/contracts/rollup.ts +99 -82
  150. package/src/contracts/tally_slashing_proposer.ts +11 -8
  151. package/src/deploy_aztec_l1_contracts.ts +557 -0
  152. package/src/deploy_l1_contract.ts +362 -0
  153. package/src/forwarder_proxy.ts +108 -0
  154. package/src/l1_contract_addresses.ts +22 -20
  155. package/src/l1_reader.ts +8 -0
  156. package/src/l1_tx_utils/config.ts +32 -11
  157. package/src/l1_tx_utils/constants.ts +11 -0
  158. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  159. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +159 -0
  160. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +241 -0
  161. package/src/l1_tx_utils/fee-strategies/types.ts +88 -0
  162. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
  163. package/src/l1_tx_utils/index-blobs.ts +2 -0
  164. package/src/l1_tx_utils/index.ts +2 -0
  165. package/src/l1_tx_utils/interfaces.ts +1 -1
  166. package/src/l1_tx_utils/l1_fee_analyzer.ts +804 -0
  167. package/src/l1_tx_utils/l1_tx_utils.ts +24 -4
  168. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +78 -179
  169. package/src/queries.ts +12 -3
  170. package/src/test/chain_monitor.ts +50 -48
  171. package/src/test/eth_cheat_codes.ts +9 -3
  172. package/src/test/rollup_cheat_codes.ts +45 -43
  173. package/src/test/start_anvil.ts +4 -0
  174. package/src/test/tx_delayer.ts +5 -3
  175. package/src/types.ts +62 -0
  176. package/src/utils.ts +30 -1
  177. package/dest/deploy_l1_contracts.d.ts +0 -226
  178. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  179. package/dest/deploy_l1_contracts.js +0 -1473
  180. package/dest/index.d.ts +0 -18
  181. package/dest/index.d.ts.map +0 -1
  182. package/dest/index.js +0 -17
  183. package/src/deploy_l1_contracts.ts +0 -1849
  184. package/src/index.ts +0 -17
package/src/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
- type NetworkNames,
3
+ // type NetworkNames,
4
4
  bigintConfigHelper,
5
5
  booleanConfigHelper,
6
6
  enumConfigHelper,
@@ -10,7 +10,7 @@ import {
10
10
  } from '@aztec/foundation/config';
11
11
  import { EthAddress } from '@aztec/foundation/eth-address';
12
12
 
13
- import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/index.js';
13
+ import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
14
14
 
15
15
  export type GenesisStateConfig = {
16
16
  /** Whether to populate the genesis state with initial fee juice for the test accounts */
@@ -29,7 +29,11 @@ export type L1ContractsConfig = {
29
29
  /** The target validator committee size. */
30
30
  aztecTargetCommitteeSize: number;
31
31
  /** The number of epochs to lag behind the current epoch for validator selection. */
32
- lagInEpochs: number;
32
+ lagInEpochsForValidatorSet: number;
33
+ /** The number of epochs to lag behind the current epoch for randao selection. */
34
+ lagInEpochsForRandao: number;
35
+ /** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
36
+ inboxLag: number;
33
37
  /** The number of epochs after an epoch ends that proofs are still accepted. */
34
38
  aztecProofSubmissionEpochs: number;
35
39
  /** The deposit amount for a validator */
@@ -77,7 +81,9 @@ export const DefaultL1ContractsConfig = {
77
81
  aztecSlotDuration: 36,
78
82
  aztecEpochDuration: 32,
79
83
  aztecTargetCommitteeSize: 48,
80
- lagInEpochs: 2,
84
+ lagInEpochsForValidatorSet: 2,
85
+ lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
86
+ inboxLag: 1, // Default inbox lag to prevent sequencer DOS attacks
81
87
  aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
82
88
  activationThreshold: 100n * 10n ** 18n,
83
89
  ejectionThreshold: 50n * 10n ** 18n,
@@ -90,7 +96,7 @@ export const DefaultL1ContractsConfig = {
90
96
  slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
91
97
  slashingVetoer: EthAddress.ZERO,
92
98
  governanceProposerRoundSize: 300,
93
- manaTarget: BigInt(1e10),
99
+ manaTarget: BigInt(100e6),
94
100
  provingCostPerMana: BigInt(100),
95
101
  exitDelaySeconds: 2 * 24 * 60 * 60,
96
102
  slasherFlavor: 'tally' as const,
@@ -98,208 +104,6 @@ export const DefaultL1ContractsConfig = {
98
104
  slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
99
105
  } satisfies L1ContractsConfig;
100
106
 
101
- const LocalGovernanceConfiguration = {
102
- proposeConfig: {
103
- lockDelay: 60n * 60n * 24n * 30n,
104
- lockAmount: 1n * 10n ** 24n,
105
- },
106
- votingDelay: 60n,
107
- votingDuration: 60n * 60n,
108
- executionDelay: 60n,
109
- gracePeriod: 60n * 60n * 24n * 7n,
110
- quorum: 1n * 10n ** 17n, // 10%
111
- requiredYeaMargin: 4n * 10n ** 16n, // 4%
112
- minimumVotes: 400n * 10n ** 18n,
113
- };
114
-
115
- const StagingPublicGovernanceConfiguration = {
116
- proposeConfig: {
117
- lockDelay: 60n * 60n * 24n * 30n,
118
- lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
119
- },
120
- votingDelay: 60n,
121
- votingDuration: 60n * 60n,
122
- executionDelay: 60n,
123
- gracePeriod: 60n * 60n * 24n * 7n,
124
- quorum: 3n * 10n ** 17n, // 30%
125
- requiredYeaMargin: 4n * 10n ** 16n, // 4%
126
- minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote
127
- };
128
-
129
- const TestnetGovernanceConfiguration = {
130
- proposeConfig: {
131
- lockDelay: 10n * 365n * 24n * 60n * 60n,
132
- lockAmount: 1250n * 200_000n * 10n ** 18n,
133
- },
134
-
135
- votingDelay: 12n * 60n * 60n, // 12 hours
136
- votingDuration: 1n * 24n * 60n * 60n, // 1 day
137
- executionDelay: 12n * 60n * 60n, // 12 hours
138
- gracePeriod: 1n * 24n * 60n * 60n, // 1 day
139
- quorum: 2n * 10n ** 17n, // 20%
140
- requiredYeaMargin: 1n * 10n ** 17n, // 10%
141
- minimumVotes: 100n * 200_000n * 10n ** 18n,
142
- };
143
-
144
- const StagingIgnitionGovernanceConfiguration = {
145
- proposeConfig: {
146
- lockDelay: 10n * 365n * 24n * 60n * 60n,
147
- lockAmount: 1250n * 200_000n * 10n ** 18n,
148
- },
149
-
150
- votingDelay: 7n * 24n * 60n * 60n,
151
- votingDuration: 7n * 24n * 60n * 60n,
152
- executionDelay: 30n * 24n * 60n * 60n,
153
- gracePeriod: 7n * 24n * 60n * 60n,
154
- quorum: 2n * 10n ** 17n, // 20%
155
- requiredYeaMargin: 1n * 10n ** 17n, // 10%
156
- minimumVotes: 1250n * 200_000n * 10n ** 18n,
157
- };
158
-
159
- const MainnetGovernanceConfiguration = {
160
- proposeConfig: {
161
- lockDelay: 90n * 24n * 60n * 60n,
162
- lockAmount: 258_750_000n * 10n ** 18n,
163
- },
164
-
165
- votingDelay: 3n * 24n * 60n * 60n,
166
- votingDuration: 7n * 24n * 60n * 60n,
167
- executionDelay: 7n * 24n * 60n * 60n,
168
- gracePeriod: 7n * 24n * 60n * 60n,
169
- quorum: 2n * 10n ** 17n, // 20%
170
- requiredYeaMargin: 33n * 10n ** 16n, // 33%
171
- minimumVotes: 1000n * 200_000n * 10n ** 18n,
172
- };
173
-
174
- export const getGovernanceConfiguration = (networkName: NetworkNames) => {
175
- switch (networkName) {
176
- case 'local':
177
- return LocalGovernanceConfiguration;
178
- case 'next-net':
179
- return LocalGovernanceConfiguration;
180
- case 'devnet':
181
- return LocalGovernanceConfiguration;
182
- case 'staging-public':
183
- return StagingPublicGovernanceConfiguration;
184
- case 'testnet':
185
- return TestnetGovernanceConfiguration;
186
- case 'staging-ignition':
187
- return StagingIgnitionGovernanceConfiguration;
188
- case 'mainnet':
189
- return MainnetGovernanceConfiguration;
190
- default:
191
- throw new Error(`Unrecognized network name: ${networkName}`);
192
- }
193
- };
194
-
195
- // Making a default config here as we are only using it thought the deployment
196
- // and do not expect to be using different setups, so having environment variables
197
- // for it seems overkill
198
-
199
- const DefaultRewardConfig = {
200
- sequencerBps: 8000,
201
- rewardDistributor: EthAddress.ZERO.toString(),
202
- booster: EthAddress.ZERO.toString(),
203
- blockReward: 500n * 10n ** 18n,
204
- };
205
-
206
- const MainnetRewardConfig = {
207
- sequencerBps: 7_000,
208
- rewardDistributor: EthAddress.ZERO.toString(),
209
- booster: EthAddress.ZERO.toString(),
210
- blockReward: 400n * 10n ** 18n,
211
- };
212
-
213
- export const getRewardConfig = (networkName: NetworkNames) => {
214
- switch (networkName) {
215
- case 'local':
216
- case 'devnet':
217
- case 'next-net':
218
- case 'staging-public':
219
- case 'testnet':
220
- case 'staging-ignition':
221
- return DefaultRewardConfig;
222
- case 'mainnet':
223
- return MainnetRewardConfig;
224
- default:
225
- throw new Error(`Unrecognized network name: ${networkName}`);
226
- }
227
- };
228
-
229
- export const getRewardBoostConfig = () => {
230
- // The reward configuration is specified with a precision of 1e5, and we use the same across
231
- // all networks.
232
- return {
233
- increment: 125_000, // 1.25
234
- maxScore: 15_000_000, // 150
235
- a: 1_000, // 0.01
236
- k: 1_000_000, // 10
237
- minimum: 100_000, // 1
238
- };
239
- };
240
-
241
- // Similar to the above, no need for environment variables for this.
242
- const LocalEntryQueueConfig = {
243
- bootstrapValidatorSetSize: 0n,
244
- bootstrapFlushSize: 0n,
245
- normalFlushSizeMin: 48n,
246
- normalFlushSizeQuotient: 2n,
247
- maxQueueFlushSize: 48n,
248
- };
249
-
250
- const StagingPublicEntryQueueConfig = {
251
- bootstrapValidatorSetSize: 48n,
252
- bootstrapFlushSize: 48n,
253
- normalFlushSizeMin: 1n,
254
- normalFlushSizeQuotient: 2475n,
255
- maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
256
- };
257
-
258
- const TestnetEntryQueueConfig = {
259
- bootstrapValidatorSetSize: 256n,
260
- bootstrapFlushSize: 256n,
261
- normalFlushSizeMin: 4n,
262
- normalFlushSizeQuotient: 2048n,
263
- maxQueueFlushSize: 8n,
264
- };
265
-
266
- const StagingIgnitionEntryQueueConfig = {
267
- bootstrapValidatorSetSize: 48n,
268
- bootstrapFlushSize: 48n,
269
- normalFlushSizeMin: 1n,
270
- normalFlushSizeQuotient: 2048n,
271
- maxQueueFlushSize: 24n,
272
- };
273
-
274
- const MainnetEntryQueueConfig = {
275
- bootstrapValidatorSetSize: 1_000n,
276
- bootstrapFlushSize: 1_000n,
277
- normalFlushSizeMin: 1n,
278
- normalFlushSizeQuotient: 2_048n,
279
- maxQueueFlushSize: 8n,
280
- };
281
-
282
- export const getEntryQueueConfig = (networkName: NetworkNames) => {
283
- switch (networkName) {
284
- case 'local':
285
- return LocalEntryQueueConfig;
286
- case 'next-net':
287
- return LocalEntryQueueConfig;
288
- case 'devnet':
289
- return LocalEntryQueueConfig;
290
- case 'staging-public':
291
- return StagingPublicEntryQueueConfig;
292
- case 'testnet':
293
- return TestnetEntryQueueConfig;
294
- case 'staging-ignition':
295
- return StagingIgnitionEntryQueueConfig;
296
- case 'mainnet':
297
- return MainnetEntryQueueConfig;
298
- default:
299
- throw new Error(`Unrecognized network name: ${networkName}`);
300
- }
301
- };
302
-
303
107
  export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
304
108
  ethereumSlotDuration: {
305
109
  env: 'ETHEREUM_SLOT_DURATION',
@@ -321,10 +125,20 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
321
125
  description: 'The target validator committee size.',
322
126
  ...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
323
127
  },
324
- lagInEpochs: {
325
- env: 'AZTEC_LAG_IN_EPOCHS',
128
+ lagInEpochsForValidatorSet: {
129
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
326
130
  description: 'The number of epochs to lag behind the current epoch for validator selection.',
327
- ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochs),
131
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet),
132
+ },
133
+ lagInEpochsForRandao: {
134
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
135
+ description: 'The number of epochs to lag behind the current epoch for randao selection.',
136
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
137
+ },
138
+ inboxLag: {
139
+ env: 'AZTEC_INBOX_LAG',
140
+ description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
141
+ ...numberConfigHelper(DefaultL1ContractsConfig.inboxLag),
328
142
  },
329
143
  aztecProofSubmissionEpochs: {
330
144
  env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
@@ -452,205 +266,3 @@ export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
452
266
  export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
453
267
  return getConfigFromMappings(genesisStateConfigMappings);
454
268
  }
455
-
456
- /**
457
- * Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
458
- * during construction are satisfied before deployment.
459
- * Accumulates all validation errors and throws an exception listing them all if any are found.
460
- */
461
- export function validateConfig(config: Omit<L1ContractsConfig, keyof L1TxUtilsConfig>): void {
462
- const errors: string[] = [];
463
-
464
- // RollupCore constructor validation: normalFlushSizeMin > 0
465
- // From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
466
- const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
467
- if (entryQueueConfig.normalFlushSizeMin <= 0n) {
468
- errors.push('normalFlushSizeMin must be greater than 0');
469
- }
470
-
471
- // TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
472
- // While not explicitly required in constructor, this is a common validation for time-based systems
473
- if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
474
- errors.push(
475
- `aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`,
476
- );
477
- }
478
-
479
- // EmpireBase constructor validations for governance/slashing proposers
480
- // From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
481
- const { governanceProposerQuorum, governanceProposerRoundSize } = config;
482
- if (
483
- governanceProposerQuorum !== undefined &&
484
- governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)
485
- ) {
486
- errors.push(
487
- `governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`,
488
- );
489
- }
490
-
491
- // From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
492
- if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
493
- errors.push(
494
- `governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`,
495
- );
496
- }
497
-
498
- // Slashing quorum validations (similar to governance quorum)
499
- const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
500
- const { slashingQuorum } = config;
501
- if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
502
- errors.push(
503
- `slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`,
504
- );
505
- }
506
-
507
- if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
508
- errors.push(
509
- `slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`,
510
- );
511
- }
512
-
513
- // EmpireBase and TallySlashingProposer lifetime and execution delay validation
514
- // From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
515
- if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
516
- errors.push(
517
- `slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`,
518
- );
519
- }
520
-
521
- // Staking asset validation: activationThreshold > ejectionThreshold
522
- if (config.activationThreshold < config.ejectionThreshold) {
523
- errors.push(
524
- `activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`,
525
- );
526
- }
527
-
528
- // TallySlashingProposer constructor validations
529
- if (config.slasherFlavor === 'tally') {
530
- validateTallySlasherConfig(config, errors);
531
- }
532
-
533
- // Epoch and slot duration validations
534
- if (config.aztecSlotDuration <= 0) {
535
- errors.push('aztecSlotDuration must be greater than 0');
536
- }
537
-
538
- if (config.ethereumSlotDuration <= 0) {
539
- errors.push('ethereumSlotDuration must be greater than 0');
540
- }
541
-
542
- if (config.aztecEpochDuration <= 0) {
543
- errors.push('aztecEpochDuration must be greater than 0');
544
- }
545
-
546
- // Committee size validation
547
- if (config.aztecTargetCommitteeSize < 0) {
548
- errors.push('aztecTargetCommitteeSize cannot be negative');
549
- }
550
-
551
- // Proof submission epochs validation
552
- if (config.aztecProofSubmissionEpochs < 0) {
553
- errors.push('aztecProofSubmissionEpochs cannot be negative');
554
- }
555
-
556
- // Exit delay validation
557
- if (config.exitDelaySeconds < 0) {
558
- errors.push('exitDelaySeconds cannot be negative');
559
- }
560
-
561
- // Mana validation
562
- if (config.manaTarget < 0n) {
563
- errors.push('manaTarget cannot be negative');
564
- }
565
-
566
- if (config.provingCostPerMana < 0n) {
567
- errors.push('provingCostPerMana cannot be negative');
568
- }
569
-
570
- // If any errors were found, throw an exception with all of them
571
- if (errors.length > 0) {
572
- throw new Error(
573
- `L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index) => `${index + 1}. ${error}`).join('\n')}`,
574
- );
575
- }
576
- }
577
-
578
- function validateTallySlasherConfig(config: L1ContractsConfig, errors: string[]) {
579
- if (config.slasherFlavor !== 'tally') {
580
- return;
581
- }
582
-
583
- // From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
584
- if (config.slashingOffsetInRounds <= 0) {
585
- errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
586
- }
587
-
588
- // From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
589
- const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
590
-
591
- // From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
592
- const { slashingQuorum } = config;
593
- if (slashingQuorum !== undefined && slashingQuorum <= 0) {
594
- errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
595
- }
596
-
597
- // From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
598
- if (roundSizeInSlots <= 1) {
599
- errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
600
- }
601
-
602
- // From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
603
- if (config.slashAmountSmall > config.slashAmountMedium) {
604
- errors.push(
605
- `slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`,
606
- );
607
- }
608
-
609
- // From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
610
- if (config.slashAmountMedium > config.slashAmountLarge) {
611
- errors.push(
612
- `slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`,
613
- );
614
- }
615
-
616
- // From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
617
- const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
618
- if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
619
- errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
620
- }
621
-
622
- // From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
623
- if (config.slashingRoundSizeInEpochs <= 0) {
624
- errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
625
- }
626
-
627
- // From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
628
- const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
629
- if (roundSizeInSlots >= MAX_ROUND_SIZE) {
630
- errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
631
- }
632
-
633
- // From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
634
- if (config.aztecTargetCommitteeSize <= 0) {
635
- errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
636
- }
637
-
638
- // From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
639
- // voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
640
- const voteSize = (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) / 4;
641
- if (voteSize > 128) {
642
- errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
643
- }
644
-
645
- // From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
646
- if ((config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) % 4 !== 0) {
647
- errors.push(
648
- `aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`,
649
- );
650
- }
651
-
652
- // Slashing offset validation: should be positive to allow proper slashing timing
653
- if (config.slashingOffsetInRounds < 0) {
654
- errors.push('slashingOffsetInRounds cannot be negative');
655
- }
656
- }
@@ -1,3 +1,4 @@
1
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import { Signature } from '@aztec/foundation/eth-signature';
3
4
  import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
@@ -11,12 +12,12 @@ export interface IEmpireBase {
11
12
  getRoundInfo(
12
13
  rollupAddress: Hex,
13
14
  round: bigint,
14
- ): Promise<{ lastSignalSlot: bigint; payloadWithMostSignals: Hex; executed: boolean }>;
15
- computeRound(slot: bigint): Promise<bigint>;
15
+ ): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }>;
16
+ computeRound(slot: SlotNumber): Promise<bigint>;
16
17
  createSignalRequest(payload: Hex): L1TxRequest;
17
18
  createSignalRequestWithSignature(
18
19
  payload: Hex,
19
- round: bigint,
20
+ slot: SlotNumber,
20
21
  chainId: number,
21
22
  signerAddress: Hex,
22
23
  signer: (msg: TypedDataDefinition) => Promise<Hex>,
@@ -51,7 +52,7 @@ export function encodeSignalWithSignature(payload: Hex, signature: Signature) {
51
52
  export async function signSignalWithSig(
52
53
  signer: (msg: TypedDataDefinition) => Promise<Hex>,
53
54
  payload: Hex,
54
- slot: bigint,
55
+ slot: SlotNumber,
55
56
  instance: Hex,
56
57
  verifyingContract: Hex,
57
58
  chainId: number,
@@ -79,7 +80,7 @@ export async function signSignalWithSig(
79
80
 
80
81
  const message = {
81
82
  payload,
82
- slot,
83
+ slot: BigInt(slot),
83
84
  instance,
84
85
  };
85
86
 
@@ -1,3 +1,4 @@
1
+ import { SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import { createLogger } from '@aztec/foundation/log';
3
4
  import { retryUntil } from '@aztec/foundation/retry';
@@ -67,8 +68,8 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
67
68
  return this.proposer.read.getCurrentRound();
68
69
  }
69
70
 
70
- public computeRound(slot: bigint): Promise<bigint> {
71
- return this.proposer.read.computeRound([slot]);
71
+ public computeRound(slot: SlotNumber): Promise<bigint> {
72
+ return this.proposer.read.computeRound([BigInt(slot)]);
72
73
  }
73
74
 
74
75
  public getInstance() {
@@ -78,8 +79,18 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
78
79
  public async getRoundInfo(
79
80
  rollupAddress: Hex,
80
81
  round: bigint,
81
- ): Promise<{ lastSignalSlot: bigint; payloadWithMostSignals: Hex; executed: boolean }> {
82
- return await this.proposer.read.getRoundData([rollupAddress, round]);
82
+ ): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
83
+ const result = await this.proposer.read.getRoundData([rollupAddress, round]);
84
+ const [signalCount, quorum] = await Promise.all([
85
+ this.proposer.read.signalCount([rollupAddress, round, result.payloadWithMostSignals]),
86
+ this.getQuorumSize(),
87
+ ]);
88
+ return {
89
+ lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
90
+ payloadWithMostSignals: result.payloadWithMostSignals,
91
+ quorumReached: signalCount >= quorum,
92
+ executed: result.executed,
93
+ };
83
94
  }
84
95
 
85
96
  public getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint> {
@@ -95,7 +106,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
95
106
 
96
107
  public async createSignalRequestWithSignature(
97
108
  payload: Hex,
98
- slot: bigint,
109
+ slot: SlotNumber,
99
110
  chainId: number,
100
111
  signerAddress: Hex,
101
112
  signer: (msg: TypedDataDefinition) => Promise<Hex>,
@@ -1,3 +1,4 @@
1
+ import { SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { memoize } from '@aztec/foundation/decorators';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import { GovernanceProposerAbi } from '@aztec/l1-artifacts/GovernanceProposerAbi';
@@ -54,15 +55,25 @@ export class GovernanceProposerContract implements IEmpireBase {
54
55
  return this.proposer.read.getInstance();
55
56
  }
56
57
 
57
- public computeRound(slot: bigint): Promise<bigint> {
58
- return this.proposer.read.computeRound([slot]);
58
+ public computeRound(slot: SlotNumber): Promise<bigint> {
59
+ return this.proposer.read.computeRound([BigInt(slot)]);
59
60
  }
60
61
 
61
62
  public async getRoundInfo(
62
63
  rollupAddress: Hex,
63
64
  round: bigint,
64
- ): Promise<{ lastSignalSlot: bigint; payloadWithMostSignals: Hex; executed: boolean }> {
65
- return await this.proposer.read.getRoundData([rollupAddress, round]);
65
+ ): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
66
+ const result = await this.proposer.read.getRoundData([rollupAddress, round]);
67
+ const [signalCount, quorum] = await Promise.all([
68
+ this.proposer.read.signalCount([rollupAddress, round, result.payloadWithMostSignals]),
69
+ this.getQuorumSize(),
70
+ ]);
71
+ return {
72
+ lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
73
+ payloadWithMostSignals: result.payloadWithMostSignals,
74
+ quorumReached: signalCount >= quorum,
75
+ executed: result.executed,
76
+ };
66
77
  }
67
78
 
68
79
  public getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint> {
@@ -78,7 +89,7 @@ export class GovernanceProposerContract implements IEmpireBase {
78
89
 
79
90
  public async createSignalRequestWithSignature(
80
91
  payload: Hex,
81
- slot: bigint,
92
+ slot: SlotNumber,
82
93
  chainId: number,
83
94
  signerAddress: Hex,
84
95
  signer: (msg: TypedDataDefinition) => Promise<Hex>,
@@ -5,7 +5,7 @@ import { InboxAbi } from '@aztec/l1-artifacts/InboxAbi';
5
5
  import { type BlockTag, type GetContractReturnType, type Hex, getContract } from 'viem';
6
6
 
7
7
  import { getPublicClient } from '../client.js';
8
- import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
8
+ import type { DeployAztecL1ContractsReturnType } from '../deploy_aztec_l1_contracts.js';
9
9
  import type { L1ReaderConfig } from '../l1_reader.js';
10
10
  import type { ViemClient } from '../types.js';
11
11
  import { checkBlockTag } from './utils.js';
@@ -13,7 +13,7 @@ import { checkBlockTag } from './utils.js';
13
13
  export class InboxContract {
14
14
  private readonly inbox: GetContractReturnType<typeof InboxAbi, ViemClient>;
15
15
 
16
- static getFromL1ContractsValues(deployL1ContractsValues: DeployL1ContractsReturnType) {
16
+ static getFromL1ContractsValues(deployL1ContractsValues: DeployAztecL1ContractsReturnType) {
17
17
  const {
18
18
  l1Client,
19
19
  l1ContractAddresses: { inboxAddress },
@@ -45,6 +45,11 @@ export class InboxContract {
45
45
  return this.inbox;
46
46
  }
47
47
 
48
+ public async getLag(opts: { blockTag?: BlockTag; blockNumber?: bigint } = {}): Promise<bigint> {
49
+ await checkBlockTag(opts.blockNumber, this.client);
50
+ return await this.inbox.read.LAG(opts);
51
+ }
52
+
48
53
  public async getState(opts: { blockTag?: BlockTag; blockNumber?: bigint } = {}): Promise<InboxContractState> {
49
54
  await checkBlockTag(opts.blockNumber, this.client);
50
55
  const state = await this.inbox.read.getState(opts);