@aztec/ethereum 1.2.1 → 2.0.0-nightly.20250813

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 (98) hide show
  1. package/dest/config.d.ts +22 -7
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +49 -14
  4. package/dest/contracts/empire_base.d.ts +12 -10
  5. package/dest/contracts/empire_base.d.ts.map +1 -1
  6. package/dest/contracts/empire_base.js +21 -16
  7. package/dest/contracts/governance.d.ts +4 -4
  8. package/dest/contracts/governance.js +2 -2
  9. package/dest/contracts/governance_proposer.d.ts +7 -7
  10. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  11. package/dest/contracts/governance_proposer.js +13 -13
  12. package/dest/contracts/gse.d.ts +29 -0
  13. package/dest/contracts/gse.d.ts.map +1 -0
  14. package/dest/contracts/gse.js +56 -0
  15. package/dest/contracts/index.d.ts +1 -0
  16. package/dest/contracts/index.d.ts.map +1 -1
  17. package/dest/contracts/index.js +1 -0
  18. package/dest/contracts/multicall.d.ts +3 -1
  19. package/dest/contracts/multicall.d.ts.map +1 -1
  20. package/dest/contracts/multicall.js +11 -2
  21. package/dest/contracts/registry.d.ts +1 -0
  22. package/dest/contracts/registry.d.ts.map +1 -1
  23. package/dest/contracts/registry.js +3 -0
  24. package/dest/contracts/rollup.d.ts +39 -5
  25. package/dest/contracts/rollup.d.ts.map +1 -1
  26. package/dest/contracts/rollup.js +92 -14
  27. package/dest/contracts/slashing_proposer.d.ts +21 -10
  28. package/dest/contracts/slashing_proposer.d.ts.map +1 -1
  29. package/dest/contracts/slashing_proposer.js +43 -23
  30. package/dest/deploy_l1_contracts.d.ts +11 -36664
  31. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  32. package/dest/deploy_l1_contracts.js +92 -177
  33. package/dest/index.d.ts +1 -1
  34. package/dest/index.d.ts.map +1 -1
  35. package/dest/index.js +1 -1
  36. package/dest/l1_artifacts.d.ts +51869 -0
  37. package/dest/l1_artifacts.d.ts.map +1 -0
  38. package/dest/l1_artifacts.js +141 -0
  39. package/dest/l1_tx_utils.d.ts +4 -2
  40. package/dest/l1_tx_utils.d.ts.map +1 -1
  41. package/dest/l1_tx_utils.js +46 -21
  42. package/dest/queries.d.ts +1 -8
  43. package/dest/queries.d.ts.map +1 -1
  44. package/dest/queries.js +20 -15
  45. package/dest/test/chain_monitor.d.ts +4 -2
  46. package/dest/test/chain_monitor.d.ts.map +1 -1
  47. package/dest/test/chain_monitor.js +12 -3
  48. package/dest/test/delayed_tx_utils.js +2 -2
  49. package/dest/{eth_cheat_codes.d.ts → test/eth_cheat_codes.d.ts} +8 -4
  50. package/dest/test/eth_cheat_codes.d.ts.map +1 -0
  51. package/dest/{eth_cheat_codes.js → test/eth_cheat_codes.js} +27 -11
  52. package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
  53. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  54. package/dest/test/eth_cheat_codes_with_state.js +1 -1
  55. package/dest/test/index.d.ts +2 -0
  56. package/dest/test/index.d.ts.map +1 -1
  57. package/dest/test/index.js +2 -0
  58. package/dest/test/rollup_cheat_codes.d.ts +81 -0
  59. package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
  60. package/dest/test/rollup_cheat_codes.js +234 -0
  61. package/dest/test/start_anvil.d.ts +1 -0
  62. package/dest/test/start_anvil.d.ts.map +1 -1
  63. package/dest/test/start_anvil.js +6 -1
  64. package/dest/test/tx_delayer.d.ts +8 -1
  65. package/dest/test/tx_delayer.d.ts.map +1 -1
  66. package/dest/test/tx_delayer.js +51 -11
  67. package/dest/test/upgrade_utils.d.ts.map +1 -1
  68. package/dest/test/upgrade_utils.js +1 -1
  69. package/dest/utils.d.ts +1 -0
  70. package/dest/utils.d.ts.map +1 -1
  71. package/dest/utils.js +1 -1
  72. package/package.json +5 -5
  73. package/src/config.ts +62 -18
  74. package/src/contracts/empire_base.ts +28 -19
  75. package/src/contracts/governance.ts +2 -2
  76. package/src/contracts/governance_proposer.ts +23 -15
  77. package/src/contracts/gse.ts +73 -0
  78. package/src/contracts/index.ts +1 -0
  79. package/src/contracts/multicall.ts +8 -1
  80. package/src/contracts/registry.ts +4 -0
  81. package/src/contracts/rollup.ts +115 -9
  82. package/src/contracts/slashing_proposer.ts +55 -27
  83. package/src/deploy_l1_contracts.ts +151 -238
  84. package/src/index.ts +1 -1
  85. package/src/l1_artifacts.ts +216 -0
  86. package/src/l1_tx_utils.ts +52 -26
  87. package/src/queries.ts +20 -31
  88. package/src/test/chain_monitor.ts +9 -2
  89. package/src/test/delayed_tx_utils.ts +2 -2
  90. package/src/{eth_cheat_codes.ts → test/eth_cheat_codes.ts} +20 -14
  91. package/src/test/eth_cheat_codes_with_state.ts +1 -1
  92. package/src/test/index.ts +2 -0
  93. package/src/test/rollup_cheat_codes.ts +257 -0
  94. package/src/test/start_anvil.ts +9 -1
  95. package/src/test/tx_delayer.ts +55 -9
  96. package/src/test/upgrade_utils.ts +1 -1
  97. package/src/utils.ts +1 -1
  98. package/dest/eth_cheat_codes.d.ts.map +0 -1
