@aztec/end-to-end 0.0.0-test.0 → 0.0.1-commit.023c3e5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +62 -0
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/benchmark.js +281 -0
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.js +321 -0
  7. package/dest/bench/client_flows/config.d.ts +14 -0
  8. package/dest/bench/client_flows/config.d.ts.map +1 -0
  9. package/dest/bench/client_flows/config.js +106 -0
  10. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  12. package/dest/bench/client_flows/data_extractor.js +79 -0
  13. package/dest/bench/utils.d.ts +16 -41
  14. package/dest/bench/utils.d.ts.map +1 -1
  15. package/dest/bench/utils.js +41 -72
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -19
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +114 -102
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +104 -104
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  24. package/dest/e2e_deploy_contract/deploy_test.js +26 -27
  25. package/dest/e2e_epochs/epochs_test.d.ts +71 -22
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +260 -54
  28. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  29. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  30. package/dest/e2e_fees/bridging_race.notest.js +61 -0
  31. package/dest/e2e_fees/fees_test.d.ts +38 -23
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +162 -183
  34. package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
  35. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  36. package/dest/e2e_l1_publisher/write_json.js +56 -0
  37. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  38. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  39. package/dest/e2e_multi_validator/utils.js +214 -0
  40. package/dest/e2e_nested_contract/nested_contract_test.d.ts +15 -15
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +37 -41
  43. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +281 -27
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +237 -175
  49. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  50. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  51. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  52. package/dest/e2e_p2p/shared.d.ts +44 -8
  53. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  54. package/dest/e2e_p2p/shared.js +165 -27
  55. package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
  56. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  57. package/dest/e2e_token_contract/token_contract_test.js +96 -74
  58. package/dest/fixtures/e2e_prover_test.d.ts +55 -0
  59. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  60. package/dest/fixtures/e2e_prover_test.js +278 -0
  61. package/dest/fixtures/fixtures.d.ts +6 -8
  62. package/dest/fixtures/fixtures.d.ts.map +1 -1
  63. package/dest/fixtures/fixtures.js +5 -5
  64. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  65. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  66. package/dest/fixtures/get_acvm_config.js +3 -15
  67. package/dest/fixtures/get_bb_config.d.ts +2 -2
  68. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  69. package/dest/fixtures/get_bb_config.js +10 -17
  70. package/dest/fixtures/index.d.ts +1 -1
  71. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  72. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  73. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  74. package/dest/fixtures/logging.d.ts +1 -1
  75. package/dest/fixtures/setup.d.ts +218 -0
  76. package/dest/fixtures/setup.d.ts.map +1 -0
  77. package/dest/fixtures/setup.js +695 -0
  78. package/dest/fixtures/setup_p2p_test.d.ts +15 -15
  79. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  80. package/dest/fixtures/setup_p2p_test.js +96 -31
  81. package/dest/fixtures/token_utils.d.ts +10 -4
  82. package/dest/fixtures/token_utils.d.ts.map +1 -1
  83. package/dest/fixtures/token_utils.js +31 -12
  84. package/dest/fixtures/utils.d.ts +5 -153
  85. package/dest/fixtures/utils.d.ts.map +1 -1
  86. package/dest/fixtures/utils.js +4 -552
  87. package/dest/fixtures/web3signer.d.ts +5 -0
  88. package/dest/fixtures/web3signer.d.ts.map +1 -0
  89. package/dest/fixtures/web3signer.js +53 -0
  90. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  91. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  92. package/dest/fixtures/with_telemetry_utils.js +2 -2
  93. package/dest/index.d.ts +1 -1
  94. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  95. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  96. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  97. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  98. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  99. package/dest/quality_of_service/prometheus_client.js +67 -0
  100. package/dest/shared/cross_chain_test_harness.d.ts +44 -27
  101. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  102. package/dest/shared/cross_chain_test_harness.js +105 -51
  103. package/dest/shared/gas_portal_test_harness.d.ts +33 -25
  104. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  105. package/dest/shared/gas_portal_test_harness.js +51 -30
  106. package/dest/shared/index.d.ts +2 -2
  107. package/dest/shared/index.d.ts.map +1 -1
  108. package/dest/shared/jest_setup.d.ts +1 -1
  109. package/dest/shared/jest_setup.js +1 -1
  110. package/dest/shared/submit-transactions.d.ts +6 -4
  111. package/dest/shared/submit-transactions.d.ts.map +1 -1
  112. package/dest/shared/submit-transactions.js +15 -16
  113. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  114. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  115. package/dest/shared/uniswap_l1_l2.js +176 -126
  116. package/dest/simulators/index.d.ts +1 -1
  117. package/dest/simulators/lending_simulator.d.ts +7 -7
  118. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  119. package/dest/simulators/lending_simulator.js +17 -18
  120. package/dest/simulators/token_simulator.d.ts +6 -3
  121. package/dest/simulators/token_simulator.d.ts.map +1 -1
  122. package/dest/simulators/token_simulator.js +16 -13
  123. package/dest/spartan/setup_test_wallets.d.ts +27 -11
  124. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  125. package/dest/spartan/setup_test_wallets.js +233 -62
  126. package/dest/spartan/tx_metrics.d.ts +88 -0
  127. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  128. package/dest/spartan/tx_metrics.js +422 -0
  129. package/dest/spartan/utils/bot.d.ts +27 -0
  130. package/dest/spartan/utils/bot.d.ts.map +1 -0
  131. package/dest/spartan/utils/bot.js +141 -0
  132. package/dest/spartan/utils/chaos.d.ts +79 -0
  133. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  134. package/dest/spartan/utils/chaos.js +142 -0
  135. package/dest/spartan/utils/clients.d.ts +39 -0
  136. package/dest/spartan/utils/clients.d.ts.map +1 -0
  137. package/dest/spartan/utils/clients.js +90 -0
  138. package/dest/spartan/utils/config.d.ts +36 -0
  139. package/dest/spartan/utils/config.d.ts.map +1 -0
  140. package/dest/spartan/utils/config.js +20 -0
  141. package/dest/spartan/utils/health.d.ts +63 -0
  142. package/dest/spartan/utils/health.d.ts.map +1 -0
  143. package/dest/spartan/utils/health.js +202 -0
  144. package/dest/spartan/utils/helm.d.ts +15 -0
  145. package/dest/spartan/utils/helm.d.ts.map +1 -0
  146. package/dest/spartan/utils/helm.js +47 -0
  147. package/dest/spartan/utils/index.d.ts +9 -0
  148. package/dest/spartan/utils/index.d.ts.map +1 -0
  149. package/dest/spartan/utils/index.js +18 -0
  150. package/dest/spartan/utils/k8s.d.ts +126 -0
  151. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  152. package/dest/spartan/utils/k8s.js +375 -0
  153. package/dest/spartan/utils/nodes.d.ts +41 -0
  154. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  155. package/dest/spartan/utils/nodes.js +461 -0
  156. package/dest/spartan/utils/scripts.d.ts +16 -0
  157. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  158. package/dest/spartan/utils/scripts.js +66 -0
  159. package/dest/spartan/utils.d.ts +2 -415
  160. package/dest/spartan/utils.d.ts.map +1 -1
  161. package/dest/spartan/utils.js +1 -445
  162. package/package.json +66 -58
  163. package/src/bench/client_flows/benchmark.ts +363 -0
  164. package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
  165. package/src/bench/client_flows/config.ts +61 -0
  166. package/src/bench/client_flows/data_extractor.ts +89 -0
  167. package/src/bench/utils.ts +41 -85
  168. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
  169. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
  170. package/src/e2e_deploy_contract/deploy_test.ts +40 -48
  171. package/src/e2e_epochs/epochs_test.ts +341 -81
  172. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  173. package/src/e2e_fees/fees_test.ts +220 -258
  174. package/src/e2e_l1_publisher/write_json.ts +77 -0
  175. package/src/e2e_multi_validator/utils.ts +258 -0
  176. package/src/e2e_nested_contract/nested_contract_test.ts +46 -59
  177. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  178. package/src/e2e_p2p/p2p_network.ts +341 -234
  179. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  180. package/src/e2e_p2p/shared.ts +260 -39
  181. package/src/e2e_token_contract/token_contract_test.ts +115 -126
  182. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  183. package/src/fixtures/e2e_prover_test.ts +336 -0
  184. package/src/fixtures/fixtures.ts +5 -7
  185. package/src/fixtures/get_acvm_config.ts +4 -12
  186. package/src/fixtures/get_bb_config.ts +18 -13
  187. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  188. package/src/fixtures/setup.ts +1017 -0
  189. package/src/fixtures/setup_p2p_test.ts +133 -50
  190. package/src/fixtures/token_utils.ts +33 -15
  191. package/src/fixtures/utils.ts +27 -820
  192. package/src/fixtures/web3signer.ts +63 -0
  193. package/src/fixtures/with_telemetry_utils.ts +2 -2
  194. package/src/guides/up_quick_start.sh +7 -15
  195. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  196. package/src/quality_of_service/prometheus_client.ts +113 -0
  197. package/src/shared/cross_chain_test_harness.ts +103 -91
  198. package/src/shared/gas_portal_test_harness.ts +59 -50
  199. package/src/shared/index.ts +1 -1
  200. package/src/shared/jest_setup.ts +1 -1
  201. package/src/shared/submit-transactions.ts +18 -20
  202. package/src/shared/uniswap_l1_l2.ts +197 -221
  203. package/src/simulators/lending_simulator.ts +16 -17
  204. package/src/simulators/token_simulator.ts +21 -13
  205. package/src/spartan/DEVELOP.md +128 -0
  206. package/src/spartan/setup_test_wallets.ts +308 -95
  207. package/src/spartan/tx_metrics.ts +376 -0
  208. package/src/spartan/utils/bot.ts +185 -0
  209. package/src/spartan/utils/chaos.ts +253 -0
  210. package/src/spartan/utils/clients.ts +100 -0
  211. package/src/spartan/utils/config.ts +26 -0
  212. package/src/spartan/utils/health.ts +255 -0
  213. package/src/spartan/utils/helm.ts +84 -0
  214. package/src/spartan/utils/index.ts +64 -0
  215. package/src/spartan/utils/k8s.ts +527 -0
  216. package/src/spartan/utils/nodes.ts +538 -0
  217. package/src/spartan/utils/scripts.ts +63 -0
  218. package/src/spartan/utils.ts +1 -582
  219. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  220. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  221. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  222. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  223. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  224. package/dest/fixtures/setup_l1_contracts.js +0 -17
  225. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  226. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  227. package/dest/fixtures/snapshot_manager.js +0 -479
  228. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  229. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  230. package/dest/sample-dapp/connect.js +0 -12
  231. package/dest/sample-dapp/contracts.js +0 -10
  232. package/dest/sample-dapp/deploy.js +0 -35
  233. package/dest/sample-dapp/index.js +0 -98
  234. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  235. package/src/fixtures/setup_l1_contracts.ts +0 -27
  236. package/src/fixtures/snapshot_manager.ts +0 -617
  237. package/src/sample-dapp/connect.mjs +0 -16
  238. package/src/sample-dapp/contracts.mjs +0 -14
  239. package/src/sample-dapp/deploy.mjs +0 -40
  240. package/src/sample-dapp/index.mjs +0 -128
