@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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 (165) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +4 -3
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +2 -2
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -15
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
  7. package/dest/bench/client_flows/config.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +10 -30
  10. package/dest/bench/utils.d.ts +3 -12
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +17 -37
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +35 -35
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  22. package/dest/e2e_epochs/epochs_test.d.ts +20 -12
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +36 -27
  25. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  26. package/dest/e2e_fees/bridging_race.notest.js +14 -11
  27. package/dest/e2e_fees/fees_test.d.ts +13 -9
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +39 -40
  30. package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
  31. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  32. package/dest/e2e_l1_publisher/write_json.js +9 -8
  33. package/dest/e2e_multi_validator/utils.d.ts +2 -2
  34. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  35. package/dest/e2e_multi_validator/utils.js +4 -10
  36. package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
  37. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  38. package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
  39. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  40. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  41. package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
  42. package/dest/e2e_p2p/p2p_network.d.ts +238 -18
  43. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  44. package/dest/e2e_p2p/p2p_network.js +50 -25
  45. package/dest/e2e_p2p/shared.d.ts +16 -17
  46. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  47. package/dest/e2e_p2p/shared.js +57 -56
  48. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
  49. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  50. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  51. package/dest/fixtures/e2e_prover_test.d.ts +13 -11
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +57 -66
  54. package/dest/fixtures/fixtures.d.ts +2 -3
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +2 -3
  57. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  58. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  59. package/dest/fixtures/get_acvm_config.js +1 -1
  60. package/dest/fixtures/get_bb_config.d.ts +2 -2
  61. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  62. package/dest/fixtures/get_bb_config.js +2 -2
  63. package/dest/fixtures/index.d.ts +1 -1
  64. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  66. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  67. package/dest/fixtures/logging.d.ts +1 -1
  68. package/dest/fixtures/setup_p2p_test.d.ts +12 -11
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +50 -24
  71. package/dest/fixtures/snapshot_manager.d.ts +16 -15
  72. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  73. package/dest/fixtures/snapshot_manager.js +84 -88
  74. package/dest/fixtures/token_utils.d.ts +10 -5
  75. package/dest/fixtures/token_utils.d.ts.map +1 -1
  76. package/dest/fixtures/token_utils.js +17 -18
  77. package/dest/fixtures/utils.d.ts +44 -47
  78. package/dest/fixtures/utils.d.ts.map +1 -1
  79. package/dest/fixtures/utils.js +128 -185
  80. package/dest/fixtures/web3signer.d.ts +5 -0
  81. package/dest/fixtures/web3signer.d.ts.map +1 -0
  82. package/dest/fixtures/web3signer.js +53 -0
  83. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  84. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  85. package/dest/fixtures/with_telemetry_utils.js +2 -2
  86. package/dest/index.d.ts +1 -1
  87. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  88. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  89. package/dest/shared/cross_chain_test_harness.d.ts +20 -23
  90. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  91. package/dest/shared/cross_chain_test_harness.js +14 -16
  92. package/dest/shared/gas_portal_test_harness.d.ts +10 -17
  93. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  94. package/dest/shared/gas_portal_test_harness.js +11 -8
  95. package/dest/shared/index.d.ts +1 -1
  96. package/dest/shared/jest_setup.d.ts +1 -1
  97. package/dest/shared/jest_setup.js +1 -1
  98. package/dest/shared/submit-transactions.d.ts +6 -4
  99. package/dest/shared/submit-transactions.d.ts.map +1 -1
  100. package/dest/shared/submit-transactions.js +8 -7
  101. package/dest/shared/uniswap_l1_l2.d.ts +13 -9
  102. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  103. package/dest/shared/uniswap_l1_l2.js +44 -58
  104. package/dest/simulators/index.d.ts +1 -1
  105. package/dest/simulators/lending_simulator.d.ts +4 -7
  106. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  107. package/dest/simulators/lending_simulator.js +8 -5
  108. package/dest/simulators/token_simulator.d.ts +4 -2
  109. package/dest/simulators/token_simulator.d.ts.map +1 -1
  110. package/dest/simulators/token_simulator.js +2 -2
  111. package/dest/spartan/setup_test_wallets.d.ts +22 -14
  112. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  113. package/dest/spartan/setup_test_wallets.js +144 -86
  114. package/dest/spartan/tx_metrics.d.ts +39 -0
  115. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  116. package/dest/spartan/tx_metrics.js +95 -0
  117. package/dest/spartan/utils.d.ts +101 -16
  118. package/dest/spartan/utils.d.ts.map +1 -1
  119. package/dest/spartan/utils.js +414 -52
  120. package/package.json +43 -40
  121. package/src/bench/client_flows/benchmark.ts +8 -8
  122. package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
  123. package/src/bench/client_flows/data_extractor.ts +9 -31
  124. package/src/bench/utils.ts +15 -39
  125. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  126. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
  127. package/src/e2e_deploy_contract/deploy_test.ts +18 -36
  128. package/src/e2e_epochs/epochs_test.ts +59 -42
  129. package/src/e2e_fees/bridging_race.notest.ts +16 -11
  130. package/src/e2e_fees/fees_test.ts +48 -52
  131. package/src/e2e_l1_publisher/write_json.ts +12 -9
  132. package/src/e2e_multi_validator/utils.ts +5 -11
  133. package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
  134. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  135. package/src/e2e_p2p/p2p_network.ts +125 -89
  136. package/src/e2e_p2p/shared.ts +69 -60
  137. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  138. package/src/fixtures/e2e_prover_test.ts +65 -105
  139. package/src/fixtures/fixtures.ts +2 -5
  140. package/src/fixtures/get_acvm_config.ts +2 -2
  141. package/src/fixtures/get_bb_config.ts +3 -2
  142. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  143. package/src/fixtures/setup_p2p_test.ts +79 -32
  144. package/src/fixtures/snapshot_manager.ts +120 -131
  145. package/src/fixtures/token_utils.ts +16 -24
  146. package/src/fixtures/utils.ts +175 -269
  147. package/src/fixtures/web3signer.ts +63 -0
  148. package/src/fixtures/with_telemetry_utils.ts +2 -2
  149. package/src/guides/up_quick_start.sh +3 -11
  150. package/src/quality_of_service/alert_checker.ts +1 -1
  151. package/src/shared/cross_chain_test_harness.ts +23 -31
  152. package/src/shared/gas_portal_test_harness.ts +14 -21
  153. package/src/shared/jest_setup.ts +1 -1
  154. package/src/shared/submit-transactions.ts +12 -8
  155. package/src/shared/uniswap_l1_l2.ts +80 -88
  156. package/src/simulators/lending_simulator.ts +9 -6
  157. package/src/simulators/token_simulator.ts +5 -2
  158. package/src/spartan/DEVELOP.md +15 -3
  159. package/src/spartan/setup_test_wallets.ts +171 -127
  160. package/src/spartan/tx_metrics.ts +130 -0
  161. package/src/spartan/utils.ts +543 -45
  162. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  163. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  164. package/dest/fixtures/setup_l1_contracts.js +0 -17
  165. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -1,27 +1,21 @@