@@ -1,54 +1,8 @@
1
- import { getActiveNetworkName } from '@aztec/foundation/config';
1
+ import { SecretValue, getActiveNetworkName } from '@aztec/foundation/config';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { Fr } from '@aztec/foundation/fields';
4
4
  import { type Logger, createLogger } from '@aztec/foundation/log';
5
- import {
6
- CoinIssuerAbi,
7
- CoinIssuerBytecode,
8
- ExtRollupLib2Abi,
9
- ExtRollupLib2Bytecode,
10
- ExtRollupLibAbi,
11
- ExtRollupLibBytecode,
12
- FeeAssetHandlerAbi,
13
- FeeAssetHandlerBytecode,
14
- FeeJuicePortalAbi,
15
- FeeJuicePortalBytecode,
16
- GSEAbi,
17
- GSEBytecode,
18
- GovernanceAbi,
19
- GovernanceBytecode,
20
- GovernanceProposerAbi,
21
- GovernanceProposerBytecode,
22
- HonkVerifierAbi,
23
- HonkVerifierBytecode,
24
- InboxAbi,
25
- InboxBytecode,
26
- MockVerifierAbi,
27
- MockVerifierBytecode,
28
- MockZKPassportVerifierAbi,
29
- MockZKPassportVerifierBytecode,
30
- MultiAdderAbi,
31
- MultiAdderBytecode,
32
- OutboxAbi,
33
- OutboxBytecode,
34
- RegisterNewRollupVersionPayloadAbi,
35
- RegisterNewRollupVersionPayloadBytecode,
36
- RegistryAbi,
37
- RegistryBytecode,
38
- RewardDistributorAbi,
39
- RewardDistributorBytecode,
40
- RollupAbi,
41
- RollupBytecode,
42
- RollupLinkReferences,
43
- SlashFactoryAbi,
44
- SlashFactoryBytecode,
45
- StakingAssetHandlerAbi,
46
- StakingAssetHandlerBytecode,
47
- TestERC20Abi,
48
- TestERC20Bytecode,
49
- ValidatorSelectionLibAbi,
50
- ValidatorSelectionLibBytecode,
51
- } from '@aztec/l1-artifacts';
5
+ import { DateProvider } from '@aztec/foundation/timer';
52
6
 
53
7
  import type { Abi, Narrow } from 'abitype';