@@ -1,11 +1,20 @@
1
- import { AztecAddress, EthAddress, Fr, computeAuthWitMessageHash, generateClaimSecret } from '@aztec/aztec.js';
2
- import { deployL1Contract, extractEvent } from '@aztec/ethereum';
3
- import { sha256ToField } from '@aztec/foundation/crypto';
4
- import { InboxAbi, RollupAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
1
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization';
3
+ import { waitForProven } from '@aztec/aztec.js/contracts';
4
+ import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
5
+ import { Fr } from '@aztec/aztec.js/fields';
6
+ import { RollupContract } from '@aztec/ethereum/contracts';
7
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
8
+ import { extractEvent } from '@aztec/ethereum/utils';
9
+ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
10
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
11
+ import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
5
12
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
13
+ import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
14
+ import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
6
15
  import { jest } from '@jest/globals';
7
16
  import { getContract, parseEther, toFunctionSelector } from 'viem';
8
- import { ensureAccountsPubliclyDeployed } from '../fixtures/utils.js';
17
+ import { ensureAccountContractsPublished } from '../fixtures/utils.js';
9
18
  import { CrossChainTestHarness } from './cross_chain_test_harness.js';
10
19
  // PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
11
20
  // don't need to burn through RPC requests.
@@ -13,26 +22,20 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
13
22
  // To start an actual fork, use the command:
14
23
  // anvil --fork-url https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c --fork-block-number 17514288 --chain-id 31337
15
24
  // For CI, this is configured in `run_tests.sh` and `docker-compose-images.yml`
16
- // docs:start:uniswap_l1_l2_test_setup_const
17
25
  const TIMEOUT = 360_000;
18
- // docs:end:uniswap_l1_l2_test_setup_const
19
26
  export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 17514288)=>{
20
- // docs:start:uniswap_l1_l2_test_beforeAll
21
27
  describe('uniswap_trade_on_l1_from_l2', ()=>{
22
28
  jest.setTimeout(TIMEOUT);
23
29
  const WETH9_ADDRESS = EthAddress.fromString('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
24
30
  const DAI_ADDRESS = EthAddress.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F');
25
31
  let aztecNode;
26
- let pxe;
27
32
  let logger;
28
- let walletClient;
29
- let publicClient;
30
- let ownerWallet;
33
+ let l1Client;
34
+ let wallet;
31
35
  let ownerAddress;
32
36
  let ownerEthAddress;
33
37
  // does transactions on behalf of owner on Aztec:
34
- let sponsorWallet;
35
- // let sponsorAddress: AztecAddress;
38
+ let sponsorAddress;
36
39
  let daiCrossChainHarness;
37
40
  let wethCrossChainHarness;
38
41
  let deployL1ContractsValues;
@@ -44,54 +47,54 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
44
47
  const uniswapFeeTier = 3000n;
45
48
  const minimumOutputAmount = 0n;
46
49
  let cheatCodes;
50
+ let version;
47
51
  beforeAll(async ()=>{
48
- ({ aztecNode, pxe, logger, publicClient, walletClient, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } = await setup());
49
- if (Number(await publicClient.getBlockNumber()) < expectedForkBlockNumber) {
52
+ const t = await setup();
53
+ ({ aztecNode, logger, deployL1ContractsValues, cheatCodes, wallet, accounts: [ownerAddress, sponsorAddress] } = t);
54
+ l1Client = deployL1ContractsValues.l1Client;
55
+ t.watcher?.setIsMarkingAsProven(false);
56
+ if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
50
57
  throw new Error('This test must be run on a fork of mainnet with the expected fork block');
51
58
  }
52
- rollup = getContract({
53
- address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
54
- abi: RollupAbi,
55
- client: deployL1ContractsValues.walletClient
56
- });
57
- ownerAddress = ownerWallet.getAddress();
58
- // sponsorAddress = sponsorWallet.getAddress();
59
- ownerEthAddress = EthAddress.fromString((await walletClient.getAddresses())[0]);
60
- await ensureAccountsPubliclyDeployed(ownerWallet, [
61
- ownerWallet,
62
- sponsorWallet
59
+ rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
60
+ version = Number(await rollup.getVersion());
61
+ ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
62
+ await ensureAccountContractsPublished(wallet, [
63
+ ownerAddress,
64
+ sponsorAddress
63
65
  ]);
64
66
  logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
65
- daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, publicClient, walletClient, ownerWallet, logger, DAI_ADDRESS);
67
+ daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, deployL1ContractsValues.l1Client, wallet, ownerAddress, logger, DAI_ADDRESS);
66
68
  logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
67
- wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, publicClient, walletClient, ownerWallet, logger, WETH9_ADDRESS);
69
+ wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, l1Client, wallet, ownerAddress, logger, WETH9_ADDRESS);
68
70
  logger.info('Deploy Uniswap portal on L1 and L2...');
69
- uniswapPortalAddress = await deployL1Contract(walletClient, publicClient, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
71
+ uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
70
72
  uniswapPortal = getContract({
71
73
  address: uniswapPortalAddress.toString(),
72
74
  abi: UniswapPortalAbi,
73
- client: walletClient
75
+ client: l1Client
74
76
  });
75
77
  // deploy l2 uniswap contract and attach to portal
76
- uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send().deployed();
77
- const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
78
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
79
+ from: ownerAddress
80
+ });
81
+ const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
78
82
  await uniswapPortal.write.initialize([
79
83
  registryAddress.toString(),
80
84
  uniswapL2Contract.address.toString()
81
85
  ], {});
82
86
  // Give me some WETH so I can deposit to L2 and do the swap...
83
87
  logger.info('Getting some weth');
84
- const hash = await walletClient.sendTransaction({
88
+ const hash = await l1Client.sendTransaction({
85
89
  to: WETH9_ADDRESS.toString(),
86
90
  value: parseEther('1000')
87
91
  });
88
- await publicClient.waitForTransactionReceipt({
92
+ await l1Client.waitForTransactionReceipt({
89
93
  hash
90
94
  });
91
95
  const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
92
96
  expect(wethBalance).toBe(parseEther('1000'));
93
97
  });
94
- // docs:end:uniswap_l1_l2_test_beforeAll
95
98
  afterAll(async ()=>{
96
99
  await cleanup();
97
100
  });
@@ -114,14 +117,19 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
114
117
  // 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
115
118
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
116
119
  const nonceForWETHTransferToPublicApproval = new Fr(1n);
117
- await ownerWallet.createAuthWit({
120
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
118
121
  caller: uniswapL2Contract.address,
119
122
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
120
123
  });
121
124
  // 4. Swap on L1 - sends L2 to L1 message to withdraw WETH to L1 and another message to swap assets.
122
125
  logger.info('Withdrawing weth to L1 and sending message to swap to dai');
123
126
  const [secretForDepositingSwappedDai, secretHashForDepositingSwappedDai] = await generateClaimSecret();
124
- const l2UniswapInteractionReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send().wait();
127
+ const l2UniswapInteractionReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
128
+ from: ownerAddress,
129
+ authWitnesses: [
130
+ transferToPublicAuhtwit
131
+ ]
132
+ });
125
133
  const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
126
134
  const swapPrivateContent = sha256ToField([
127
135
  Buffer.from(toFunctionSelector(swapPrivateFunction).substring(2), 'hex'),
@@ -133,44 +141,53 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
133
141
  secretHashForDepositingSwappedDai,
134
142
  ownerEthAddress.toBuffer32()
135
143
  ]);
136
- const swapPrivateLeaf = sha256ToField([
137
- uniswapL2Contract.address,
138
- new Fr(1),
139
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
140
- new Fr(publicClient.chain.id),
141
- swapPrivateContent
142
- ]);
144
+ const swapPrivateLeaf = computeL2ToL1MessageHash({
145
+ l2Sender: uniswapL2Contract.address,
146
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
147
+ content: swapPrivateContent,
148
+ rollupVersion: new Fr(version),
149
+ chainId: new Fr(l1Client.chain.id)
150
+ });
143
151
  const withdrawContent = sha256ToField([
144
152
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
145
153
  uniswapPortalAddress.toBuffer32(),
146
154
  new Fr(wethAmountToBridge),
147
155
  uniswapPortalAddress.toBuffer32()
148
156
  ]);
149
- const withdrawLeaf = sha256ToField([
150
- wethCrossChainHarness.l2Bridge.address,
151
- new Fr(1),
152
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
153
- new Fr(publicClient.chain.id),
154
- withdrawContent
155
- ]);
157
+ const withdrawLeaf = computeL2ToL1MessageHash({
158
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
159
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
160
+ content: withdrawContent,
161
+ rollupVersion: new Fr(version),
162
+ chainId: new Fr(l1Client.chain.id)
163
+ });
156
164
  // ensure that user's funds were burnt
157
165
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
158
166
  // ensure that uniswap contract didn't eat the funds.
159
167
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
160
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
161
- await cheatCodes.rollup.markAsProven(await rollup.read.getPendingBlockNumber());
168
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
169
+ const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber);
170
+ const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
171
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
172
+ await waitForProven(aztecNode, l2UniswapInteractionReceipt, {
173
+ provenTimeout: 300
174
+ });
162
175
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
163
176
  logger.info('Execute withdraw and swap on the uniswapPortal!');
164
177
  const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(daiCrossChainHarness.tokenPortalAddress);
165
- const [swapPrivateL2MessageIndex, swapPrivateSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(l2UniswapInteractionReceipt.blockNumber, swapPrivateLeaf);
166
- const [withdrawL2MessageIndex, withdrawSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(l2UniswapInteractionReceipt.blockNumber, withdrawLeaf);
178
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
179
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
180
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
181
+ const swapPrivateSiblingPath = swapResult.siblingPath;
182
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
183
+ const withdrawSiblingPath = withdrawResult.siblingPath;
167
184
  const withdrawMessageMetadata = {
168
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber),
185
+ _epoch: BigInt(epoch),
169
186
  _leafIndex: BigInt(withdrawL2MessageIndex),
170
187
  _path: withdrawSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
171
188
  };
172
189
  const swapPrivateMessageMetadata = {
173
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber),
190
+ _epoch: BigInt(epoch),
174
191
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
175
192
  _path: swapPrivateSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
176
193
  };
@@ -188,7 +205,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
188
205
  ]
189
206
  ];
