@aztec/end-to-end 3.0.0-nightly.20250910 → 3.0.0-nightly.20250912

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 (82) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +14 -12
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +35 -39
  4. package/dest/bench/utils.d.ts.map +1 -1
  5. package/dest/bench/utils.js +6 -4
  6. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -6
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  8. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +38 -38
  9. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +4 -5
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  11. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +16 -20
  12. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  13. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  14. package/dest/e2e_deploy_contract/deploy_test.js +4 -7
  15. package/dest/e2e_epochs/epochs_test.d.ts +2 -0
  16. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  17. package/dest/e2e_epochs/epochs_test.js +5 -0
  18. package/dest/e2e_fees/bridging_race.notest.js +10 -8
  19. package/dest/e2e_fees/fees_test.d.ts +3 -4
  20. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  21. package/dest/e2e_fees/fees_test.js +26 -21
  22. package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -2
  23. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  24. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  25. package/dest/e2e_p2p/p2p_network.d.ts +3 -2
  26. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  27. package/dest/e2e_p2p/p2p_network.js +7 -11
  28. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  29. package/dest/e2e_p2p/shared.js +10 -18
  30. package/dest/e2e_token_contract/token_contract_test.d.ts +2 -4
  31. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_token_contract/token_contract_test.js +13 -16
  33. package/dest/fixtures/e2e_prover_test.d.ts +4 -3
  34. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  35. package/dest/fixtures/e2e_prover_test.js +22 -29
  36. package/dest/fixtures/snapshot_manager.d.ts +6 -4
  37. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  38. package/dest/fixtures/snapshot_manager.js +22 -12
  39. package/dest/fixtures/token_utils.d.ts +3 -3
  40. package/dest/fixtures/token_utils.d.ts.map +1 -1
  41. package/dest/fixtures/token_utils.js +8 -10
  42. package/dest/fixtures/utils.d.ts +7 -7
  43. package/dest/fixtures/utils.d.ts.map +1 -1
  44. package/dest/fixtures/utils.js +31 -28
  45. package/dest/shared/cross_chain_test_harness.d.ts +6 -6
  46. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  47. package/dest/shared/cross_chain_test_harness.js +5 -6
  48. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  49. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  50. package/dest/shared/submit-transactions.d.ts +3 -3
  51. package/dest/shared/submit-transactions.d.ts.map +1 -1
  52. package/dest/shared/submit-transactions.js +4 -5
  53. package/dest/shared/uniswap_l1_l2.d.ts +6 -4
  54. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  55. package/dest/shared/uniswap_l1_l2.js +18 -21
  56. package/dest/simulators/lending_simulator.js +1 -1
  57. package/dest/spartan/setup_test_wallets.d.ts +12 -10
  58. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  59. package/dest/spartan/setup_test_wallets.js +54 -50
  60. package/package.json +37 -36
  61. package/src/bench/client_flows/client_flows_benchmark.ts +41 -52
  62. package/src/bench/utils.ts +6 -6
  63. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +39 -50
  64. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +15 -33
  65. package/src/e2e_deploy_contract/deploy_test.ts +6 -14
  66. package/src/e2e_epochs/epochs_test.ts +3 -0
  67. package/src/e2e_fees/bridging_race.notest.ts +12 -9
  68. package/src/e2e_fees/fees_test.ts +30 -30
  69. package/src/e2e_nested_contract/nested_contract_test.ts +6 -8
  70. package/src/e2e_p2p/p2p_network.ts +16 -15
  71. package/src/e2e_p2p/shared.ts +14 -21
  72. package/src/e2e_token_contract/token_contract_test.ts +14 -17
  73. package/src/fixtures/e2e_prover_test.ts +26 -60
  74. package/src/fixtures/snapshot_manager.ts +32 -24
  75. package/src/fixtures/token_utils.ts +7 -15
  76. package/src/fixtures/utils.ts +41 -44
  77. package/src/shared/cross_chain_test_harness.ts +5 -7
  78. package/src/shared/gas_portal_test_harness.ts +1 -1
  79. package/src/shared/submit-transactions.ts +7 -8
  80. package/src/shared/uniswap_l1_l2.ts +40 -36
  81. package/src/simulators/lending_simulator.ts +1 -1
  82. package/src/spartan/setup_test_wallets.ts +82 -73