54
8
  import {
@@ -72,12 +26,32 @@ import { createExtendedL1Client } from './client.js';
72
26
  import {
73
27
  type L1ContractsConfig,
74
28
  getEntryQueueConfig,
29
+ getGSEConfiguration,
75
30
  getGovernanceConfiguration,
76
31
  getRewardBoostConfig,
77
32
  getRewardConfig,
78
33
  } from './config.js';
34
+ import { GSEContract } from './contracts/gse.js';
35
+ import { deployMulticall3 } from './contracts/multicall.js';
79
36
  import { RegistryContract } from './contracts/registry.js';
80
37
  import { RollupContract } from './contracts/rollup.js';
38
+ import {
39
+ CoinIssuerArtifact,
40
+ FeeAssetArtifact,
41
+ FeeAssetHandlerArtifact,
42
+ GSEArtifact,
43
+ GovernanceArtifact,
44
+ GovernanceProposerArtifact,
45
+ MultiAdderArtifact,
46
+ RegisterNewRollupVersionPayloadArtifact,
47
+ RegistryArtifact,
48
+ RollupArtifact,
49
+ SlashFactoryArtifact,
50
+ StakingAssetArtifact,
51
+ StakingAssetHandlerArtifact,
52
+ l1ArtifactsVerifiers,
53
+ mockVerifiers,
54
+ } from './l1_artifacts.js';
81
55
  import type { L1ContractAddresses } from './l1_contract_addresses.js';
82
56
  import {
83
57
  type GasPrice,
@@ -88,6 +62,7 @@ import {
88
62
  getL1TxUtilsConfigEnvVars,
89
63
  } from './l1_tx_utils.js';
90
64
  import type { ExtendedViemWalletClient } from './types.js';
65
+ import { formatViemError } from './utils.js';
91
66
  import { ZK_PASSPORT_DOMAIN, ZK_PASSPORT_SCOPE, ZK_PASSPORT_VERIFIER_ADDRESS } from './zkPassportVerifierAddress.js';
92
67
 
93
68
  export const DEPLOYER_ADDRESS: Hex = '0x4e59b44847b379578588920cA78FbF26c0B4956C';
@@ -97,6 +72,7 @@ const networkName = getActiveNetworkName();
97
72
  export type Operator = {
98
73
  attester: EthAddress;
99
74
  withdrawer: EthAddress;
75
+ bn254SecretKey: SecretValue<bigint>;
100
76
  };
101
77
 
102
78
  /**
@@ -129,6 +105,10 @@ export interface Libraries {
129
105
  * Contract artifacts
130
106
  */
131
107
  export interface ContractArtifacts {
108
+ /**
109
+ * The contract name.
110
+ */
111
+ name: string;
132
112
  /**
133
113
  * The contract abi.
134
114
  */
@@ -143,112 +123,6 @@ export interface ContractArtifacts {
143
123
  libraries?: Libraries;
144
124
  }
145
125
 
146
- export const l1Artifacts = {
147
- registry: {
148
- contractAbi: RegistryAbi,
149
- contractBytecode: RegistryBytecode as Hex,
150
- },
151
- inbox: {
152
- contractAbi: InboxAbi,
153
- contractBytecode: InboxBytecode as Hex,
154
- },
155
- outbox: {
156
- contractAbi: OutboxAbi,
157
- contractBytecode: OutboxBytecode as Hex,
158
- },
159
- rollup: {
160
- contractAbi: RollupAbi,
161
- contractBytecode: RollupBytecode as Hex,
162
- libraries: {
163
- linkReferences: RollupLinkReferences,
164
- libraryCode: {
165
- ValidatorSelectionLib: {
166
- contractAbi: ValidatorSelectionLibAbi,
167
- contractBytecode: ValidatorSelectionLibBytecode as Hex,
168
- },
169
- ExtRollupLib: {
170
- contractAbi: ExtRollupLibAbi,
171
- contractBytecode: ExtRollupLibBytecode as Hex,
172
- },
173
- ExtRollupLib2: {
174
- contractAbi: ExtRollupLib2Abi,
175
- contractBytecode: ExtRollupLib2Bytecode as Hex,
176
- },
177
- },
178
- },
179
- },
180
- stakingAsset: {
181
- contractAbi: TestERC20Abi,
182
- contractBytecode: TestERC20Bytecode as Hex,
183
- },
184
- feeAsset: {
185
- contractAbi: TestERC20Abi,
186
- contractBytecode: TestERC20Bytecode as Hex,
187
- },
188
- feeJuicePortal: {
189
- contractAbi: FeeJuicePortalAbi,
190
- contractBytecode: FeeJuicePortalBytecode as Hex,
191
- },
192
- rewardDistributor: {
193
- contractAbi: RewardDistributorAbi,
194
- contractBytecode: RewardDistributorBytecode as Hex,
195
- },
196
- coinIssuer: {
197
- contractAbi: CoinIssuerAbi,
198
- contractBytecode: CoinIssuerBytecode as Hex,
199
- },
200
- governanceProposer: {
201
- contractAbi: GovernanceProposerAbi,
202
- contractBytecode: GovernanceProposerBytecode as Hex,
203
- },
204
- governance: {
205
- contractAbi: GovernanceAbi,
206
- contractBytecode: GovernanceBytecode as Hex,
207
- },
208
- slashFactory: {
209
- contractAbi: SlashFactoryAbi,
210
- contractBytecode: SlashFactoryBytecode as Hex,
211
- },
212
- registerNewRollupVersionPayload: {
213
- contractAbi: RegisterNewRollupVersionPayloadAbi,
214
- contractBytecode: RegisterNewRollupVersionPayloadBytecode as Hex,
215
- },
216
- feeAssetHandler: {
217
- contractAbi: FeeAssetHandlerAbi,
218
- contractBytecode: FeeAssetHandlerBytecode as Hex,
219
- },
220
- stakingAssetHandler: {
221
- contractAbi: StakingAssetHandlerAbi,
222
- contractBytecode: StakingAssetHandlerBytecode as Hex,
223
- },
224
- multiAdder: {
225
- contractAbi: MultiAdderAbi,
226
- contractBytecode: MultiAdderBytecode as Hex,
227
- },
228
- gse: {
229
- contractAbi: GSEAbi,
230
- contractBytecode: GSEBytecode as Hex,
231
- },
232
- };
233
-
234
- export const l1ArtifactsVerifiers = {
235
- honkVerifier: {
236
- contractAbi: HonkVerifierAbi,
237
- contractBytecode: HonkVerifierBytecode as Hex,
238
- },
239
- };
240
-
241
- const mockVerifiers = {
242
- mockVerifier: {
243
- contractAbi: MockVerifierAbi,
244
- contractBytecode: MockVerifierBytecode as Hex,
245
- },
246
- mockZkPassportVerifier: {
247
- contractAbi: MockZKPassportVerifierAbi,
248
- contractBytecode: MockZKPassportVerifierBytecode as Hex,
249
- },
250
- };
251
-
252
126
  export interface DeployL1ContractsArgs extends L1ContractsConfig {
253
127
  /** The vk tree root. */
254
128
  vkTreeRoot: Fr;
@@ -287,37 +161,41 @@ export const deploySharedContracts = async (
287
161
  args: DeployL1ContractsArgs,
288
162
  logger: Logger,
289
163
  ) => {
290
- logger.info(`Deploying shared contracts. Network configration: ${networkName}`);
164
+ logger.info(`Deploying shared contracts for network configration: ${networkName}`);
291
165
 
292
166
  const txHashes: Hex[] = [];
293
167
 
294
- const feeAssetAddress = await deployer.deploy(l1Artifacts.feeAsset, [
168
+ const feeAssetAddress = await deployer.deploy(FeeAssetArtifact, [
295
169
  'FeeJuice',
296
170
  'FEE',
297
171
  l1Client.account.address.toString(),
298
172
  ]);
299
173
  logger.verbose(`Deployed Fee Asset at ${feeAssetAddress}`);
300
174
 
301
- const stakingAssetAddress = await deployer.deploy(l1Artifacts.stakingAsset, [
175
+ const stakingAssetAddress = await deployer.deploy(StakingAssetArtifact, [
302
176
  'Staking',
303
177
  'STK',
304
178
  l1Client.account.address.toString(),
305
179
  ]);
306
180
  logger.verbose(`Deployed Staking Asset at ${stakingAssetAddress}`);
307
181
 
308
- const gseAddress = await deployer.deploy(l1Artifacts.gse, [
182
+ const gseConfiguration = getGSEConfiguration(networkName);
183
+
184
+ const gseAddress = await deployer.deploy(GSEArtifact, [
309
185
  l1Client.account.address.toString(),
310
186
  stakingAssetAddress.toString(),
187
+ gseConfiguration.activationThreshold,
188
+ gseConfiguration.ejectionThreshold,
311
189
  ]);
312
190
  logger.verbose(`Deployed GSE at ${gseAddress}`);
313
191
 
314
- const registryAddress = await deployer.deploy(l1Artifacts.registry, [
192
+ const registryAddress = await deployer.deploy(RegistryArtifact, [
315
193
  l1Client.account.address.toString(),
316
194
  feeAssetAddress.toString(),
317
195
  ]);
318
196
  logger.verbose(`Deployed Registry at ${registryAddress}`);
319
197
 
320
- const governanceProposerAddress = await deployer.deploy(l1Artifacts.governanceProposer, [
198
+ const governanceProposerAddress = await deployer.deploy(GovernanceProposerArtifact, [
321
199
  registryAddress.toString(),
322
200
  gseAddress.toString(),
323
201
  args.governanceProposerQuorum,
@@ -327,7 +205,7 @@ export const deploySharedContracts = async (
327
205
 
328
206
  // @note @LHerskind the assets are expected to be the same at some point, but for better
329
207
  // configurability they are different for now.
330
- const governanceAddress = await deployer.deploy(l1Artifacts.governance, [
208
+ const governanceAddress = await deployer.deploy(GovernanceArtifact, [
331
209
  stakingAssetAddress.toString(),
332
210
  governanceProposerAddress.toString(),
333
211
  gseAddress.toString(),
@@ -343,7 +221,7 @@ export const deploySharedContracts = async (
343
221
  } else {
344
222
  const gseContract = getContract({
345
223
  address: getAddress(gseAddress.toString()),
346
- abi: l1Artifacts.gse.contractAbi,
224
+ abi: GSEArtifact.contractAbi,
347
225
  client: l1Client,
348
226
  });
349
227
  const existingGovernance = await gseContract.read.getGovernance();
@@ -357,7 +235,7 @@ export const deploySharedContracts = async (
357
235
  {
358
236
  to: gseAddress.toString(),
359
237
  data: encodeFunctionData({
360
- abi: l1Artifacts.gse.contractAbi,
238
+ abi: GSEArtifact.contractAbi,
361
239
  functionName: 'setGovernance',
362
240
  args: [governanceAddress.toString()],
363
241
  }),
@@ -369,7 +247,7 @@ export const deploySharedContracts = async (
369
247
  txHashes.push(txHash);
370
248
  }
371
249
 
372
- const coinIssuerAddress = await deployer.deploy(l1Artifacts.coinIssuer, [
250
+ const coinIssuerAddress = await deployer.deploy(CoinIssuerArtifact, [
373
251
  feeAssetAddress.toString(),
374
252
  1n * 10n ** 18n, // @todo #8084
375
253
  governanceAddress.toString(),
@@ -378,7 +256,7 @@ export const deploySharedContracts = async (
378
256
 
379
257
  const feeAsset = getContract({
380
258
  address: feeAssetAddress.toString(),
381
- abi: l1Artifacts.feeAsset.contractAbi,
259
+ abi: FeeAssetArtifact.contractAbi,
382
260
  client: l1Client,
383
261
  });
384
262
 
@@ -390,7 +268,7 @@ export const deploySharedContracts = async (
390
268
  {
391
269
  to: feeAssetAddress.toString(),
392
270
  data: encodeFunctionData({
393
- abi: l1Artifacts.feeAsset.contractAbi,
271
+ abi: FeeAssetArtifact.contractAbi,
394
272
  functionName: 'addMinter',
395
273
  args: [coinIssuerAddress.toString()],
396
274
  }),
@@ -401,16 +279,7 @@ export const deploySharedContracts = async (
401
279
  txHashes.push(txHash);
402
280
  }
403
281
 
404
- const { txHash: setGovernanceTxHash } = await deployer.sendTransaction({
405
- to: registryAddress.toString(),
406
- data: encodeFunctionData({
407
- abi: l1Artifacts.registry.contractAbi,
408
- functionName: 'updateGovernance',
409
- args: [governanceAddress.toString()],
410
- }),
411
- });
412
-
413
- txHashes.push(setGovernanceTxHash);
282
+ // Registry ownership will be transferred to governance later, after rollup is added
414
283
 
415
284
  let feeAssetHandlerAddress: EthAddress | undefined = undefined;
416
285
  let stakingAssetHandlerAddress: EthAddress | undefined = undefined;
@@ -422,7 +291,7 @@ export const deploySharedContracts = async (
422
291
  /* CHEAT CODES START HERE */
423
292
  /* -------------------------------------------------------------------------- */
424
293
 
425
- feeAssetHandlerAddress = await deployer.deploy(l1Artifacts.feeAssetHandler, [
294
+ feeAssetHandlerAddress = await deployer.deploy(FeeAssetHandlerArtifact, [
426
295
  l1Client.account.address,
427
296
  feeAssetAddress.toString(),
428
297
  BigInt(1e18),
@@ -432,7 +301,7 @@ export const deploySharedContracts = async (
432
301
  const { txHash } = await deployer.sendTransaction({
433
302
  to: feeAssetAddress.toString(),
434
303
  data: encodeFunctionData({
435
- abi: l1Artifacts.feeAsset.contractAbi,
304
+ abi: FeeAssetArtifact.contractAbi,
436
305
  functionName: 'addMinter',
437
306
  args: [feeAssetHandlerAddress.toString()],
438
307
  }),
@@ -465,15 +334,13 @@ export const deploySharedContracts = async (
465
334
  skipMerkleCheck: true, // skip merkle check - needed for testing without generating proofs
466
335
  };
467
336
 
468
- stakingAssetHandlerAddress = await deployer.deploy(l1Artifacts.stakingAssetHandler, [
469
- stakingAssetHandlerDeployArgs,
470
- ]);
337
+ stakingAssetHandlerAddress = await deployer.deploy(StakingAssetHandlerArtifact, [stakingAssetHandlerDeployArgs]);
471
338
  logger.verbose(`Deployed StakingAssetHandler at ${stakingAssetHandlerAddress}`);
472
339
 
473
340
  const { txHash: stakingMinterTxHash } = await deployer.sendTransaction({
474
341
  to: stakingAssetAddress.toString(),
475
342
  data: encodeFunctionData({
476
- abi: l1Artifacts.stakingAsset.contractAbi,
343
+ abi: StakingAssetArtifact.contractAbi,
477
344
  functionName: 'addMinter',
478
345
  args: [stakingAssetHandlerAddress.toString()],
479
346
  }),
@@ -503,19 +370,13 @@ export const deploySharedContracts = async (
503
370
 
504
371
  const rewardDistributorAddress = await registry.getRewardDistributor();
505
372
 
506
- const rewardDistributor = getContract({
507
- address: rewardDistributorAddress.toString(),
508
- abi: l1Artifacts.rewardDistributor.contractAbi,
509
- client: l1Client,
510
- });
511
-
512
- const blockReward = await rewardDistributor.read.BLOCK_REWARD();
373
+ const blockReward = getRewardConfig(networkName).blockReward;
513
374
 
514
375
  const funding = blockReward * 200000n;
515
376
  const { txHash: fundRewardDistributorTxHash } = await deployer.sendTransaction({
516
377
  to: feeAssetAddress.toString(),
517
378
  data: encodeFunctionData({
518
- abi: l1Artifacts.feeAsset.contractAbi,
379
+ abi: FeeAssetArtifact.contractAbi,
519
380
  functionName: 'mint',
520
381
  args: [rewardDistributorAddress.toString(), funding],
521
382
  }),
@@ -572,13 +433,20 @@ export const deployRollupForUpgrade = async (
572
433
  extendedClient: ExtendedViemWalletClient,
573
434
  args: Omit<
574
435
  DeployL1ContractsArgs,
575
- 'governanceProposerQuorum' | 'governanceProposerRoundSize' | 'minimumStake' | 'depositAmount'
436
+ 'governanceProposerQuorum' | 'governanceProposerRoundSize' | 'ejectionThreshold' | 'activationThreshold'
576
437
  >,
577
438
  registryAddress: EthAddress,
578
439
  logger: Logger,
579
440
  txUtilsConfig: L1TxUtilsConfig,
580
441
  ) => {
581
- const deployer = new L1Deployer(extendedClient, args.salt, args.acceleratedTestDeployments, logger, txUtilsConfig);
442
+ const deployer = new L1Deployer(
443
+ extendedClient,
444
+ args.salt,
445
+ undefined,
446
+ args.acceleratedTestDeployments,
447
+ logger,
448
+ txUtilsConfig,
449
+ );
582
450
 
583
451
  const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
584
452
 
@@ -590,7 +458,7 @@ export const deployRollupForUpgrade = async (
590
458
  };
591
459
 
592
460
  export const deploySlashFactory = async (deployer: L1Deployer, rollupAddress: Hex, logger: Logger) => {
593
- const slashFactoryAddress = await deployer.deploy(l1Artifacts.slashFactory, [rollupAddress]);
461
+ const slashFactoryAddress = await deployer.deploy(SlashFactoryArtifact, [rollupAddress]);
594
462
  logger.verbose(`Deployed SlashFactory at ${slashFactoryAddress}`);
595
463
  return slashFactoryAddress;
596
464
  };
@@ -599,7 +467,7 @@ export const deployUpgradePayload = async (
599
467
  deployer: L1Deployer,
600
468
  addresses: Pick<L1ContractAddresses, 'registryAddress' | 'rollupAddress'>,
601
469
  ) => {
602
- const payloadAddress = await deployer.deploy(l1Artifacts.registerNewRollupVersionPayload, [
470
+ const payloadAddress = await deployer.deploy(RegisterNewRollupVersionPayloadArtifact, [
603
471
  addresses.registryAddress.toString(),
604
472
  addresses.rollupAddress.toString(),
605
473
  ]);
@@ -615,7 +483,7 @@ export const deployRollup = async (
615
483
  deployer: L1Deployer,
616
484
  args: Omit<
617
485
  DeployL1ContractsArgs,
618
- 'governanceProposerQuorum' | 'governanceProposerRoundSize' | 'minimumStake' | 'depositAmount'
486
+ 'governanceProposerQuorum' | 'governanceProposerRoundSize' | 'ejectionThreshold' | 'activationThreshold'
619
487
  >,
620
488
  addresses: Pick<
621
489
  L1ContractAddresses,
@@ -653,6 +521,9 @@ export const deployRollup = async (
653
521
  aztecProofSubmissionEpochs: args.aztecProofSubmissionEpochs,
654
522
  slashingQuorum: args.slashingQuorum,
655
523
  slashingRoundSize: args.slashingRoundSize,
524
+ slashingLifetimeInRounds: args.slashingLifetimeInRounds,
525
+ slashingExecutionDelayInRounds: args.slashingExecutionDelayInRounds,
526
+ slashingVetoer: args.slashingVetoer.toString(),
656
527
  manaTarget: args.manaTarget,
657
528
  provingCostPerMana: args.provingCostPerMana,
658
529
  rewardConfig: rewardConfig,
@@ -677,7 +548,7 @@ export const deployRollup = async (
677
548
  rollupConfigArgs,
678
549
  ];
679
550
 
680
- const rollupAddress = await deployer.deploy(l1Artifacts.rollup, rollupArgs);
551
+ const rollupAddress = await deployer.deploy(RollupArtifact, rollupArgs);
681
552
  logger.verbose(`Deployed Rollup at ${rollupAddress}`, rollupConfigArgs);
682
553
 
683
554
  const rollupContract = new RollupContract(extendedClient, rollupAddress);
@@ -692,7 +563,7 @@ export const deployRollup = async (
692
563
  const { txHash: mintTxHash } = await deployer.sendTransaction({
693
564
  to: addresses.feeJuiceAddress.toString(),
694
565
  data: encodeFunctionData({
695
- abi: l1Artifacts.feeAsset.contractAbi,
566
+ abi: FeeAssetArtifact.contractAbi,
696
567
  functionName: 'mint',
697
568
  args: [feeJuicePortalAddress.toString(), args.feeJuicePortalInitialBalance],
698
569
  }),
@@ -703,13 +574,13 @@ export const deployRollup = async (
703
574
  txHashes.push(mintTxHash);
704
575
  }
705
576
 
706
- const slashFactoryAddress = await deployer.deploy(l1Artifacts.slashFactory, [rollupAddress.toString()]);
577
+ const slashFactoryAddress = await deployer.deploy(SlashFactoryArtifact, [rollupAddress.toString()]);
707
578
  logger.verbose(`Deployed SlashFactory at ${slashFactoryAddress}`);
708
579
 
709
580
  // We need to call a function on the registry to set the various contract addresses.
710
581
  const registryContract = getContract({
711
582
  address: getAddress(addresses.registryAddress.toString()),
712
- abi: l1Artifacts.registry.contractAbi,
583
+ abi: RegistryArtifact.contractAbi,
713
584
  client: extendedClient,
714
585
  });
715
586
 
@@ -723,7 +594,7 @@ export const deployRollup = async (
723
594
  const { txHash: addRollupTxHash } = await deployer.sendTransaction({
724
595
  to: addresses.registryAddress.toString(),
725
596
  data: encodeFunctionData({
726
- abi: l1Artifacts.registry.contractAbi,
597
+ abi: RegistryArtifact.contractAbi,
727
598
  functionName: 'addRollup',
728
599
  args: [getAddress(rollupContract.address)],
729
600
  }),
@@ -741,7 +612,7 @@ export const deployRollup = async (
741
612
  // We need to call a function on the registry to set the various contract addresses.
742
613
  const gseContract = getContract({
743
614
  address: getAddress(addresses.gseAddress.toString()),
744
- abi: l1Artifacts.gse.contractAbi,
615
+ abi: GSEArtifact.contractAbi,
745
616
  client: extendedClient,
746
617
  });
747
618
  if ((await gseContract.read.owner()) === getAddress(extendedClient.account.address)) {
@@ -749,7 +620,7 @@ export const deployRollup = async (
749
620
  const { txHash: addRollupTxHash } = await deployer.sendTransaction({
750
621
  to: addresses.gseAddress.toString(),
751
622
  data: encodeFunctionData({
752
- abi: l1Artifacts.gse.contractAbi,
623
+ abi: GSEArtifact.contractAbi,
753
624
  functionName: 'addRollup',
754
625
  args: [getAddress(rollupContract.address)],
755
626
  }),
@@ -769,6 +640,7 @@ export const deployRollup = async (
769
640
  await addMultipleValidators(
770
641
  extendedClient,
771
642
  deployer,
643
+ addresses.gseAddress.toString(),
772
644
  rollupAddress.toString(),
773
645
  addresses.stakingAssetAddress.toString(),
774
646
  args.initialValidators,
@@ -796,13 +668,13 @@ export const handoverToGovernance = async (
796
668
  // We need to call a function on the registry to set the various contract addresses.
797
669
  const registryContract = getContract({
798
670
  address: getAddress(registryAddress.toString()),
799
- abi: l1Artifacts.registry.contractAbi,
671
+ abi: RegistryArtifact.contractAbi,
800
672
  client: extendedClient,
801
673
  });
802
674
 
803
675
  const gseContract = getContract({
804
676
  address: getAddress(gseAddress.toString()),
805
- abi: l1Artifacts.gse.contractAbi,
677
+ abi: GSEArtifact.contractAbi,
806
678
  client: extendedClient,
807
679
  });
808
680
 
@@ -817,7 +689,7 @@ export const handoverToGovernance = async (
817
689
  const { txHash: transferOwnershipTxHash } = await deployer.sendTransaction({
818
690
  to: registryAddress.toString(),
819
691
  data: encodeFunctionData({
820
- abi: l1Artifacts.registry.contractAbi,
692
+ abi: RegistryArtifact.contractAbi,
821
693
  functionName: 'transferOwnership',
822
694
  args: [getAddress(governanceAddress.toString())],
823
695
  }),
@@ -834,7 +706,7 @@ export const handoverToGovernance = async (
834
706
  const { txHash: transferOwnershipTxHash } = await deployer.sendTransaction({
835
707
  to: gseContract.address,
836
708
  data: encodeFunctionData({
837
- abi: l1Artifacts.gse.contractAbi,
709
+ abi: GSEArtifact.contractAbi,
838
710
  functionName: 'transferOwnership',
839
711
  args: [getAddress(governanceAddress.toString())],
840
712
  }),
@@ -864,6 +736,7 @@ export const handoverToGovernance = async (
864
736
  export const addMultipleValidators = async (
865
737
  extendedClient: ExtendedViemWalletClient,
866
738
  deployer: L1Deployer,
739
+ gseAddress: Hex,
867
740
  rollupAddress: Hex,
868
741
  stakingAssetAddress: Hex,
869
742
  validators: Operator[],
@@ -871,7 +744,7 @@ export const addMultipleValidators = async (
871
744
  logger: Logger,
872
745
  ) => {
873
746
  const rollup = new RollupContract(extendedClient, rollupAddress);
874
- const depositAmount = await rollup.getDepositAmount();
747
+ const activationThreshold = await rollup.getActivationThreshold();
875
748
  if (validators && validators.length > 0) {
876
749
  // Check if some of the initial validators are already registered, so we support idempotent deployments
877
750
  if (!acceleratedTestDeployments) {
@@ -894,22 +767,26 @@ export const addMultipleValidators = async (
894
767
  }
895
768
 
896
769
  if (validators.length > 0) {
897
- const multiAdder = await deployer.deploy(l1Artifacts.multiAdder, [
898
- rollupAddress,
899
- deployer.client.account.address,
900
- ]);
770
+ const gseContract = new GSEContract(extendedClient, gseAddress);
771
+ const multiAdder = await deployer.deploy(MultiAdderArtifact, [rollupAddress, deployer.client.account.address]);
772
+
773
+ const makeValidatorTuples = async (validator: Operator) => {
774
+ const registrationTuple = await gseContract.makeRegistrationTuple(validator.bn254SecretKey.getValue());
775
+ return {
776
+ attester: getAddress(validator.attester.toString()),
777
+ withdrawer: getAddress(validator.withdrawer.toString()),
778
+ ...registrationTuple,
779
+ };
780
+ };
901
781
 
902
- const validatorsTuples = validators.map(v => ({
903
- attester: getAddress(v.attester.toString()),
904
- withdrawer: getAddress(v.withdrawer.toString()),
905
- }));
782
+ const validatorsTuples = await Promise.all(validators.map(makeValidatorTuples));
906
783
 
907
784
  // Mint tokens, approve them, use cheat code to initialise validator set without setting up the epoch.
908
- const stakeNeeded = depositAmount * BigInt(validators.length);
785
+ const stakeNeeded = activationThreshold * BigInt(validators.length);
909
786
  const { txHash } = await deployer.sendTransaction({
910
787
  to: stakingAssetAddress,
911
788
  data: encodeFunctionData({
912
- abi: l1Artifacts.stakingAsset.contractAbi,
789
+ abi: StakingAssetArtifact.contractAbi,
913
790
  functionName: 'mint',
914
791
  args: [multiAdder.toString(), stakeNeeded],
915
792
  }),
@@ -922,7 +799,7 @@ export const addMultipleValidators = async (
922
799
 
923
800
  const addValidatorsTxHash = await deployer.client.writeContract({
924
801
  address: multiAdder.toString(),
925
- abi: l1Artifacts.multiAdder.contractAbi,
802
+ abi: MultiAdderArtifact.contractAbi,
926
803
  functionName: 'addValidators',
927
804
  args: [validatorsTuples],
928
805
  });
@@ -954,7 +831,7 @@ export const cheat_initializeFeeAssetHandler = async (
954
831
  feeAssetHandlerAddress: EthAddress;
955
832
  txHash: Hex;
956
833
  }> => {
957
- const feeAssetHandlerAddress = await deployer.deploy(l1Artifacts.feeAssetHandler, [
834
+ const feeAssetHandlerAddress = await deployer.deploy(FeeAssetHandlerArtifact, [
958
835
  extendedClient.account.address,
959
836
  feeAssetAddress.toString(),
960
837
  BigInt(1e18),
@@ -964,7 +841,7 @@ export const cheat_initializeFeeAssetHandler = async (
964
841
  const { txHash } = await deployer.sendTransaction({
965
842
  to: feeAssetAddress.toString(),
966
843
  data: encodeFunctionData({
967
- abi: l1Artifacts.feeAsset.contractAbi,
844
+ abi: FeeAssetArtifact.contractAbi,
968
845
  functionName: 'addMinter',
969
846
  args: [feeAssetHandlerAddress.toString()],
970
847
  }),
@@ -992,6 +869,9 @@ export const deployL1Contracts = async (
992
869
  ): Promise<DeployL1ContractsReturnType> => {
993
870
  const l1Client = createExtendedL1Client(rpcUrls, account, chain);
994
871
 
872
+ // Deploy multicall3 if it does not exist in this network
873
+ await deployMulticall3(l1Client, logger);
874
+
995
875
  // We are assuming that you are running this on a local anvil node which have 1s block times
996
876
  // To align better with actual deployment, we update the block interval to 12s
997
877
 
@@ -1014,7 +894,15 @@ export const deployL1Contracts = async (
1014
894
 
1015
895
  logger.verbose(`Deploying contracts from ${account.address.toString()}`);
1016
896
 
1017
- const deployer = new L1Deployer(l1Client, args.salt, args.acceleratedTestDeployments, logger, txUtilsConfig);
897
+ const dateProvider = new DateProvider();
898
+ const deployer = new L1Deployer(
899
+ l1Client,
900
+ args.salt,
901
+ dateProvider,
902
+ args.acceleratedTestDeployments,
903
+ logger,
904
+ txUtilsConfig,
905
+ );
1018
906
 
1019
907
  const {
1020
908
  feeAssetAddress,
@@ -1023,6 +911,7 @@ export const deployL1Contracts = async (
1023
911
  stakingAssetHandlerAddress,
1024
912
  registryAddress,
1025
913
  gseAddress,
914
+ governanceAddress,
1026
915
  rewardDistributorAddress,
1027
916
  zkPassportVerifierAddress,
1028
917
  } = await deploySharedContracts(l1Client, deployer, args, logger);
@@ -1043,13 +932,24 @@ export const deployL1Contracts = async (
1043
932
  logger.verbose('Waiting for rollup and slash factory to be deployed');
1044
933
  await deployer.waitForDeployments();
1045
934
 
935
+ // Now that the rollup has been deployed and added to the registry, transfer ownership to governance
936
+ await handoverToGovernance(
937
+ l1Client,
938
+ deployer,
939
+ registryAddress,
940
+ gseAddress,
941
+ governanceAddress,
942
+ logger,
943
+ args.acceleratedTestDeployments,
944
+ );
945
+
946
+ logger.info(`Handing over to governance complete`);
947
+
1046
948
  logger.verbose(`All transactions for L1 deployment have been mined`);
1047
949
  const l1Contracts = await RegistryContract.collectAddresses(l1Client, registryAddress, 'canonical');
1048
950
 
1049
951
  logger.info(`Aztec L1 contracts initialized`, l1Contracts);
1050
952
 
1051
- logger.info(`Handing over to governance`);
1052
-
1053
953
  if (isAnvilTestChain(chain.id)) {
1054
954
  // @note We make a time jump PAST the very first slot to not have to deal with the edge case of the first slot.
1055
955
  // The edge case being that the genesis block is already occupying slot 0, so we cannot have another block.
@@ -1094,30 +994,43 @@ export class L1Deployer {
1094
994
  constructor(
1095
995
  public readonly client: ExtendedViemWalletClient,
1096
996
  maybeSalt: number | undefined,
997
+ dateProvider: DateProvider = new DateProvider(),
1097
998
  private acceleratedTestDeployments: boolean = false,
1098
999
  private logger: Logger = createLogger('L1Deployer'),
1099
1000
  private txUtilsConfig?: L1TxUtilsConfig,
1100
1001
  ) {
1101
1002
  this.salt = maybeSalt ? padHex(numberToHex(maybeSalt), { size: 32 }) : undefined;
1102
- this.l1TxUtils = new L1TxUtils(this.client, this.logger, this.txUtilsConfig, this.acceleratedTestDeployments);
1103
- }
1104
-
1105
- async deploy(params: ContractArtifacts, args: readonly unknown[] = []): Promise<EthAddress> {
1106
- const { txHash, address } = await deployL1Contract(
1003
+ this.l1TxUtils = new L1TxUtils(
1107
1004
  this.client,
1108
- params.contractAbi,
1109
- params.contractBytecode,
1110
- args,
1111
- this.salt,
1112
- params.libraries,
1113
1005
  this.logger,
1114
- this.l1TxUtils,
1006
+ dateProvider,
1007
+ this.txUtilsConfig,
1115
1008
  this.acceleratedTestDeployments,
1116
1009
  );
1117
- if (txHash) {
1118
- this.txHashes.push(txHash);
1010
+ }
1011
+
1012
+ async deploy(params: ContractArtifacts, args: readonly unknown[] = []): Promise<EthAddress> {
1013
+ this.logger.debug(`Deploying ${params.name} contract`, { args });
1014
+ try {
1015
+ const { txHash, address } = await deployL1Contract(
1016
+ this.client,
1017
+ params.contractAbi,
1018
+ params.contractBytecode,
1019
+ args,
1020
+ this.salt,
1021
+ params.libraries,
1022
+ this.logger,
1023
+ this.l1TxUtils,
1024
+ this.acceleratedTestDeployments,
1025
+ );
1026
+ if (txHash) {
1027
+ this.txHashes.push(txHash);
1028
+ }
1029
+ this.logger.debug(`Deployed ${params.name} at ${address}`, { args });
1030
+ return address;
1031
+ } catch (error) {
1032
+ throw new Error(`Failed to deploy ${params.name}`, { cause: formatViemError(error) });
1119
1033
  }
1120
- return address;
1121
1034
  }
1122
1035
 
1123
1036
  async waitForDeployments(): Promise<void> {
@@ -1169,7 +1082,7 @@ export async function deployL1Contract(
1169
1082
 
1170
1083
  if (!l1TxUtils) {
1171
1084
  const config = getL1TxUtilsConfigEnvVars();
1172
- l1TxUtils = new L1TxUtils(extendedClient, logger, config, acceleratedTestDeployments);
1085
+ l1TxUtils = new L1TxUtils(extendedClient, logger, undefined, config, acceleratedTestDeployments);
1173
1086
  }
1174
1087
 
1175
1088
  if (libraries) {