190
207
  // this should also insert a message into the inbox.
191
- const txReceipt = await daiCrossChainHarness.publicClient.waitForTransactionReceipt({
208
+ const txReceipt = await daiCrossChainHarness.l1Client.waitForTransactionReceipt({
192
209
  hash: await uniswapPortal.write.swapPrivate(swapArgs)
193
210
  });
194
211
  // We get the msg leaf from event so that we can later wait for it to be available for consumption
@@ -297,9 +314,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
297
314
  // ownerEthAddress,
298
315
  // nonceForSwap,
299
316
  // );
300
- // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send().wait();
317
+ // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send();
301
318
  // // 4.2 Call swap_public from user2 on behalf of owner
302
- // const uniswapL2Interaction = await action.send().wait();
319
+ // const uniswapL2Interaction = await action.send();
303
320
  // const swapPublicContent = sha256ToField([
304
321
  // Buffer.from(
305
322
  // toFunctionSelector('swap_public(address,uint256,uint24,address,uint256,bytes32,bytes32,address)').substring(
@@ -352,14 +369,14 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
352
369
  // withdrawLeaf,
353
370
  // );
354
371
  // const withdrawMessageMetadata = {
355
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
372
+ // _epoch: epoch,
356
373
  // _leafIndex: BigInt(withdrawL2MessageIndex),
357
374
  // _path: withdrawSiblingPath
358
375
  // .toBufferArray()
359
376
  // .map((buf: Buffer) => `0x${buf.toString('hex')}`) as readonly `0x${string}`[],
360
377
  // };
361
378
  // const swapPrivateMessageMetadata = {
362
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
379
+ // _epoch: epoch,
363
380
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
364
381
  // _path: swapPrivateSiblingPath
365
382
  // .toBufferArray()
@@ -432,12 +449,11 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
432
449
  const nonceForWETHTransferToPublicApproval = new Fr(2n);
433
450
  const expectedMessageHash = await computeAuthWitMessageHash({
434
451
  caller: uniswapL2Contract.address,
435
- action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
436
- }, {
437
- chainId: ownerWallet.getChainId(),
438
- version: ownerWallet.getVersion()
439
- });
440
- await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove()).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
452
+ call: await wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval).getFunctionCall()
453
+ }, await wallet.getChainInfo());
454
+ await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
455
+ from: ownerAddress
456
+ })).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
441
457
  });