1
- import {
2
- type AccountWallet,
3
- AztecAddress,
4
- type AztecNode,
5
- EthAddress,
6
- Fr,
7
- type Logger,
8
- type PXE,
9
- computeAuthWitMessageHash,
10
- generateClaimSecret,
11
- } from '@aztec/aztec.js';
1
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization';
3
+ import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { Logger } from '@aztec/aztec.js/log';
6
+ import type { AztecNode } from '@aztec/aztec.js/node';
12
7
  import { CheatCodes } from '@aztec/aztec/testing';
13
- import {
14
- type DeployL1ContractsReturnType,
15
- type ExtendedViemWalletClient,
16
- RollupContract,
17
- deployL1Contract,
18
- extractEvent,
19
- } from '@aztec/ethereum';
20
- import { sha256ToField } from '@aztec/foundation/crypto';
8
+ import { RollupContract } from '@aztec/ethereum/contracts';
9
+ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
10
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
11
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
12
+ import { extractEvent } from '@aztec/ethereum/utils';
13
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
21
14
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
22
15
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
23
16
  import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
24
17
  import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
18
+ import type { TestWallet } from '@aztec/test-wallet/server';
25
19
 
26
20
  import { jest } from '@jest/globals';
27
21
  import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
@@ -36,36 +30,33 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
36
30
  // anvil --fork-url https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c --fork-block-number 17514288 --chain-id 31337
