@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,7 +1,5 @@
1
- import { getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
2
- import { generateSchnorrAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
1
+ import { generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
3
2
  import {
4
- type AccountWalletWithSecretKey,
5
3
  type AztecAddress,
6
4
  type AztecNode,
7
5
  FeeJuicePaymentMethodWithClaim,
@@ -10,6 +8,7 @@ import {
10
8
  L1FeeJuicePortalManager,
11
9
  type PXE,
12
10
  SponsoredFeePaymentMethod,
11
+ type Wallet,
13
12
  createAztecNodeClient,
14
13
  createCompatibleClient,
15
14
  retryUntil,
@@ -19,18 +18,19 @@ import type { Logger } from '@aztec/foundation/log';
19
18
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
19
  import { createPXEService } from '@aztec/pxe/server';
21
20
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
21
+ import { TestWallet } from '@aztec/test-wallet';
22
22
 
23
23
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
24
24
  import { getBBConfig } from '../fixtures/get_bb_config.js';
25
25
  import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
26
26
 
27
- export interface TestWallets {
27
+ export interface TestAccounts {
28
28
  pxe: PXE;
29
- wallets: AccountWalletWithSecretKey[];
30
- tokenAdminWallet: TokenContract;
29
+ wallet: TestWallet;
30
+ accounts: AztecAddress[];
31
+ tokenContract: TokenContract;
31
32
  tokenAdminAddress: AztecAddress;
32
33
  tokenName: string;
33
- recipientWallet: AccountWalletWithSecretKey;
34
34
  recipientAddress: AztecAddress;
35
35
  tokenAddress: AztecAddress;
36
36
  }
@@ -39,83 +39,86 @@ const TOKEN_NAME = 'USDC';
39
39
  const TOKEN_SYMBOL = 'USD';
40
40
  const TOKEN_DECIMALS = 18n;
41
41
 
42
- export async function setupTestWalletsWithTokens(
42
+ export async function setupTestAccountsWithTokens(
43
43
  pxeUrl: string,
44
44
  mintAmount: bigint,
45
45
  logger: Logger,
46
- ): Promise<TestWallets> {
47
- const WALLET_COUNT = 1; // TODO fix this to allow for 16 wallets again
46
+ ): Promise<TestAccounts> {
47
+ const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
48
48
 
49
49
  const pxe = await createCompatibleClient(pxeUrl, logger);
50
+ const wallet = new TestWallet(pxe);
50
51
 
51
- const [recipientWallet, ...wallets] = (await getDeployedTestAccountsWallets(pxe)).slice(0, WALLET_COUNT + 1);
52
+ const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(pxe)).slice(0, ACCOUNT_COUNT + 1);
52
53
 
53
- const tokenAdmin = wallets[0];
54
- const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
55
- const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
54
+ const tokenAdmin = accounts[0];
55
+ const tokenAddress = await deployTokenAndMint(
56
+ wallet,
57
+ accounts.map(acc => acc.address),
58
+ tokenAdmin.address,
59
+ mintAmount,
60
+ undefined,
61
+ logger,
62
+ );
63
+ const tokenContract = await TokenContract.at(tokenAddress, wallet);
56
64
 
57
65
  return {
58
66
  pxe,
59
- wallets,
60
- tokenAdminWallet,
61
- tokenAdminAddress: tokenAdmin.getAddress(),
67
+ accounts: accounts.map(acc => acc.address),
68
+ wallet,
69
+ tokenAdminAddress: tokenAdmin.address,
62
70
  tokenName: TOKEN_NAME,
63
71
  tokenAddress,
64
- recipientAddress: recipientWallet.getAddress(),
65
- recipientWallet,
72
+ tokenContract,
73
+ recipientAddress: recipientAccount.address,
66
74
  };
67
75
  }
68
76
 
69
- export async function deploySponsoredTestWallets(
77
+ export async function deploySponsoredTestAccounts(
70
78
  pxe: PXE,
71
79
  mintAmount: bigint,
72
80
  logger: Logger,
73
81
  numberOfFundedWallets = 1,
74
- ): Promise<TestWallets> {
82
+ ): Promise<TestAccounts> {
83
+ const wallet = new TestWallet(pxe);
75
84
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
76
- const recipientWallet = await getSchnorrWalletWithSecretKey(
77
- pxe,
78
- recipient.secret,
79
- recipient.signingKey,
80
- recipient.salt,
81
- );
82
- const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
85
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
86
+ const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
83
87
 
84
- await registerSponsoredFPC(pxe);
88
+ await registerSponsoredFPC(wallet);
85
89
 
86
- const wallets = await Promise.all(
90
+ await Promise.all(
87
91
  fundedAccounts.map(async a => {
88
- const wallet = await a.getWallet();
89
92
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
90
- await a.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
93
+ await recipientAccount.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
91
94
  logger.info(`Account deployed at ${a.getAddress()}`);
92
- return wallet;
93
95
  }),
94
96
  );
95
97
 
96
- const tokenAdmin = wallets[0];
98
+ const tokenAdmin = fundedAccounts[0];
97
99
  const tokenAddress = await deployTokenAndMint(
98
- wallets,
100
+ wallet,
101
+ fundedAccounts.map(acc => acc.getAddress()),
99
102
  tokenAdmin.getAddress(),
100
103
  mintAmount,
101
104
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
102
105
  logger,
103
106
  );
104
- const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
107
+ const tokenContract = await TokenContract.at(tokenAddress, wallet);
105
108
 
106
109
  return {
107
110
  pxe,
108
- wallets,
111
+ wallet,
112
+ accounts: fundedAccounts.map(acc => acc.getAddress()),
109
113
  tokenAdminAddress: tokenAdmin.getAddress(),
110
- tokenAdminWallet,
111
114
  tokenName: TOKEN_NAME,
112
115
  tokenAddress,
113
- recipientWallet,
114
- recipientAddress: recipientWallet.getAddress(),
116
+ tokenContract,
117
+ recipientAddress: recipientAccount.getAddress(),
115
118
  };
116
119
  }
117
120
 
118
- export async function deployTestWalletWithTokens(
121
+ export async function deployTestAccountsWithTokens(
119
122
  pxeUrl: string,
120
123
  nodeUrl: string,
121
124
  l1RpcUrls: string[],
@@ -123,18 +126,14 @@ export async function deployTestWalletWithTokens(
123
126
  mintAmount: bigint,
124
127
  logger: Logger,
125
128
  numberOfFundedWallets = 1,
126
- ): Promise<TestWallets> {
129
+ ): Promise<TestAccounts> {
127
130
  const pxe = await createCompatibleClient(pxeUrl, logger);
128
131
  const node = createAztecNodeClient(nodeUrl);
132
+ const wallet = new TestWallet(pxe);
129
133
 
130
134
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
131
- const recipientWallet = await getSchnorrWalletWithSecretKey(
132
- pxe,
133
- recipient.secret,
134
- recipient.signingKey,
135
- recipient.salt,
136
- );
137
- const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
135
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
136
+ const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
138
137
 
139
138
  const claims = await Promise.all(
140
139
  fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
@@ -145,29 +144,34 @@ export async function deployTestWalletWithTokens(
145
144
  await advanceL2Block(node);
146
145
  await advanceL2Block(node);
147
146
 
148
- const wallets = await Promise.all(
147
+ await Promise.all(
149
148
  fundedAccounts.map(async (a, i) => {
150
- const wallet = await a.getWallet();
151
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(wallet, claims[i]);
149
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.getAddress(), claims[i]);
152
150
  await a.deploy({ fee: { paymentMethod } }).wait();
153
151
  logger.info(`Account deployed at ${a.getAddress()}`);
154
- return wallet;
155
152
  }),
156
153
  );
157
154
 
158
- const tokenAdmin = wallets[0];
159
- const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
160
- const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
155
+ const tokenAdmin = fundedAccounts[0];
156
+ const tokenAddress = await deployTokenAndMint(
157
+ wallet,
158
+ fundedAccounts.map(acc => acc.getAddress()),
159
+ tokenAdmin.getAddress(),
160
+ mintAmount,
161
+ undefined,
162
+ logger,
163
+ );
164
+ const tokenContract = await TokenContract.at(tokenAddress, wallet);
161
165
 
162
166
  return {
163
167
  pxe,
164
- wallets,
168
+ wallet,
169
+ accounts: fundedAccounts.map(acc => acc.getAddress()),
165
170
  tokenAdminAddress: tokenAdmin.getAddress(),
166
- tokenAdminWallet,
167
171
  tokenName: TOKEN_NAME,
168
172
  tokenAddress,
169
- recipientWallet,
170
- recipientAddress: recipientWallet.getAddress(),
173
+ tokenContract,
174
+ recipientAddress: recipientAccount.getAddress(),
171
175
  };
172
176
  }
173
177
 
@@ -212,14 +216,15 @@ async function advanceL2Block(node: AztecNode, nodeAdmin?: AztecNodeAdmin) {
212
216
  }
213
217
 
214
218
  async function deployTokenAndMint(
215
- wallets: AccountWalletWithSecretKey[],
219
+ wallet: Wallet,
220
+ accounts: AztecAddress[],
216
221
  admin: AztecAddress,
217
222
  mintAmount: bigint,
218
223
  paymentMethod: FeePaymentMethod | undefined,
219
224
  logger: Logger,
220
225
  ) {
221
226
  logger.verbose(`Deploying TokenContract...`);
222
- const tokenContract = await TokenContract.deploy(wallets[0], admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
227
+ const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
223
228
  .send({
224
229
  from: admin,
225
230
  fee: {
@@ -230,12 +235,12 @@ async function deployTokenAndMint(
230
235
 
231
236
  const tokenAddress = tokenContract.address;
232
237
 
233
- logger.verbose(`Minting ${mintAmount} public assets to the ${wallets.length} wallets...`);
238
+ logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
234
239
 
235
240
  await Promise.all(
236
- wallets.map(async w =>
237
- (await TokenContract.at(tokenAddress, w)).methods
238
- .mint_to_public(w.getAddress(), mintAmount)
241
+ accounts.map(async acc =>
242
+ (await TokenContract.at(tokenAddress, wallet)).methods
243
+ .mint_to_public(acc, mintAmount)
239
244
  .send({ from: admin, fee: { paymentMethod } })
240
245
  .wait({ timeout: 600 }),
241
246
  ),
@@ -247,22 +252,26 @@ async function deployTokenAndMint(
247
252
  }
248
253
 
249
254
  export async function performTransfers({
250
- testWallets,
255
+ testAccounts,
251
256
  rounds,
252
257
  transferAmount,
253
258
  logger,
259
+ feePaymentMethod,
254
260
  }: {
255
- testWallets: TestWallets;
261
+ testAccounts: TestAccounts;
256
262
  rounds: number;
257
263
  transferAmount: bigint;
258
264
  logger: Logger;
265
+ feePaymentMethod?: FeePaymentMethod;
259
266
  }) {
260
- const recipient = testWallets.recipientWallet.getAddress();
267
+ const recipient = testAccounts.recipientAddress;
268
+ // Default to sponsored fee payment if no fee method is provided
269
+ const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
261
270
  for (let i = 0; i < rounds; i++) {
262
- const txs = testWallets.wallets.map(async w =>
263
- (await TokenContract.at(testWallets.tokenAddress, w)).methods
264
- .transfer_in_public(w.getAddress(), recipient, transferAmount, 0)
265
- .prove({ from: w.getAddress() }),
271
+ const txs = testAccounts.accounts.map(async acc =>
272
+ (await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet)).methods
273
+ .transfer_in_public(acc, recipient, transferAmount, 0)
274
+ .prove({ from: acc, fee: { paymentMethod: defaultFeePaymentMethod } }),
266
275
  );
267
276
 
268
277
  const provenTxs = await Promise.all(txs);