442
458
  it("can't swap if user passes a token different to what the bridge tracks", async ()=>{
443
459
  // 1. give user private funds on L2:
@@ -446,13 +462,18 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
446
462
  // 2. owner gives uniswap approval to transfer the funds to public:
447
463
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
448
464
  const nonceForWETHTransferToPublicApproval = new Fr(3n);
449
- await ownerWallet.createAuthWit({
465
+ const transferToPublicAuthwith = await wallet.createAuthWit(ownerAddress, {
450
466
  caller: uniswapL2Contract.address,
451
467
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
452
468
  });
453
469
  // 3. Swap but send the wrong token address
454
470
  logger.info('Swap but send the wrong token address');
455
- await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove()).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
471
+ await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).send({
472
+ from: ownerAddress,
473
+ authWitnesses: [
474
+ transferToPublicAuthwith
475
+ ]
476
+ })).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
456
477
  });
457
478
  // edge cases for public flow:
458
479
  it("I don't need approval to call swap_public if I'm swapping on my own behalf", async ()=>{
@@ -460,14 +481,16 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
460
481
  await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
461
482
  // 2. Give approval to uniswap to transfer funds to itself
462
483
  const nonceForWETHTransferApproval = new Fr(2n);
463
- const validateActionInteraction = await ownerWallet.setPublicAuthWit({
484
+ const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
464
485
  caller: uniswapL2Contract.address,
465
486
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
466
487
  }, true);
467
- await validateActionInteraction.send().wait();
488
+ await validateActionInteraction.send();
468
489
  // No approval to call `swap` but should work even without it:
469
490
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
470
- await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send().wait();
491
+ await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
492
+ from: ownerAddress
493
+ });
471
494
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
472
495
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
473
496
  });