37
31
  // For CI, this is configured in `run_tests.sh` and `docker-compose-images.yml`
38
32
 
39
- // docs:start:uniswap_l1_l2_test_setup_const
40
33
  const TIMEOUT = 360_000;
41
34
 
42
35
  /** Objects to be returned by the uniswap setup function */
43
36
  export type UniswapSetupContext = {
44
37
  /** Aztec Node instance */
45
38
  aztecNode: AztecNode;
46
- /** The Private eXecution Environment (PXE). */
47
- pxe: PXE;
48
39
  /** Logger instance named as the current test. */
49
40
  logger: Logger;
50
41
  /** The L1 wallet client, extended with public actions. */
51
42
  l1Client: ExtendedViemWalletClient;
52
- /** The owner wallet. */
53
- ownerWallet: AccountWallet;
43
+ /** The wallet. */
44
+ wallet: TestWallet;
45
+ /** The owner address. */
46
+ ownerAddress: AztecAddress;
54
47
  /** The sponsor wallet. */
55
- sponsorWallet: AccountWallet;
48
+ sponsorAddress: AztecAddress;
56
49
  /** */
57
- deployL1ContractsValues: DeployL1ContractsReturnType;
50
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
58
51
  /** Cheat codes instance. */
59
52
  cheatCodes: CheatCodes;
60
53
  };
61
- // docs:end:uniswap_l1_l2_test_setup_const
62
54
 