@@ -1,17 +1,9 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import {
3
- type InitialAccountData,
4
- deployFundedSchnorrAccounts,
5
- generateSchnorrAccounts,
6
- getDeployedTestAccounts,
7
- getDeployedTestAccountsWallets,
8
- } from '@aztec/accounts/testing';
2
+ import { type InitialAccountData, generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
9
3
  import { type Archiver, createArchiver } from '@aztec/archiver';
10
4
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
11
5
  import {
12
- AccountManager,
13
- type AccountWalletWithSecretKey,
14
- type AztecAddress,
6
+ AztecAddress,
15
7
  type AztecNode,
16
8
  BatchCall,
17
9
  type ContractMethod,
@@ -91,6 +83,7 @@ import {
91
83
  initTelemetryClient,
92
84
  } from '@aztec/telemetry-client';
93
85
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
86
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
94
87
  import { getGenesisValues } from '@aztec/world-state/testing';
95
88
 
96
89
  import type { Anvil } from '@viem/anvil';
@@ -246,15 +239,22 @@ async function setupWithRemoteEnvironment(
246
239
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!);
247
240
  const teardown = () => Promise.resolve();
248
241
 
249
- logger.verbose('Constructing available wallets from already registered accounts...');
242
+ logger.verbose('Populating wallet from already registered accounts...');
250
243
  const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
251
- const wallets = await getDeployedTestAccountsWallets(pxeClient);
244
+ const wallet = new TestWallet(pxeClient);
252
245
 
253
- if (wallets.length < numberOfAccounts) {
254
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
246
+ if (initialFundedAccounts.length < numberOfAccounts) {
247
+ throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
255
248
  // Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
256
249
  }
257
250
 
251
+ const testAccounts = await Promise.all(
252
+ initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
253
+ const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
254
+ return accountManager.getAddress();
255
+ }),
256
+ );
257
+
258
258
  return {
259
259
  aztecNode,
260
260
  aztecNodeAdmin: undefined,
@@ -264,9 +264,8 @@ async function setupWithRemoteEnvironment(
264
264
  deployL1ContractsValues,
265
265
  config,
266
266
  initialFundedAccounts,
267
- wallets,
268
- wallet: wallets[0],
269
- accounts: wallets.slice(0, numberOfAccounts).map(w => w.getAddress()),
267
+ wallet,
268
+ accounts: testAccounts,
270
269
  logger,
271
270
  cheatCodes,
272
271
  ethCheatCodes,
@@ -346,11 +345,9 @@ export type EndToEndContext = {
346
345
  config: AztecNodeConfig;
347
346
  /** The data for the initial funded accounts. */
348
347
  initialFundedAccounts: InitialAccountData[];
349
- /* Wallets created for the initial funded accounts, with secret keys. */
350
- wallets: AccountWalletWithSecretKey[];
351
- /** The first wallet to be used. */
352
- wallet: AccountWalletWithSecretKey;
353
- /** The accounts to be used. */
348
+ /** The wallet to be used. */
349
+ wallet: TestWallet;
350
+ /** The wallets to be used. */
354
351
  accounts: AztecAddress[];
355
352
  /** Logger instance named as the current test. */
356
353
  logger: Logger;
@@ -666,15 +663,16 @@ export async function setup(
666
663
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
667
664
  (opts.initialValidators && opts.initialValidators.length > 0)
668
665
  ) {
669
- // We need to advance to epoch 2 such that the committee is set up.
670
- logger.info(`Advancing to epoch 2`);
671
- await cheatCodes.rollup.advanceToEpoch(2n, { updateDateProvider: dateProvider });
666
+ // We need to advance such that the committee is set up.
667
+ await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1), {
668
+ updateDateProvider: dateProvider,
669
+ });
672
670
  await cheatCodes.rollup.setupEpoch();
673
671
  await cheatCodes.rollup.debugRollup();
674
672
  }
675
-
673
+ const wallet = new TestWallet(pxe);
674
+ let accounts: AztecAddress[] = [];
676
675
  // Below we continue with what we described in the long comment on line 571.
677
- let accountManagers: AccountManager[] = [];
678
676
  if (numberOfAccounts === 0) {
679
677
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
680
678
  while ((await pxe.getBlockNumber()) === 0) {
@@ -684,13 +682,14 @@ export async function setup(
684
682
  logger.info(
685
683
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
686
684
  );
687
- accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
685
+ const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
686
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
687
+ accounts = accountManagers.map(accountManager => accountManager.getAddress());
688
688
  }
689
689
 
690
690
  // Now we restore the original minTxsPerBlock setting.
691
691
  sequencerClient!.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
692
692
 
693
- const wallets = await Promise.all(accountManagers.map(account => account.getWallet()));
694
693
  if (initialFundedAccounts.length < numberOfAccounts) {
695
694
  // TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
696
695
  throw new Error(
@@ -741,9 +740,8 @@ export async function setup(
741
740
  sequencer: sequencerClient,
742
741
  teardown,
743
742
  telemetryClient: telemetry,
744
- wallets,
745
- wallet: wallets[0],
746
- accounts: wallets.map(w => w.getAddress()),
743
+ wallet,
744
+ accounts,
747
745
  watcher,
748
746
  };
749
747
  } catch (err) {
@@ -761,15 +759,14 @@ export async function setup(
761
759
  */
762
760
 
763
761
  // docs:start:public_deploy_accounts
764
- export async function ensureAccountContractsPublished(sender: Wallet, accountsToDeploy: Wallet[]) {
762
+ export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
765
763
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
766
764
  // the sandbox and the test accounts exist
767
765
  const accountsAndAddresses = await Promise.all(
768
- accountsToDeploy.map(async account => {
769
- const address = account.getAddress();
766
+ accountsToDeploy.map(async address => {
770
767
  return {
771
768
  address,
772
- deployed: (await sender.getContractMetadata(address)).isContractPublished,
769
+ deployed: (await wallet.getContractMetadata(address)).isContractPublished,
773
770
  };
774
771
  }),
775
772
  );
@@ -777,18 +774,18 @@ export async function ensureAccountContractsPublished(sender: Wallet, accountsTo
777
774
  await Promise.all(
778
775
  accountsAndAddresses
779
776
  .filter(({ deployed }) => !deployed)
780
- .map(({ address }) => sender.getContractMetadata(address)),
777
+ .map(({ address }) => wallet.getContractMetadata(address)),
781
778
  )
782
779
  ).map(contractMetadata => contractMetadata.contractInstance);
783
780
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
784
- if (!(await sender.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
785
- await (await publishContractClass(sender, SchnorrAccountContractArtifact))
786
- .send({ from: accountsToDeploy[0].getAddress() })
781
+ if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
782
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
783
+ .send({ from: accountsToDeploy[0] })
787
784
  .wait();
788
785
  }
789
- const requests = await Promise.all(instances.map(async instance => await publishInstance(sender, instance!)));
790
- const batch = new BatchCall(sender, requests);
791
- await batch.send({ from: accountsToDeploy[0].getAddress() }).wait();
786
+ const requests = await Promise.all(instances.map(async instance => await publishInstance(wallet, instance!)));
787
+ const batch = new BatchCall(wallet, requests);
788
+ await batch.send({ from: accountsToDeploy[0] }).wait();
792
789
  }
793
790
  // docs:end:public_deploy_accounts
794
791
 
@@ -908,7 +905,7 @@ export async function setupSponsoredFPC(pxe: PXE) {
908
905
  * Registers the SponsoredFPC in this PXE instance
909
906
  * @param pxe - The pxe client
910
907
  */
911
- export async function registerSponsoredFPC(pxe: PXE): Promise<void> {
908
+ export async function registerSponsoredFPC(pxe: PXE | Wallet): Promise<void> {
912
909
  await pxe.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
913
910
  }
914
911
 
@@ -1,6 +1,5 @@
1
1
  // docs:start:cross_chain_test_harness
2
2
  import {
3
- type AccountWallet,
4
3
  AuthWitness,
5
4
  type AztecAddress,
6
5
  type AztecNode,
@@ -134,7 +133,7 @@ export class CrossChainTestHarness {
134
133
  aztecNode: AztecNode,
135
134
  pxeService: PXE,
136
135
  l1Client: ExtendedViemWalletClient,
137
- wallet: AccountWallet,
136
+ wallet: Wallet,
138
137
  ownerAddress: AztecAddress,
139
138
  logger: Logger,
140
139
  underlyingERC20Address: EthAddress,
@@ -148,7 +147,7 @@ export class CrossChainTestHarness {
148
147
  wallet,
149
148
  l1Client,
150
149
  l1ContractAddresses.registryAddress,
151
- wallet.getAddress(),
150
+ ownerAddress,
152
151
  underlyingERC20Address,
153
152
  );
154
153
  logger.info('Deployed and initialized token, portal and its bridge.');
@@ -198,8 +197,8 @@ export class CrossChainTestHarness {
198
197
  /** Deployment addresses for all L1 contracts */
199
198
  public readonly l1ContractAddresses: L1ContractAddresses,
200
199
 
201
- /** Wallet of the owner. */
202
- public readonly ownerWallet: AccountWallet,
200
+ /** Wallet to simulate and send txs from. */
201
+ public readonly wallet: Wallet,
203
202
 
204
203
  /** Owner of the l2 token and bridge */
205
204
  public readonly ownerAddress: AztecAddress,
@@ -213,7 +212,6 @@ export class CrossChainTestHarness {
213
212
  this.logger,
214
213
  );
215
214
  this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
216
- this.ownerAddress = this.ownerWallet.getAddress();
217
215
  }
218
216
 
219
217
  async mintTokensOnL1(amount: bigint) {
@@ -246,7 +244,7 @@ export class CrossChainTestHarness {
246
244
  }
247
245
 
248
246
  async mintTokensPrivateOnL2(amount: bigint) {
249
- await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerWallet, this.ownerAddress, amount);
247
+ await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerAddress, amount);
250
248
  }
251
249
 
252
250
  async sendL2PublicTransfer(transferAmount: bigint, receiverAddress: AztecAddress) {
@@ -1,5 +1,5 @@
1
1
  import {
2
- type AztecAddress,
2
+ AztecAddress,
3
3
  type AztecNode,
4
4
  EthAddress,
5
5
  Fr,
@@ -1,20 +1,19 @@
1
- import { getSchnorrAccount } from '@aztec/accounts/schnorr';
2
- import { Fr, GrumpkinScalar, type Logger, type SentTx, TxStatus, type Wallet } from '@aztec/aztec.js';
1
+ import { AztecAddress, Fr, GrumpkinScalar, type Logger, type SentTx, TxStatus } from '@aztec/aztec.js';
3
2
  import { times } from '@aztec/foundation/collection';
4
- import type { PXEService } from '@aztec/pxe/server';
3
+ import type { TestWallet } from '@aztec/test-wallet';
5
4
 
6
- // submits a set of transactions to the provided Private eXecution Environment (PXE)
5
+ // submits a set of transactions to the provided Wallet
7
6
  export const submitTxsTo = async (
8
- pxe: PXEService,
7
+ wallet: TestWallet,
8
+ submitter: AztecAddress,
9
9
  numTxs: number,
10
- wallet: Wallet,
11
10
  logger: Logger,
12
11
  ): Promise<SentTx[]> => {
13
12
  const txs: SentTx[] = [];
14
13
  await Promise.all(
15
14
  times(numTxs, async () => {
16
- const accountManager = await getSchnorrAccount(pxe, Fr.random(), GrumpkinScalar.random(), Fr.random());
17
- const tx = accountManager.deploy({ deployWallet: wallet });
15
+ const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
16
+ const tx = accountManager.deploy({ deployAccount: submitter });
18
17
  const txHash = await tx.getTxHash();
19
18
 
20
19
  logger.info(`Tx sent with hash ${txHash}`);
@@ -1,11 +1,11 @@
1
1
  import {
2
- type AccountWallet,
3
2
  AztecAddress,
4
3
  type AztecNode,
5
4
  EthAddress,
6
5
  Fr,
7
6
  type Logger,
8
7
  type PXE,
8
+ type Wallet,
9
9
  computeAuthWitMessageHash,
10
10
  generateClaimSecret,
11
11
  } from '@aztec/aztec.js';
@@ -49,10 +49,12 @@ export type UniswapSetupContext = {
49
49
  logger: Logger;
50
50
  /** The L1 wallet client, extended with public actions. */
51
51
  l1Client: ExtendedViemWalletClient;
52
- /** The owner wallet. */
53
- ownerWallet: AccountWallet;
52
+ /** The wallet. */
53
+ wallet: Wallet;
54
+ /** The owner address. */
55
+ ownerAddress: AztecAddress;
54
56
  /** The sponsor wallet. */
55
- sponsorWallet: AccountWallet;
57
+ sponsorAddress: AztecAddress;
56
58
  /** */
57
59
  deployL1ContractsValues: DeployL1ContractsReturnType;
58
60
  /** Cheat codes instance. */
@@ -78,11 +80,10 @@ export const uniswapL1L2TestSuite = (
78
80
 
79
81
  let l1Client: ExtendedViemWalletClient;
80
82
 
81
- let ownerWallet: AccountWallet;
83
+ let wallet: Wallet;
82
84
  let ownerAddress: AztecAddress;
83
85
  let ownerEthAddress: EthAddress;
84
86
  // does transactions on behalf of owner on Aztec:
85
- let sponsorWallet: AccountWallet;
86
87
  let sponsorAddress: AztecAddress;
87
88
 
88
89
  let daiCrossChainHarness: CrossChainTestHarness;
@@ -101,7 +102,7 @@ export const uniswapL1L2TestSuite = (
101
102
  let cheatCodes: CheatCodes;
102
103
  let version: number;
103
104
  beforeAll(async () => {
104
- ({ aztecNode, pxe, logger, l1Client, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } =
105
+ ({ aztecNode, pxe, logger, l1Client, wallet, ownerAddress, sponsorAddress, deployL1ContractsValues, cheatCodes } =
105
106
  await setup());
106
107
 
107
108
  if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
@@ -113,18 +114,16 @@ export const uniswapL1L2TestSuite = (
113
114
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
114
115
  );
115
116
  version = Number(await rollup.getVersion());
116
- ownerAddress = ownerWallet.getAddress();
117
- sponsorAddress = sponsorWallet.getAddress();
118
117
  ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
119
118
 
120
- await ensureAccountContractsPublished(ownerWallet, [ownerWallet, sponsorWallet]);
119
+ await ensureAccountContractsPublished(wallet, [ownerAddress, sponsorAddress]);
121
120
 
122
121
  logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
123
122
  daiCrossChainHarness = await CrossChainTestHarness.new(
124
123
  aztecNode,
125
124
  pxe,
126
125
  deployL1ContractsValues.l1Client,
127
- ownerWallet,
126
+ wallet,
128
127
  ownerAddress,
129
128
  logger,
130
129
  DAI_ADDRESS,
@@ -135,7 +134,7 @@ export const uniswapL1L2TestSuite = (
135
134
  aztecNode,
136
135
  pxe,
137
136
  l1Client,
138
- ownerWallet,
137
+ wallet,
139
138
  ownerAddress,
140
139
  logger,
141
140
  WETH9_ADDRESS,
@@ -152,7 +151,7 @@ export const uniswapL1L2TestSuite = (
152
151
  client: l1Client,
153
152
  });
154
153
  // deploy l2 uniswap contract and attach to portal
155
- uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress)
154
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress)
156
155
  .send({ from: ownerAddress })
157
156
  .deployed();
158
157
 
@@ -206,7 +205,7 @@ export const uniswapL1L2TestSuite = (
206
205
  // 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
207
206
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
208
207
  const nonceForWETHTransferToPublicApproval = new Fr(1n);
209
- const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
208
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
210
209
  caller: uniswapL2Contract.address,
211
210
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
212
211
  ownerAddress,
@@ -622,7 +621,7 @@ export const uniswapL1L2TestSuite = (
622
621
  nonceForWETHTransferToPublicApproval,
623
622
  ),
624
623
  },
625
- { chainId: ownerWallet.getChainId(), version: ownerWallet.getVersion() },
624
+ { chainId: new Fr(await aztecNode.getChainId()), version: new Fr(await aztecNode.getVersion()) },
626
625
  );
627
626
 
628
627
  await expect(
@@ -650,7 +649,7 @@ export const uniswapL1L2TestSuite = (
650
649
  // 2. owner gives uniswap approval to transfer the funds to public:
651
650
  logger.info('Approving uniswap to transfer funds to public to self on my behalf');
652
651
  const nonceForWETHTransferToPublicApproval = new Fr(3n);
653
- const transferToPublicAuthwith = await ownerWallet.createAuthWit({
652
+ const transferToPublicAuthwith = await wallet.createAuthWit(ownerAddress, {
654
653
  caller: uniswapL2Contract.address,
655
654
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
656
655
  ownerAddress,
@@ -687,7 +686,8 @@ export const uniswapL1L2TestSuite = (
687
686
 
688
687
  // 2. Give approval to uniswap to transfer funds to itself
689
688
  const nonceForWETHTransferApproval = new Fr(2n);
690
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
689
+ const validateActionInteraction = await wallet.setPublicAuthWit(
690
+ ownerAddress,
691
691
  {
692
692
  caller: uniswapL2Contract.address,
693
693
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -731,22 +731,24 @@ export const uniswapL1L2TestSuite = (
731
731
  const nonceForWETHTransferApproval = new Fr(3n);
732
732
  const nonceForSwap = new Fr(3n);
733
733
  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);
734
+ const action = uniswapL2Contract.methods.swap_public(
735
+ ownerAddress,
736
+ wethCrossChainHarness.l2Bridge.address,
737
+ wethAmountToBridge,
738
+ daiCrossChainHarness.l2Bridge.address,
739
+ nonceForWETHTransferApproval,
740
+ uniswapFeeTier,
741
+ minimumOutputAmount,
742
+ ownerAddress,
743
+ secretHashForDepositingSwappedDai,
744
+ ownerEthAddress,
745
+ nonceForSwap,
746
+ );
747
+ const validateActionInteraction = await wallet.setPublicAuthWit(
748
+ ownerAddress,
749
+ { caller: approvedUser, action },
750
+ true,
751
+ );
750
752
  await validateActionInteraction.send({ from: ownerAddress }).wait();
751
753
 
752
754
  await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
@@ -756,7 +758,8 @@ export const uniswapL1L2TestSuite = (
756
758
  // swap should fail since no transfer approval to uniswap:
757
759
  const nonceForWETHTransferApproval = new Fr(4n);
758
760
 
759
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
761
+ const validateActionInteraction = await wallet.setPublicAuthWit(
762
+ ownerAddress,
760
763
  {
761
764
  caller: uniswapL2Contract.address,
762
765
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -798,7 +801,7 @@ export const uniswapL1L2TestSuite = (
798
801
  // Owner gives uniswap approval to transfer the funds to public to self on its behalf
799
802
  logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
800
803
  const nonceForWETHTransferToPublicApproval = new Fr(4n);
801
- const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
804
+ const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
802
805
  caller: uniswapL2Contract.address,
803
806
  action: wethCrossChainHarness.l2Token.methods.transfer_to_public(
804
807
  ownerAddress,
@@ -926,7 +929,8 @@ export const uniswapL1L2TestSuite = (
926
929
 
927
930
  // Owner gives uniswap approval to transfer funds on its behalf
928
931
  const nonceForWETHTransferApproval = new Fr(5n);
929
- const validateActionInteraction = await ownerWallet.setPublicAuthWit(
932
+ const validateActionInteraction = await wallet.setPublicAuthWit(
933
+ ownerAddress,
930
934
  {
931
935
  caller: uniswapL2Contract.address,
932
936
  action: wethCrossChainHarness.l2Token.methods.transfer_in_public(
@@ -190,7 +190,7 @@ export class LendingSimulator {
190
190
  expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
191
191
 
192
192
  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 });
193
+ const privatePos = await this.lendingContract.methods.get_position(key).simulate({ from: this.account.address });
194
194
  expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
195
195
  expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
196
196
  expect(privatePos['debt']).toEqual(