@@ -477,23 +500,27 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
477
500
  const nonceForWETHTransferApproval = new Fr(3n);
478
501
  const nonceForSwap = new Fr(3n);
479
502
  const secretHashForDepositingSwappedDai = new Fr(4n);
480
- const action = uniswapL2Contract.withWallet(sponsorWallet).methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, nonceForSwap);
481
- const validateActionInteraction = await ownerWallet.setPublicAuthWit({
503
+ const action = uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, nonceForSwap);
504
+ const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
482
505
  caller: approvedUser,
483
506
  action
484
507
  }, true);
485
- await validateActionInteraction.send().wait();
486
- await expect(action.simulate()).rejects.toThrow(/unauthorized/);
508
+ await validateActionInteraction.send();
509
+ await expect(action.simulate({
510
+ from: sponsorAddress
511
+ })).rejects.toThrow(/unauthorized/);
487
512
  });
488
513
  it("uniswap can't pull funds without transfer approval", async ()=>{
489
514
  // swap should fail since no transfer approval to uniswap:
490
515
  const nonceForWETHTransferApproval = new Fr(4n);
491
- const validateActionInteraction = await ownerWallet.setPublicAuthWit({
516
+ const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
492
517
  caller: uniswapL2Contract.address,
493
518
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
494
519
  }, true);
495
- await validateActionInteraction.send().wait();
496
- await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate()).rejects.toThrow(/unauthorized/);
520
+ await validateActionInteraction.send();
521
+ await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate({
522
+ from: ownerAddress
523
+ })).rejects.toThrow(/unauthorized/);
497
524
  });