63
55
  export const uniswapL1L2TestSuite = (
64
56
  setup: () => Promise<UniswapSetupContext>,
65
57
  cleanup: () => Promise<void>,
66
58
  expectedForkBlockNumber = 17514288,
67
59
  ) => {
68
- // docs:start:uniswap_l1_l2_test_beforeAll
69
60
  describe('uniswap_trade_on_l1_from_l2', () => {
70
61
  jest.setTimeout(TIMEOUT);
71
62
 
@@ -73,22 +64,20 @@ export const uniswapL1L2TestSuite = (
73
64
  const DAI_ADDRESS: EthAddress = EthAddress.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F');
74
65
 
75
66
  let aztecNode: AztecNode;
76
- let pxe: PXE;
77
67
  let logger: Logger;
78
68
 
79
69
  let l1Client: ExtendedViemWalletClient;
80
70
 
81
- let ownerWallet: AccountWallet;
71
+ let wallet: TestWallet;
82
72
  let ownerAddress: AztecAddress;
83
73
  let ownerEthAddress: EthAddress;
84
74
  // does transactions on behalf of owner on Aztec:
85
- let sponsorWallet: AccountWallet;
86
75
  let sponsorAddress: AztecAddress;
87
76
 
88
77
  let daiCrossChainHarness: CrossChainTestHarness;
89
78
  let wethCrossChainHarness: CrossChainTestHarness;
90
79
 
91
- let deployL1ContractsValues: DeployL1ContractsReturnType;
80
+ let deployL1ContractsValues: DeployAztecL1ContractsReturnType;
92
81
  let rollup: RollupContract;
93
82
  let uniswapPortal: GetContractReturnType<typeof UniswapPortalAbi, ExtendedViemWalletClient>;
94
83
  let uniswapPortalAddress: EthAddress;
@@ -101,7 +90,7 @@ export const uniswapL1L2TestSuite = (
101
90
  let cheatCodes: CheatCodes;
102
91
  let version: number;
103
92
  beforeAll(async () => {
104
- ({ aztecNode, pxe, logger, l1Client, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } =
93
+ ({ aztecNode, logger, l1Client, wallet, ownerAddress, sponsorAddress, deployL1ContractsValues, cheatCodes } =
105
94
  await setup());
106
95
 
107
96
  if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
@@ -113,18 +102,15 @@ export const uniswapL1L2TestSuite = (
113
102
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
114
103
  );
115
104
  version = Number(await rollup.getVersion());
116
- ownerAddress = ownerWallet.getAddress();
117
- sponsorAddress = sponsorWallet.getAddress();
118
105
  ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
119
106
 
120
- await ensureAccountContractsPublished(ownerWallet, [ownerWallet, sponsorWallet]);
107
+ await ensureAccountContractsPublished(wallet, [ownerAddress, sponsorAddress]);
121
108
 
122
109
  logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
123
110
  daiCrossChainHarness = await CrossChainTestHarness.new(
124
111
  aztecNode,
125
- pxe,
126
112
  deployL1ContractsValues.l1Client,
127
- ownerWallet,
113
+ wallet,
128
114
  ownerAddress,
129
115
  logger,
130
116
  DAI_ADDRESS,
@@ -133,9 +119,8 @@ export const uniswapL1L2TestSuite = (
133
119
  logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
134
120
  wethCrossChainHarness = await CrossChainTestHarness.new(
135
121
  aztecNode,
136
- pxe,
137
122
  l1Client,
138
- ownerWallet,
123
+ wallet,
139
124
  ownerAddress,
140
125
  logger,
141
126
  WETH9_ADDRESS,
@@ -152,11 +137,11 @@ export const uniswapL1L2TestSuite = (
152
137
  client: l1Client,
153
138
  });
154
139
  // deploy l2 uniswap contract and attach to portal
155
- uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress)
140
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress)
156
141
  .send({ from: ownerAddress })
157
142
  .deployed();
158
143
 
159
- const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
144
+ const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
160
145
 
161
146
  await uniswapPortal.write.initialize(
162
147
  [registryAddress.toString(), uniswapL2Contract.address.toString()],
@@ -171,7 +156,6 @@ export const uniswapL1L2TestSuite = (
171
156
  const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
172
157
  expect(wethBalance).toBe(parseEther('1000'));
173
158
  });
174
- // docs:end:uniswap_l1_l2_test_beforeAll
175
159
 
176
160
  afterAll(async () => {
177
161
  await cleanup();
@@ -206,7 +190,7 @@ export const uniswapL1L2TestSuite = (
206
190
  // 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
207
191
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
208
192
  const nonceForWETHTransferToPublicApproval = new Fr(1n);
209
- const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
193
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
210
194
  caller: uniswapL2Contract.address,
211
195
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
212
196
  ownerAddress,
@@ -276,7 +260,7 @@ export const uniswapL1L2TestSuite = (
276
260
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
277
261
 
278
262
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
279
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
263
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
280
264
 
281
265
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
282
266
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -301,7 +285,7 @@ export const uniswapL1L2TestSuite = (
301
285
  const withdrawSiblingPath = withdrawResult!.siblingPath;
302
286
 
303
287
  const withdrawMessageMetadata = {
304
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
288
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
305
289
  _leafIndex: BigInt(withdrawL2MessageIndex),
306
290
  _path: withdrawSiblingPath
307
291
  .toBufferArray()
@@ -309,7 +293,7 @@ export const uniswapL1L2TestSuite = (
309
293
  };
310
294
 
311
295
  const swapPrivateMessageMetadata = {
312
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
296
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
313
297
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
314
298
  _path: swapPrivateSiblingPath
315
299
  .toBufferArray()
@@ -520,7 +504,7 @@ export const uniswapL1L2TestSuite = (
520
504
  // );
521
505
 
522
506
  // const withdrawMessageMetadata = {
523
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
507
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
524
508
  // _leafIndex: BigInt(withdrawL2MessageIndex),
525
509
  // _path: withdrawSiblingPath
526
510
  // .toBufferArray()
@@ -528,7 +512,7 @@ export const uniswapL1L2TestSuite = (
528
512
  // };
529
513
 
530
514
  // const swapPrivateMessageMetadata = {
531
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
515
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
532
516
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
533
517
  // _path: swapPrivateSiblingPath
534
518
  // .toBufferArray()
@@ -615,14 +599,16 @@ export const uniswapL1L2TestSuite = (
615
599
  const expectedMessageHash = await computeAuthWitMessageHash(
616
600
  {
617
601
  caller: uniswapL2Contract.address,
618
- action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
619
- ownerAddress,
620
- uniswapL2Contract.address,
621
- wethAmountToBridge,
622
- nonceForWETHTransferToPublicApproval,
623
- ),
602
+ call: await wethCrossChainHarness.l2Token.methods
603
+ .transfer_to_public(
604
+ ownerAddress,
605
+ uniswapL2Contract.address,
606
+ wethAmountToBridge,
607
+ nonceForWETHTransferToPublicApproval,
608
+ )
609
+ .getFunctionCall(),
624
610
  },
625
- { chainId: ownerWallet.getChainId(), version: ownerWallet.getVersion() },
611
+ await wallet.getChainInfo(),
626
612
  );
627
613
 
628
614
  await expect(
@@ -650,7 +636,7 @@ export const uniswapL1L2TestSuite = (
650
636
  // 2. owner gives uniswap approval to transfer the funds to public:
651
637
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
652
638
  const nonceForWETHTransferToPublicApproval = new Fr(3n);
653
- const transferToPublicAuthwith = await ownerWallet.createAuthWit({
639
+ const transferToPublicAuthwith = await wallet.createAuthWit(ownerAddress, {
654
640
  caller: uniswapL2Contract.address,
655
641
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
656
642
  ownerAddress,
@@ -675,7 +661,8 @@ export const uniswapL1L2TestSuite = (
675
661
  Fr.random(),
676
662
  ownerEthAddress,
677
663
  )
678
- .prove({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] }),
664
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
665
+ .wait(),
679
666
  ).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
680
667
  });
681
668
 
@@ -687,7 +674,8 @@ export const uniswapL1L2TestSuite = (
687
674
 
688
675
  // 2. Give approval to uniswap to transfer funds to itself
689
676
  const nonceForWETHTransferApproval = new Fr(2n);
690
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
677
+ const validateActionInteraction = await wallet.setPublicAuthWit(
678
+ ownerAddress,
691
679
  {
692
680
  caller: uniswapL2Contract.address,
693
681
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -699,7 +687,7 @@ export const uniswapL1L2TestSuite = (
699
687
  },
700
688
  true,
701
689
  );
702
- await validateActionInteraction.send({ from: ownerAddress }).wait();
690
+ await validateActionInteraction.send().wait();
703
691
 
704
692
  // No approval to call `swap` but should work even without it:
705
693
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
@@ -731,23 +719,25 @@ export const uniswapL1L2TestSuite = (
731
719
  const nonceForWETHTransferApproval = new Fr(3n);
732
720
  const nonceForSwap = new Fr(3n);
733
721
  const secretHashForDepositingSwappedDai = new Fr(4n);
734
- const action = uniswapL2Contract
735
- .withWallet(sponsorWallet)
736
- .methods.swap_public(
737
- ownerAddress,
738
- wethCrossChainHarness.l2Bridge.address,
739
- wethAmountToBridge,
740
- daiCrossChainHarness.l2Bridge.address,
741
- nonceForWETHTransferApproval,
742
- uniswapFeeTier,
743
- minimumOutputAmount,
744
- ownerAddress,
745
- secretHashForDepositingSwappedDai,
746
- ownerEthAddress,
747
- nonceForSwap,
748
- );
749
- const validateActionInteraction = await ownerWallet.setPublicAuthWit({ caller: approvedUser, action }, true);
750
- await validateActionInteraction.send({ from: ownerAddress }).wait();
722
+ const action = uniswapL2Contract.methods.swap_public(
723
+ ownerAddress,
724
+ wethCrossChainHarness.l2Bridge.address,
725
+ wethAmountToBridge,
726
+ daiCrossChainHarness.l2Bridge.address,
727
+ nonceForWETHTransferApproval,
728
+ uniswapFeeTier,
729
+ minimumOutputAmount,
730
+ ownerAddress,
731
+ secretHashForDepositingSwappedDai,
732
+ ownerEthAddress,
733
+ nonceForSwap,
734
+ );
735
+ const validateActionInteraction = await wallet.setPublicAuthWit(
736
+ ownerAddress,
737
+ { caller: approvedUser, action },
738
+ true,
739
+ );
740
+ await validateActionInteraction.send().wait();
751
741
 
752
742
  await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
753
743
  });
@@ -756,7 +746,8 @@ export const uniswapL1L2TestSuite = (
756
746
  // swap should fail since no transfer approval to uniswap:
757
747
  const nonceForWETHTransferApproval = new Fr(4n);
758
748
 
759
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
749
+ const validateActionInteraction = await wallet.setPublicAuthWit(
750
+ ownerAddress,
760
751
  {
761
752
  caller: uniswapL2Contract.address,
762
753
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -768,7 +759,7 @@ export const uniswapL1L2TestSuite = (
768
759
  },
769
760
  true,
770
761
  );
771
- await validateActionInteraction.send({ from: ownerAddress }).wait();
762
+ await validateActionInteraction.send().wait();
772
763
 
773
764
  await expect(
774
765
  uniswapL2Contract.methods
@@ -798,7 +789,7 @@ export const uniswapL1L2TestSuite = (
798
789
  // Owner gives uniswap approval to transfer the funds to public to self on its behalf
799
790
  logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
800
791
  const nonceForWETHTransferToPublicApproval = new Fr(4n);
801
- const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
792
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
802
793
  caller: uniswapL2Contract.address,
803
794
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
804
795
  ownerAddress,
@@ -879,7 +870,7 @@ export const uniswapL1L2TestSuite = (
879
870
  const withdrawSiblingPath = withdrawResult!.siblingPath;
880
871
 
881
872
  const withdrawMessageMetadata = {
882
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
873
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
883
874
  _leafIndex: BigInt(withdrawL2MessageIndex),
884
875
  _path: withdrawSiblingPath
885
876
  .toBufferArray()
@@ -887,7 +878,7 @@ export const uniswapL1L2TestSuite = (
887
878
  };
888
879
 
889
880
  const swapPrivateMessageMetadata = {
890
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
881
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
891
882
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
892
883
  _path: swapPrivateSiblingPath
893
884
  .toBufferArray()
@@ -898,7 +889,7 @@ export const uniswapL1L2TestSuite = (
898
889
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
899
890
 
900
891
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
901
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
892
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
902
893
 
903
894
  // On L1 call swap_public!
904
895
  logger.info('call swap_public on L1');
@@ -926,7 +917,8 @@ export const uniswapL1L2TestSuite = (
926
917
 
927
918
  // Owner gives uniswap approval to transfer funds on its behalf
928
919
  const nonceForWETHTransferApproval = new Fr(5n);
929
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
920
+ const validateActionInteraction = await wallet.setPublicAuthWit(
921
+ ownerAddress,
930
922
  {
931
923
  caller: uniswapL2Contract.address,
932
924
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -938,7 +930,7 @@ export const uniswapL1L2TestSuite = (
938
930
  },
939
931
  true,
940
932
  );
941
- await validateActionInteraction.send({ from: ownerAddress }).wait();
933
+ await validateActionInteraction.send().wait();
942
934
 
943
935
  // Call swap_public on L2
944
936
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -1013,7 +1005,7 @@ export const uniswapL1L2TestSuite = (
1013
1005
  const withdrawSiblingPath = withdrawResult!.siblingPath;
1014
1006
 
1015
1007
  const withdrawMessageMetadata = {
1016
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1008
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1017
1009
  _leafIndex: BigInt(withdrawL2MessageIndex),
1018
1010
  _path: withdrawSiblingPath
1019
1011
  .toBufferArray()
@@ -1021,7 +1013,7 @@ export const uniswapL1L2TestSuite = (
1021
1013
  };
1022
1014
 
1023
1015
  const swapPublicMessageMetadata = {
1024
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1016
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1025
1017
  _leafIndex: BigInt(swapPublicL2MessageIndex),
1026
1018
  _path: swapPublicSiblingPath
1027
1019
  .toBufferArray()
@@ -1032,7 +1024,7 @@ export const uniswapL1L2TestSuite = (
1032
1024
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
1033
1025
 
1034
1026
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
1035
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
1027
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
1036
1028
 
1037
1029
  // Call swap_private on L1
1038
1030
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -1,8 +1,10 @@
1
1
  // Convenience struct to hold an account's address and secret that can easily be passed around.
2
- import { AztecAddress, Fr } from '@aztec/aztec.js';
2
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import { Fr } from '@aztec/aztec.js/fields';
3
4
  import { CheatCodes } from '@aztec/aztec/testing';
4
- import type { RollupContract } from '@aztec/ethereum';
5
- import { pedersenHash } from '@aztec/foundation/crypto';
5
+ import type { RollupContract } from '@aztec/ethereum/contracts';
6
+ import { SlotNumber } from '@aztec/foundation/branded-types';
7
+ import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
6
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
7
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
8
10
 
@@ -102,7 +104,8 @@ export class LendingSimulator {
102
104
  }
103
105
 
104
106
  const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
105
- const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
107
+ const targetSlot = SlotNumber(slot + diff);
108
+ const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
106
109
  const timeDiff = ts - this.time;
107
110
  this.time = ts;
108
111
 
@@ -111,7 +114,7 @@ export class LendingSimulator {
111
114
  if (dateProvider) {
112
115
  dateProvider.setTime(this.time * 1000);
113
116
  }
114
- await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
117
+ await this.cc.rollup.markAsProven(await this.rollup.getCheckpointNumber());
115
118
  this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
116
119
  }
117
120
 
@@ -190,7 +193,7 @@ export class LendingSimulator {
190
193
  expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
191
194
 
192
195
  for (const key of [this.account.address, AztecAddress.fromField(await this.account.key())]) {
193
- const privatePos = await this.lendingContract.methods.get_position(key).simulate({ from: key });
196
+ const privatePos = await this.lendingContract.methods.get_position(key).simulate({ from: this.account.address });
194
197
  expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
195
198
  expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
196
199
  expect(privatePos['debt']).toEqual(
@@ -1,4 +1,7 @@
1
- import { type AztecAddress, BatchCall, type Logger, type Wallet } from '@aztec/aztec.js';
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { BatchCall } from '@aztec/aztec.js/contracts';
3
+ import type { Logger } from '@aztec/aztec.js/log';
4
+ import type { Wallet } from '@aztec/aztec.js/wallet';
2
5
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
3
6
 
4
7
  import chunk from 'lodash.chunk';
@@ -104,7 +107,7 @@ export class TokenSimulator {
104
107
 
105
108
  const results = (
106
109
  await Promise.all(
107
- chunk(calls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
110
+ chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
108
111
  )
109
112
  ).flat();
110
113
  expect(results[0]).toEqual(this.totalSupply);
@@ -60,10 +60,22 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
60
60
  - the container that runs the rollup contract deployment
61
61
  - the containers for the aztec infrastructure (validators, provers, etc)
62
62
 
63
+ # Deploy Metrics
64
+
65
+ ```bash
66
+ ./spartan/bootstrap.sh metrics-kind
67
+ ```
68
+
69
+ # Install Chaos Mesh
70
+
71
+ ```bash
72
+ ./spartan/bootstrap.sh chaos-mesh
73
+ ```
74
+
63
75
  # Deploy stuff
64
76
 
65
77
  ```bash
66
- ./spartan/bootstrap.sh network_deploy scenario.local.env
78
+ ./spartan/bootstrap.sh network_deploy scenario.local
67
79
  ```
68
80
 
69
81
  That will take 1-3 minutes. But at the end you should have everything you need.
@@ -103,10 +115,10 @@ With the cluster running, you can now easily run tests.
103
115
 
104
116
  ```bash
105
117
  # run one
106
- ./spartan/bootstrap.sh single_test scenario.local.env spartan/smoke.test.ts
118
+ ./spartan/bootstrap.sh single_test scenario.local spartan/smoke.test.ts
107
119
 
108
120
  # run all (serially)
109
- ./spartan/bootstrap.sh network_tests scenario.local.env
121
+ ./spartan/bootstrap.sh network_tests scenario.local
110
122
  ```
111
123
 
112
124
  Right now, I recommend running the smoke test first, always, as it waits for the committee to exist.