498
525
  // tests when trying to mix private and public flows:
499
526
  it("can't call swap_public on L1 if called swap_private on L2", async ()=>{
@@ -503,7 +530,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
503
530
  // Owner gives uniswap approval to transfer the funds to public to self on its behalf
504
531
  logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
505
532
  const nonceForWETHTransferToPublicApproval = new Fr(4n);
506
- await ownerWallet.createAuthWit({
533
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
507
534
  caller: uniswapL2Contract.address,
508
535
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
509
536
  });
@@ -511,7 +538,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
511
538
  // Swap
512
539
  logger.info('Withdrawing weth to L1 and sending message to swap to dai');
513
540
  const [, secretHashForDepositingSwappedDai] = await generateClaimSecret();
514
- const withdrawReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send().wait();
541
+ const withdrawReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
542
+ from: ownerAddress,
543
+ authWitnesses: [
544
+ transferToPublicAuhtwit
545
+ ]
546
+ });
515
547
  const swapPrivateContent = sha256ToField([
516
548
  Buffer.from(toFunctionSelector('swap_private(address,uint256,uint24,address,uint256,bytes32,address)').substring(2), 'hex'),
517
549
  wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
@@ -522,42 +554,50 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
522
554
  secretHashForDepositingSwappedDai,
523
555
  ownerEthAddress.toBuffer32()
524
556
  ]);
525
- const swapPrivateLeaf = sha256ToField([
526
- uniswapL2Contract.address,
527
- new Fr(1),
528
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
529
- new Fr(publicClient.chain.id),
530
- swapPrivateContent
531
- ]);
557
+ const swapPrivateLeaf = computeL2ToL1MessageHash({
558
+ l2Sender: uniswapL2Contract.address,
559
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
560
+ content: swapPrivateContent,
561
+ rollupVersion: new Fr(version),
562
+ chainId: new Fr(l1Client.chain.id)
563
+ });
532
564
  const withdrawContent = sha256ToField([
533
565
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
534
566
  uniswapPortalAddress.toBuffer32(),
535
567
  new Fr(wethAmountToBridge),
536
568
  uniswapPortalAddress.toBuffer32()
537
569
  ]);
538
- const withdrawLeaf = sha256ToField([
539
- wethCrossChainHarness.l2Bridge.address,
540
- new Fr(1),
541
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
542
- new Fr(publicClient.chain.id),
543
- withdrawContent
544
- ]);
545
- const [swapPrivateL2MessageIndex, swapPrivateSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPrivateLeaf);
546
- const [withdrawL2MessageIndex, withdrawSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, withdrawLeaf);
570
+ const withdrawLeaf = computeL2ToL1MessageHash({
571
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
572
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
573
+ content: withdrawContent,
574
+ rollupVersion: new Fr(version),
575
+ chainId: new Fr(l1Client.chain.id)
576
+ });
577
+ const epoch = await rollup.getEpochNumberForCheckpoint(CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber));
578
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
579
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
580
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
581
+ const swapPrivateSiblingPath = swapResult.siblingPath;
582
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
583
+ const withdrawSiblingPath = withdrawResult.siblingPath;
547
584
  const withdrawMessageMetadata = {
548
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
585
+ _epoch: BigInt(epoch),
549
586
  _leafIndex: BigInt(withdrawL2MessageIndex),
550
587
  _path: withdrawSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
551
588
  };
552
589
  const swapPrivateMessageMetadata = {
553
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
590
+ _epoch: BigInt(epoch),
554
591
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
555
592
  _path: swapPrivateSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
556
593
  };
557
594
  // ensure that user's funds were burnt
558
595
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
559
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
560
- await cheatCodes.rollup.markAsProven(await rollup.read.getPendingBlockNumber());
596
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
597
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
598
+ await waitForProven(aztecNode, withdrawReceipt, {
599
+ provenTimeout: 300
600
+ });
561
601
  // On L1 call swap_public!
562
602
  logger.info('call swap_public on L1');
563
603
  const swapArgs = [
@@ -583,14 +623,16 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
583
623
  await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
584
624
  // Owner gives uniswap approval to transfer funds on its behalf
585
625
  const nonceForWETHTransferApproval = new Fr(5n);
586
- const validateActionInteraction = await ownerWallet.setPublicAuthWit({
626
+ const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
587
627
  caller: uniswapL2Contract.address,
588
628
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
589
629
  }, true);
590
- await validateActionInteraction.send().wait();
630
+ await validateActionInteraction.send();
591
631
  // Call swap_public on L2
592
632
  const secretHashForDepositingSwappedDai = Fr.random();
593
- const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send().wait();
633
+ const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
634
+ from: ownerAddress
635
+ });
594
636
  const swapPublicContent = sha256ToField([
595
637
  Buffer.from(toFunctionSelector('swap_public(address,uint256,uint24,address,uint256,bytes32,bytes32,address)').substring(2), 'hex'),
596
638
  wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
@@ -602,42 +644,50 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
602
644
  secretHashForDepositingSwappedDai,
603
645
  ownerEthAddress.toBuffer32()
604
646
  ]);
605
- const swapPublicLeaf = sha256ToField([
606
- uniswapL2Contract.address,
607
- new Fr(1),
608
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
609
- new Fr(publicClient.chain.id),
610
- swapPublicContent
611
- ]);
647
+ const swapPublicLeaf = computeL2ToL1MessageHash({
648
+ l2Sender: uniswapL2Contract.address,
649
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
650
+ content: swapPublicContent,
651
+ rollupVersion: new Fr(version),
652
+ chainId: new Fr(l1Client.chain.id)
653
+ });
612
654
  const withdrawContent = sha256ToField([
613
655
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
614
656
  uniswapPortalAddress.toBuffer32(),
615
657
  new Fr(wethAmountToBridge),
616
658
  uniswapPortalAddress.toBuffer32()
617
659
  ]);
618
- const withdrawLeaf = sha256ToField([
619
- wethCrossChainHarness.l2Bridge.address,
620
- new Fr(1),
621
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
622
- new Fr(publicClient.chain.id),
623
- withdrawContent
624
- ]);
625
- const [swapPublicL2MessageIndex, swapPublicSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPublicLeaf);
626
- const [withdrawL2MessageIndex, withdrawSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, withdrawLeaf);
660
+ const withdrawLeaf = computeL2ToL1MessageHash({
661
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
662
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
663
+ content: withdrawContent,
664
+ rollupVersion: new Fr(version),
665
+ chainId: new Fr(l1Client.chain.id)
666
+ });
667
+ const epoch = await rollup.getEpochNumberForCheckpoint(CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber));
668
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
669
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
670
+ const swapPublicL2MessageIndex = swapResult.leafIndex;
671
+ const swapPublicSiblingPath = swapResult.siblingPath;
672
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
673
+ const withdrawSiblingPath = withdrawResult.siblingPath;
627
674
  const withdrawMessageMetadata = {
628
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
675
+ _epoch: BigInt(epoch),
629
676
  _leafIndex: BigInt(withdrawL2MessageIndex),
630
677
  _path: withdrawSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
631
678
  };
632
679
  const swapPublicMessageMetadata = {
633
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
680
+ _epoch: BigInt(epoch),
634
681
  _leafIndex: BigInt(swapPublicL2MessageIndex),
635
682
  _path: swapPublicSiblingPath.toBufferArray().map((buf)=>`0x${buf.toString('hex')}`)
636
683
  };
637
684
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
638
685
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
639
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
640
- await cheatCodes.rollup.markAsProven(await rollup.read.getPendingBlockNumber());
686
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
687
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
688
+ await waitForProven(aztecNode, withdrawReceipt, {
689
+ provenTimeout: 300
690
+ });
641
691
  // Call swap_private on L1
642
692
  logger.info('Execute withdraw and swap on the uniswapPortal!');
643
693
  const swapArgs = [
@@ -1,3 +1,3 @@
1
1
  export * from './lending_simulator.js';
2
2
  export * from './token_simulator.js';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaW11bGF0b3JzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxzQkFBc0IsQ0FBQyJ9
@@ -1,9 +1,9 @@
1
- import { AztecAddress, type CheatCodes, Fr } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import { CheatCodes } from '@aztec/aztec/testing';
4
+ import type { RollupContract } from '@aztec/ethereum/contracts';
2
5
  import type { TestDateProvider } from '@aztec/foundation/timer';
3
- import type { RollupAbi } from '@aztec/l1-artifacts';
4
6
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
5
- import type { Account, GetContractReturnType, HttpTransport, WalletClient } from 'viem';
6
- import type * as chains from 'viem/chains';
7
7
  import type { TokenSimulator } from './token_simulator.js';
8
8
  /**
9
9
  * Contains utilities to compute the "key" for private holdings in the public state.
@@ -29,7 +29,7 @@ export declare class LendingSimulator {
29
29
  private rate;
30
30
  private ethereumSlotDuration;
31
31
  /** the rollup contract */
32
- rollup: GetContractReturnType<typeof RollupAbi, WalletClient<HttpTransport, chains.Chain, Account>>;
32
+ rollup: RollupContract;
33
33
  /** the lending contract */
34
34
  lendingContract: LendingContract;
35
35
  /** the collateral asset used in the lending contract */
@@ -46,7 +46,7 @@ export declare class LendingSimulator {
46
46
  private mintedOutside;
47
47
  constructor(cc: CheatCodes, account: LendingAccount, rate: bigint, ethereumSlotDuration: number,
48
48
  /** the rollup contract */
49
- rollup: GetContractReturnType<typeof RollupAbi, WalletClient<HttpTransport, chains.Chain, Account>>,
49
+ rollup: RollupContract,
50
50
  /** the lending contract */
51
51
  lendingContract: LendingContract,
52
52
  /** the collateral asset used in the lending contract */
@@ -66,4 +66,4 @@ export declare class LendingSimulator {
66
66
  mintStableCoinOutsideLoan(recipient: AztecAddress, amount: bigint, priv?: boolean): void;
67
67
  check(): Promise<void>;
68
68
  }
69
- //# sourceMappingURL=lending_simulator.d.ts.map
69
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGVuZGluZ19zaW11bGF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaW11bGF0b3JzL2xlbmRpbmdfc2ltdWxhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDNUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR2hFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFeEUsT0FBTyxL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